diff options
author | Paul B Mahol <onemda@gmail.com> | 2018-11-18 22:11:53 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2018-11-18 22:20:34 +0100 |
commit | f3d8a4ea46236f6d62a9ac58e63b7ea316f3b11b (patch) | |
tree | 796f6a1b4ee3f364eda7fc9680c86544c8bff687 /libavfilter/vf_limiter.c | |
parent | 40b74abfca39bf514333c3ebb6d6e946975057c3 (diff) | |
download | ffmpeg-f3d8a4ea46236f6d62a9ac58e63b7ea316f3b11b.tar.gz |
avfilter/vf_limiter: always limit min/max to format depth
Diffstat (limited to 'libavfilter/vf_limiter.c')
-rw-r--r-- | libavfilter/vf_limiter.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c index bb7f1d37cd..ac19ada3c5 100644 --- a/libavfilter/vf_limiter.c +++ b/libavfilter/vf_limiter.c @@ -138,13 +138,14 @@ static int config_props(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; LimiterContext *s = ctx->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); - int vsub, hsub, ret; + int depth, vsub, hsub, ret; s->nb_planes = av_pix_fmt_count_planes(inlink->format); if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0) return ret; + depth = desc->comp[0].depth; hsub = desc->log2_chroma_w; vsub = desc->log2_chroma_h; s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub); @@ -152,10 +153,11 @@ static int config_props(AVFilterLink *inlink) s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, hsub); s->width[0] = s->width[3] = inlink->w; - if (desc->comp[0].depth == 8) { + s->max = FFMIN(s->max, (1 << depth) - 1); + s->min = FFMIN(s->min, (1 << depth) - 1); + + if (depth == 8) { s->dsp.limiter = limiter8; - s->max = FFMIN(s->max, 255); - s->min = FFMIN(s->min, 255); } else { s->dsp.limiter = limiter16; } |