[FFmpeg-devel] [PATCH v2] avfilter/vf_guided: support enhanced guided filter
Xuewei Meng
928826483 at qq.com
Wed Aug 25 15:04:37 EEST 2021
From: Xuewei Meng <xwmeng96 at gmail.com>
Check block algin
Signed-off-by: Xuewei Meng <xwmeng96 at gmail.com>
---
libavfilter/vf_guided.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c
index c030080..94318c0 100644
--- a/libavfilter/vf_guided.c
+++ b/libavfilter/vf_guided.c
@@ -81,19 +81,19 @@ typedef struct GuidedContext {
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static const AVOption guided_options[] = {
- { "radius", "set the box radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64 = 3 }, 1, 20, FLAGS },
- { "eps", "set the regularization parameter (with square)", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl = 0.01 }, 0.0, 1, FLAGS },
+ { "radius", "set the box radius", OFFSET(radius), AV_OPT_TYPE_INT, {.i64 = 3 }, 1, 20, FLAGS },
+ { "eps", "set the regularization parameter (with square)", OFFSET(eps), AV_OPT_TYPE_FLOAT, {.dbl = 0.01 }, 0.0, 1, FLAGS },
{ "mode", "set filtering mode (0: basic mode; 1: fast basic mode; 3: enhanced mode; 4: fast enhanced mode)",
OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = BASIC }, BASIC, NB_MODES - 1, FLAGS, "mode" },
- { "basic", "basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = BASIC}, 0, 0, FLAGS, "mode" },
+ { "basic", "basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = BASIC }, 0, 0, FLAGS, "mode" },
{ "basic fast", "fast basic guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = FAST_BASIC }, 0, 0, FLAGS, "mode" },
{ "enhanced", "enhanced guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = ENHANCED }, 0, 0, FLAGS, "mode" },
{ "enhanced fast", "fast enhanced guided filter", 0, AV_OPT_TYPE_CONST, {.i64 = FAST_ENHANCED }, 0, 0, FLAGS, "mode" },
- { "sub", "subsampling ratio for fast mode", OFFSET(sub), AV_OPT_TYPE_INT, {.i64 = 4 }, 2, 64, FLAGS },
- { "guidance", "set guidance mode (0: off mode; 1: on mode)", OFFSET(guidance), AV_OPT_TYPE_INT, {.i64 = OFF }, OFF, NB_GUIDANCE_MODES - 1, FLAGS, "guidance" },
- { "off", "only one input is enabled", 0, AV_OPT_TYPE_CONST, {.i64 = OFF }, 0, 0, FLAGS, "guidance" },
- { "on", "two inputs are required", 0, AV_OPT_TYPE_CONST, {.i64 = ON }, 0, 0, FLAGS, "guidance" },
- { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 0xF, FLAGS },
+ { "sub", "subsampling ratio for fast mode", OFFSET(sub), AV_OPT_TYPE_INT, {.i64 = 4 }, 2, 64, FLAGS },
+ { "guidance", "set guidance mode (0: off mode; 1: on mode)", OFFSET(guidance), AV_OPT_TYPE_INT, {.i64 = OFF }, OFF, NB_GUIDANCE_MODES - 1, FLAGS, "guidance" },
+ { "off", "only one input is enabled", 0, AV_OPT_TYPE_CONST, {.i64 = OFF }, 0, 0, FLAGS, "guidance" },
+ { "on", "two inputs are required", 0, AV_OPT_TYPE_CONST, {.i64 = ON }, 0, 0, FLAGS, "guidance" },
+ { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 0xF, FLAGS },
{ NULL }
};
@@ -288,9 +288,8 @@ static int config_input(AVFilterLink *inlink)
} else if (s->mode == FAST_BASIC || s->mode == FAST_ENHANCED) {
if (s->radius >= s->sub)
s->radius = s->radius / s->sub;
- else {
+ else
s->radius = 1;
- }
}
s->depth = desc->comp[0].depth;
--
1.9.1
More information about the ffmpeg-devel
mailing list