diff common.h @ 542:d55978a3c369 libavcodec

rl vlc decoding optimizations
author michaelni
date Sat, 13 Jul 2002 14:55:12 +0000
parents 7f1b09bb34c6
children b746a7d75ce6
line wrap: on
line diff
--- a/common.h	Fri Jul 12 12:41:32 2002 +0000
+++ b/common.h	Sat Jul 13 14:55:12 2002 +0000
@@ -238,6 +238,12 @@
     int table_size, table_allocated;
 } VLC;
 
+typedef struct RL_VLC_ELEM {
+    int16_t level;
+    int8_t len;
+    uint8_t run;
+} RL_VLC_ELEM;
+
 /* used to avoid missaligned exceptions on some archs (alpha, ...) */
 #ifdef ARCH_X86
 #define unaligned32(a) (*(UINT32*)(a))
@@ -755,6 +761,28 @@
     SKIP_BITS(name, gb, n)\
 }
 
+#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth)\
+{\
+    int n, index, nb_bits;\
+\
+    index= SHOW_UBITS(name, gb, bits);\
+    level = table[index].level;\
+    n     = table[index].len;\
+\
+    if(max_depth > 1 && n < 0){\
+        LAST_SKIP_BITS(name, gb, bits)\
+        UPDATE_CACHE(name, gb)\
+\
+        nb_bits = -n;\
+\
+        index= SHOW_UBITS(name, gb, nb_bits) + level;\
+        level = table[index].level;\
+        n     = table[index].len;\
+    }\
+    run= table[index].run;\
+    SKIP_BITS(name, gb, n)\
+}
+
 // deprecated, dont use get_vlc for new code, use get_vlc2 instead or use GET_VLC directly
 static inline int get_vlc(GetBitContext *s, VLC *vlc)
 {
@@ -783,6 +811,7 @@
     return code;
 }
 
+
 /* define it to include statistics code (useful only for optimizing
    codec efficiency */
 //#define STATS