[FFmpeg-devel] [PATCH][libavfilter] codecview: improved options

Michael Niedermayer michael at niedermayer.cc
Mon May 30 10:12:07 CEST 2016


On Mon, May 23, 2016 at 05:09:35PM +0000, Davinder Singh wrote:
>  vf_codecview.c |   55 +++++++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 45 insertions(+), 10 deletions(-)
> 464b23c4638d1a408e8237651facf327994945bf  0001-vf_codecview-added-new-options.patch
> From 641d6f92e792ea7def3610f5462b6bbec019c4b7 Mon Sep 17 00:00:00 2001
> From: dsmudhar <ds.mudhar at gmail.com>
> Date: Mon, 23 May 2016 22:29:51 +0530
> Subject: [PATCH] vf_codecview: added new options
> 
> ---
>  libavfilter/vf_codecview.c | 55 +++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 45 insertions(+), 10 deletions(-)
> 
> diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c
> index e70b397..1cb521d 100644
> --- a/libavfilter/vf_codecview.c
> +++ b/libavfilter/vf_codecview.c
> @@ -38,21 +38,39 @@
>  #define MV_P_FOR  (1<<0)
>  #define MV_B_FOR  (1<<1)
>  #define MV_B_BACK (1<<2)
> +#define MV_TYPE_FOR  (1<<0)
> +#define MV_TYPE_BACK (1<<1)
> +#define FRAME_TYPE_I (1<<0)
> +#define FRAME_TYPE_P (1<<1)
> +#define FRAME_TYPE_B (1<<2)
>  
>  typedef struct {
>      const AVClass *class;
>      unsigned mv;
> +    unsigned frame_type;
> +    unsigned mv_type;
>      int hsub, vsub;
>      int qp;
>  } CodecViewContext;
>  
>  #define OFFSET(x) offsetof(CodecViewContext, x)
>  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
> +#define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, unit }
> +
>  static const AVOption codecview_options[] = {
>      { "mv", "set motion vectors to visualize", OFFSET(mv), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv" },
> -        {"pf", "forward predicted MVs of P-frames",  0, AV_OPT_TYPE_CONST, {.i64 = MV_P_FOR },  INT_MIN, INT_MAX, FLAGS, "mv"},
> -        {"bf", "forward predicted MVs of B-frames",  0, AV_OPT_TYPE_CONST, {.i64 = MV_B_FOR },  INT_MIN, INT_MAX, FLAGS, "mv"},
> -        {"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = MV_B_BACK }, INT_MIN, INT_MAX, FLAGS, "mv"},
> +        CONST("pf", "forward predicted MVs of P-frames",  MV_P_FOR,  "mv"),
> +        CONST("bf", "forward predicted MVs of B-frames",  MV_B_FOR,  "mv"),
> +        CONST("bb", "backward predicted MVs of B-frames", MV_B_BACK, "mv"),
> +    { "mv_type", "set motion vectors type", OFFSET(mv_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv_type" },
> +    { "mvt",     "set motion vectors type", OFFSET(mv_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv_type" },
> +        CONST("fp", "forward predicted MVs",  MV_TYPE_FOR,  "mv_type"),
> +        CONST("bp", "backward predicted MVs", MV_TYPE_BACK, "mv_type"),
> +    { "frame_type", "set frame types to visualize motion vectors of", OFFSET(frame_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "frame_type" },
> +    { "ft",         "set frame types to visualize motion vectors of", OFFSET(frame_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "frame_type" },
> +        CONST("if", "I-frames", FRAME_TYPE_I, "frame_type"),
> +        CONST("pf", "P-frames", FRAME_TYPE_P, "frame_type"),
> +        CONST("bf", "B-frames", FRAME_TYPE_B, "frame_type"),
>      { "qp", NULL, OFFSET(qp), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },

the new options should be added at the end, inserting them in the middle
breaks for example
-flags2 +export_mvs -vf codecview=0:1

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160530/b2b7d3e5/attachment.sig>


More information about the ffmpeg-devel mailing list