This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 2d9023564b1cb9d25f46d2cdbe23668e120414c9
Author:     Ramiro Polla <[email protected]>
AuthorDate: Wed Sep 24 23:33:50 2025 +0200
Commit:     Ramiro Polla <[email protected]>
CommitDate: Fri Feb 20 16:32:10 2026 +0100

    avcodec/mjpegdec: move handling of AVRn interlaced picture to 
mjpeg_decode_scan()
    
    AVRn interlaced files are only present in sequential JPEG.
---
 libavcodec/mjpegdec.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 42b034140d..1dab0eaca6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1503,6 +1503,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int 
nb_components, int Ah,
         s->coefs_finished[c] |= 1;
     }
 
+next_field:
     for (i = 0; i < nb_components; i++)
         s->last_dc[i] = (4 << s->bits);
 
@@ -1589,6 +1590,22 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int 
nb_components, int Ah,
             handle_rstn(s, nb_components);
         }
     }
+
+    if (s->interlaced &&
+        get_bits_left(&s->gb) > 32 &&
+        show_bits(&s->gb, 8) == 0xFF) {
+        GetBitContext bak = s->gb;
+        align_get_bits(&bak);
+        if (show_bits(&bak, 16) == 0xFFD1) {
+            av_log(s->avctx, AV_LOG_DEBUG, "AVRn interlaced picture marker 
found\n");
+            s->gb = bak;
+            skip_bits(&s->gb, 16);
+            s->bottom_field ^= 1;
+
+            goto next_field;
+        }
+    }
+
     return 0;
 }
 
@@ -1781,7 +1798,6 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const 
uint8_t *mb_bitmask,
     if (ret < 0)
         return ret;
 
-next_field:
     if (s->avctx->hwaccel) {
         int bytes_to_start = bytestream2_tell(&s->gB);
         av_assert0(bytes_to_start >= 0 &&
@@ -1825,21 +1841,6 @@ next_field:
         }
     }
 
-    if (s->interlaced &&
-        get_bits_left(&s->gb) > 32 &&
-        show_bits(&s->gb, 8) == 0xFF) {
-        GetBitContext bak = s->gb;
-        align_get_bits(&bak);
-        if (show_bits(&bak, 16) == 0xFFD1) {
-            av_log(s->avctx, AV_LOG_DEBUG, "AVRn interlaced picture marker 
found\n");
-            s->gb = bak;
-            skip_bits(&s->gb, 16);
-            s->bottom_field ^= 1;
-
-            goto next_field;
-        }
-    }
-
     /* Add the amount of bits read from the unescaped image data buffer
      * into the GetByteContext. */
     bytestream2_skipu(&s->gB, (get_bits_count(&s->gb) + 7) / 8);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to