[FFmpeg-cvslog] avcodec/mpegvideo_enc: Fix 1 line and one column images

Michael Niedermayer git at videolan.org
Fri Jun 14 22:19:51 EEST 2024


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Mon Apr  8 18:38:42 2024 +0200| [816ac9de679766a055e996dadb052cf5ea4970d7] | committer: Michael Niedermayer

avcodec/mpegvideo_enc: Fix 1 line and one column images

Fixes: Ticket10952
Fixes: poc21ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 96449cfeaeb95fcfd7a2b8d9ccf7719e97471ed1)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mpegvideo_enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 59d23687cf..d084f1c8e6 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1239,8 +1239,8 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
                     ptrdiff_t dst_stride = i ? s->uvlinesize : s->linesize;
                     int h_shift = i ? h_chroma_shift : 0;
                     int v_shift = i ? v_chroma_shift : 0;
-                    int w = s->width  >> h_shift;
-                    int h = s->height >> v_shift;
+                    int w = AV_CEIL_RSHIFT(s->width , h_shift);
+                    int h = AV_CEIL_RSHIFT(s->height, v_shift);
                     uint8_t *src = pic_arg->data[i];
                     uint8_t *dst = pic->f->data[i];
                     int vpad = 16;



More information about the ffmpeg-cvslog mailing list