[FFmpeg-cvslog] cabac: Move code only used within the CABAC test program into the test program.

Diego Biurrun git at videolan.org
Sun Jan 8 04:21:44 CET 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Sat Jan  7 20:46:09 2012 +0100| [badb195d139f15dc189dd3f78930c9cbfce89c24] | committer: Diego Biurrun

cabac: Move code only used within the CABAC test program into the test program.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=badb195d139f15dc189dd3f78930c9cbfce89c24
---

 libavcodec/cabac.c |   25 +++++++++++++++++++++++++
 libavcodec/cabac.h |   25 -------------------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index bcb2429..466d623 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -162,6 +162,31 @@ void ff_init_cabac_states(CABACContext *c){
 #include "avcodec.h"
 #include "cabac.h"
 
+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 put_cabac(CABACContext *c, uint8_t * const state, int bit){
     int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + *state];
 
diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
index b0d056d..dda6348 100644
--- a/libavcodec/cabac.h
+++ b/libavcodec/cabac.h
@@ -62,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);



More information about the ffmpeg-cvslog mailing list