[FFmpeg-cvslog] avfilter/vf_zscale: fix number of threads

Marton Balint git at videolan.org
Wed Mar 16 21:23:08 EET 2022


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Mon Mar 14 21:48:29 2022 +0100| [c0351ee5c58e0640066d0430a8c9af88a3918504] | committer: Marton Balint

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 at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0351ee5c58e0640066d0430a8c9af88a3918504
---

 libavfilter/vf_zscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;



More information about the ffmpeg-cvslog mailing list