From 8b44de14d1fa363fa7fe18d015ead0017a0177c8 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 30 Jul 2009 21:00:08 +0000 Subject: [PATCH] Change av_log() calls surrounded by '#ifdef DEBUG' into dprintf macros. Originally committed as revision 19550 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ac3enc.c | 4 +--- libavcodec/dvbsub_parser.c | 18 +++++------------- libavcodec/dvbsubdec.c | 34 +++++++++------------------------- libavcodec/dvdsubdec.c | 37 +++++++++++-------------------------- libavcodec/h261dec.c | 6 ++---- libavcodec/h263.c | 4 +--- libavcodec/mjpegdec.c | 4 +--- libavcodec/mpegaudioenc.c | 6 ++---- libavcodec/pngdec.c | 26 ++++++++++---------------- 9 files changed, 42 insertions(+), 97 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 7d12e04b30..5384fdc4c9 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -250,9 +250,7 @@ static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNEL exp_strategy[0][ch] = EXP_NEW; for(i=1;i EXP_DIFF_THRESHOLD) exp_strategy[i][ch] = EXP_NEW; else diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c index 11ade86627..c9ccfd0d9c 100644 --- a/libavcodec/dvbsub_parser.c +++ b/libavcodec/dvbsub_parser.c @@ -55,10 +55,8 @@ static int dvbsub_parse(AVCodecParserContext *s, uint8_t *p, *p_end; int len, buf_pos = 0; -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", + dprintf(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]); -#endif #ifdef DEBUG_PACKET_CONTENTS int i; @@ -84,19 +82,15 @@ static int dvbsub_parse(AVCodecParserContext *s, { if (pc->packet_index != pc->packet_start) { -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Discarding %d bytes\n", - pc->packet_index - pc->packet_start); -#endif + dprintf(avctx, "Discarding %d bytes\n", + pc->packet_index - pc->packet_start); } pc->packet_start = 0; pc->packet_index = 0; if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) { -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Bad packet header\n"); -#endif + dprintf(avctx, "Bad packet header\n"); return -1; } @@ -153,9 +147,7 @@ static int dvbsub_parse(AVCodecParserContext *s, } else if (*p == 0xff) { if (p + 1 < p_end) { -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Junk at end of packet\n"); -#endif + dprintf(avctx, "Junk at end of packet\n"); } pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index ac6bd1393f..fb09740c2b 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -731,10 +731,8 @@ static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDis 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; uint8_t *map_table; -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "DVB pixel block size %d, %s field:\n", buf_size, - top_bottom ? "bottom" : "top"); -#endif + dprintf(avctx, "DVB pixel block size %d, %s field:\n", buf_size, + top_bottom ? "bottom" : "top"); #ifdef DEBUG_PACKET_CONTENTS for (i = 0; i < buf_size; i++) { @@ -968,9 +966,7 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx, YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); -#endif + dprintf(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); @@ -1046,15 +1042,11 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, region->bgcolor = (((*buf++) >> 2) & 3); } -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Region %d, (%dx%d)\n", region_id, region->width, region->height); -#endif + dprintf(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height); if (fill) { memset(region->pbuf, region->bgcolor, region->buf_size); -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Fill region (%d)\n", region->bgcolor); -#endif + dprintf(avctx, "Fill region (%d)\n", region->bgcolor); } delete_region_display_list(ctx, region); @@ -1115,9 +1107,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx, ctx->time_out = *buf++; page_state = ((*buf++) >> 2) & 3; -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Page time out %ds, state %d\n", ctx->time_out, page_state); -#endif + dprintf(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state); if (page_state == 2) { delete_state(ctx); @@ -1155,9 +1145,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx, ctx->display_list = display; ctx->display_list_size++; -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos); -#endif + dprintf(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos); } while (tmp_display_list) { @@ -1405,10 +1393,8 @@ static int dvbsub_decode(AVCodecContext *avctx, *data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub); break; default: -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Subtitling segment type 0x%x, page id %d, length %d\n", + dprintf(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n", segment_type, page_id, segment_length); -#endif break; } } @@ -1417,9 +1403,7 @@ static int dvbsub_decode(AVCodecContext *avctx, } if (p != p_end) { -#ifdef DEBUG - av_log(avctx, AV_LOG_INFO, "Junk at end of packet\n"); -#endif + dprintf(avctx, "Junk at end of packet\n"); return -1; } diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 6c0756b6a4..a99b7af858 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -194,19 +194,15 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, while ((cmd_pos + 2 + offset_size) < buf_size) { date = AV_RB16(buf + cmd_pos); next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2); -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n", - cmd_pos, next_cmd_pos, date); -#endif + dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n", + cmd_pos, next_cmd_pos, date); pos = cmd_pos + 2 + offset_size; offset1 = -1; offset2 = -1; x1 = y1 = x2 = y2 = 0; while (pos < buf_size) { cmd = buf[pos++]; -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "cmd=%02x\n", cmd); -#endif + dprintf(NULL, "cmd=%02x\n", cmd); switch(cmd) { case 0x00: /* menu subpicture */ @@ -239,9 +235,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, alpha[1] = buf[pos + 1] >> 4; alpha[0] = buf[pos + 1] & 0x0f; pos += 2; -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]); -#endif + dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]); break; case 0x05: case 0x85: @@ -253,10 +247,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5]; if (cmd & 0x80) is_8bit = 1; -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "x1=%d x2=%d y1=%d y2=%d\n", - x1, x2, y1, y2); -#endif + dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2); pos += 6; break; case 0x06: @@ -264,9 +255,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, goto fail; offset1 = AV_RB16(buf + pos); offset2 = AV_RB16(buf + pos + 2); -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); -#endif + dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); pos += 4; break; case 0x86: @@ -274,9 +263,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, goto fail; offset1 = AV_RB32(buf + pos); offset2 = AV_RB32(buf + pos + 4); -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); -#endif + dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); pos += 8; break; @@ -299,9 +286,7 @@ static int decode_dvd_subtitles(AVSubtitle *sub_header, case 0xff: goto the_end; default: -#ifdef DEBUG - av_log(NULL, AV_LOG_INFO, "unrecognised subpicture command 0x%x\n", cmd); -#endif + dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd); goto the_end; } } @@ -495,9 +480,9 @@ static int dvdsub_decode(AVCodecContext *avctx, goto no_subtitle; #if defined(DEBUG) - av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n", - sub->start_display_time, - sub->end_display_time); + dprintf(NULL, "start=%d ms end =%d ms\n", + sub->start_display_time, + sub->end_display_time); ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0], sub->rects[0]->w, sub->rects[0]->h, sub->rects[0]->pict.data[1]); #endif diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 2e850ecf22..d5dcc0b2c4 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -552,10 +552,8 @@ static int h261_decode_frame(AVCodecContext *avctx, int ret; AVFrame *pict = data; -#ifdef DEBUG - av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); - av_log(avctx, AV_LOG_DEBUG, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); -#endif + dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); + dprintf(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); s->flags= avctx->flags; s->flags2= avctx->flags2; diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b445c9b589..a8c03339e6 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -4586,9 +4586,7 @@ static int h263p_decode_umotion(MpegEncContext * s, int pred) code >>= 1; code = (sign) ? (pred - code) : (pred + code); -#ifdef DEBUG - av_log( s->avctx, AV_LOG_DEBUG,"H.263+ UMV Motion = %d\n", code); -#endif + dprintf(s->avctx,"H.263+ UMV Motion = %d\n", code); return code; } diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index a18403d268..ad4187b121 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1232,9 +1232,7 @@ static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end) } val = -1; found: -#ifdef DEBUG - av_log(NULL, AV_LOG_VERBOSE, "find_marker skipped %d bytes\n", skipped); -#endif + dprintf(NULL, "find_marker skipped %d bytes\n", skipped); *pbuf_ptr = buf_ptr; return val; } diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c index de3081e2bf..f48d4c8ba6 100644 --- a/libavcodec/mpegaudioenc.c +++ b/libavcodec/mpegaudioenc.c @@ -126,10 +126,8 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) s->sblimit = ff_mpa_sblimit_table[table]; s->alloc_table = ff_mpa_alloc_tables[table]; -#ifdef DEBUG - av_log(avctx, AV_LOG_DEBUG, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", - bitrate, freq, s->frame_size, table, s->frame_frac_incr); -#endif + dprintf(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", + bitrate, freq, s->frame_size, table, s->frame_frac_incr); for(i=0;inb_channels;i++) s->samples_offset[i] = 0; diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 5711c8ad88..29644f5095 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -430,13 +430,11 @@ static int decode_frame(AVCodecContext *avctx, goto fail; tag32 = bytestream_get_be32(&s->bytestream); tag = bswap_32(tag32); -#ifdef DEBUG - av_log(avctx, AV_LOG_DEBUG, "png: tag=%c%c%c%c length=%u\n", - (tag & 0xff), - ((tag >> 8) & 0xff), - ((tag >> 16) & 0xff), - ((tag >> 24) & 0xff), length); -#endif + dprintf(avctx, "png: tag=%c%c%c%c length=%u\n", + (tag & 0xff), + ((tag >> 8) & 0xff), + ((tag >> 16) & 0xff), + ((tag >> 24) & 0xff), length); switch(tag) { case MKTAG('I', 'H', 'D', 'R'): if (length != 13) @@ -454,11 +452,9 @@ static int decode_frame(AVCodecContext *avctx, s->interlace_type = *s->bytestream++; crc = bytestream_get_be32(&s->bytestream); s->state |= PNG_IHDR; -#ifdef DEBUG - av_log(avctx, AV_LOG_DEBUG, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", - s->width, s->height, s->bit_depth, s->color_type, - s->compression_type, s->filter_type, s->interlace_type); -#endif + dprintf(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n", + s->width, s->height, s->bit_depth, s->color_type, + s->compression_type, s->filter_type, s->interlace_type); break; case MKTAG('I', 'D', 'A', 'T'): if (!(s->state & PNG_IHDR)) @@ -518,10 +514,8 @@ static int decode_frame(AVCodecContext *avctx, s->width); s->crow_size = s->pass_row_size + 1; } -#ifdef DEBUG - av_log(avctx, AV_LOG_DEBUG, "row_size=%d crow_size =%d\n", - s->row_size, s->crow_size); -#endif + dprintf(avctx, "row_size=%d crow_size =%d\n", + s->row_size, s->crow_size); s->image_buf = p->data[0]; s->image_linesize = p->linesize[0]; /* copy the palette if needed */