[FFmpeg-devel] [PATCH] Add lut filter.

Michael Niedermayer michaelni at gmx.at
Tue Jun 7 13:13:53 CEST 2011


On Tue, Jun 07, 2011 at 10:34:36AM +0200, Stefano Sabatini wrote:
> On date Tuesday 2011-06-07 08:32:37 +0100, Mark Himsley encoded:
> > On 06/06/2011 20:42, Stefano Sabatini wrote:
> > 
> > > +        /* compute the lut */
> > > +        lut->var_values[VAR_MAXVAL] = max[comp];
> > > +        lut->var_values[VAR_MINVAL] = min[comp];
> > > +
> > > +        for (val = 0; val < 256; val++) {
> > > +            lut->var_values[VAR_VAL] = av_clip(val, min[comp], max[comp]);
> > > +            lut->var_values[VAR_INVVAL] =
> > > +                av_clip(min[comp] + max[comp] - lut->var_values[VAR_VAL],
> > > +                        min[comp], max[comp]);
> > > +
> > > +            res = av_expr_eval(lut->comp_expr[comp], lut->var_values, lut);
> > > +            if (isnan(res)) {
> > > +                av_log(ctx, AV_LOG_ERROR,
> > > +                       "Error when evaluating the expression '%s' for the value %d for the component #%d.\n",
> > > +                       lut->comp_expr_str[comp], val, comp);
> > > +                return AVERROR(EINVAL);
> > > +            }
> > > +            lut->lut[comp][val] = av_clip((int)res, min[comp], max[comp]);
> > > +            av_log(ctx, AV_LOG_DEBUG, "val[%d][%d] = %d\n", comp, val, lut->lut[comp][val]);
> > > +        }
> > 
> > Another thought - studio level video is allowed to have excursions below
> > 'black' and above 'white'. Am I right in my understanding that this
> > filter will clip at black and white?
> 
> That's correct. I did it since that was resulting in artifacts for
> out-of-band values with gamma correction (this was resulting in
> negative gamma-corrected values for out-of-band values). We may find a
> better solution or disable clipping through an option.

try sign(a)|a|^b instead of a^b

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20110607/e22bd5c5/attachment.asc>


More information about the ffmpeg-devel mailing list