[FFmpeg-cvslog] avfilter/vf_zscale: dissallow too small slices
Paul B Mahol
git at videolan.org
Thu Jun 16 11:21:55 EEST 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Jun 16 09:53:50 2022 +0200| [42289d5eaf3e938f0969aaf58c81550c0aed8f5e] | committer: Paul B Mahol
avfilter/vf_zscale: dissallow too small slices
Also change rounding type when calculating slices size.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42289d5eaf3e938f0969aaf58c81550c0aed8f5e
---
libavfilter/vf_zscale.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index bb397deea6..44cb4b9c61 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -45,6 +45,7 @@
#include "libavutil/imgutils.h"
#define ZIMG_ALIGNMENT 64
+#define MIN_TILESIZE 64
#define MAX_THREADS 64
static const char *const var_names[] = {
@@ -234,7 +235,7 @@ static void slice_params(ZScaleContext *s, int out_h, int in_h)
{
int slice_size;
- slice_size = (out_h + s->nb_threads - 1) / s->nb_threads;
+ slice_size = (out_h + (s->nb_threads / 2)) / s->nb_threads;
if (slice_size % 2)
slice_size += 1;
s->out_slice_start[0] = 0;
@@ -829,7 +830,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 = av_clip(FFMIN(ff_filter_get_nb_threads(ctx), FFMIN(link->h, outlink->h) / 8), 1, MAX_THREADS);
+ s->nb_threads = av_clip(FFMIN(ff_filter_get_nb_threads(ctx), FFMIN(link->h, outlink->h) / MIN_TILESIZE), 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