[FFmpeg-devel] [PATCH] vf_curves: add option to set all curves at once

Michael Niedermayer michaelni at gmx.at
Wed Apr 10 19:28:32 CEST 2013


On Wed, Apr 10, 2013 at 12:41:22AM +0200, Clément Bœsch wrote:
> On Wed, Apr 10, 2013 at 12:31:32AM +0200, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  doc/filters.texi        |    2 ++
> >  libavfilter/vf_curves.c |   13 ++++++++++++-
> >  2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 483d8a1..5e21651 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -2345,6 +2345,8 @@ Set the key points for the red component.
> >  Set the key points for the green component.
> >  @item blue, b
> >  Set the key points for the blue component.
> > + at item all
> > +Set the key points for all components.
> 
> You could add "Can be used in addition to the other key points component
> options. In this case, the unset component(s) will fallback on this
> @option{all} setting." or something like that.
> 
> >  @item preset
> >  Select one of the available color presets. This option can not be used in
> >  addition to the @option{r}, @option{g}, @option{b} parameters.
> > diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
> > index 360dc72..5d60a08 100644
> > --- a/libavfilter/vf_curves.c
> > +++ b/libavfilter/vf_curves.c
> > @@ -52,6 +52,7 @@ typedef struct {
> >      const AVClass *class;
> >      enum preset preset;
> >      char *comp_points_str[NB_COMP];
> > +    char *comp_points_str_all;
> >      uint8_t graph[NB_COMP][256];
> >  } CurvesContext;
> >  
> > @@ -64,6 +65,7 @@ static const AVOption curves_options[] = {
> >      { "g",     "set green points coordinates", OFFSET(comp_points_str[1]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
> >      { "blue",  "set blue points coordinates",  OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
> >      { "b",     "set blue points coordinates",  OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
> > +    { "all",   "set all points coordinates",   OFFSET(comp_points_str_all),AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
> 
> "set points coordinates for all components"
> 
> >      { "preset", "select a color curves preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=PRESET_NONE}, PRESET_NONE, NB_PRESETS-1, FLAGS, "preset_name" },
> >          { "color_negative",     NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_COLOR_NEGATIVE},       INT_MIN, INT_MAX, FLAGS, "preset_name" },
> >          { "cross_process",      NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_CROSS_PROCESS},        INT_MIN, INT_MAX, FLAGS, "preset_name" },
> > @@ -318,9 +320,18 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
> >      int i, j, ret;
> >      CurvesContext *curves = ctx->priv;
> >      struct keypoint *comp_points[NB_COMP] = {0};
> > +    char **pts = curves->comp_points_str;
> > +
> > +    if (curves->comp_points_str_all) {
> > +        for (i = 0; i < NB_COMP; i++) {
> > +            if (!pts[i])
> > +                pts[i] = av_strdup(curves->comp_points_str_all);
> > +            if (!pts[i])
> > +                return AVERROR(ENOMEM);
> > +        }
> > +    }
> >  
> >      if (curves->preset != PRESET_NONE) {
> > -        char **pts = curves->comp_points_str;
> >          if (pts[0] || pts[1] || pts[2]) {
> >              av_log(ctx, AV_LOG_ERROR, "It is not possible to mix a preset "
> >                     "with explicit points placements\n");
> 
> Rest LGTM, thanks.

fixed & applied

thnx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130410/e1deed6e/attachment.asc>


More information about the ffmpeg-devel mailing list