[FFmpeg-devel] [PATCH] avfilter: add codecview filter

Stefano Sabatini stefasab at gmail.com
Wed Aug 20 13:37:23 CEST 2014


On date Monday 2014-08-18 18:03:39 +0200, Clément Bœsch encoded:
> From: Clément Bœsch <clement at stupeflix.com>
> 
> ---
> Note: I didn't use FF_API_DEBUG_MV because it seems to overlap with all
> kind of other things and I couldn't test properly the conditional
> compilation.
> 
> BTW, I could add a FATE test easily, but I didn't find any relevant
> samples available.
> 
> TODO: minor bump avfilter, micro bump avcodec
> ---
>  Changelog                  |   1 +
>  RELEASE_NOTES              |   2 +
>  doc/filters.texi           |  36 +++++++
>  libavcodec/mpegvideo.c     |  13 ++-
>  libavcodec/options_table.h |   4 +-
>  libavcodec/utils.c         |   6 ++
>  libavcodec/version.h       |   4 +
>  libavfilter/Makefile       |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vf_codecview.c | 241 +++++++++++++++++++++++++++++++++++++++++++++
>  10 files changed, 305 insertions(+), 4 deletions(-)
>  create mode 100644 libavfilter/vf_codecview.c
[...] 
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 7000531..ad3d52e 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

Note: you may mention that the option is deprecated in ffmpeg-codecs.

>  {"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 6a40a03..70f5734 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: http://ffmpeg.org/ffmpeg-filters.html#codecview\n");

Please don't use links in code, as we don't want to update them (and
the user may have no Internet connectivity or no browser).

[...]
> diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c
> new file mode 100644
> index 0000000..5749631
> --- /dev/null
> +++ b/libavfilter/vf_codecview.c
> @@ -0,0 +1,241 @@
> +/*
> + * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
> + * Copyright (c) 2014 Clément Bœsch <u pkh me>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +/**
> + * @file
> + * Codec debug viewer filter.

Please mention the file from which the code was taken
(libavcodec/mpegvideo.c).

> + *
> + * TODO: segmentation
> + * TODO: quantization
> + */
> +
[...]

LGTM, thanks.
-- 
FFmpeg = Fanciful and Freak Monstrous Political Ecumenical Genius


More information about the ffmpeg-devel mailing list