The branch, master has been updated
       via  5733e08c97e50c1b64d671f9dfe26d3bc2d65039 (commit)
      from  f610b55525613b032b79f9c16607364ca07a611e (commit)


- Log -----------------------------------------------------------------
commit 5733e08c97e50c1b64d671f9dfe26d3bc2d65039
Author:     Ramiro Polla <[email protected]>
AuthorDate: Mon Aug 11 18:32:45 2025 +0200
Commit:     James Almer <[email protected]>
CommitDate: Mon Aug 11 21:23:38 2025 +0000

    avcodec/mjpegdec: decode only SOF fields when finding stream info
    
    When called from avformat_find_stream_info(), we are only interested in
    decoding SOF fields.
    
    This patch makes the decoder skip all other fields (including SOI, SOS,
    and EOI). This also prevents the decoder from incorrectly printing the
    warning "EOI missing, emulating" (which is the case since 2ae82788).
    
    Fixes: #20119

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 15a4ebc7f1..87d1d02077 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2463,9 +2463,6 @@ redo_for_pal8:
             case SOF2:
             case SOF3:
             case SOF48:
-            case SOI:
-            case SOS:
-            case EOI:
                 break;
             default:
                 goto skip;
@@ -2541,7 +2538,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             break;
         case EOI:
 eoi_parser:
-            if (!avctx->hwaccel && avctx->skip_frame != AVDISCARD_ALL &&
+            if (!avctx->hwaccel &&
                 s->progressive && s->cur_scan && s->got_picture)
                 mjpeg_idct_scan_progressive_ac(s);
             s->cur_scan = 0;
@@ -2556,10 +2553,6 @@ eoi_parser:
                 if (s->bottom_field == !s->interlace_polarity)
                     break;
             }
-            if (avctx->skip_frame == AVDISCARD_ALL) {
-                s->got_picture = 0;
-                goto the_end_no_picture;
-            }
             if (avctx->hwaccel) {
                 ret = FF_HW_SIMPLE_CALL(avctx, end_frame);
                 if (ret < 0)
@@ -2588,10 +2581,6 @@ eoi_parser:
             s->raw_scan_buffer_size = buf_end - buf_ptr;
 
             s->cur_scan++;
-            if (avctx->skip_frame == AVDISCARD_ALL) {
-                skip_bits(&s->gb, get_bits_left(&s->gb));
-                break;
-            }
 
             if ((ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL)) < 0 &&
                 (avctx->err_recognition & AV_EF_EXPLODE))
@@ -2616,6 +2605,18 @@ eoi_parser:
             break;
         }
 
+        if (avctx->skip_frame == AVDISCARD_ALL) {
+            switch(start_code) {
+            case SOF0:
+            case SOF1:
+            case SOF2:
+            case SOF3:
+            case SOF48:
+                s->got_picture = 0;
+                goto the_end_no_picture;
+            }
+        }
+
 skip:
         /* eof process start code */
         buf_ptr += (get_bits_count(&s->gb) + 7) / 8;

-----------------------------------------------------------------------

Summary of changes:
 libavcodec/mjpegdec.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to