[FFmpeg-devel] [PATCH] lavc/ffmpeg: put FF_API_DEBUG_MV around remaining uses of FF_DEBUG_VIS_QP/MB_TYPE.

Ronald S. Bultje rsbultje at gmail.com
Mon Aug 17 14:01:56 CEST 2015


---
 ffmpeg.c                   | 6 +++++-
 libavcodec/mpegvideo.c     | 4 ++++
 libavcodec/options_table.h | 2 ++
 libavcodec/pthread_frame.c | 2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 434abd4..268ef57 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3422,7 +3422,11 @@ static int check_keyboard_interaction(int64_t cur_time)
         if(key == 'D') {
             debug = input_streams[0]->st->codec->debug<<1;
             if(!debug) debug = 1;
-            while(debug & (FF_DEBUG_DCT_COEFF|FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) //unsupported, would just crash
+            while(debug & (FF_DEBUG_DCT_COEFF
+#if FF_API_DEBUG_MV
+                                             |FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE
+#endif
+                                             )) //unsupported, would just crash
                 debug += debug;
         }else{
             char buf[32];
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index f28f7e8..e0b1d32 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1502,6 +1502,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
     }
 }
 
+#if FF_API_DEBUG_MV
 /**
  * Draw an arrow from (ex, ey) -> (sx, sy).
  * @param w width of the image
@@ -1547,6 +1548,7 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex,
     draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
 }
 #endif
+#endif
 
 static int add_mb(AVMotionVector *mb, uint32_t mb_type,
                   int dst_x, int dst_y,
@@ -1733,6 +1735,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
         }
     }
 
+#if FF_API_DEBUG_MV
     if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
         (avctx->debug_mv)) {
         int mb_y;
@@ -1945,6 +1948,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
             }
         }
     }
+#endif
 }
 
 void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict)
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 0fc343a..5376cbb 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -266,8 +266,10 @@ static const AVOption avcodec_options[] = {
 {"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"},
 {"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"},
 {"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"},
+#if FF_API_DEBUG_MV
 {"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"},
 {"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
+#endif
 {"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"},
 {"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"},
 {"nomc", "skip motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_NOMC }, INT_MIN, INT_MAX, V|A|D, "debug"},
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 5a3214c..d7a75cd 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -639,8 +639,10 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 
     if (!thread_count) {
         int nb_cpus = av_cpu_count();
+#if FF_API_DEBUG_MV
         if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv)
             nb_cpus = 1;
+#endif
         // use number of cores + 1 as thread count if there is more than one
         if (nb_cpus > 1)
             thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
-- 
2.1.2



More information about the ffmpeg-devel mailing list