[FFmpeg-soc] [soc]: r488 - in rv40: rv40.c rv40data.h

kostya subversion at mplayerhq.hu
Thu Jul 19 09:30:38 CEST 2007


Author: kostya
Date: Thu Jul 19 09:30:37 2007
New Revision: 488

Log:
Use correct quantizer-based VLC set selection

Modified:
   rv40/rv40.c
   rv40/rv40data.h

Modified: rv40/rv40.c
==============================================================================
--- rv40/rv40.c	(original)
+++ rv40/rv40.c	Thu Jul 19 09:30:37 2007
@@ -479,6 +479,20 @@ static void rv40_parse_picture_size(GetB
     *h = get_dimension(gb, rv40_standard_heights, rv40_standard_heights2);
 }
 
+/**
+ * Select VLC set for decoding from current quantizer, modifier and frame type
+ */
+static inline int choose_vlc_set(int quant, int mod, int type)
+{
+    if(mod == 2){
+        if(quant < 19) quant += 10;
+        else if(quant < 26) quant += 5;
+    }
+    if(mod == 1)
+        if(quant < 26) quant += 5;
+    return rv40_quant_to_vlc_set[!!type][av_clip(quant, 0, 30)];
+}
+
 static int rv40_parse_slice_header(RV40DecContext *r, GetBitContext *gb, SliceInfo *si)
 {
     int t, mb_bits;
@@ -491,7 +505,7 @@ static int rv40_parse_slice_header(RV40D
     si->quant = get_bits(gb, 5);
     if(get_bits(gb, 2))
         return -1;
-    si->vlc_set = get_bits(gb, 2) + 1;
+    si->vlc_set = choose_vlc_set(si->quant, get_bits(gb, 2), si->type);
     if(get_bits1(gb))
         return -1;
     t = get_bits(gb, 13); /// ???

Modified: rv40/rv40data.h
==============================================================================
--- rv40/rv40data.h	(original)
+++ rv40/rv40data.h	Thu Jul 19 09:30:37 2007
@@ -147,4 +147,14 @@ static const uint8_t rv40_dezigzag[16] =
  11, 19, 26, 27
 };
 
+/**
+ * Tables used to translate quantizer value into VLC set for decoding
+ * First table is used for intraframes.
+ */
+static const uint8_t rv40_quant_to_vlc_set[2][31] = {
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+   2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3,
+   3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 },
+};
 #endif /* RV40DATA_H */



More information about the FFmpeg-soc mailing list