[FFmpeg-soc] [soc]: r593 - in rv40: rv40.c rv40vlc2.h

kostya subversion at mplayerhq.hu
Thu Aug 2 18:37:46 CEST 2007


Author: kostya
Date: Thu Aug  2 18:37:46 2007
New Revision: 593

Log:
VLCs for determining P/B-frame macroblock type

Modified:
   rv40/rv40.c
   rv40/rv40vlc2.h

Modified: rv40/rv40.c
==============================================================================
--- rv40/rv40.c	(original)
+++ rv40/rv40.c	Thu Aug  2 18:37:46 2007
@@ -85,7 +85,7 @@ typedef struct RV40DecContext{
 static RV40VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES];
 static VLC aic_top_vlc;
 static VLC aic_mode1_vlc[AIC_MODE1_NUM], aic_mode2_vlc[AIC_MODE2_NUM];
-static VLC mbinfo_vlc;
+static VLC mbinfo_vlc, ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS];
 
 /**
  * @defgroup vlc RV40 VLC generating functions
@@ -196,6 +196,16 @@ static void rv40_init_tables()
                     mbinfo_vlc_bits,  1, 1,
                     mbinfo_vlc_codes, 1, 1,
                     mbinfo_vlc_syms,  1, 1, INIT_VLC_USE_STATIC);
+    for(i = 0; i < NUM_PTYPE_VLCS; i++)
+         init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE,
+                         ptype_vlc_bits[i],  1, 1,
+                         ptype_vlc_codes[i], 1, 1,
+                         ptype_vlc_syms,     1, 1, INIT_VLC_USE_STATIC);
+    for(i = 0; i < NUM_BTYPE_VLCS; i++)
+         init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE,
+                         btype_vlc_bits[i],  1, 1,
+                         btype_vlc_codes[i], 1, 1,
+                         btype_vlc_syms,     1, 1, INIT_VLC_USE_STATIC);
 }
 
 /** @} */ // vlc group

Modified: rv40/rv40vlc2.h
==============================================================================
--- rv40/rv40vlc2.h	(original)
+++ rv40/rv40vlc2.h	Thu Aug  2 18:37:46 2007
@@ -659,4 +659,75 @@ static const uint8_t mbinfo_vlc_syms[NUM
 };
 //@}
 
+#define PBTYPE_ESCAPE 0xFF
+
+/** Tables used for P-frame macroblock type decoding */
+//@{
+#define NUM_PTYPE_VLCS 7
+#define PTYPE_VLC_SIZE 8
+#define PTYPE_VLC_BITS 7
+
+static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C },
+ { 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
+};
+
+static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
+ { 1, 2, 3, 6, 5, 4, 7, 7 },
+ { 3, 1, 2, 7, 6, 5, 4, 7 },
+ { 5, 4, 1, 4, 3, 3, 4, 5 },
+ { 4, 5, 2, 2, 3, 2, 6, 6 },
+ { 5, 6, 1, 4, 2, 3, 7, 7 },
+ { 5, 6, 1, 4, 3, 2, 7, 7 },
+ { 6, 3, 2, 7, 5, 4, 1, 7 }
+};
+
+static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] = {
+ 0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE
+};
+
+/** reverse of ptype_vlc_syms */
+static const uint8_t block_num_to_ptype_vlc_num[12] = {
+ 0, 1, 2, 3, 0, 0, 0, 0, 4, 5, 0, 6
+};
+//@}
+
+/** Tables used for P-frame macroblock type decoding */
+//@{
+#define NUM_BTYPE_VLCS 6
+#define BTYPE_VLC_SIZE 7
+#define BTYPE_VLC_BITS 6
+
+static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] = {
+ { 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
+ { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
+};
+
+static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] = {
+ { 2, 3, 2, 2, 5, 4, 5 },
+ { 4, 1, 3, 2, 6, 5, 6 },
+ { 6, 4, 1, 2, 5, 3, 6 },
+ { 5, 3, 3, 1, 4, 3, 5 },
+ { 6, 5, 3, 2, 4, 1, 6 },
+ { 6, 5, 3, 1, 4, 2, 6 }
+};
+
+static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] = {
+ 0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE
+};
+
+/** reverse of btype_vlc_syms */
+static const uint8_t block_num_to_btype_vlc_num[12] = {
+ 0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
+};
+//@}
 #endif /* RV40VLC2_H */



More information about the FFmpeg-soc mailing list