avfilter/vf_zscale: fix number of threads

Make sure it is between [1, MAX_THERADS] and also take into account the outlink
size in order not to request zero height output from zscale.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2022-03-14 21:48:29 +01:00
parent 11c4f4b455
commit c0351ee5c5
1 changed files with 1 additions and 1 deletions

View File

@ -799,7 +799,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
link->dst->inputs[0]->w = in->width;
link->dst->inputs[0]->h = in->height;
s->nb_threads = FFMIN(ff_filter_get_nb_threads(ctx), link->h / 8);
s->nb_threads = av_clip(FFMIN(ff_filter_get_nb_threads(ctx), FFMIN(link->h, outlink->h) / 8), 1, MAX_THREADS);
s->in_colorspace = in->colorspace;
s->in_trc = in->color_trc;
s->in_primaries = in->color_primaries;