]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cabac.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / cabac.h
index ed156e6fcaeef94636e79d7eaac78439fd8664a0..8065ae0f45a8c6b44db2d93f74900f747f6512f9 100644 (file)
@@ -41,9 +41,6 @@ typedef struct CABACContext{
     int low;
     int range;
     int outstanding_count;
-#ifdef STRICT_LIMITS
-    int symCount;
-#endif
     const uint8_t *bytestream_start;
     const uint8_t *bytestream;
     const uint8_t *bytestream_end;
@@ -65,31 +62,6 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
 void ff_init_cabac_states(CABACContext *c);
 
 
-static inline void put_cabac_bit(CABACContext *c, int b){
-    put_bits(&c->pb, 1, b);
-    for(;c->outstanding_count; c->outstanding_count--){
-        put_bits(&c->pb, 1, 1-b);
-    }
-}
-
-static inline void renorm_cabac_encoder(CABACContext *c){
-    while(c->range < 0x100){
-        //FIXME optimize
-        if(c->low<0x100){
-            put_cabac_bit(c, 0);
-        }else if(c->low<0x200){
-            c->outstanding_count++;
-            c->low -= 0x100;
-        }else{
-            put_cabac_bit(c, 1);
-            c->low -= 0x200;
-        }
-
-        c->range+= c->range;
-        c->low += c->low;
-    }
-}
-
 static void refill(CABACContext *c){
 #if CABAC_BITS == 16
         c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
@@ -100,15 +72,6 @@ static void refill(CABACContext *c){
     c->bytestream+= CABAC_BITS/8;
 }
 
-static inline void renorm_cabac_decoder(CABACContext *c){
-    while(c->range < 0x100){
-        c->range+= c->range;
-        c->low+= c->low;
-        if(!(c->low & CABAC_MASK))
-            refill(c);
-    }
-}
-
 static inline void renorm_cabac_decoder_once(CABACContext *c){
     int shift= (uint32_t)(c->range - 0x100)>>31;
     c->range<<= shift;
@@ -216,62 +179,4 @@ static int av_unused get_cabac_terminate(CABACContext *c){
     }
 }
 
-#if 0
-/**
- * Get (truncated) unary binarization.
- */
-static int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated){
-    int i;
-
-    for(i=0; i<max; i++){
-        if(get_cabac(c, state)==0)
-            return i;
-
-        if(i< max_index) state++;
-    }
-
-    return truncated ? max : -1;
-}
-
-/**
- * get unary exp golomb k-th order binarization.
- */
-static int get_cabac_ueg(CABACContext *c, uint8_t * state, int max, int is_signed, int k, int max_index){
-    int i, v;
-    int m= 1<<k;
-
-    if(get_cabac(c, state)==0)
-        return 0;
-
-    if(0 < max_index) state++;
-
-    for(i=1; i<max; i++){
-        if(get_cabac(c, state)==0){
-            if(is_signed && get_cabac_bypass(c)){
-                return -i;
-            }else
-                return i;
-        }
-
-        if(i < max_index) state++;
-    }
-
-    while(get_cabac_bypass(c)){
-        i+= m;
-        m+= m;
-    }
-
-    v=0;
-    while(m>>=1){
-        v+= v + get_cabac_bypass(c);
-    }
-    i += v;
-
-    if(is_signed && get_cabac_bypass(c)){
-        return -i;
-    }else
-        return i;
-}
-#endif /* 0 */
-
 #endif /* AVCODEC_CABAC_H */