diff mbox

[FFmpeg-devel] avfilter/vf_bilateral: process command to set the parameter at runtime

Message ID 1571834065-74094-1-git-send-email-leozhang@qiyi.com
State Superseded
Headers show

Commit Message

leozhang Oct. 23, 2019, 12:34 p.m. UTC
---
 libavfilter/vf_bilateral.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

mypopy@gmail.com Oct. 23, 2019, 12:44 p.m. UTC | #1
On Wed, Oct 23, 2019 at 8:34 PM leozhang <leozhang@qiyi.com> wrote:
>
> ---
>  libavfilter/vf_bilateral.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c
> index 3c9d800..a06f434 100644
> --- a/libavfilter/vf_bilateral.c
> +++ b/libavfilter/vf_bilateral.c
> @@ -54,7 +54,7 @@ typedef struct BilateralContext {
>  } BilateralContext;
>
>  #define OFFSET(x) offsetof(BilateralContext, x)
> -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
>
>  static const AVOption bilateral_options[] = {
>      { "sigmaS", "set spatial sigma",    OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0,  10, FLAGS },
> @@ -358,13 +358,14 @@ static const AVFilterPad bilateral_outputs[] = {
>  };
>
>  AVFilter ff_vf_bilateral = {
> -    .name          = "bilateral",
> -    .description   = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> -    .priv_size     = sizeof(BilateralContext),
> -    .priv_class    = &bilateral_class,
> -    .uninit        = uninit,
> -    .query_formats = query_formats,
> -    .inputs        = bilateral_inputs,
> -    .outputs       = bilateral_outputs,
> -    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
I can't find a special reason to change above part
> +    .name            = "bilateral",
> +    .description     = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> +    .priv_size       = sizeof(BilateralContext),
> +    .priv_class      = &bilateral_class,
> +    .uninit          = uninit,
> +    .query_formats   = query_formats,
> +    .inputs          = bilateral_inputs,
> +    .outputs         = bilateral_outputs,
> +    .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> +    .process_command = ff_filter_process_command,
>  };
> --
> 1.8.3.1
>
Paul B Mahol Oct. 23, 2019, 1:47 p.m. UTC | #2
Not ok, range sigma is used to change array values you never update here.

On 10/23/19, leozhang <leozhang@qiyi.com> wrote:
> ---
>  libavfilter/vf_bilateral.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c
> index 3c9d800..a06f434 100644
> --- a/libavfilter/vf_bilateral.c
> +++ b/libavfilter/vf_bilateral.c
> @@ -54,7 +54,7 @@ typedef struct BilateralContext {
>  } BilateralContext;
>
>  #define OFFSET(x) offsetof(BilateralContext, x)
> -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> +#define FLAGS
> AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
>
>  static const AVOption bilateral_options[] = {
>      { "sigmaS", "set spatial sigma",    OFFSET(sigmaS), AV_OPT_TYPE_FLOAT,
> {.dbl=0.1}, 0.0,  10, FLAGS },
> @@ -358,13 +358,14 @@ static const AVFilterPad bilateral_outputs[] = {
>  };
>
>  AVFilter ff_vf_bilateral = {
> -    .name          = "bilateral",
> -    .description   = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> -    .priv_size     = sizeof(BilateralContext),
> -    .priv_class    = &bilateral_class,
> -    .uninit        = uninit,
> -    .query_formats = query_formats,
> -    .inputs        = bilateral_inputs,
> -    .outputs       = bilateral_outputs,
> -    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> +    .name            = "bilateral",
> +    .description     = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> +    .priv_size       = sizeof(BilateralContext),
> +    .priv_class      = &bilateral_class,
> +    .uninit          = uninit,
> +    .query_formats   = query_formats,
> +    .inputs          = bilateral_inputs,
> +    .outputs         = bilateral_outputs,
> +    .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> +    .process_command = ff_filter_process_command,
>  };
> --
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Tao Zhang Oct. 24, 2019, 1:28 a.m. UTC | #3
Paul B Mahol <onemda@gmail.com> 于2019年10月23日周三 下午9:47写道:
>
> Not ok, range sigma is used to change array values you never update here.
Right, I will submit a new version which try to call config_props()
when the user set range sigma at runtime. Thanks a lot.
>
> On 10/23/19, leozhang <leozhang@qiyi.com> wrote:
> > ---
> >  libavfilter/vf_bilateral.c | 21 +++++++++++----------
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c
> > index 3c9d800..a06f434 100644
> > --- a/libavfilter/vf_bilateral.c
> > +++ b/libavfilter/vf_bilateral.c
> > @@ -54,7 +54,7 @@ typedef struct BilateralContext {
> >  } BilateralContext;
> >
> >  #define OFFSET(x) offsetof(BilateralContext, x)
> > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> > +#define FLAGS
> > AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
> >
> >  static const AVOption bilateral_options[] = {
> >      { "sigmaS", "set spatial sigma",    OFFSET(sigmaS), AV_OPT_TYPE_FLOAT,
> > {.dbl=0.1}, 0.0,  10, FLAGS },
> > @@ -358,13 +358,14 @@ static const AVFilterPad bilateral_outputs[] = {
> >  };
> >
> >  AVFilter ff_vf_bilateral = {
> > -    .name          = "bilateral",
> > -    .description   = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> > -    .priv_size     = sizeof(BilateralContext),
> > -    .priv_class    = &bilateral_class,
> > -    .uninit        = uninit,
> > -    .query_formats = query_formats,
> > -    .inputs        = bilateral_inputs,
> > -    .outputs       = bilateral_outputs,
> > -    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> > +    .name            = "bilateral",
> > +    .description     = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> > +    .priv_size       = sizeof(BilateralContext),
> > +    .priv_class      = &bilateral_class,
> > +    .uninit          = uninit,
> > +    .query_formats   = query_formats,
> > +    .inputs          = bilateral_inputs,
> > +    .outputs         = bilateral_outputs,
> > +    .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> > +    .process_command = ff_filter_process_command,
> >  };
> > --
> > 1.8.3.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Tao Zhang Oct. 24, 2019, 1:31 a.m. UTC | #4
mypopy@gmail.com <mypopy@gmail.com> 于2019年10月23日周三 下午8:50写道:
>
> On Wed, Oct 23, 2019 at 8:34 PM leozhang <leozhang@qiyi.com> wrote:
> >
> > ---
> >  libavfilter/vf_bilateral.c | 21 +++++++++++----------
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c
> > index 3c9d800..a06f434 100644
> > --- a/libavfilter/vf_bilateral.c
> > +++ b/libavfilter/vf_bilateral.c
> > @@ -54,7 +54,7 @@ typedef struct BilateralContext {
> >  } BilateralContext;
> >
> >  #define OFFSET(x) offsetof(BilateralContext, x)
> > -#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> > +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
> >
> >  static const AVOption bilateral_options[] = {
> >      { "sigmaS", "set spatial sigma",    OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0,  10, FLAGS },
> > @@ -358,13 +358,14 @@ static const AVFilterPad bilateral_outputs[] = {
> >  };
> >
> >  AVFilter ff_vf_bilateral = {
> > -    .name          = "bilateral",
> > -    .description   = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> > -    .priv_size     = sizeof(BilateralContext),
> > -    .priv_class    = &bilateral_class,
> > -    .uninit        = uninit,
> > -    .query_formats = query_formats,
> > -    .inputs        = bilateral_inputs,
> > -    .outputs       = bilateral_outputs,
> > -    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> I can't find a special reason to change above part
To make the equal signs aligned. Thanks a lot.
> > +    .name            = "bilateral",
> > +    .description     = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
> > +    .priv_size       = sizeof(BilateralContext),
> > +    .priv_class      = &bilateral_class,
> > +    .uninit          = uninit,
> > +    .query_formats   = query_formats,
> > +    .inputs          = bilateral_inputs,
> > +    .outputs         = bilateral_outputs,
> > +    .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
> > +    .process_command = ff_filter_process_command,
> >  };
> > --
> > 1.8.3.1
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c
index 3c9d800..a06f434 100644
--- a/libavfilter/vf_bilateral.c
+++ b/libavfilter/vf_bilateral.c
@@ -54,7 +54,7 @@  typedef struct BilateralContext {
 } BilateralContext;
 
 #define OFFSET(x) offsetof(BilateralContext, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
 static const AVOption bilateral_options[] = {
     { "sigmaS", "set spatial sigma",    OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.0,  10, FLAGS },
@@ -358,13 +358,14 @@  static const AVFilterPad bilateral_outputs[] = {
 };
 
 AVFilter ff_vf_bilateral = {
-    .name          = "bilateral",
-    .description   = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
-    .priv_size     = sizeof(BilateralContext),
-    .priv_class    = &bilateral_class,
-    .uninit        = uninit,
-    .query_formats = query_formats,
-    .inputs        = bilateral_inputs,
-    .outputs       = bilateral_outputs,
-    .flags         = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
+    .name            = "bilateral",
+    .description     = NULL_IF_CONFIG_SMALL("Apply Bilateral filter."),
+    .priv_size       = sizeof(BilateralContext),
+    .priv_class      = &bilateral_class,
+    .uninit          = uninit,
+    .query_formats   = query_formats,
+    .inputs          = bilateral_inputs,
+    .outputs         = bilateral_outputs,
+    .flags           = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
+    .process_command = ff_filter_process_command,
 };