From eb5f84633991eeed2c4a547ae04b593ad6adb03e Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 23 Oct 2017 16:52:24 -0300 Subject: [PATCH] avcodec: drop deprecated vismv option Deprecated in 08/2014. Signed-off-by: James Almer --- doc/codecs.texi | 15 --- libavcodec/mpegvideo.c | 218 ------------------------------------- libavcodec/options_table.h | 6 - libavcodec/utils.c | 6 - libavcodec/version.h | 4 - 5 files changed, 249 deletions(-) diff --git a/doc/codecs.texi b/doc/codecs.texi index 6ab02c35de..6f0aad2169 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -506,21 +506,6 @@ threading operations skip motion compensation @end table -@item vismv @var{integer} (@emph{decoding,video}) -Visualize motion vectors (MVs). - -This option is deprecated, see the codecview filter instead. - -Possible values: -@table @samp -@item pf -forward predicted MVs of P-frames -@item bf -forward predicted MVs of B-frames -@item bb -backward predicted MVs of B-frames -@end table - @item cmp @var{integer} (@emph{encoding,video}) Set full pel me compare function. diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 75e6742995..2f5793b9a4 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1418,134 +1418,6 @@ void ff_mpv_frame_end(MpegEncContext *s) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); } - -#if FF_API_VISMV -static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx) -{ - if(*sx > *ex) - return clip_line(ex, ey, sx, sy, maxx); - - if (*sx < 0) { - if (*ex < 0) - return 1; - *sy = *ey + (*sy - *ey) * (int64_t)*ex / (*ex - *sx); - *sx = 0; - } - - if (*ex > maxx) { - if (*sx > maxx) - return 1; - *ey = *sy + (*ey - *sy) * (int64_t)(maxx - *sx) / (*ex - *sx); - *ex = maxx; - } - return 0; -} - - -/** - * Draw a line from (ex, ey) -> (sx, sy). - * @param w width of the image - * @param h height of the image - * @param stride stride/linesize of the image - * @param color color of the arrow - */ -static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, - int w, int h, int stride, int color) -{ - int x, y, fr, f; - - if (clip_line(&sx, &sy, &ex, &ey, w - 1)) - return; - if (clip_line(&sy, &sx, &ey, &ex, h - 1)) - return; - - sx = av_clip(sx, 0, w - 1); - sy = av_clip(sy, 0, h - 1); - ex = av_clip(ex, 0, w - 1); - ey = av_clip(ey, 0, h - 1); - - buf[sy * stride + sx] += color; - - if (FFABS(ex - sx) > FFABS(ey - sy)) { - if (sx > ex) { - FFSWAP(int, sx, ex); - FFSWAP(int, sy, ey); - } - buf += sx + sy * stride; - ex -= sx; - f = ((ey - sy) << 16) / ex; - for (x = 0; x <= ex; x++) { - y = (x * f) >> 16; - fr = (x * f) & 0xFFFF; - buf[y * stride + x] += (color * (0x10000 - fr)) >> 16; - if(fr) buf[(y + 1) * stride + x] += (color * fr ) >> 16; - } - } else { - if (sy > ey) { - FFSWAP(int, sx, ex); - FFSWAP(int, sy, ey); - } - buf += sx + sy * stride; - ey -= sy; - if (ey) - f = ((ex - sx) << 16) / ey; - else - f = 0; - for(y= 0; y <= ey; y++){ - x = (y*f) >> 16; - fr = (y*f) & 0xFFFF; - buf[y * stride + x] += (color * (0x10000 - fr)) >> 16; - if(fr) buf[y * stride + x + 1] += (color * fr ) >> 16; - } - } -} - -/** - * Draw an arrow from (ex, ey) -> (sx, sy). - * @param w width of the image - * @param h height of the image - * @param stride stride/linesize of the image - * @param color color of the arrow - */ -static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, - int ey, int w, int h, int stride, int color, int tail, int direction) -{ - int dx,dy; - - if (direction) { - FFSWAP(int, sx, ex); - FFSWAP(int, sy, ey); - } - - sx = av_clip(sx, -100, w + 100); - sy = av_clip(sy, -100, h + 100); - ex = av_clip(ex, -100, w + 100); - ey = av_clip(ey, -100, h + 100); - - dx = ex - sx; - dy = ey - sy; - - if (dx * dx + dy * dy > 3 * 3) { - int rx = dx + dy; - int ry = -dx + dy; - int length = ff_sqrt((rx * rx + ry * ry) << 8); - - // FIXME subpixel accuracy - rx = ROUNDED_DIV(rx * 3 << 4, length); - ry = ROUNDED_DIV(ry * 3 << 4, length); - - if (tail) { - rx = -rx; - ry = -ry; - } - - draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color); - draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color); - } - draw_line(buf, sx, sy, ex, ey, w, h, stride, color); -} -#endif - static int add_mb(AVMotionVector *mb, uint32_t mb_type, int dst_x, int dst_y, int motion_x, int motion_y, int motion_scale, @@ -1737,12 +1609,6 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_ int mb_y; int i; int h_chroma_shift, v_chroma_shift, block_height; -#if FF_API_VISMV - const int shift = 1 + quarter_sample; - uint8_t *ptr; - const int width = avctx->width; - const int height = avctx->height; -#endif 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); @@ -1755,96 +1621,12 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_ av_frame_make_writable(pict); pict->opaque = NULL; -#if FF_API_VISMV - ptr = pict->data[0]; -#endif 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 FF_API_VISMV - if ((avctx->debug_mv) && motion_val[0]) { - int type; - for (type = 0; type < 3; type++) { - int direction = 0; - switch (type) { - case 0: - if ((!(avctx->debug_mv & FF_DEBUG_VIS_MV_P_FOR)) || - (pict->pict_type!= AV_PICTURE_TYPE_P)) - continue; - direction = 0; - break; - case 1: - if ((!(avctx->debug_mv & FF_DEBUG_VIS_MV_B_FOR)) || - (pict->pict_type!= AV_PICTURE_TYPE_B)) - continue; - direction = 0; - break; - case 2: - if ((!(avctx->debug_mv & FF_DEBUG_VIS_MV_B_BACK)) || - (pict->pict_type!= AV_PICTURE_TYPE_B)) - continue; - direction = 1; - break; - } - if (!USES_LIST(mbtype_table[mb_index], direction)) - continue; - - if (IS_8X8(mbtype_table[mb_index])) { - int i; - for (i = 0; i < 4; i++) { - int sx = mb_x * 16 + 4 + 8 * (i & 1); - int sy = mb_y * 16 + 4 + 8 * (i >> 1); - int xy = (mb_x * 2 + (i & 1) + - (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1); - int mx = (motion_val[direction][xy][0] >> shift) + sx; - int my = (motion_val[direction][xy][1] >> shift) + sy; - draw_arrow(ptr, sx, sy, mx, my, width, - height, pict->linesize[0], 100, 0, direction); - } - } else if (IS_16X8(mbtype_table[mb_index])) { - int i; - for (i = 0; i < 2; i++) { - int sx = mb_x * 16 + 8; - int sy = mb_y * 16 + 4 + 8 * i; - int xy = (mb_x * 2 + (mb_y * 2 + i) * mv_stride) << (mv_sample_log2 - 1); - int mx = (motion_val[direction][xy][0] >> shift); - int my = (motion_val[direction][xy][1] >> shift); - - if (IS_INTERLACED(mbtype_table[mb_index])) - my *= 2; - - draw_arrow(ptr, sx, sy, mx + sx, my + sy, width, - height, pict->linesize[0], 100, 0, direction); - } - } else if (IS_8X16(mbtype_table[mb_index])) { - int i; - for (i = 0; i < 2; i++) { - int sx = mb_x * 16 + 4 + 8 * i; - int sy = mb_y * 16 + 8; - int xy = (mb_x * 2 + i + mb_y * 2 * mv_stride) << (mv_sample_log2 - 1); - int mx = motion_val[direction][xy][0] >> shift; - int my = motion_val[direction][xy][1] >> shift; - - if (IS_INTERLACED(mbtype_table[mb_index])) - my *= 2; - - draw_arrow(ptr, sx, sy, mx + sx, my + sy, width, - height, pict->linesize[0], 100, 0, direction); - } - } else { - int sx= mb_x * 16 + 8; - int sy= mb_y * 16 + 8; - int xy= (mb_x + mb_y * mv_stride) << mv_sample_log2; - int mx= (motion_val[direction][xy][0]>>shift) + sx; - int my= (motion_val[direction][xy][1]>>shift) + sy; - draw_arrow(ptr, sx, sy, mx, my, width, height, pict->linesize[0], 100, 0, direction); - } - } - } -#endif if ((avctx->debug & FF_DEBUG_VIS_QP)) { uint64_t c = (qscale_table[mb_index] * 128 / 31) * 0x0101010101010101ULL; diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 51932f857d..942aecec05 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -249,12 +249,6 @@ static const AVOption avcodec_options[] = { {"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"}, -#if FF_API_VISMV -{"vismv", "visualize motion vectors (MVs) (deprecated)", OFFSET(debug_mv), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"}, -{"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bf", "forward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -#endif {"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 6f6707a7c7..965b6c6276 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -816,12 +816,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avctx->lowres = avctx->codec->max_lowres; } -#if FF_API_VISMV - if (avctx->debug_mv) - av_log(avctx, AV_LOG_WARNING, "The 'vismv' option is deprecated, " - "see the codecview filter instead.\n"); -#endif - if (av_codec_is_encoder(avctx->codec)) { int i; #if FF_API_CODED_FRAME diff --git a/libavcodec/version.h b/libavcodec/version.h index 3dd58c448d..6c52ae983c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -57,10 +57,6 @@ #ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58) #endif -#ifndef FF_API_VISMV -/* XXX: don't forget to drop the -vismv documentation */ -#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 58) -#endif #ifndef FF_API_VAAPI_CONTEXT #define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58) #endif