[FFmpeg-devel] [PATCH] vf_curves: add option to set all curves at once
Michael Niedermayer
michaelni at gmx.at
Wed Apr 10 00:32:46 CEST 2013
On Tue, Apr 09, 2013 at 11:21:52PM +0200, Clément Bœsch wrote:
> On Tue, Apr 09, 2013 at 11:04:49PM +0200, Michael Niedermayer wrote:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libavfilter/vf_curves.c | 17 ++++++++++++++---
> > 1 file changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
> > index 360dc72..f32e4ab 100644
> > --- a/libavfilter/vf_curves.c
> > +++ b/libavfilter/vf_curves.c
> > @@ -31,7 +31,7 @@ struct keypoint {
> > struct keypoint *next;
> > };
> >
> > -#define NB_COMP 3
> > +#define NB_COMP 5 //RGBA All
> >
> > enum preset {
> > PRESET_NONE,
> > @@ -64,6 +64,8 @@ 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[4]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
>
> > + { "l", "set all points coordinates", OFFSET(comp_points_str[4]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
>
> I'm not sure that alias is really relevant.
>
> > { "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 (pts[4]) {
> > + for (i = 0; i < 4; i++) {
> > + if (!pts[i])
> > + pts[i] = av_strdup(pts[4]);
> > + 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");
> > @@ -407,7 +418,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> > const uint8_t *srcp = src;
> >
> > for (x = 0; x < inlink->w; x++)
> > - for (i = 0; i < NB_COMP; i++, dstp++, srcp++)
> > + for (i = 0; i < 3; i++, dstp++, srcp++)
>
> I think you need to change a few other NB_COMP entries; actually, it might
> be wise to instead add a char *all pointer in the context, and dup it
> in r, g and b when set.
>
> [...]
>
> Also, missing documentation update.
>
> BTW, an alternative is to cumulate them. IIRC Gimp is doing such thing.
new patch submitted that should fix above things
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct answer.
-------------- 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/f6c67283/attachment.asc>
More information about the ffmpeg-devel
mailing list