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

Git pushed a commit to branch master
in repository ffmpeg.

commit 46d9065bdd85608e9497cb85c6403abed4f4abd4
Author:     Rainbaby <[email protected]>
AuthorDate: Fri Aug 28 16:18:07 2026 +0900
Commit:     Peter Ross <[email protected]>
CommitDate: Mon Nov 2 22:18:06 2026 +0000

    avcodec/cavsdec: fix slice weighted prediction parsing
    
    The flag is present when MbIndex >= MbWidth * MbHeight / 2, not when
    the row exceeds MbWidth / 2. Every published edition states it that
    way, back to GB/T 20090.2-2006 clause 7.1.4.
    
    When set, the macroblock layer grows a bit per non-intra macroblock, so
    refuse the picture rather than decode it out of sync.
    
    Signed-off-by: Rainbaby <[email protected]>
---
 libavcodec/cavsdec.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 82422bccb0..1ec50af121 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -23,6 +23,8 @@
  * @file
  * Chinese AVS video (AVS1-P2, JiZhun profile) decoder
  * @author Stefan Gehrer <[email protected]>
+ *
+ * Clause, table and figure numbers refer to GY/T 257.1-2012.
  */
 
 #include "libavutil/attributes.h"
@@ -958,10 +960,10 @@ static inline int decode_slice_header(AVSContext *h, 
GetBitContext *gb)
     }
     /* inter frame or second slice can have weighting params */
     if ((h->cur.f->pict_type != AV_PICTURE_TYPE_I) ||
-        (!h->pic_structure && h->mby >= h->mb_width / 2))
+        (!h->pic_structure && h->mbidx >= h->mb_width * h->mb_height / 2))
         if (get_bits1(gb)) { //slice_weighting_flag
-            av_log(h->avctx, AV_LOG_ERROR,
-                   "weighted prediction not yet supported\n");
+            avpriv_request_sample(h->avctx, "Weighted prediction");
+            return AVERROR_PATCHWELCOME;
         }
     return 0;
 }
@@ -970,6 +972,7 @@ static inline int check_for_slice(AVSContext *h)
 {
     GetBitContext *gb = &h->gb;
     int align;
+    int ret;
 
     if (h->mbx)
         return 0;
@@ -991,7 +994,9 @@ static inline int check_for_slice(AVSContext *h)
         }
         *gb    = peek;
         h->stc = stc;
-        decode_slice_header(h, gb);
+        ret = decode_slice_header(h, gb);
+        if (ret < 0)
+            return ret;
         return 1;
     }
     return 0;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to