[FFmpeg-devel] [PATCH 3/3] lavfi: add haldclut filter.

Clément Bœsch ubitux at gmail.com
Mon May 27 20:50:54 CEST 2013


On Sun, May 26, 2013 at 10:28:34PM +0200, Stefano Sabatini wrote:
> On date Saturday 2013-05-25 17:10:57 +0200, Clément Bœsch encoded:
> > TODO: minor bump
> > ---
> >  Changelog                |   1 +
> >  doc/filters.texi         |  43 +++++++++
> >  libavfilter/Makefile     |   1 +
> >  libavfilter/allfilters.c |   1 +
> >  libavfilter/vf_lut3d.c   | 231 ++++++++++++++++++++++++++++++++++++++++++++---
> >  5 files changed, 263 insertions(+), 14 deletions(-)
> > 
> > diff --git a/Changelog b/Changelog
> > index f42e5e3..e3d6ff6 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -55,6 +55,7 @@ version <next>:
> >  - 3D LUT filter (lut3d)
> >  - SMPTE 302M audio encoder
> >  - support for slice multithreading in libavfilter
> > +- Hald CLUT support (generation and filtering)
> >  
> >  
> >  version 1.2:
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 1dadba4..b66f127 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -4170,6 +4170,41 @@ gradfun=radius=8
> >  
> >  @end itemize
> >  
> > + at section haldclut
> > +
> > +Apply a Hald CLUT to a video stream.
> > +
> > +First input is the Hald CLUT, and second one is the video stream. The Hald CLUT
> > +input can be a simple picture or a complete video stream.
> > +
> > +The filter accepts the following options:
> > +
> > + at table @option
> > + at item shortest
> > +Force termination when the shortest input terminates. Default is @code{0}.
> 
> > + at item repeatlast
> > +Continue applying the last CLUT after the end of the stream. Default is @code{1}.
> 
> What happens otherwise?
> 

Added a longer sentence.

[...]
> > +static AVFrame *apply_lut(AVFilterLink *inlink, AVFrame *in)
> >  {
> >      int x, y, direct = 0;
> >      AVFilterContext *ctx = inlink->dst;
> > @@ -533,7 +541,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> >          out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
> >          if (!out) {
> >              av_frame_free(&in);
> > -            return AVERROR(ENOMEM);
> > +            return NULL;
> >          }
> >          av_frame_copy_props(out, in);
> >      }
> 
> Nit: you could do:
> static int apply_lut(AVFilterLink *inlink, AVFrame **out, AVFrame *in)
> ...
> 
> > @@ -544,9 +552,26 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> >      if (!direct)
> >          av_frame_free(&in);
> >  
> > +    return out;
> > +}
> > +
> > +static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> > +{
> > +    AVFilterLink *outlink = inlink->dst->outputs[0];
> 
> > +    AVFrame *out = apply_lut(inlink, in);
> > +    if (!out)
> > +        return AVERROR(ENOMEM);
> 
> and do:
> if ((ret = apply_lut(inlink, &out, in)) < 0)
>     return ret;
> 

I actually prefer that way.

[...]
> > +    if (level > MAX_LEVEL) {
> > +        av_log(ctx, AV_LOG_ERROR, "Too large Hald CLUT\n");
> 
> Nit: you could show the max value for level
> 

Message made more verbose.

[...]

Added a cool feature (see second workflow example) and pushed.

Thanks!

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130527/eef87502/attachment.asc>


More information about the ffmpeg-devel mailing list