[FFmpeg-devel] [PATCH] colorlevels filter

Stefano Sabatini stefasab at gmail.com
Fri May 24 17:29:42 CEST 2013


On date Tuesday 2013-05-14 17:19:19 +0000, Paul B Mahol encoded:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  doc/filters.texi             |   4 +
>  libavfilter/Makefile         |   1 +
>  libavfilter/allfilters.c     |   1 +
>  libavfilter/vf_colorlevels.c | 254 +++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 260 insertions(+)
>  create mode 100644 libavfilter/vf_colorlevels.c
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 3f7034b..ef4cdab 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -2295,6 +2295,10 @@ colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
>  @end example
>  @end itemize
>  
> + at section colorlevels
> +
> +Adjust color adjustments using levels.

Missing docs.

[...]
> +static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> +{
> +    AVFilterContext *ctx = inlink->dst;
> +    ColorLevelsContext *s = ctx->priv;
> +    AVFilterLink *outlink = ctx->outputs[0];
> +    const int step = s->step;
> +    AVFrame *out;
> +    int x, y, i;
> +
> +    if (av_frame_is_writable(in)) {
> +        out = in;
> +    } else {
> +        out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
> +        if (!out) {
> +            av_frame_free(&in);
> +            return AVERROR(ENOMEM);
> +        }
> +        av_frame_copy_props(out, in);
> +    }
> +
> +    switch (s->bpp) {
> +    case 1:
[...]
> +    case 2:
[...]
      }

This is mostly duplicated, you could use a macro, unless it ends up
too ugly.
-- 
FFmpeg = Fundamentalist & Friendly Mysterious Practical Elastic Guru


More information about the ffmpeg-devel mailing list