diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-06-16 09:53:50 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-06-16 10:23:30 +0200 |
commit | 42289d5eaf3e938f0969aaf58c81550c0aed8f5e (patch) | |
tree | 3503a6c934549128a685411223b364de3bd4054d /libavfilter | |
parent | afc7679c89fc5bd017b910cfc0a45f8ed080c1d4 (diff) | |
download | ffmpeg-42289d5eaf3e938f0969aaf58c81550c0aed8f5e.tar.gz |
avfilter/vf_zscale: dissallow too small slices
Also change rounding type when calculating slices size.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_zscale.c | 5 |
1 files 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; |