]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/rl.h
Indeo 5 decoder
[ffmpeg] / libavcodec / rl.h
index bb7a7ee7799550a3608632fb3a79eaad25881854..64cbeddfaae5ad4dd1361bfd87efbc2e291babe9 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file rl.h
+ * @file libavcodec/rl.h
  * rl header.
  */
 
 #define AVCODEC_RL_H
 
 #include <stdint.h>
-#include "bitstream.h"
-#include "mpegvideo.h"
+#include "get_bits.h"
+
+/* run length table */
+#define MAX_RUN    64
+#define MAX_LEVEL  64
 
 /** RLTable. */
 typedef struct RLTable {
@@ -51,7 +54,23 @@ typedef struct RLTable {
  *                     the level and run tables, if this is NULL av_malloc() will be used
  */
 void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]);
-void init_vlc_rl(RLTable *rl, int use_static);
+void init_vlc_rl(RLTable *rl);
+
+#define INIT_VLC_RL(rl, static_size)\
+{\
+    int q;\
+    static RL_VLC_ELEM rl_vlc_table[32][static_size];\
+    INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\
+             &rl.table_vlc[0][1], 4, 2,\
+             &rl.table_vlc[0][0], 4, 2, static_size);\
+\
+    if(!rl.rl_vlc[0]){\
+        for(q=0; q<32; q++)\
+            rl.rl_vlc[q]= rl_vlc_table[q];\
+\
+        init_vlc_rl(&rl);\
+    }\
+}
 
 static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
 {
@@ -64,4 +83,4 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
     return index + level - 1;
 }
 
-#endif
+#endif /* AVCODEC_RL_H */