diff mbox series

[FFmpeg-devel,06/15] avcodec/mpeg12dec: Don't pretend MPEG-1/2 to support alpha

Message ID GV1P250MB0737B28527DDF41EA248C3AC8F032@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 518f79f2a83d07f8917e5acda794f0481a93e2d4
Headers show
Series [FFmpeg-devel,01/15] avcodec/mpegvideo_enc: Don't update current_picture unnecessarily | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt April 5, 2024, 12:41 p.m. UTC
(FF_PTR_ADD has to be kept although MPEG-1/2 only supports
YUV pixel formats because our decoder also supports decoding
to AV_PIX_FMT_GRAY8 depending upon CONFIG_GRAY.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12dec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 83ff40d237..337654c88d 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1303,7 +1303,7 @@  static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
             s->current_picture_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST *
                                                 (s->picture_structure == PICT_TOP_FIELD);
 
-            for (int i = 0; i < 4; i++) {
+            for (int i = 0; i < 3; i++) {
                 if (s->picture_structure == PICT_BOTTOM_FIELD) {
                     s->current_picture.f->data[i] = FF_PTR_ADD(s->current_picture.f->data[i],
                                                                s->current_picture.f->linesize[i]);
@@ -1368,8 +1368,6 @@  static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
         if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_FRAME))
             ff_thread_finish_setup(avctx);
     } else { // second field
-        int i;
-
         if (!s->current_picture_ptr) {
             av_log(s->avctx, AV_LOG_ERROR, "first field missing\n");
             return AVERROR_INVALIDDATA;
@@ -1383,7 +1381,7 @@  static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
             }
         }
 
-        for (i = 0; i < 4; i++) {
+        for (int i = 0; i < 3; i++) {
             s->current_picture.f->data[i] = s->current_picture_ptr->f->data[i];
             if (s->picture_structure == PICT_BOTTOM_FIELD)
                 s->current_picture.f->data[i] +=