[FFmpeg-cvslog] avcodec/magicyuvenc: ensure no slice slot is left unset

Paul B Mahol git at videolan.org
Sun Sep 10 14:48:52 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 10 02:42:35 2023 +0200| [f832a77231ba8850aa390015df8e2f3025a822c4] | committer: Paul B Mahol

avcodec/magicyuvenc: ensure no slice slot is left unset

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

 libavcodec/magicyuvenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index 082e2846c7..d299bc14a0 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -209,6 +209,7 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
     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]);
+    s->nb_slices = (avctx->height + s->slice_height - 1) / s->slice_height;
     s->slice_pos = av_calloc(s->nb_slices * s->planes, sizeof(*s->slice_pos));
     s->slice_size = av_calloc(s->nb_slices * s->planes, sizeof(*s->slice_size));
     s->slices = av_calloc(s->nb_slices * s->planes, sizeof(*s->slices));



More information about the ffmpeg-cvslog mailing list