[FFmpeg-cvslog] avcodec: remove long dead debug_mv code
James Almer
git at videolan.org
Tue Jan 26 00:31:38 EET 2021
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Jan 24 19:34:56 2021 -0300| [c3f3b562c92ed8422f2db085f7d2a4a618e1e2d4] | committer: James Almer
avcodec: remove long dead debug_mv code
FF_API_DEBUG_MV has been zero since ffmpeg 4.0
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3f3b562c92ed8422f2db085f7d2a4a618e1e2d4
---
fftools/ffmpeg.c | 6 +--
libavcodec/avcodec.h | 24 ---------
libavcodec/mpegpicture.c | 3 --
libavcodec/mpegutils.c | 128 ---------------------------------------------
libavcodec/options_table.h | 7 ---
libavcodec/pthread_frame.c | 4 --
libavcodec/version.h | 3 --
7 files changed, 1 insertion(+), 174 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 4419c68d11..d7c833be63 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -4032,11 +4032,7 @@ static int check_keyboard_interaction(int64_t cur_time)
if(key == 'D') {
debug = input_streams[0]->dec_ctx->debug << 1;
if(!debug) debug = 1;
- 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
+ while (debug & FF_DEBUG_DCT_COEFF) //unsupported, would just crash
debug += debug;
}else{
char buf[32];
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fdb4276260..dc8738c819 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1619,39 +1619,17 @@ typedef struct AVCodecContext {
#define FF_DEBUG_BITSTREAM 4
#define FF_DEBUG_MB_TYPE 8
#define FF_DEBUG_QP 16
-#if FF_API_DEBUG_MV
-/**
- * @deprecated this option does nothing
- */
-#define FF_DEBUG_MV 32
-#endif
#define FF_DEBUG_DCT_COEFF 0x00000040
#define FF_DEBUG_SKIP 0x00000080
#define FF_DEBUG_STARTCODE 0x00000100
#define FF_DEBUG_ER 0x00000400
#define FF_DEBUG_MMCO 0x00000800
#define FF_DEBUG_BUGS 0x00001000
-#if FF_API_DEBUG_MV
-#define FF_DEBUG_VIS_QP 0x00002000
-#define FF_DEBUG_VIS_MB_TYPE 0x00004000
-#endif
#define FF_DEBUG_BUFFERS 0x00008000
#define FF_DEBUG_THREADS 0x00010000
#define FF_DEBUG_GREEN_MD 0x00800000
#define FF_DEBUG_NOMC 0x01000000
-#if FF_API_DEBUG_MV
- /**
- * debug
- * - encoding: Set by user.
- * - decoding: Set by user.
- */
- int debug_mv;
-#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames
-#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames
-#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames
-#endif
-
/**
* Error recognition; may misdetect some more or less valid parts as errors.
* - encoding: unused
@@ -2163,7 +2141,6 @@ typedef struct AVCodecContext {
*/
int seek_preroll;
-#if !FF_API_DEBUG_MV
/**
* debug motion vectors
* - encoding: Set by user.
@@ -2173,7 +2150,6 @@ typedef struct AVCodecContext {
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
-#endif
/**
* custom intra quantization matrix
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index e495e315e6..e3f648895d 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -203,9 +203,6 @@ static int alloc_picture_tables(AVCodecContext *avctx, Picture *pic, int encodin
}
if (out_format == FMT_H263 || encoding ||
-#if FF_API_DEBUG_MV
- avctx->debug_mv ||
-#endif
(avctx->export_side_data & AV_CODEC_EXPORT_DATA_MVS)) {
int mv_size = 2 * (b8_array_size + 4) * sizeof(int16_t);
int ref_index_size = 4 * mb_array_size;
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aae85..e5105ecc58 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -262,132 +262,4 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
av_log(avctx, AV_LOG_DEBUG, "\n");
}
}
-
-#if FF_API_DEBUG_MV
- if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
- (avctx->debug_mv)) {
- int mb_y;
- int i, ret;
- int h_chroma_shift, v_chroma_shift, block_height;
- const int mv_sample_log2 = avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_SVQ3 ? 2 : 1;
- const int mv_stride = (mb_width << mv_sample_log2) +
- (avctx->codec->id == AV_CODEC_ID_H264 ? 0 : 1);
-
- if (low_delay)
- *low_delay = 0; // needed to see the vectors without trashing the buffers
-
- ret = av_pix_fmt_get_chroma_sub_sample (avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
- if (ret)
- return ret;
-
- av_frame_make_writable(pict);
-
- pict->opaque = NULL;
- block_height = 16 >> v_chroma_shift;
-
- for (mb_y = 0; mb_y < mb_height; mb_y++) {
- int mb_x;
- for (mb_x = 0; mb_x < mb_width; mb_x++) {
- const int mb_index = mb_x + mb_y * mb_stride;
- if ((avctx->debug & FF_DEBUG_VIS_QP)) {
- uint64_t c = (qscale_table[mb_index] * 128 / 31) *
- 0x0101010101010101ULL;
- int y;
- for (y = 0; y < block_height; y++) {
- *(uint64_t *)(pict->data[1] + 8 * mb_x +
- (block_height * mb_y + y) *
- pict->linesize[1]) = c;
- *(uint64_t *)(pict->data[2] + 8 * mb_x +
- (block_height * mb_y + y) *
- pict->linesize[2]) = c;
- }
- }
- if ((avctx->debug & FF_DEBUG_VIS_MB_TYPE) &&
- motion_val[0]) {
- int mb_type = mbtype_table[mb_index];
- uint64_t u,v;
- int y;
-#define COLOR(theta, r) \
- u = (int)(128 + r * cos(theta * M_PI / 180)); \
- v = (int)(128 + r * sin(theta * M_PI / 180));
-
-
- u = v = 128;
- if (IS_PCM(mb_type)) {
- COLOR(120, 48)
- } else if ((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) ||
- IS_INTRA16x16(mb_type)) {
- COLOR(30, 48)
- } else if (IS_INTRA4x4(mb_type)) {
- COLOR(90, 48)
- } else if (IS_DIRECT(mb_type) && IS_SKIP(mb_type)) {
- // COLOR(120, 48)
- } else if (IS_DIRECT(mb_type)) {
- COLOR(150, 48)
- } else if (IS_GMC(mb_type) && IS_SKIP(mb_type)) {
- COLOR(170, 48)
- } else if (IS_GMC(mb_type)) {
- COLOR(190, 48)
- } else if (IS_SKIP(mb_type)) {
- // COLOR(180, 48)
- } else if (!USES_LIST(mb_type, 1)) {
- COLOR(240, 48)
- } else if (!USES_LIST(mb_type, 0)) {
- COLOR(0, 48)
- } else {
- av_assert2(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
- COLOR(300,48)
- }
-
- u *= 0x0101010101010101ULL;
- v *= 0x0101010101010101ULL;
- for (y = 0; y < block_height; y++) {
- *(uint64_t *)(pict->data[1] + 8 * mb_x +
- (block_height * mb_y + y) * pict->linesize[1]) = u;
- *(uint64_t *)(pict->data[2] + 8 * mb_x +
- (block_height * mb_y + y) * pict->linesize[2]) = v;
- }
-
- // segmentation
- if (IS_8X8(mb_type) || IS_16X8(mb_type)) {
- *(uint64_t *)(pict->data[0] + 16 * mb_x + 0 +
- (16 * mb_y + 8) * pict->linesize[0]) ^= 0x8080808080808080ULL;
- *(uint64_t *)(pict->data[0] + 16 * mb_x + 8 +
- (16 * mb_y + 8) * pict->linesize[0]) ^= 0x8080808080808080ULL;
- }
- if (IS_8X8(mb_type) || IS_8X16(mb_type)) {
- for (y = 0; y < 16; y++)
- pict->data[0][16 * mb_x + 8 + (16 * mb_y + y) *
- pict->linesize[0]] ^= 0x80;
- }
- if (IS_8X8(mb_type) && mv_sample_log2 >= 2) {
- int dm = 1 << (mv_sample_log2 - 2);
- for (i = 0; i < 4; i++) {
- int sx = mb_x * 16 + 8 * (i & 1);
- int sy = mb_y * 16 + 8 * (i >> 1);
- int xy = (mb_x * 2 + (i & 1) +
- (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
- // FIXME bidir
- int32_t *mv = (int32_t *) &motion_val[0][xy];
- if (mv[0] != mv[dm] ||
- mv[dm * mv_stride] != mv[dm * (mv_stride + 1)])
- for (y = 0; y < 8; y++)
- pict->data[0][sx + 4 + (sy + y) * pict->linesize[0]] ^= 0x80;
- if (mv[0] != mv[dm * mv_stride] || mv[dm] != mv[dm * (mv_stride + 1)])
- *(uint64_t *)(pict->data[0] + sx + (sy + 4) *
- pict->linesize[0]) ^= 0x8080808080808080ULL;
- }
- }
-
- if (IS_INTERLACED(mb_type) &&
- avctx->codec->id == AV_CODEC_ID_H264) {
- // hmm
- }
- }
- if (mbskip_table)
- mbskip_table[mb_index] = 0;
- }
- }
- }
-#endif
}
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 1b9d39a3a7..61b4fb9e7f 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -208,9 +208,6 @@ static const AVOption avcodec_options[] = {
{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"},
{"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
{"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"},
-#if FF_API_DEBUG_MV
-{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"},
-#endif
{"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"},
{"green_metadata", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_GREEN_MD }, INT_MIN, INT_MAX, V|D, "debug"},
{"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"},
@@ -218,10 +215,6 @@ 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 c9d2e00ce3..a570e25e0d 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -774,10 +774,6 @@ 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);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 807062af7f..c0ce9f1865 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -54,9 +54,6 @@
#ifndef FF_API_LOWRES
#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
-#ifndef FF_API_DEBUG_MV
-#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58)
-#endif
#ifndef FF_API_AVCTX_TIMEBASE
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
More information about the ffmpeg-cvslog
mailing list