[FFmpeg-user] minterpolate problem

Mark Filipak (ffmpeg) markfilipak at bog.us
Thu Jan 28 21:49:04 EET 2021


On 01/27/2021 03:16 AM, list+ffmpeg-user at jdlh.com wrote:
> This is the part of the minterpolate video filter which defines the options:
> https://github.com/FFmpeg/FFmpeg/blob/master/libavfilter/vf_minterpolate.c#L205-L235
> 
> [The following looks better in a fixed-pitch font.]
> 
> static const AVOption minterpolate_options[] = {
>      { "fps", "output's frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "60"}, 0, 
> INT_MAX, FLAGS },
>      { "mi_mode", "motion interpolation mode", OFFSET(mi_mode), AV_OPT_TYPE_INT, {.i64 = 
> MI_MODE_MCI}, MI_MODE_DUP, MI_MODE_MCI, FLAGS, "mi_mode" },
>          CONST("dup",    "duplicate frames", MI_MODE_DUP, "mi_mode"),
>          CONST("blend",  "blend frames", MI_MODE_BLEND,          "mi_mode"),
>          CONST("mci",    "motion compensated interpolation", MI_MODE_MCI,            "mi_mode"),
>      { "mc_mode", "motion compensation mode", OFFSET(mc_mode), AV_OPT_TYPE_INT, {.i64 = 
> MC_MODE_OBMC}, MC_MODE_OBMC, MC_MODE_AOBMC, FLAGS, "mc_mode" },
>          CONST("obmc",   "overlapped block motion compensation", MC_MODE_OBMC,           "mc_mode"),
>          CONST("aobmc",  "adaptive overlapped block motion compensation", MC_MODE_AOBMC, "mc_mode"),
>      { "me_mode", "motion estimation mode", OFFSET(me_mode), AV_OPT_TYPE_INT, {.i64 = 
> ME_MODE_BILAT}, ME_MODE_BIDIR, ME_MODE_BILAT, FLAGS, "me_mode" },
>          CONST("bidir",  "bidirectional motion estimation", ME_MODE_BIDIR,          "me_mode"),
>          CONST("bilat",  "bilateral motion estimation", ME_MODE_BILAT,          "me_mode"),
>      { "me", "motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = 
> AV_ME_METHOD_EPZS}, AV_ME_METHOD_ESA, AV_ME_METHOD_UMH, FLAGS, "me" },
>          CONST("esa",    "exhaustive search", AV_ME_METHOD_ESA,       "me"),
>          CONST("tss",    "three step search", AV_ME_METHOD_TSS,       "me"),
>          CONST("tdls",   "two dimensional logarithmic search", AV_ME_METHOD_TDLS,      "me"),
>          CONST("ntss",   "new three step search", AV_ME_METHOD_NTSS,      "me"),
>          CONST("fss",    "four step search", AV_ME_METHOD_FSS,       "me"),
>          CONST("ds",     "diamond search", AV_ME_METHOD_DS,        "me"),
>          CONST("hexbs",  "hexagon-based search", AV_ME_METHOD_HEXBS, "me"),
>          CONST("epzs",   "enhanced predictive zonal search", AV_ME_METHOD_EPZS,      "me"),
>          CONST("umh",    "uneven multi-hexagon search", AV_ME_METHOD_UMH,       "me"),
>      { "mb_size", "macroblock size", OFFSET(mb_size), AV_OPT_TYPE_INT, {.i64 = 16}, 4, 16, FLAGS },
>      { "search_param", "search parameter", OFFSET(search_param), AV_OPT_TYPE_INT, {.i64 = 32}, 4, 
> INT_MAX, FLAGS },
>      { "vsbmc", "variable-size block motion compensation", OFFSET(vsbmc), AV_OPT_TYPE_INT, {.i64 = 
> 0}, 0, 1, FLAGS },
>      { "scd", "scene change detection method", OFFSET(scd_method), AV_OPT_TYPE_INT, {.i64 = 
> SCD_METHOD_FDIFF}, SCD_METHOD_NONE, SCD_METHOD_FDIFF, FLAGS, "scene" },
>          CONST("none",   "disable detection", SCD_METHOD_NONE, "scene"),
>          CONST("fdiff",  "frame difference", SCD_METHOD_FDIFF, "scene"),
>      { "scd_threshold", "scene change threshold", OFFSET(scd_threshold), AV_OPT_TYPE_DOUBLE, {.dbl = 
> 10.}, 0, 100.0, FLAGS },
>      { NULL }
> };
> 
> What that means:
> 
> There is an option, "fps", which means "output's frame rate". It can (I believe) take any frame rate 
> value describe in 7.5 "Frame Rate" (http://ffmpeg.org/ffmpeg-all.html#Video-rate), including 
> integers, rational numbers, and 8 special names (because "AV_OPT_TYPE_VIDEO_RATE"). The default 
> value is 60 (because '{.str = "60"}').
> 
> There is an option, "mi_mode", which means "motion interpolation mode". It can take any of the 
> following values:
> "dup", meaning  "duplicate frames"; "blend", meaning  "blend frames"; or "mci", meaning "motion 
> compensated interpolation".
> The default value is "mci" (because '{.i64 = MI_MODE_MCI}' and 'CONST("mci" … MI_MODE_MCI').
> 
> There is an option, "mc_mode",  which means "motion compensation mode". Reading the code elsewhere 
> in that file, it seems that the filter only consults this option when "mi_mode"="mci". It can take 
> any of the following values:
> "obmc", meaning "overlapped block motion compensation"; or "aobmc", meaning "adaptive overlapped 
> block motion compensation".
> The default value is "obmc" (because '{.i64 = MC_MODE_OBMC}' and 'CONST("obmc" … MC_MODE_OBMC').
> 
> There is an option, "me_mode", which means "motion estimation mode". Reading the code elsewhere in 
> that file, it seems that the filter only consults this option when "mi_mode"="mci". It can take any 
> of the following values:
> "bidir", meaning "bidirectional motion estimation"; or "bilat", meaing "bilateral motion estimation".
> The default value is "bilat" (because '{.i64 = ME_MODE_BILAT}' and 'CONST("bilat" … ME_MODE_BILAT').
> 
> There is an option, "me", meaning "motion estimation method". Reading the code elsewhere in that 
> file, it seems that the filter only consults this option when "mi_mode"="mci". It can take any of 
> the following values:
> "esa", meaning "exhaustive search"; "tss", meaning "three step search"; "tdls", meaning "two 
> dimensional logarithmic search";
> "ntss", meaning "new three step search"; "fss", meaning "four step search"; "ds", meaning "diamond 
> search";
> "hexbs", meaning "hexagon-based search"; "epzs", meaning "enhanced predictive zonal search"; or 
> "umh", meaning "uneven multi-hexagon search".
> The default value is "epzs" (because '{.i64 = AV_ME_METHOD_EPZS}' and 'CONST("epzs" … 
> AV_ME_METHOD_EPZS').
> 
> There is an option, "mb_size", meaning "macroblock size". It takes an integer value of 4-16 (because 
> 'AV_OPT_TYPE_INT' and  '4, 16'). The default value is 16 (because '{.i64 = 16}').
> 
> There is an option, "search_param", meaning "search parameter". It takes an integer value of 4 or 
> more (because 'AV_OPT_TYPE_INT' and  '4, INT_MAX'). The default value is 32 (because '{.i64 = 32}').
> 
> There is an option, "vsbmc", meaning "variable-size block motion compensation". It takes an integer 
> value of 0 or 1 (because 'AV_OPT_TYPE_INT' and '0, 1'). The default value is 0 (because '{.i64 = 0}').
> 
> There is an option, "scd", meaning "scene change detection method". It can take either of the 
> following values:
> "none", meaning "disable detection"; or "fdiff", meaning "frame difference".
> The default value is "fdiff" (because '{.i64 = SCD_METHOD_FDIFF}' and 'CONST("fdiff", … 
> SCD_METHOD_FDIFF').
> 
> There is an option, "scd_threshold", meaning "scene change threshold". It takes a real-number value 
> of 0.0-100.0 (because 'AV_OPT_TYPE_DOUBLE' and '0, 100.0'). The default value is 10.0 (because 
> '{.dbl = 10.}'.
> 
> 
> I wrote out that translation of the code into English in part to help you with your documentation, 
> and in part to help others who want to learn how to read the idioms in source code. This skill is 
> useful for checking where the documentation is incomplete or wrong.
> 
> Note that I just translated the options declaration in lines 205-235 of the source code. This 
> describes only the names and data types of the options. To understand what FFmpeg actually does when 
> presented with the various options, one has to read the rest of the source code. (For instance, are 
> options 'mb_size', 'search_param', and 'vsbmc' consulted only when option 'mi_mode'='mci'? Lines 
> 205-235 don't say.)
> 
>      —Jim DeLaHunt

Thank you so much, Jim. That really helps.

Mark.
-- 
Someone's sneaking in and turning up the range so that my food burns.
I'm sure of it.
And the older I get, the more sure of it I become.


More information about the ffmpeg-user mailing list