[FFmpeg-devel] [PATCH] Change av_dlog so syntax is checked even when it is disabled.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue May 10 20:29:48 CEST 2011


---
 libavcodec/mjpegdec.c   |    4 ----
 libavcodec/motion_est.c |    4 ++--
 libavutil/log.h         |    2 +-
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 3b1a8ab..afcc1b7 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1282,9 +1282,7 @@ static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
     const uint8_t *buf_ptr;
     unsigned int v, v2;
     int val;
-#ifdef DEBUG
     int skipped=0;
-#endif
 
     buf_ptr = *pbuf_ptr;
     while (buf_ptr < buf_end) {
@@ -1294,9 +1292,7 @@ static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
             val = *buf_ptr++;
             goto found;
         }
-#ifdef DEBUG
         skipped++;
-#endif
     }
     val = -1;
 found:
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index f4d7e12..01e786d 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1119,8 +1119,8 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
 //    pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin;
     c->mc_mb_var_sum_temp += (vard+128)>>8;
 
-    av_dlog(s, "varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n",
-            varc, s->avg_mb_var, sum, vard, mx - xx, my - yy);
+    av_dlog(s, "varc=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n",
+            varc, sum, vard, mx, my);
     if(mb_type){
         int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100);
         int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20;
diff --git a/libavutil/log.h b/libavutil/log.h
index 0bcf2c4..c87125d 100644
--- a/libavutil/log.h
+++ b/libavutil/log.h
@@ -143,7 +143,7 @@ const char* av_default_item_name(void* ctx);
 #ifdef DEBUG
 #    define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
 #else
-#    define av_dlog(pctx, ...)
+#    define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
 #endif
 
 /**
-- 
1.7.5.1



More information about the ffmpeg-devel mailing list