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

Git pushed a commit to branch master
in repository ffmpeg.

commit 13e677465c7ac7a7cb128ead485dc13f475ba34a
Author:     Ramiro Polla <[email protected]>
AuthorDate: Mon Nov 2 17:55:48 2026 +0100
Commit:     Ramiro Polla <[email protected]>
CommitDate: Wed Nov 11 16:01:48 2026 +0000

    avcodec/cabac: remove dead code for CABAC_BITS != 16
    
    CABAC_BITS has been hardcoded to 16 since 5659b509c7 ("refill cabac
    variables in 16bit steps, 3% faster get_cabac()"), which changed it
    from 8. The code for other values of CABAC_BITS has not been compiled
    since then, so remove it.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Ramiro Polla <[email protected]>
---
 libavcodec/cabac.c           |  5 -----
 libavcodec/cabac_functions.h | 14 ++------------
 libavcodec/h264_cabac.c      |  4 +---
 libavcodec/vvc/cabac.c       |  4 ----
 4 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index 7d41cd2ae6..387be648c4 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -164,7 +164,6 @@ int ff_init_cabac_decoder(CABACContext *c, const uint8_t 
*buf, int buf_size){
     c->bytestream= buf;
     c->bytestream_end= buf + buf_size;
 
-#if CABAC_BITS == 16
     c->low =  (*c->bytestream++)<<18;
     c->low+=  (*c->bytestream++)<<10;
     // Keep our fetches on a 2-byte boundary as this should avoid ever having 
to
@@ -176,10 +175,6 @@ int ff_init_cabac_decoder(CABACContext *c, const uint8_t 
*buf, int buf_size){
     else {
         c->low += ((*c->bytestream++) << 2) + 2;
     }
-#else
-    c->low =  (*c->bytestream++)<<10;
-    c->low+= ((*c->bytestream++)<<2) + 2;
-#endif
     c->range= 0x1FE;
     if ((c->range<<(CABAC_BITS+1)) < c->low)
         return AVERROR_INVALIDDATA;
diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h
index 6a2e9ceca5..eec0e25099 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -62,11 +62,7 @@ static const uint8_t * const 
ff_h264_last_coeff_flag_offset_8x8 = ff_h264_cabac_
 
 #if !defined(get_cabac_bypass) || !defined(get_cabac_terminate)
 static void refill(CABACContext *c){
-#if CABAC_BITS == 16
-        c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
-#else
-        c->low+= c->bytestream[0]<<1;
-#endif
+    c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
     c->low -= CABAC_MASK;
 #if !UNCHECKED_BITSTREAM_READER
     if (c->bytestream < c->bytestream_end)
@@ -98,11 +94,7 @@ static void refill2(CABACContext *c){
 
     x= -CABAC_MASK;
 
-#if CABAC_BITS == 16
-        x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
-#else
-        x+= c->bytestream[0]<<1;
-#endif
+    x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
 
     c->low += x<<i;
 #if !UNCHECKED_BITSTREAM_READER
@@ -205,10 +197,8 @@ av_unused static const uint8_t* skip_bytes(CABACContext 
*c, int n) {
 
     if (c->low & 0x1)
         ptr--;
-#if CABAC_BITS == 16
     if (c->low & 0x1FF)
         ptr--;
-#endif
     if ((int) (c->bytestream_end - ptr) < n)
         return NULL;
     if (ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n) < 0)
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 7fc4817634..4d826caeb6 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -2041,9 +2041,7 @@ decode_intra_mb:
         // decode, I think it should be done by a function in cabac.h (or 
cabac.c).
         ptr= sl->cabac.bytestream;
         if(sl->cabac.low&0x1) ptr--;
-        if(CABAC_BITS==16){
-            if(sl->cabac.low&0x1FF) ptr--;
-        }
+        if(sl->cabac.low&0x1FF) ptr--;
 
         // The pixels are stored in the same order as levels in h->mb array.
         if ((int) (sl->cabac.bytestream_end - ptr) < mb_size)
diff --git a/libavcodec/vvc/cabac.c b/libavcodec/vvc/cabac.c
index 329172e475..ec45cdee8c 100644
--- a/libavcodec/vvc/cabac.c
+++ b/libavcodec/vvc/cabac.c
@@ -876,11 +876,7 @@ static void vvc_refill2(CABACContext* c) {
 
     x = -CABAC_MASK;
 
-#if CABAC_BITS == 16
     x += (c->bytestream[0] << 9) + (c->bytestream[1] << 1);
-#else
-    x += c->bytestream[0] << 1;
-#endif
 
     c->low += x << i;
 #if !UNCHECKED_BITSTREAM_READER

-- 
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