[FFmpeg-soc] [soc]: r599 - rv40/rv40.c

kostya subversion at mplayerhq.hu
Fri Aug 3 19:23:50 CEST 2007


Author: kostya
Date: Fri Aug  3 19:23:50 2007
New Revision: 599

Log:
Make VLC set selectable at arbitrary time (will be useful for dquant)

Modified:
   rv40/rv40.c

Modified: rv40/rv40.c
==============================================================================
--- rv40/rv40.c	(original)
+++ rv40/rv40.c	Fri Aug  3 19:23:50 2007
@@ -522,7 +522,7 @@ static void rv40_parse_picture_size(GetB
 /**
  * Select VLC set for decoding from current quantizer, modifier and frame type
  */
-static inline int choose_vlc_set(int quant, int mod, int type)
+static inline RV40VLC* choose_vlc_set(int quant, int mod, int type)
 {
     if(mod == 2){
         if(quant < 19) quant += 10;
@@ -530,7 +530,8 @@ static inline int choose_vlc_set(int qua
     }
     if(mod == 1)
         if(quant < 26) quant += 5;
-    return rv40_quant_to_vlc_set[!!type][av_clip(quant, 0, 30)];
+    return type ? &inter_vlcs[rv40_quant_to_vlc_set[1][av_clip(quant, 0, 30)]]
+                : &intra_vlcs[rv40_quant_to_vlc_set[0][av_clip(quant, 0, 30)]];
 }
 
 static int rv40_parse_slice_header(RV40DecContext *r, GetBitContext *gb, SliceInfo *si)
@@ -547,7 +548,7 @@ static int rv40_parse_slice_header(RV40D
     si->quant = get_bits(gb, 5);
     if(get_bits(gb, 2))
         return -1;
-    si->vlc_set = choose_vlc_set(si->quant, get_bits(gb, 2), si->type);
+    si->vlc_set = get_bits(gb, 2);
     if(get_bits1(gb))
         return -1;
     t = get_bits(gb, 13); /// ???
@@ -1032,7 +1033,7 @@ static int rv40_decode_frame(AVCodecCont
                 r->prev_si.end = si.start;
             }
             r->slice_data = buf + offset;
-            r->cur_vlcs = &intra_vlcs[r->prev_si.vlc_set];
+            r->cur_vlcs = choose_vlc_set(r->prev_si.quant, r->prev_si.vlc_set, r->prev_si.type);
             r->quant = r->prev_si.quant;
             r->bits = r->prev_si.size;
             r->block_start = r->prev_si.start;
@@ -1066,7 +1067,7 @@ static int rv40_decode_frame(AVCodecCont
     if(si.start > r->prev_si.start && si.type == r->prev_si.type) r->prev_si.end = si.start;
     if(r->has_slice){
         //XXX: Take it directly from slice info
-        r->cur_vlcs = &intra_vlcs[r->prev_si.vlc_set];
+        r->cur_vlcs = choose_vlc_set(r->prev_si.quant, r->prev_si.vlc_set, r->prev_si.type);
         r->quant = r->prev_si.quant;
         r->bits = r->prev_si.size;
         r->block_start = r->prev_si.start;



More information about the FFmpeg-soc mailing list