mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/vf_pullup: make sure metric_plane is available
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
8302abf844
commit
394a73cad2
@ -161,13 +161,19 @@ static int config_input(AVFilterLink *inlink)
|
|||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
PullupContext *s = ctx->priv;
|
PullupContext *s = ctx->priv;
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
||||||
const int mp = s->metric_plane;
|
int mp = s->metric_plane;
|
||||||
|
|
||||||
|
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
|
||||||
|
|
||||||
|
if (mp + 1 > s->nb_planes) {
|
||||||
|
av_log(ctx, AV_LOG_WARNING, "input format does not have such plane\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
|
s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
|
||||||
s->planeheight[0] = s->planeheight[3] = inlink->h;
|
s->planeheight[0] = s->planeheight[3] = inlink->h;
|
||||||
s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
|
s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
|
||||||
s->planewidth[0] = s->planewidth[3] = inlink->w;
|
s->planewidth[0] = s->planewidth[3] = inlink->w;
|
||||||
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
|
|
||||||
|
|
||||||
s->metric_w = (s->planewidth[mp] - ((s->junk_left + s->junk_right) << 3)) >> 3;
|
s->metric_w = (s->planewidth[mp] - ((s->junk_left + s->junk_right) << 3)) >> 3;
|
||||||
s->metric_h = (s->planeheight[mp] - ((s->junk_top + s->junk_bottom) << 1)) >> 3;
|
s->metric_h = (s->planeheight[mp] - ((s->junk_top + s->junk_bottom) << 1)) >> 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user