diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-04-11 22:46:57 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-04-20 22:04:36 +0200 |
commit | 685f658524314a7e70a1fe3ad11e2cd59a010be4 (patch) | |
tree | 847997a6bb4c604dea47dd522f88ab6df5b59d92 | |
parent | 853e66a0726b0a9d6d6269a22f6f9b5be7763738 (diff) | |
download | ffmpeg-685f658524314a7e70a1fe3ad11e2cd59a010be4.tar.gz |
avcodec/magicyuvenc: Fix setting nb_slices
Do not derive it via av_cpu_count() in case AVCodecContext.slices
is unset. Instead default to AVCodecContext.thread_num instead
(which is one in case frame-threading is used and gives the actual
number of slice threads for slice threading).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/magicyuvenc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c index bf0e7d99bb..a10da9684f 100644 --- a/libavcodec/magicyuvenc.c +++ b/libavcodec/magicyuvenc.c @@ -201,7 +201,7 @@ static av_cold int magy_encode_init(AVCodecContext *avctx) s->planes = av_pix_fmt_count_planes(avctx->pix_fmt); - s->nb_slices = (avctx->slices <= 0) ? av_cpu_count() : avctx->slices; + s->nb_slices = avctx->slices > 0 ? avctx->slices : avctx->thread_count; s->nb_slices = FFMIN(s->nb_slices, avctx->height >> s->vshift[1]); s->nb_slices = FFMAX(1, s->nb_slices); s->slice_height = FFALIGN((avctx->height + s->nb_slices - 1) / s->nb_slices, 1 << s->vshift[1]); |