[FFmpeg-soc] [soc]: r5528 - in amr: amrnbdata.h amrnbdec.c

vitor subversion at mplayerhq.hu
Sat Dec 12 14:34:19 CET 2009


Author: vitor
Date: Sat Dec 12 14:34:19 2009
New Revision: 5528

Log:
The gray_decode[] table is always used multiplied by 5, multiply the table
entries by 5.

Modified:
   amr/amrnbdata.h
   amr/amrnbdec.c

Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h	Sat Dec 12 14:29:49 2009	(r5527)
+++ amr/amrnbdata.h	Sat Dec 12 14:34:19 2009	(r5528)
@@ -1556,7 +1556,7 @@ static const uint8_t pulses_nb_per_mode[
 static const uint8_t track_position[16] = { 0, 2, 0, 3, 0, 2, 0, 3, 1, 3, 2, 4, 1, 4, 1, 4 };
 
 /** 3-bit Gray code to binary lookup table */
-static const uint8_t gray_decode[8] = { 0, 1, 3, 2, 5, 6, 4, 7 };
+static const uint8_t gray_decode[8] = { 0, 5, 15, 10, 25, 30, 20, 35 };
 
 
 // gain tables

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Sat Dec 12 14:29:49 2009	(r5527)
+++ amr/amrnbdec.c	Sat Dec 12 14:34:19 2009	(r5528)
@@ -473,8 +473,8 @@ static void decode_10_pulses_35bits(cons
 
     fixed_sparse->n = 10;
     for (i = 0; i < 5; i++) {
-        const int pos1   = gray_decode[fixed_index[2*i + 1] & 7] * 5 + i;
-        const int pos2   = gray_decode[fixed_index[2*i    ] & 7] * 5 + i;
+        const int pos1   = gray_decode[fixed_index[2*i + 1] & 7] + i;
+        const int pos2   = gray_decode[fixed_index[2*i    ] & 7] + i;
         const float sign = (fixed_index[2*i + 1] & 8) ? -1.0 : 1.0;
         fixed_sparse->x[2*i + 1] = pos1;
         fixed_sparse->x[2*i    ] = pos2;
@@ -531,11 +531,11 @@ static void decode_fixed_sparse(AMRFixed
             pulse_position[2] = ((fixed_index >> 8) & 7) * 5 + pulse_subset + 2;
             fixed_sparse->n = 3;
         } else { // mode <= MODE_7k95
-            pulse_position[0] = gray_decode[ fixed_index        & 7] * 5;
-            pulse_position[1] = gray_decode[(fixed_index >> 3)  & 7] * 5 + 1;
-            pulse_position[2] = gray_decode[(fixed_index >> 6)  & 7] * 5 + 2;
+            pulse_position[0] = gray_decode[ fixed_index        & 7];
+            pulse_position[1] = gray_decode[(fixed_index >> 3)  & 7] + 1;
+            pulse_position[2] = gray_decode[(fixed_index >> 6)  & 7] + 2;
             pulse_subset      = (fixed_index >> 9) & 1;
-            pulse_position[3] = gray_decode[(fixed_index >> 10) & 7] * 5 + pulse_subset + 3;
+            pulse_position[3] = gray_decode[(fixed_index >> 10) & 7] + pulse_subset + 3;
             fixed_sparse->n = 4;
         }
         for (i = 0; i < fixed_sparse->n; i++)


More information about the FFmpeg-soc mailing list