aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorClément Bœsch <clement@stupeflix.com>2014-08-18 16:32:26 +0200
committerClément Bœsch <u@pkh.me>2014-08-24 14:35:11 +0200
commitf888331769d666fd7b9cebf7d1b6d824300978cb (patch)
tree612e293481539cab0b90dac4ed5baed76baa066c /libavcodec
parent6dfa70f272d7ede75d45991c907dd93c50be1690 (diff)
downloadffmpeg-f888331769d666fd7b9cebf7d1b6d824300978cb.tar.gz
avfilter: add codecview filter
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.c12
-rw-r--r--libavcodec/options_table.h4
-rw-r--r--libavcodec/utils.c6
-rw-r--r--libavcodec/version.h4
4 files changed, 23 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6a0b822557..3ec81cef52 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1983,6 +1983,7 @@ void ff_mpv_frame_end(MpegEncContext *s)
}
+#if FF_API_VISMV
static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx)
{
if(*sx > *ex)
@@ -2107,6 +2108,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
static int add_mb(AVMotionVector *mb, uint32_t mb_type,
int dst_x, int dst_y,
@@ -2292,13 +2294,15 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) ||
(avctx->debug_mv)) {
- const int shift = 1 + quarter_sample;
int mb_y;
- uint8_t *ptr;
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);
@@ -2310,13 +2314,16 @@ 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++) {
@@ -2396,6 +2403,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_
}
}
}
+#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 700053129e..ad3d52ecdf 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -262,10 +262,12 @@ 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"},
-{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"},
+#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 6a40a032e8..985884f551 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1435,6 +1435,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto free_and_end;
}
+#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 (avctx->codec->sample_fmts) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2c871ba744..9da72abdd0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -174,5 +174,9 @@
#ifndef FF_API_AFD
#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 57)
#endif
+#ifndef FF_API_VISMV
+/* XXX: don't forget to drop the -vismv documentation */
+#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 57)
+#endif
#endif /* AVCODEC_VERSION_H */