[FFmpeg-devel] [PATCH] avfilter/vf_cropdetect: adjust Default threshold based on bit depth

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Dec 30 23:14:29 CET 2014


On Tue, Dec 30, 2014 at 09:12:13PM +0100, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavfilter/vf_cropdetect.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
> index dd237ef..d49101c 100644
> --- a/libavfilter/vf_cropdetect.c
> +++ b/libavfilter/vf_cropdetect.c
> @@ -137,9 +137,12 @@ static int config_input(AVFilterLink *inlink)
>  {
>      AVFilterContext *ctx = inlink->dst;
>      CropDetectContext *s = ctx->priv;
> +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
>  
> -    av_image_fill_max_pixsteps(s->max_pixsteps, NULL,
> -                               av_pix_fmt_desc_get(inlink->format));
> +    av_image_fill_max_pixsteps(s->max_pixsteps, NULL, desc);
> +
> +    if (s->limit < 0)
> +        s->limit = 24 << (desc->comp[0].depth_minus1 - 7);

I'd feel better if you added an assert that depth_minus1 is at least 7.
Also, it would be nice if it was possible to specify a limit in a way
that doesn't depend on bit depth (which you might not know when typing
the command), e.g. as a float value?


More information about the ffmpeg-devel mailing list