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

kostya subversion at mplayerhq.hu
Tue Aug 21 08:18:23 CEST 2007


Author: kostya
Date: Tue Aug 21 08:18:23 2007
New Revision: 1124

Log:
Move extracting coefficients code into subblock decoding functions

Modified:
   rv40/rv40.c

Modified: rv40/rv40.c
==============================================================================
--- rv40/rv40.c	(original)
+++ rv40/rv40.c	Tue Aug 21 08:18:23 2007
@@ -380,8 +380,14 @@ static inline void decode_coeff(DCTELEM 
     }
 }
 
-static inline void decode_subblock(DCTELEM *dst, int coeffs[4], GetBitContext *gb, VLC *vlc)
+static inline void decode_subblock(DCTELEM *dst, int code, GetBitContext *gb, VLC *vlc)
 {
+    int coeffs[4];
+
+    coeffs[0] = modulo_three_table[code][0];
+    coeffs[1] = modulo_three_table[code][1];
+    coeffs[2] = modulo_three_table[code][2];
+    coeffs[3] = modulo_three_table[code][3];
     decode_coeff(dst  , coeffs[0], 3, gb, vlc);
     decode_coeff(dst+1, coeffs[1], 2, gb, vlc);
     decode_coeff(dst+8, coeffs[2], 2, gb, vlc);
@@ -389,8 +395,14 @@ static inline void decode_subblock(DCTEL
 }
 
 // slightly modified version for the third subblock
-static inline void decode_subblock2(DCTELEM *dst, int coeffs[4], GetBitContext *gb, VLC *vlc)
+static inline void decode_subblock2(DCTELEM *dst, int code, GetBitContext *gb, VLC *vlc)
 {
+    int coeffs[4];
+
+    coeffs[0] = modulo_three_table[code][0];
+    coeffs[1] = modulo_three_table[code][1];
+    coeffs[2] = modulo_three_table[code][2];
+    coeffs[3] = modulo_three_table[code][3];
     decode_coeff(dst  , coeffs[0], 3, gb, vlc);
     decode_coeff(dst+8, coeffs[1], 2, gb, vlc);
     decode_coeff(dst+1, coeffs[2], 2, gb, vlc);
@@ -411,42 +423,25 @@ static inline void decode_subblock2(DCTE
 static inline void rv40_decode_block(DCTELEM *dst, GetBitContext *gb, RV40VLC *rvlc, int fc, int sc)
 {
     int code, pattern;
-    int coeffs[4];
 
     code = get_vlc2(gb, rvlc->first_pattern[fc].table, 9, 2);
 
     pattern = code & 0x7;
 
     code >>= 3;
-    coeffs[0] = modulo_three_table[code][0];
-    coeffs[1] = modulo_three_table[code][1];
-    coeffs[2] = modulo_three_table[code][2];
-    coeffs[3] = modulo_three_table[code][3];
-    decode_subblock(dst, coeffs, gb, &rvlc->coefficient);
+    decode_subblock(dst, code, gb, &rvlc->coefficient);
 
     if(pattern & 4){
         code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
-        coeffs[0] = modulo_three_table[code][0];
-        coeffs[1] = modulo_three_table[code][1];
-        coeffs[2] = modulo_three_table[code][2];
-        coeffs[3] = modulo_three_table[code][3];
-        decode_subblock(dst + 2, coeffs, gb, &rvlc->coefficient);
+        decode_subblock(dst + 2, code, gb, &rvlc->coefficient);
     }
     if(pattern & 2){ // Looks like coefficients 1 and 2 are swapped for this block
         code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
-        coeffs[0] = modulo_three_table[code][0];
-        coeffs[1] = modulo_three_table[code][1];
-        coeffs[2] = modulo_three_table[code][2];
-        coeffs[3] = modulo_three_table[code][3];
-        decode_subblock2(dst + 8*2, coeffs, gb, &rvlc->coefficient);
+        decode_subblock2(dst + 8*2, code, gb, &rvlc->coefficient);
     }
     if(pattern & 1){
         code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2);
-        coeffs[0] = modulo_three_table[code][0];
-        coeffs[1] = modulo_three_table[code][1];
-        coeffs[2] = modulo_three_table[code][2];
-        coeffs[3] = modulo_three_table[code][3];
-        decode_subblock(dst + 8*2+2, coeffs, gb, &rvlc->coefficient);
+        decode_subblock(dst + 8*2+2, code, gb, &rvlc->coefficient);
     }
 }
 



More information about the FFmpeg-soc mailing list