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

Mark Himsley mark at mdsh.com
Tue Jun 7 09:32:37 CEST 2011


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?

-- 
Mark


More information about the ffmpeg-devel mailing list