[FFmpeg-soc] [soc]: r1486 - in rv40: rv34.c rv34vlc.h

kostya subversion at mplayerhq.hu
Sat Dec 1 12:06:52 CET 2007


Author: kostya
Date: Sat Dec  1 12:06:52 2007
New Revision: 1486

Log:
General VLC code used by RV3/4 is really Elias Gamma code

Modified:
   rv40/rv34.c
   rv40/rv34vlc.h

Modified: rv40/rv34.c
==============================================================================
--- rv40/rv34.c	(original)
+++ rv40/rv34.c	Sat Dec  1 12:06:52 2007
@@ -43,7 +43,6 @@ static const int rv34_mb_type_to_lavc[12
 
 
 static RV34VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES];
-static VLC omega_part_vlc;
 
 /**
  * @defgroup vlc RV30/40 VLC generating functions
@@ -117,11 +116,6 @@ static void rv34_init_tables()
         }
         rv34_gen_vlc(rv34_inter_coeffvlc[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL);
     }
-
-    init_vlc_sparse(&omega_part_vlc, OMEGA_BITS, NUM_OMEGA,
-                    omega_part_vlc_bits,  1, 1,
-                    omega_part_vlc_codes, 1, 1,
-                    omega_part_vlc_syms,  1, 1, INIT_VLC_USE_STATIC);
 }
 
 /** @} */ // vlc group
@@ -390,31 +384,20 @@ static inline RV34VLC* choose_vlc_set(in
 }
 
 /**
- * Decode variable-length code constructed from variable-length codes
- * similar to Even-Rodeh and Elias Omega codes.
- *
- * Code is constructed from bit chunks of even length (odd length means end of code)
- * and chunks are coded with variable-length codes too.
+ * Decode Levenstein (also known as Elias Gamma) code.
  */
 int ff_rv34_get_omega(GetBitContext *gb)
 {
-    int code = 1, t, tb;
+    int code = 1;
 
-    for(;;){
-        t = get_vlc2(gb, omega_part_vlc.table, OMEGA_BITS, 1);
-        tb = t >> 5;
-        code = (code << tb) | (t & 0xF);
-        if(t & 0x10) break;
+    while(!get_bits1(gb)){
+        code = (code << 1) | get_bits1(gb);
     }
     return code;
 }
 
 /**
- * Decode signed integer variable-length code constructed from variable-length codes
- * similar to Even-Rodeh and Elias Omega codes.
- *
- * Code is constructed from bit chunks of even length (odd length means end of code)
- * and chunks are coded with variable-length codes too.
+ * Decode Levenstein (also known as Elias Gamma) code as signed integer.
  */
 int ff_rv34_get_omega_signed(GetBitContext *gb)
 {

Modified: rv40/rv34vlc.h
==============================================================================
--- rv40/rv34vlc.h	(original)
+++ rv40/rv34vlc.h	Sat Dec  1 12:06:52 2007
@@ -4065,32 +4065,4 @@ static const uint8_t rv34_inter_coeffvlc
 }
 };
 
-
-/** Tables used in variable code parts decoding */
-//@{
-#define NUM_OMEGA 31
-#define OMEGA_BITS 8
-
-static const uint8_t omega_part_vlc_codes[NUM_OMEGA] = {
- 0x00, 0x01, 0x01, 0x04, 0x05, 0x03, 0x01,
- 0x10, 0x11, 0x09, 0x14, 0x15, 0x0B, 0x03, 0x01,
- 0x40, 0x41, 0x21, 0x44, 0x45, 0x23, 0x09,
- 0x50, 0x51, 0x29, 0x54, 0x55, 0x2B, 0x0B, 0x03, 0x01
-};
-
-static const uint8_t omega_part_vlc_bits[NUM_OMEGA] = {
- 8, 8, 7, 8, 8, 7, 5,
- 8, 8, 7, 8, 8, 7, 5, 3,
- 8, 8, 7, 8, 8, 7, 5,
- 8, 8, 7, 8, 8, 7, 5, 3, 1
-};
-
-static const uint8_t omega_part_vlc_syms[NUM_OMEGA] = {
- 0x80, 0x81, 0x70, 0x82, 0x83, 0x71, 0x50,
- 0x84, 0x85, 0x72, 0x86, 0x87, 0x73, 0x51, 0x30,
- 0x88, 0x89, 0x74, 0x8A, 0x8B, 0x75, 0x52,
- 0x8C, 0x8D, 0x76, 0x8E, 0x8F, 0x77, 0x53, 0x31, 0x10
-};
-//@}
-
 #endif /* FFMPEG_RV34VLC_H */



More information about the FFmpeg-soc mailing list