[FFmpeg-devel] [PATCH] Don't check for DEBUG before using ff_dprintf.

Diego Elio 'Flameeyes' Pettenò flameeyes
Wed Jul 21 22:04:41 CEST 2010


The ff_dprintf macro is no-op when DEBUG is unset, so there is no need to
put it conditional to DEBUG.
---
 libavcodec/gifdec.c  |   22 ++++++++++------------
 libavformat/avidec.c |    2 --
 libavformat/mxf.h    |    4 ----
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 1fb4abb..7631473 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -75,9 +75,8 @@ static int gif_read_image(GifState *s)
     is_interleaved = flags & 0x40;
     has_local_palette = flags & 0x80;
     bits_per_pixel = (flags & 0x07) + 1;
-#ifdef DEBUG
+
     ff_dprintf(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height);
-#endif
 
     if (has_local_palette) {
         bytestream_get_buffer(&s->bytestream, s->local_palette, 3 * (1 << bits_per_pixel));
@@ -162,9 +161,9 @@ static int gif_read_extension(GifState *s)
     /* extension */
     ext_code = bytestream_get_byte(&s->bytestream);
     ext_len = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
+
     ff_dprintf(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
-#endif
+
     switch(ext_code) {
     case 0xf9:
         if (ext_len != 4)
@@ -178,11 +177,11 @@ static int gif_read_extension(GifState *s)
         else
             s->transparent_color_index = -1;
         s->gce_disposal = (gce_flags >> 2) & 0x7;
-#ifdef DEBUG
+
         ff_dprintf(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
                gce_flags, s->gce_delay,
                s->transparent_color_index, s->gce_disposal);
-#endif
+
         ext_len = bytestream_get_byte(&s->bytestream);
         break;
     }
@@ -193,9 +192,8 @@ static int gif_read_extension(GifState *s)
         for (i = 0; i < ext_len; i++)
             bytestream_get_byte(&s->bytestream);
         ext_len = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
+
         ff_dprintf(s->avctx, "gif: ext_len1=%d\n", ext_len);
-#endif
     }
     return 0;
 }
@@ -231,11 +229,11 @@ static int gif_read_header1(GifState *s)
     s->bits_per_pixel = (v & 0x07) + 1;
     s->background_color_index = bytestream_get_byte(&s->bytestream);
     bytestream_get_byte(&s->bytestream);                /* ignored */
-#ifdef DEBUG
+
     ff_dprintf(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n",
            s->screen_width, s->screen_height, s->bits_per_pixel,
            has_global_palette);
-#endif
+
     if (has_global_palette) {
         n = 1 << s->bits_per_pixel;
         if (s->bytestream_end < s->bytestream + n * 3)
@@ -249,9 +247,9 @@ static int gif_parse_next_image(GifState *s)
 {
     while (s->bytestream < s->bytestream_end) {
         int code = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
+
         ff_dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code);
-#endif
+
         switch (code) {
         case ',':
             return gif_read_image(s);
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index a893d0d..64255f7 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -78,7 +78,6 @@ static const char avi_headers[][8] = {
 static int avi_load_index(AVFormatContext *s);
 static int guess_ni_flag(AVFormatContext *s);
 
-#ifdef DEBUG
 static void print_tag(const char *str, unsigned int tag, int size)
 {
     ff_dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n",
@@ -88,7 +87,6 @@ static void print_tag(const char *str, unsigned int tag, int size)
            (tag >> 24) & 0xff,
            size);
 }
-#endif
 
 static inline int get_duration(AVIStream *ast, int len){
     if(ast->sample_size){
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index d67e827..5ec4f46 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -70,11 +70,7 @@ extern const MXFPixelLayout ff_mxf_pixel_layouts[];
 
 int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt);
 
-#ifdef DEBUG
 #define PRINT_KEY(pc, s, x) ff_dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
                              (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15])
-#else
-#define PRINT_KEY(pc, s, x)
-#endif
 
 #endif /* AVFORMAT_MXF_H */
-- 
1.7.1.1




More information about the ffmpeg-devel mailing list