From e7becfb25f51be119f909743dcc21dcb86771ac6 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 11 Oct 2006 00:18:33 +0000 Subject: printf --> av_log with some help from Oded Originally committed as revision 6639 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libpostproc/postprocess.c | 33 +++++++++++++++++---------------- libpostproc/postprocess_internal.h | 5 +++++ libpostproc/postprocess_template.c | 10 ++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c index 52548c36e9..aba73725cd 100644 --- a/libpostproc/postprocess.c +++ b/libpostproc/postprocess.c @@ -119,8 +119,6 @@ static uint64_t __attribute__((aligned(8))) attribute_used b80= 0x80808080808080 static uint8_t clip_table[3*256]; static uint8_t * const clip_tab= clip_table + 256; -static const int verbose= 0; - static const int attribute_used deringThreshold= 20; @@ -773,7 +771,7 @@ pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality) strncpy(temp, name, GET_MODE_BUFFER_SIZE); - if(verbose>1) printf("pp: %s\n", name); + av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name); for(;;){ char *filterName; @@ -791,7 +789,7 @@ pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality) if(filterToken == NULL) break; p+= strlen(filterToken) + 1; // p points to next filterToken filterName= strtok(filterToken, optionDelimiters); - if(verbose>1) printf("pp: %s::%s\n", filterToken, filterName); + av_log(NULL, AV_LOG_DEBUG, "pp: %s::%s\n", filterToken, filterName); if(*filterName == '-') { @@ -803,7 +801,7 @@ pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality) option= strtok(NULL, optionDelimiters); if(option == NULL) break; - if(verbose>1) printf("pp: option: %s\n", option); + av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option); if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality; else if(!strcmp("nochrom", option) || !strcmp("y", option)) chrom=0; else if(!strcmp("chrom", option) || !strcmp("c", option)) chrom=1; @@ -844,7 +842,6 @@ pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality) for(i=0; filters[i].shortName!=NULL; i++) { -// printf("Compareing %s, %s, %s\n", filters[i].shortName,filters[i].longName, filterName); if( !strcmp(filters[i].longName, filterName) || !strcmp(filters[i].shortName, filterName)) { @@ -931,10 +928,10 @@ pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality) ppMode->error += numOfUnknownOptions; } - if(verbose>1) printf("pp: lumMode=%X, chromMode=%X\n", ppMode->lumMode, ppMode->chromMode); + av_log(NULL, AV_LOG_DEBUG, "pp: lumMode=%X, chromMode=%X\n", ppMode->lumMode, ppMode->chromMode); if(ppMode->error) { - fprintf(stderr, "%d errors in postprocess string \"%s\"\n", ppMode->error, name); + av_log(NULL, AV_LOG_ERROR, "%d errors in postprocess string \"%s\"\n", ppMode->error, name); av_free(ppMode); return NULL; } @@ -986,6 +983,12 @@ static void global_init(void){ memset(clip_table+512, 0, 256); } +static const char * context_to_name(void * ptr) { + return "postproc"; +} + +static AVClass av_codec_context_class = { "Postproc", context_to_name, NULL }; + pp_context_t *pp_get_context(int width, int height, int cpuCaps){ PPContext *c= av_malloc(sizeof(PPContext)); int stride= (width+15)&(~15); //assumed / will realloc if needed @@ -994,6 +997,7 @@ pp_context_t *pp_get_context(int width, int height, int cpuCaps){ global_init(); memset(c, 0, sizeof(PPContext)); + c->av_class = &av_codec_context_class; c->cpuCaps= cpuCaps; if(cpuCaps&PP_FORMAT){ c->hChromaSubSample= cpuCaps&0x3; @@ -1060,7 +1064,6 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3], else for(i=0; i2) - { - printf("using npp filters 0x%X/0x%X\n", mode->lumMode, mode->chromMode); - } + av_log(c, AV_LOG_DEBUG, "using npp filters 0x%X/0x%X\n", + mode->lumMode, mode->chromMode); postProcess(src[0], srcStride[0], dst[0], dstStride[0], width, height, QP_store, QPStride, 0, mode, c); diff --git a/libpostproc/postprocess_internal.h b/libpostproc/postprocess_internal.h index 8f5c58a320..537d728c0c 100644 --- a/libpostproc/postprocess_internal.h +++ b/libpostproc/postprocess_internal.h @@ -119,6 +119,11 @@ typedef struct PPMode{ * postprocess context. */ typedef struct PPContext{ + /** + * info on struct for av_log + */ + AVClass *av_class; + uint8_t *tempBlocks; ///>2; -//printf("%d %d %d\n", maxNoise[0], maxNoise[1], maxNoise[2]); /* Switch between 1 0 0 0 0 0 0 (0) @@ -3415,9 +3413,7 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int for(i=0; i<256; i++) { sum+= yHistogram[i]; -// printf("%d ", yHistogram[i]); } -// printf("\n\n"); /* we allways get a completly black picture first */ maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold); @@ -3545,7 +3541,6 @@ static void RENAME(postProcess)(uint8_t src[], int srcStride, uint8_t dst[], int } } -//printf("\n"); for(y=0; y