aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2022-03-14 21:48:29 +0100
committerMarton Balint <cus@passwd.hu>2022-03-16 20:20:56 +0100
commitc0351ee5c58e0640066d0430a8c9af88a3918504 (patch)
tree6c0e2f38f7278cddd18de1fad8d0553cf3539b8a
parent11c4f4b455dcc39146e0caa09b1f5fc09c58cf06 (diff)
downloadffmpeg-c0351ee5c58e0640066d0430a8c9af88a3918504.tar.gz
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>
-rw-r--r--libavfilter/vf_zscale.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index bb457423b3..bab87b0c94 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -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;