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

cmcq subversion at mplayerhq.hu
Mon Aug 10 22:02:51 CEST 2009


Author: cmcq
Date: Mon Aug 10 22:02:51 2009
New Revision: 5029

Log:
Undo r5028 - it was actually 30% slower on all modes except 4.75kbit/s

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

Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h	Mon Aug 10 20:42:31 2009	(r5028)
+++ amr/amrnbdata.h	Mon Aug 10 22:02:51 2009	(r5029)
@@ -71,10 +71,8 @@ enum Mode {
  * Bit-order table type
  */
 typedef struct AMROrder {
-    unsigned index : 6;           ///< index in (uint16_t *)AMRNBFrame
-    unsigned len   : 4;           ///< number of bits
-    unsigned shift : 4;           ///< magnitude of shift to apply
-    unsigned rev   : 1;           ///< reverse uint16_t and right shift instead of left shift
+    uint8_t index;                ///< index in (uint16_t *)AMRNBFrame
+    uint8_t bit;                  ///< bit index, LSB=0, MSB=15
 } AMROrder;
 
 
@@ -109,343 +107,362 @@ typedef struct {
 // The following order* tables are used to convert AMR frame parameters to and
 // from a bitstream. See 3GPP TS 26.101 for more information.
 
-#define AMR_BIT(field, l,s,r)                  {offsetof(AMRNBFrame, field) >> 1, l,s,r}
+#define AMR_BIT(field, bit)                  {offsetof(AMRNBFrame, field) >> 1, bit}
 /** Specify an LSF parameter bit */
-#define AMR_LSF(variable, l,s,r)               AMR_BIT(lsf[variable], l,s,r)
+#define AMR_LSF(variable, bit)               AMR_BIT(lsf[variable], bit)
 /** Specify a subframe-specific bit */
-#define AMR_OF(frame_num, variable, l,s,r)     AMR_BIT(subframe[frame_num].variable, l,s,r)
+#define AMR_OF(frame_num, variable, bit)     AMR_BIT(subframe[frame_num].variable, bit)
 /** Specify a pitch gain bit */
-#define AMR_PGAIN(frame_num, l,s,r)            AMR_OF(frame_num, p_gain, l,s,r)
+#define AMR_PGAIN(frame_num, bit)            AMR_OF(frame_num, p_gain, bit)
 /** Specify a fixed gain bit */
-#define AMR_FGAIN(frame_num, l,s,r)            AMR_OF(frame_num, fixed_gain, l,s,r)
+#define AMR_FGAIN(frame_num, bit)       AMR_OF(frame_num, fixed_gain, bit)
 /** Specify a pitch lag bit */
-#define AMR_PLAG(frame_num, l,s,r)             AMR_OF(frame_num, p_lag, l,s,r)
+#define AMR_PLAG(frame_num, bit)             AMR_OF(frame_num, p_lag, bit)
 /** Specify a pulse bit */
-#define AMR_PULSE(frame_num, pulse_id, l,s,r)  AMR_OF(frame_num, pulses[pulse_id], l,s,r)
+#define AMR_PULSE(frame_num, pulse_id, bit) AMR_OF(frame_num, pulses[pulse_id], bit)
 /** Specify an SID reference vector bit */
-#define AMR_SVECTOR(l,s,r)                     AMR_BIT(sid.ref_vector, l,s,r)
+#define AMR_SVECTOR(bit)                     AMR_BIT(sid.ref_vector, bit)
 /** Specify an SID energy index bit */
-#define AMR_SENERGY(l,s,r)                     AMR_BIT(sid.energy,     l,s,r)
+#define AMR_SENERGY(bit)                     AMR_BIT(sid.energy, bit)
 
-static AMROrder order_MODE_475[] = {
-    AMR_LSF  (  0,8, 0,0), AMR_LSF  (  1,8, 0,0), AMR_PLAG (0  ,6, 2,0),
-    AMR_PLAG (1  ,2, 2,0), AMR_PLAG (2  ,2, 2,0), AMR_PLAG (3  ,2, 2,0),
-    AMR_PGAIN(0  ,4,12,1), AMR_PGAIN(2  ,4,12,1), AMR_LSF  (  2,2, 4,0),
-    AMR_LSF  (  2,1, 2,0), AMR_LSF  (  2,1, 0,0), AMR_PGAIN(2  ,4, 8,1),
-    AMR_PLAG (0  ,2, 0,0), AMR_PGAIN(0  ,4, 8,1), AMR_PULSE(0,1,2, 0,0),
-    AMR_LSF  (  2,1, 6,0), AMR_LSF  (  2,1, 3,0), AMR_LSF  (  2,1, 1,0),
-    AMR_PLAG (1  ,2, 0,0), AMR_PULSE(1,1,2, 0,0), AMR_PLAG (2  ,2, 0,0),
-    AMR_PULSE(2,1,2, 0,0), AMR_PLAG (3  ,2, 0,0), AMR_PULSE(3,1,2, 0,0),
-    AMR_PULSE(0,0,2, 4,0), AMR_PULSE(0,0,2, 1,0), AMR_PULSE(1,0,2, 4,0),
-    AMR_PULSE(1,0,2, 1,0), AMR_PULSE(2,0,2, 4,0), AMR_PULSE(2,0,2, 1,0),
-    AMR_PULSE(3,0,2, 4,0), AMR_PULSE(3,0,2, 1,0), AMR_PULSE(0,0,1, 3,0),
-    AMR_PULSE(1,0,1, 3,0), AMR_PULSE(2,0,1, 3,0), AMR_PULSE(3,0,1, 3,0),
-    AMR_PULSE(0,0,1, 0,0), AMR_PULSE(1,0,1, 0,0), AMR_PULSE(2,0,1, 0,0),
-    AMR_PULSE(3,0,1, 0,0), AMR_PULSE(0,0,1, 6,0), AMR_PULSE(1,0,1, 6,0),
-    AMR_PULSE(2,0,1, 6,0), AMR_PULSE(3,0,1, 6,0)
+static const AMROrder order_MODE_475[95] = {
+ AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4),
+ AMR_LSF  (  0, 3), AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0),
+ AMR_LSF  (  1, 7), AMR_LSF  (  1, 6), AMR_LSF  (  1, 5), AMR_LSF  (  1, 4),
+ AMR_LSF  (  1, 3), AMR_LSF  (  1, 2), AMR_LSF  (  1, 1), AMR_LSF  (  1, 0),
+ AMR_PLAG (0,   7), AMR_PLAG (0,   6), AMR_PLAG (0,   5), AMR_PLAG (0,   4),
+ AMR_PLAG (0,   3), AMR_PLAG (0,   2), AMR_PLAG (1,   3), AMR_PLAG (1,   2),
+ AMR_PLAG (2,   3), AMR_PLAG (2,   2), AMR_PLAG (3,   3), AMR_PLAG (3,   2),
+ AMR_PGAIN(0,   0), AMR_PGAIN(0,   1), AMR_PGAIN(0,   2), AMR_PGAIN(0,   3),
+ AMR_PGAIN(2,   0), AMR_PGAIN(2,   1), AMR_PGAIN(2,   2), AMR_PGAIN(2,   3),
+ AMR_LSF  (  2, 5), AMR_LSF  (  2, 4), AMR_LSF  (  2, 2), AMR_LSF  (  2, 0),
+ AMR_PGAIN(2,   4), AMR_PGAIN(2,   5), AMR_PGAIN(2,   6), AMR_PGAIN(2,   7),
+ AMR_PLAG (0,   1), AMR_PLAG (0,   0), AMR_PGAIN(0,   4), AMR_PGAIN(0,   5),
+ AMR_PGAIN(0,   6), AMR_PGAIN(0,   7), AMR_PULSE(0,1, 1), AMR_PULSE(0,1, 0),
+ AMR_LSF  (  2, 6), AMR_LSF  (  2, 3), AMR_LSF  (  2, 1), AMR_PLAG (1,   1),
+ AMR_PLAG (1,   0), AMR_PULSE(1,1, 1), AMR_PULSE(1,1, 0), AMR_PLAG (2,   1),
+ AMR_PLAG (2,   0), AMR_PULSE(2,1, 1), AMR_PULSE(2,1, 0), AMR_PLAG (3,   1),
+ AMR_PLAG (3,   0), AMR_PULSE(3,1, 1), AMR_PULSE(3,1, 0), AMR_PULSE(0,0, 5),
+ AMR_PULSE(0,0, 4), AMR_PULSE(0,0, 2), AMR_PULSE(0,0, 1), AMR_PULSE(1,0, 5),
+ AMR_PULSE(1,0, 4), AMR_PULSE(1,0, 2), AMR_PULSE(1,0, 1), AMR_PULSE(2,0, 5),
+ AMR_PULSE(2,0, 4), AMR_PULSE(2,0, 2), AMR_PULSE(2,0, 1), AMR_PULSE(3,0, 5),
+ AMR_PULSE(3,0, 4), AMR_PULSE(3,0, 2), AMR_PULSE(3,0, 1), AMR_PULSE(0,0, 3),
+ AMR_PULSE(1,0, 3), AMR_PULSE(2,0, 3), AMR_PULSE(3,0, 3), AMR_PULSE(0,0, 0),
+ AMR_PULSE(1,0, 0), AMR_PULSE(2,0, 0), AMR_PULSE(3,0, 0), AMR_PULSE(0,0, 6),
+ AMR_PULSE(1,0, 6), AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6)
 };
 
-static AMROrder order_MODE_515[] = {
-    AMR_LSF  (  0,8, 8,1), AMR_LSF  (  1,8, 8,1), AMR_PLAG (0  ,5, 3,0),
-    AMR_PLAG (1  ,1, 3,0), AMR_PLAG (2  ,1, 3,0), AMR_PLAG (3  ,1, 3,0),
-    AMR_PGAIN(0  ,3,13,1), AMR_PGAIN(1  ,3,13,1), AMR_PGAIN(2  ,3,13,1),
-    AMR_PGAIN(3  ,3,13,1), AMR_PGAIN(0  ,1, 3,0), AMR_PGAIN(1  ,1, 3,0),
-    AMR_PGAIN(2  ,1, 3,0), AMR_PGAIN(3  ,1, 3,0), AMR_PLAG (0  ,1, 2,0),
-    AMR_PLAG (1  ,1, 2,0), AMR_PLAG (2  ,1, 2,0), AMR_PLAG (3  ,1, 2,0),
-    AMR_LSF  (  2,1, 4,0), AMR_PGAIN(0  ,1, 4,0), AMR_PGAIN(1  ,1, 4,0),
-    AMR_PGAIN(2  ,1, 4,0), AMR_PGAIN(3  ,1, 4,0), AMR_PLAG (0  ,1, 1,0),
-    AMR_PLAG (1  ,1, 1,0), AMR_PLAG (2  ,1, 1,0), AMR_LSF  (  2,1, 5,0),
-    AMR_LSF  (  2,1, 2,0), AMR_LSF  (  2,1, 0,0), AMR_PGAIN(0  ,1, 5,0),
-    AMR_PGAIN(1  ,1, 5,0), AMR_PGAIN(2  ,1, 5,0), AMR_PGAIN(3  ,1, 5,0),
-    AMR_LSF  (  2,1, 1,0), AMR_PLAG (0  ,1, 0,0), AMR_PLAG (1  ,1, 0,0),
-    AMR_PLAG (2  ,1, 0,0), AMR_PLAG (3  ,1, 1,0), AMR_LSF  (  2,1, 3,0),
-    AMR_LSF  (  2,1, 6,0), AMR_PLAG (3  ,1, 0,0), AMR_PULSE(0,1,2,14,1),
-    AMR_PULSE(1,1,2,14,1), AMR_PULSE(2,1,1, 0,0), AMR_PULSE(0,0,1, 2,0),
-    AMR_PULSE(1,0,1, 2,0), AMR_PULSE(2,0,1, 2,0), AMR_PULSE(3,0,1, 2,0),
-    AMR_PULSE(2,1,1, 1,0), AMR_PULSE(3,1,2,14,1), AMR_PULSE(0,0,1, 1,0),
-    AMR_PULSE(1,0,1, 1,0), AMR_PULSE(2,0,1, 1,0), AMR_PULSE(3,0,1, 1,0),
-    AMR_PULSE(0,0,1, 5,0), AMR_PULSE(1,0,1, 5,0), AMR_PULSE(0,0,1, 4,0),
-    AMR_PULSE(1,0,1, 4,0), AMR_PULSE(2,0,2, 4,0), AMR_PULSE(3,0,2, 4,0),
-    AMR_PULSE(0,0,1, 6,0), AMR_PULSE(1,0,1, 6,0), AMR_PULSE(2,0,1, 6,0),
-    AMR_PULSE(3,0,1, 6,0), AMR_PULSE(0,0,1, 0,0), AMR_PULSE(1,0,1, 0,0),
-    AMR_PULSE(2,0,1, 0,0), AMR_PULSE(3,0,1, 0,0), AMR_PULSE(0,0,1, 3,0),
-    AMR_PULSE(1,0,1, 3,0), AMR_PULSE(2,0,1, 3,0), AMR_PULSE(3,0,1, 3,0)
+static const AMROrder order_MODE_515[103] = {
+ AMR_LSF  (  0, 0), AMR_LSF  (  0, 1), AMR_LSF  (  0, 2), AMR_LSF  (  0, 3),
+ AMR_LSF  (  0, 4), AMR_LSF  (  0, 5), AMR_LSF  (  0, 6), AMR_LSF  (  0, 7),
+ AMR_LSF  (  1, 0), AMR_LSF  (  1, 1), AMR_LSF  (  1, 2), AMR_LSF  (  1, 3),
+ AMR_LSF  (  1, 4), AMR_LSF  (  1, 5), AMR_LSF  (  1, 6), AMR_LSF  (  1, 7),
+ AMR_PLAG (0,   7), AMR_PLAG (0,   6), AMR_PLAG (0,   5), AMR_PLAG (0,   4),
+ AMR_PLAG (0,   3), AMR_PLAG (1,   3), AMR_PLAG (2,   3), AMR_PLAG (3,   3),
+ AMR_PGAIN(0,   0), AMR_PGAIN(0,   1), AMR_PGAIN(0,   2), AMR_PGAIN(1,   0),
+ AMR_PGAIN(1,   1), AMR_PGAIN(1,   2), AMR_PGAIN(2,   0), AMR_PGAIN(2,   1),
+ AMR_PGAIN(2,   2), AMR_PGAIN(3,   0), AMR_PGAIN(3,   1), AMR_PGAIN(3,   2),
+ AMR_PGAIN(0,   3), AMR_PGAIN(1,   3), AMR_PGAIN(2,   3), AMR_PGAIN(3,   3),
+ AMR_PLAG (0,   2), AMR_PLAG (1,   2), AMR_PLAG (2,   2), AMR_PLAG (3,   2),
+ AMR_LSF  (  2, 4), AMR_PGAIN(0,   4), AMR_PGAIN(1,   4), AMR_PGAIN(2,   4),
+ AMR_PGAIN(3,   4), AMR_PLAG (0,   1), AMR_PLAG (1,   1), AMR_PLAG (2,   1),
+ AMR_LSF  (  2, 5), AMR_LSF  (  2, 2), AMR_LSF  (  2, 0), AMR_PGAIN(0,   5),
+ AMR_PGAIN(1,   5), AMR_PGAIN(2,   5), AMR_PGAIN(3,   5), AMR_LSF  (  2, 1),
+ AMR_PLAG (0,   0), AMR_PLAG (1,   0), AMR_PLAG (2,   0), AMR_PLAG (3,   1),
+ AMR_LSF  (  2, 3), AMR_LSF  (  2, 6), AMR_PLAG (3,   0), AMR_PULSE(0,1, 0),
+ AMR_PULSE(0,1, 1), AMR_PULSE(1,1, 0), AMR_PULSE(1,1, 1), AMR_PULSE(2,1, 0),
+ AMR_PULSE(0,0, 2), AMR_PULSE(1,0, 2), AMR_PULSE(2,0, 2), AMR_PULSE(3,0, 2),
+ AMR_PULSE(2,1, 1), AMR_PULSE(3,1, 0), AMR_PULSE(3,1, 1), AMR_PULSE(0,0, 1),
+ AMR_PULSE(1,0, 1), AMR_PULSE(2,0, 1), AMR_PULSE(3,0, 1), AMR_PULSE(0,0, 5),
+ AMR_PULSE(1,0, 5), AMR_PULSE(0,0, 4), AMR_PULSE(1,0, 4), AMR_PULSE(2,0, 5),
+ AMR_PULSE(2,0, 4), AMR_PULSE(3,0, 5), AMR_PULSE(3,0, 4), AMR_PULSE(0,0, 6),
+ AMR_PULSE(1,0, 6), AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6), AMR_PULSE(0,0, 0),
+ AMR_PULSE(1,0, 0), AMR_PULSE(2,0, 0), AMR_PULSE(3,0, 0), AMR_PULSE(0,0, 3),
+ AMR_PULSE(1,0, 3), AMR_PULSE(2,0, 3), AMR_PULSE(3,0, 3)
 };
 
-static AMROrder order_MODE_59[] = {
-    AMR_LSF  (  0,2, 6,0), AMR_LSF  (  0,2, 2,0), AMR_LSF  (  0,1, 4,0),
-    AMR_LSF  (  0,2, 0,0), AMR_LSF  (  0,1, 5,0), AMR_LSF  (  1,1, 3,0),
-    AMR_LSF  (  1,1, 1,0), AMR_LSF  (  1,2, 7,0), AMR_LSF  (  1,2, 4,0),
-    AMR_LSF  (  1,1, 2,0), AMR_LSF  (  1,1, 6,0), AMR_LSF  (  1,1, 0,0),
-    AMR_PLAG (0  ,1, 5,0), AMR_PLAG (2  ,1, 5,0), AMR_PLAG (0  ,1, 4,0),
-    AMR_PLAG (2  ,1, 4,0), AMR_PLAG (0  ,1, 6,0), AMR_PLAG (2  ,1, 6,0),
-    AMR_PLAG (0  ,1, 7,0), AMR_PLAG (2  ,1, 7,0), AMR_PLAG (0  ,1, 3,0),
-    AMR_PLAG (2  ,1, 3,0), AMR_PLAG (1  ,1, 3,0), AMR_PLAG (3  ,1, 3,0),
-    AMR_PGAIN(0  ,1, 0,0), AMR_PGAIN(1  ,1, 0,0), AMR_PGAIN(2  ,1, 0,0),
-    AMR_PGAIN(3  ,1, 0,0), AMR_PLAG (0  ,1, 2,0), AMR_PLAG (2  ,1, 2,0),
-    AMR_PLAG (1  ,1, 2,0), AMR_PLAG (3  ,1, 2,0), AMR_PGAIN(0  ,1, 1,0),
-    AMR_PGAIN(1  ,1, 1,0), AMR_PGAIN(2  ,1, 1,0), AMR_PGAIN(3  ,1, 1,0),
-    AMR_PLAG (1  ,1, 1,0), AMR_PLAG (3  ,1, 1,0), AMR_PLAG (0  ,1, 1,0),
-    AMR_PLAG (2  ,1, 1,0), AMR_PLAG (0  ,1, 0,0), AMR_PLAG (2  ,1, 0,0),
-    AMR_PGAIN(0  ,1, 2,0), AMR_PGAIN(1  ,1, 2,0), AMR_PGAIN(2  ,1, 2,0),
-    AMR_PGAIN(3  ,1, 2,0), AMR_PGAIN(0  ,1, 3,0), AMR_PGAIN(1  ,1, 3,0),
-    AMR_PGAIN(2  ,1, 3,0), AMR_PGAIN(3  ,1, 3,0), AMR_PGAIN(0  ,1, 4,0),
-    AMR_PGAIN(1  ,1, 4,0), AMR_PGAIN(2  ,1, 4,0), AMR_PGAIN(3  ,1, 4,0),
-    AMR_LSF  (  2,1, 6,0), AMR_LSF  (  2,1, 4,0), AMR_LSF  (  2,2,12,1),
-    AMR_LSF  (  2,2, 7,1), AMR_LSF  (  2,1, 5,0), AMR_LSF  (  2,1, 1,0),
-    AMR_PULSE(3,1,1, 0,0), AMR_PULSE(0,1,1, 1,0), AMR_PULSE(2,1,1, 1,0),
-    AMR_PULSE(3,1,1, 1,0), AMR_PULSE(1,1,2, 0,0), AMR_PULSE(0,1,1, 0,0),
-    AMR_PULSE(2,1,1, 0,0), AMR_LSF  (  2,1, 0,0), AMR_PGAIN(0  ,1, 5,0),
-    AMR_PGAIN(1  ,1, 5,0), AMR_PGAIN(2  ,1, 5,0), AMR_PGAIN(3  ,1, 5,0),
-    AMR_PLAG (1  ,1, 0,0), AMR_PLAG (3  ,1, 0,0), AMR_PULSE(0,0,1, 2,0),
-    AMR_PULSE(1,0,1, 2,0), AMR_PULSE(2,0,1, 2,0), AMR_PULSE(3,0,1, 2,0),
-    AMR_PULSE(0,0,1, 3,0), AMR_PULSE(1,0,1, 3,0), AMR_PULSE(2,0,1, 3,0),
-    AMR_PULSE(3,0,1, 3,0), AMR_PULSE(0,0,1, 6,0), AMR_PULSE(1,0,1, 6,0),
-    AMR_PULSE(2,0,1, 6,0), AMR_PULSE(3,0,1, 6,0), AMR_PULSE(0,0,1, 7,0),
-    AMR_PULSE(1,0,1, 7,0), AMR_PULSE(2,0,1, 7,0), AMR_PULSE(3,0,1, 7,0),
-    AMR_PULSE(0,0,1, 8,0), AMR_PULSE(1,0,1, 8,0), AMR_PULSE(2,0,1, 8,0),
-    AMR_PULSE(3,0,1, 8,0), AMR_PULSE(0,0,1, 0,0), AMR_PULSE(1,0,1, 0,0),
-    AMR_PULSE(2,0,1, 0,0), AMR_PULSE(3,0,1, 0,0), AMR_PULSE(0,0,1, 1,0),
-    AMR_PULSE(1,0,1, 1,0), AMR_PULSE(2,0,1, 1,0), AMR_PULSE(3,0,1, 1,0),
-    AMR_PULSE(0,0,1, 4,0), AMR_PULSE(1,0,1, 4,0), AMR_PULSE(2,0,1, 4,0),
-    AMR_PULSE(3,0,1, 4,0), AMR_PULSE(0,0,1, 5,0), AMR_PULSE(1,0,1, 5,0),
-    AMR_PULSE(2,0,1, 5,0), AMR_PULSE(3,0,1, 5,0)
+static const AMROrder order_MODE_59[118] = {
+ AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 3), AMR_LSF  (  0, 2),
+ AMR_LSF  (  0, 4), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0), AMR_LSF  (  0, 5),
+ AMR_LSF  (  1, 3), AMR_LSF  (  1, 1), AMR_LSF  (  1, 8), AMR_LSF  (  1, 7),
+ AMR_LSF  (  1, 5), AMR_LSF  (  1, 4), AMR_LSF  (  1, 2), AMR_LSF  (  1, 6),
+ AMR_LSF  (  1, 0), AMR_PLAG (0,   5), AMR_PLAG (2,   5), AMR_PLAG (0,   4),
+ AMR_PLAG (2,   4), AMR_PLAG (0,   6), AMR_PLAG (2,   6), AMR_PLAG (0,   7),
+ AMR_PLAG (2,   7), AMR_PLAG (0,   3), AMR_PLAG (2,   3), AMR_PLAG (1,   3),
+ AMR_PLAG (3,   3), AMR_PGAIN(0,   0), AMR_PGAIN(1,   0), AMR_PGAIN(2,   0),
+ AMR_PGAIN(3,   0), AMR_PLAG (0,   2), AMR_PLAG (2,   2), AMR_PLAG (1,   2),
+ AMR_PLAG (3,   2), AMR_PGAIN(0,   1), AMR_PGAIN(1,   1), AMR_PGAIN(2,   1),
+ AMR_PGAIN(3,   1), AMR_PLAG (1,   1), AMR_PLAG (3,   1), AMR_PLAG (0,   1),
+ AMR_PLAG (2,   1), AMR_PLAG (0,   0), AMR_PLAG (2,   0), AMR_PGAIN(0,   2),
+ AMR_PGAIN(1,   2), AMR_PGAIN(2,   2), AMR_PGAIN(3,   2), AMR_PGAIN(0,   3),
+ AMR_PGAIN(1,   3), AMR_PGAIN(2,   3), AMR_PGAIN(3,   3), AMR_PGAIN(0,   4),
+ AMR_PGAIN(1,   4), AMR_PGAIN(2,   4), AMR_PGAIN(3,   4), AMR_LSF  (  2, 6),
+ AMR_LSF  (  2, 4), AMR_LSF  (  2, 2), AMR_LSF  (  2, 3), AMR_LSF  (  2, 7),
+ AMR_LSF  (  2, 8), AMR_LSF  (  2, 5), AMR_LSF  (  2, 1), AMR_PULSE(3,1, 0),
+ AMR_PULSE(0,1, 1), AMR_PULSE(2,1, 1), AMR_PULSE(3,1, 1), AMR_PULSE(1,1, 1),
+ AMR_PULSE(1,1, 0), AMR_PULSE(0,1, 0), AMR_PULSE(2,1, 0), AMR_LSF  (  2, 0),
+ AMR_PGAIN(0,   5), AMR_PGAIN(1,   5), AMR_PGAIN(2,   5), AMR_PGAIN(3,   5),
+ AMR_PLAG (1,   0), AMR_PLAG (3,   0), AMR_PULSE(0,0, 2), AMR_PULSE(1,0, 2),
+ AMR_PULSE(2,0, 2), AMR_PULSE(3,0, 2), AMR_PULSE(0,0, 3), AMR_PULSE(1,0, 3),
+ AMR_PULSE(2,0, 3), AMR_PULSE(3,0, 3), AMR_PULSE(0,0, 6), AMR_PULSE(1,0, 6),
+ AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6), AMR_PULSE(0,0, 7), AMR_PULSE(1,0, 7),
+ AMR_PULSE(2,0, 7), AMR_PULSE(3,0, 7), AMR_PULSE(0,0, 8), AMR_PULSE(1,0, 8),
+ AMR_PULSE(2,0, 8), AMR_PULSE(3,0, 8), AMR_PULSE(0,0, 0), AMR_PULSE(1,0, 0),
+ AMR_PULSE(2,0, 0), AMR_PULSE(3,0, 0), AMR_PULSE(0,0, 1), AMR_PULSE(1,0, 1),
+ AMR_PULSE(2,0, 1), AMR_PULSE(3,0, 1), AMR_PULSE(0,0, 4), AMR_PULSE(1,0, 4),
+ AMR_PULSE(2,0, 4), AMR_PULSE(3,0, 4), AMR_PULSE(0,0, 5), AMR_PULSE(1,0, 5),
+ AMR_PULSE(2,0, 5), AMR_PULSE(3,0, 5)
 };
 
-static AMROrder order_MODE_67[] = {
-    AMR_LSF  (  0,2, 6,0), AMR_LSF  (  0,2,11,1), AMR_LSF  (  0,2, 1,0),
-    AMR_LSF  (  1,1, 3,0), AMR_LSF  (  0,1, 0,0), AMR_LSF  (  0,1, 5,0),
-    AMR_LSF  (  1,2, 7,0), AMR_LSF  (  1,1, 5,0), AMR_LSF  (  1,1, 1,0),
-    AMR_LSF  (  1,1, 4,0), AMR_LSF  (  1,1, 2,0), AMR_LSF  (  1,1, 6,0),
-    AMR_PLAG (0  ,1, 5,0), AMR_PLAG (2  ,1, 5,0), AMR_PLAG (0  ,1, 4,0),
-    AMR_PLAG (2  ,1, 4,0), AMR_PLAG (0  ,1, 6,0), AMR_PLAG (2  ,1, 6,0),
-    AMR_PLAG (0  ,1, 7,0), AMR_PLAG (2  ,1, 7,0), AMR_PLAG (0  ,1, 3,0),
-    AMR_PLAG (2  ,1, 3,0), AMR_LSF  (  1,1, 0,0), AMR_PLAG (1  ,1, 3,0),
-    AMR_PLAG (3  ,1, 3,0), AMR_PLAG (1  ,1, 2,0), AMR_PLAG (3  ,1, 2,0),
-    AMR_PLAG (0  ,1, 2,0), AMR_PLAG (2  ,1, 2,0), AMR_PLAG (1  ,1, 1,0),
-    AMR_PLAG (3  ,1, 1,0), AMR_PGAIN(0  ,1, 6,0), AMR_PGAIN(1  ,1, 6,0),
-    AMR_PGAIN(2  ,1, 6,0), AMR_PGAIN(3  ,1, 6,0), AMR_PLAG (0  ,1, 1,0),
-    AMR_PLAG (2  ,1, 1,0), AMR_PGAIN(0  ,1, 3,0), AMR_PGAIN(1  ,1, 3,0),
-    AMR_PGAIN(2  ,1, 3,0), AMR_PGAIN(3  ,1, 3,0), AMR_PGAIN(0  ,1, 2,0),
-    AMR_PGAIN(1  ,1, 2,0), AMR_PGAIN(2  ,1, 2,0), AMR_PGAIN(3  ,1, 2,0),
-    AMR_PLAG (1  ,1, 0,0), AMR_PLAG (3  ,1, 0,0), AMR_PLAG (0  ,1, 0,0),
-    AMR_PLAG (2  ,1, 0,0), AMR_LSF  (  2,1, 6,0), AMR_LSF  (  2,1, 2,0),
-    AMR_PGAIN(0  ,1, 1,0), AMR_PGAIN(1  ,1, 1,0), AMR_PGAIN(2  ,1, 1,0),
-    AMR_PGAIN(3  ,1, 1,0), AMR_LSF  (  2,2, 3,0), AMR_LSF  (  2,2, 7,1),
-    AMR_LSF  (  2,1, 5,0), AMR_LSF  (  2,2, 0,0), AMR_PGAIN(0  ,1, 4,0),
-    AMR_PGAIN(1  ,1, 4,0), AMR_PGAIN(2  ,1, 4,0), AMR_PGAIN(3  ,1, 4,0),
-    AMR_PULSE(0,1,1, 0,0), AMR_PULSE(1,1,1, 0,0), AMR_PULSE(2,1,1, 0,0),
-    AMR_PULSE(3,1,1, 0,0), AMR_PGAIN(0  ,1, 0,0), AMR_PGAIN(1  ,1, 0,0),
-    AMR_PGAIN(2  ,1, 0,0), AMR_PGAIN(3  ,1, 0,0), AMR_PULSE(0,1,1, 1,0),
-    AMR_PULSE(1,1,1, 1,0), AMR_PULSE(2,1,1, 1,0), AMR_PULSE(3,1,1, 1,0),
-    AMR_PGAIN(3  ,1, 5,0), AMR_PGAIN(2  ,1, 5,0), AMR_PGAIN(1  ,1, 5,0),
-    AMR_PGAIN(0  ,1, 5,0), AMR_PULSE(0,1,1, 2,0), AMR_PULSE(1,1,1, 2,0),
-    AMR_PULSE(2,1,1, 2,0), AMR_PULSE(3,1,1, 2,0), AMR_PULSE(0,0,1, 2,0),
-    AMR_PULSE(1,0,1, 2,0), AMR_PULSE(2,0,1, 2,0), AMR_PULSE(3,0,1, 2,0),
-    AMR_PULSE(0,0,1, 5,0), AMR_PULSE(1,0,1, 5,0), AMR_PULSE(2,0,1, 5,0),
-    AMR_PULSE(3,0,1, 5,0), AMR_PULSE(0,0,1, 6,0), AMR_PULSE(1,0,1, 6,0),
-    AMR_PULSE(2,0,1, 6,0), AMR_PULSE(3,0,1, 6,0), AMR_PULSE(0,0,1, 9,0),
-    AMR_PULSE(1,0,1, 9,0), AMR_PULSE(2,0,1, 9,0), AMR_PULSE(3,0,1, 9,0),
-    AMR_PULSE(0,0,1,10,0), AMR_PULSE(1,0,1,10,0), AMR_PULSE(2,0,1,10,0),
-    AMR_PULSE(3,0,1,10,0), AMR_PULSE(0,0,1, 0,0), AMR_PULSE(1,0,1, 0,0),
-    AMR_PULSE(2,0,1, 0,0), AMR_PULSE(3,0,1, 0,0), AMR_PULSE(0,0,1, 1,0),
-    AMR_PULSE(1,0,1, 1,0), AMR_PULSE(2,0,1, 1,0), AMR_PULSE(3,0,1, 1,0),
-    AMR_PULSE(0,0,1, 3,0), AMR_PULSE(1,0,1, 3,0), AMR_PULSE(2,0,1, 3,0),
-    AMR_PULSE(3,0,1, 3,0), AMR_PULSE(0,0,1, 4,0), AMR_PULSE(1,0,1, 4,0),
-    AMR_PULSE(2,0,1, 4,0), AMR_PULSE(3,0,1, 4,0), AMR_PULSE(0,0,1, 7,0),
-    AMR_PULSE(1,0,1, 7,0), AMR_PULSE(2,0,1, 7,0), AMR_PULSE(3,0,1, 7,0),
-    AMR_PULSE(0,0,1, 8,0), AMR_PULSE(1,0,1, 8,0), AMR_PULSE(2,0,1, 8,0),
-    AMR_PULSE(3,0,1, 8,0)
+static const AMROrder order_MODE_67[134] = {
+ AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 3), AMR_LSF  (  0, 4),
+ AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  1, 3), AMR_LSF  (  0, 0),
+ AMR_LSF  (  0, 5), AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 5),
+ AMR_LSF  (  1, 1), AMR_LSF  (  1, 4), AMR_LSF  (  1, 2), AMR_LSF  (  1, 6),
+ AMR_PLAG (0,   5), AMR_PLAG (2,   5), AMR_PLAG (0,   4), AMR_PLAG (2,   4),
+ AMR_PLAG (0,   6), AMR_PLAG (2,   6), AMR_PLAG (0,   7), AMR_PLAG (2,   7),
+ AMR_PLAG (0,   3), AMR_PLAG (2,   3), AMR_LSF  (  1, 0), AMR_PLAG (1,   3),
+ AMR_PLAG (3,   3), AMR_PLAG (1,   2), AMR_PLAG (3,   2), AMR_PLAG (0,   2),
+ AMR_PLAG (2,   2), AMR_PLAG (1,   1), AMR_PLAG (3,   1), AMR_PGAIN(0,   6),
+ AMR_PGAIN(1,   6), AMR_PGAIN(2,   6), AMR_PGAIN(3,   6), AMR_PLAG (0,   1),
+ AMR_PLAG (2,   1), AMR_PGAIN(0,   3), AMR_PGAIN(1,   3), AMR_PGAIN(2,   3),
+ AMR_PGAIN(3,   3), AMR_PGAIN(0,   2), AMR_PGAIN(1,   2), AMR_PGAIN(2,   2),
+ AMR_PGAIN(3,   2), AMR_PLAG (1,   0), AMR_PLAG (3,   0), AMR_PLAG (0,   0),
+ AMR_PLAG (2,   0), AMR_LSF  (  2, 6), AMR_LSF  (  2, 2), AMR_PGAIN(0,   1),
+ AMR_PGAIN(1,   1), AMR_PGAIN(2,   1), AMR_PGAIN(3,   1), AMR_LSF  (  2, 4),
+ AMR_LSF  (  2, 3), AMR_LSF  (  2, 7), AMR_LSF  (  2, 8), AMR_LSF  (  2, 5),
+ AMR_LSF  (  2, 1), AMR_LSF  (  2, 0), AMR_PGAIN(0,   4), AMR_PGAIN(1,   4),
+ AMR_PGAIN(2,   4), AMR_PGAIN(3,   4), AMR_PULSE(0,1, 0), AMR_PULSE(1,1, 0),
+ AMR_PULSE(2,1, 0), AMR_PULSE(3,1, 0), AMR_PGAIN(0,   0), AMR_PGAIN(1,   0),
+ AMR_PGAIN(2,   0), AMR_PGAIN(3,   0), AMR_PULSE(0,1, 1), AMR_PULSE(1,1, 1),
+ AMR_PULSE(2,1, 1), AMR_PULSE(3,1, 1), AMR_PGAIN(3,   5), AMR_PGAIN(2,   5),
+ AMR_PGAIN(1,   5), AMR_PGAIN(0,   5), AMR_PULSE(0,1, 2), AMR_PULSE(1,1, 2),
+ AMR_PULSE(2,1, 2), AMR_PULSE(3,1, 2), AMR_PULSE(0,0, 2), AMR_PULSE(1,0, 2),
+ AMR_PULSE(2,0, 2), AMR_PULSE(3,0, 2), AMR_PULSE(0,0, 5), AMR_PULSE(1,0, 5),
+ AMR_PULSE(2,0, 5), AMR_PULSE(3,0, 5), AMR_PULSE(0,0, 6), AMR_PULSE(1,0, 6),
+ AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6), AMR_PULSE(0,0, 9), AMR_PULSE(1,0, 9),
+ AMR_PULSE(2,0, 9), AMR_PULSE(3,0, 9), AMR_PULSE(0,0,10), AMR_PULSE(1,0,10),
+ AMR_PULSE(2,0,10), AMR_PULSE(3,0,10), AMR_PULSE(0,0, 0), AMR_PULSE(1,0, 0),
+ AMR_PULSE(2,0, 0), AMR_PULSE(3,0, 0), AMR_PULSE(0,0, 1), AMR_PULSE(1,0, 1),
+ AMR_PULSE(2,0, 1), AMR_PULSE(3,0, 1), AMR_PULSE(0,0, 3), AMR_PULSE(1,0, 3),
+ AMR_PULSE(2,0, 3), AMR_PULSE(3,0, 3), AMR_PULSE(0,0, 4), AMR_PULSE(1,0, 4),
+ AMR_PULSE(2,0, 4), AMR_PULSE(3,0, 4), AMR_PULSE(0,0, 7), AMR_PULSE(1,0, 7),
+ AMR_PULSE(2,0, 7), AMR_PULSE(3,0, 7), AMR_PULSE(0,0, 8), AMR_PULSE(1,0, 8),
+ AMR_PULSE(2,0, 8), AMR_PULSE(3,0, 8)
 };
 
-static AMROrder order_MODE_74[] = {
-    AMR_LSF  (  0,8, 0,0), AMR_LSF  (  1,9, 0,0), AMR_PLAG (0  ,1, 7,0),
-    AMR_PLAG (2  ,1, 7,0), AMR_PLAG (0  ,1, 6,0), AMR_PLAG (2  ,1, 6,0),
-    AMR_PLAG (0  ,1, 5,0), AMR_PLAG (2  ,1, 5,0), AMR_PLAG (0  ,1, 4,0),
-    AMR_PLAG (2  ,1, 4,0), AMR_PLAG (0  ,1, 3,0), AMR_PLAG (2  ,1, 3,0),
-    AMR_PGAIN(0  ,1, 6,0), AMR_PGAIN(1  ,1, 6,0), AMR_PGAIN(2  ,1, 6,0),
-    AMR_PGAIN(3  ,1, 6,0), AMR_PGAIN(0  ,1, 5,0), AMR_PGAIN(1  ,1, 5,0),
-    AMR_PGAIN(2  ,1, 5,0), AMR_PGAIN(3  ,1, 5,0), AMR_PGAIN(0  ,1, 3,0),
-    AMR_PGAIN(1  ,1, 3,0), AMR_PGAIN(2  ,1, 3,0), AMR_PGAIN(3  ,1, 3,0),
-    AMR_PGAIN(0  ,1, 2,0), AMR_PGAIN(1  ,1, 2,0), AMR_PGAIN(2  ,1, 2,0),
-    AMR_PGAIN(3  ,1, 2,0), AMR_PLAG (1  ,1, 4,0), AMR_PLAG (3  ,1, 4,0),
-    AMR_PLAG (1  ,1, 3,0), AMR_PLAG (3  ,1, 3,0), AMR_LSF  (  2,3, 2,0),
-    AMR_LSF  (  2,3, 6,0), AMR_PLAG (0  ,1, 2,0), AMR_PLAG (1  ,1, 2,0),
-    AMR_PLAG (2  ,1, 2,0), AMR_PLAG (3  ,1, 2,0), AMR_PGAIN(0  ,1, 1,0),
-    AMR_PGAIN(1  ,1, 1,0), AMR_PGAIN(2  ,1, 1,0), AMR_PGAIN(3  ,1, 1,0),
-    AMR_LSF  (  2,1, 5,0), AMR_LSF  (  2,2, 0,0), AMR_PULSE(0,1,1, 0,0),
-    AMR_PULSE(1,1,1, 0,0), AMR_PULSE(2,1,1, 0,0), AMR_PULSE(3,1,1, 0,0),
-    AMR_PGAIN(0  ,1, 0,0), AMR_PGAIN(1  ,1, 0,0), AMR_PGAIN(2  ,1, 0,0),
-    AMR_PGAIN(3  ,1, 0,0), AMR_PULSE(0,1,1, 1,0), AMR_PULSE(1,1,1, 1,0),
-    AMR_PULSE(2,1,1, 1,0), AMR_PULSE(3,1,1, 1,0), AMR_PULSE(0,1,1, 2,0),
-    AMR_PULSE(1,1,1, 2,0), AMR_PGAIN(0  ,1, 4,0), AMR_PGAIN(1  ,1, 4,0),
-    AMR_PGAIN(2  ,1, 4,0), AMR_PGAIN(3  ,1, 4,0), AMR_PULSE(2,1,1, 2,0),
-    AMR_PULSE(3,1,1, 2,0), AMR_PULSE(0,1,1, 3,0), AMR_PULSE(1,1,1, 3,0),
-    AMR_PULSE(2,1,1, 3,0), AMR_PULSE(3,1,1, 3,0), AMR_PLAG (0  ,2, 0,0),
-    AMR_PLAG (1  ,2, 0,0), AMR_PLAG (2  ,2, 0,0), AMR_PLAG (3  ,2, 0,0),
-    AMR_PULSE(0,0,6, 0,0), AMR_PULSE(1,0,6, 0,0), AMR_PULSE(2,0,6, 0,0),
-    AMR_PULSE(3,0,6, 0,0), AMR_PULSE(0,0,1,12,0), AMR_PULSE(1,0,1,12,0),
-    AMR_PULSE(2,0,1,12,0), AMR_PULSE(3,0,1,12,0), AMR_PULSE(0,0,1,11,0),
-    AMR_PULSE(1,0,1,11,0), AMR_PULSE(2,0,1,11,0), AMR_PULSE(3,0,1,11,0),
-    AMR_PULSE(0,0,1,10,0), AMR_PULSE(1,0,1,10,0), AMR_PULSE(2,0,1,10,0),
-    AMR_PULSE(3,0,1,10,0), AMR_PULSE(0,0,1, 9,0), AMR_PULSE(1,0,1, 9,0),
-    AMR_PULSE(2,0,1, 9,0), AMR_PULSE(3,0,1, 9,0), AMR_PULSE(0,0,1, 8,0),
-    AMR_PULSE(1,0,1, 8,0), AMR_PULSE(2,0,1, 8,0), AMR_PULSE(3,0,1, 8,0),
-    AMR_PULSE(0,0,1, 7,0), AMR_PULSE(1,0,1, 7,0), AMR_PULSE(2,0,1, 7,0),
-    AMR_PULSE(3,0,1, 7,0), AMR_PULSE(0,0,1, 6,0), AMR_PULSE(1,0,1, 6,0),
-    AMR_PULSE(2,0,1, 6,0), AMR_PULSE(3,0,1, 6,0)
+static const AMROrder order_MODE_74[148] = {
+ AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4),
+ AMR_LSF  (  0, 3), AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0),
+ AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 6), AMR_LSF  (  1, 5),
+ AMR_LSF  (  1, 4), AMR_LSF  (  1, 3), AMR_LSF  (  1, 2), AMR_LSF  (  1, 1),
+ AMR_LSF  (  1, 0), AMR_PLAG (0,   7), AMR_PLAG (2,   7), AMR_PLAG (0,   6),
+ AMR_PLAG (2,   6), AMR_PLAG (0,   5), AMR_PLAG (2,   5), AMR_PLAG (0,   4),
+ AMR_PLAG (2,   4), AMR_PLAG (0,   3), AMR_PLAG (2,   3), AMR_PGAIN(0,   6),
+ AMR_PGAIN(1,   6), AMR_PGAIN(2,   6), AMR_PGAIN(3,   6), AMR_PGAIN(0,   5),
+ AMR_PGAIN(1,   5), AMR_PGAIN(2,   5), AMR_PGAIN(3,   5), AMR_PGAIN(0,   3),
+ AMR_PGAIN(1,   3), AMR_PGAIN(2,   3), AMR_PGAIN(3,   3), AMR_PGAIN(0,   2),
+ AMR_PGAIN(1,   2), AMR_PGAIN(2,   2), AMR_PGAIN(3,   2), AMR_PLAG (1,   4),
+ AMR_PLAG (3,   4), AMR_PLAG (1,   3), AMR_PLAG (3,   3), AMR_LSF  (  2, 4),
+ AMR_LSF  (  2, 3), AMR_LSF  (  2, 2), AMR_LSF  (  2, 8), AMR_LSF  (  2, 7),
+ AMR_LSF  (  2, 6), AMR_PLAG (0,   2), AMR_PLAG (1,   2), AMR_PLAG (2,   2),
+ AMR_PLAG (3,   2), AMR_PGAIN(0,   1), AMR_PGAIN(1,   1), AMR_PGAIN(2,   1),
+ AMR_PGAIN(3,   1), AMR_LSF  (  2, 5), AMR_LSF  (  2, 1), AMR_LSF  (  2, 0),
+ AMR_PULSE(0,1, 0), AMR_PULSE(1,1, 0), AMR_PULSE(2,1, 0), AMR_PULSE(3,1, 0),
+ AMR_PGAIN(0,   0), AMR_PGAIN(1,   0), AMR_PGAIN(2,   0), AMR_PGAIN(3,   0),
+ AMR_PULSE(0,1, 1), AMR_PULSE(1,1, 1), AMR_PULSE(2,1, 1), AMR_PULSE(3,1, 1),
+ AMR_PULSE(0,1, 2), AMR_PULSE(1,1, 2), AMR_PGAIN(0,   4), AMR_PGAIN(1,   4),
+ AMR_PGAIN(2,   4), AMR_PGAIN(3,   4), AMR_PULSE(2,1, 2), AMR_PULSE(3,1, 2),
+ AMR_PULSE(0,1, 3), AMR_PULSE(1,1, 3), AMR_PULSE(2,1, 3), AMR_PULSE(3,1, 3),
+ AMR_PLAG (0,   1), AMR_PLAG (0,   0), AMR_PLAG (1,   1), AMR_PLAG (1,   0),
+ AMR_PLAG (2,   1), AMR_PLAG (2,   0), AMR_PLAG (3,   1), AMR_PLAG (3,   0),
+ AMR_PULSE(0,0, 5), AMR_PULSE(0,0, 4), AMR_PULSE(0,0, 3), AMR_PULSE(0,0, 2),
+ AMR_PULSE(0,0, 1), AMR_PULSE(0,0, 0), AMR_PULSE(1,0, 5), AMR_PULSE(1,0, 4),
+ AMR_PULSE(1,0, 3), AMR_PULSE(1,0, 2), AMR_PULSE(1,0, 1), AMR_PULSE(1,0, 0),
+ AMR_PULSE(2,0, 5), AMR_PULSE(2,0, 4), AMR_PULSE(2,0, 3), AMR_PULSE(2,0, 2),
+ AMR_PULSE(2,0, 1), AMR_PULSE(2,0, 0), AMR_PULSE(3,0, 5), AMR_PULSE(3,0, 4),
+ AMR_PULSE(3,0, 3), AMR_PULSE(3,0, 2), AMR_PULSE(3,0, 1), AMR_PULSE(3,0, 0),
+ AMR_PULSE(0,0,12), AMR_PULSE(1,0,12), AMR_PULSE(2,0,12), AMR_PULSE(3,0,12),
+ AMR_PULSE(0,0,11), AMR_PULSE(1,0,11), AMR_PULSE(2,0,11), AMR_PULSE(3,0,11),
+ AMR_PULSE(0,0,10), AMR_PULSE(1,0,10), AMR_PULSE(2,0,10), AMR_PULSE(3,0,10),
+ AMR_PULSE(0,0, 9), AMR_PULSE(1,0, 9), AMR_PULSE(2,0, 9), AMR_PULSE(3,0, 9),
+ AMR_PULSE(0,0, 8), AMR_PULSE(1,0, 8), AMR_PULSE(2,0, 8), AMR_PULSE(3,0, 8),
+ AMR_PULSE(0,0, 7), AMR_PULSE(1,0, 7), AMR_PULSE(2,0, 7), AMR_PULSE(3,0, 7),
+ AMR_PULSE(0,0, 6), AMR_PULSE(1,0, 6), AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6)
 };
 
-static AMROrder order_MODE_795[] = {
-    AMR_LSF  (  0,7, 9,1), AMR_LSF  (  1,1, 3,0), AMR_LSF  (  1,1, 1,0),
-    AMR_LSF  (  1,2, 7,0), AMR_LSF  (  1,2, 4,0), AMR_LSF  (  1,1, 2,0),
-    AMR_LSF  (  1,1, 6,0), AMR_LSF  (  1,1, 0,0), AMR_LSF  (  2,1, 6,0),
-    AMR_LSF  (  2,1, 4,0), AMR_LSF  (  2,2,12,1), AMR_LSF  (  2,2, 7,1),
-    AMR_LSF  (  2,1, 5,0), AMR_FGAIN(0  ,1, 4,0), AMR_FGAIN(1  ,1, 4,0),
-    AMR_FGAIN(2  ,1, 4,0), AMR_FGAIN(3  ,1, 4,0), AMR_FGAIN(0  ,1, 3,0),
-    AMR_FGAIN(1  ,1, 3,0), AMR_FGAIN(2  ,1, 3,0), AMR_FGAIN(3  ,1, 3,0),
-    AMR_FGAIN(0  ,1, 2,0), AMR_FGAIN(1  ,1, 2,0), AMR_FGAIN(2  ,1, 2,0),
-    AMR_FGAIN(3  ,1, 2,0), AMR_PGAIN(0  ,1, 3,0), AMR_PGAIN(1  ,1, 3,0),
-    AMR_PGAIN(2  ,1, 3,0), AMR_PGAIN(3  ,1, 3,0), AMR_PGAIN(0  ,1, 2,0),
-    AMR_PGAIN(1  ,1, 2,0), AMR_PGAIN(2  ,1, 2,0), AMR_PGAIN(3  ,1, 2,0),
-    AMR_PLAG (0  ,1, 7,0), AMR_PLAG (2  ,1, 7,0), AMR_PLAG (0  ,1, 6,0),
-    AMR_PLAG (2  ,1, 6,0), AMR_PLAG (0  ,1, 5,0), AMR_PLAG (2  ,1, 5,0),
-    AMR_PLAG (0  ,1, 4,0), AMR_PLAG (2  ,1, 4,0), AMR_PLAG (0  ,1, 3,0),
-    AMR_PLAG (2  ,1, 3,0), AMR_PLAG (1  ,1, 5,0), AMR_PLAG (3  ,1, 5,0),
-    AMR_PLAG (1  ,1, 4,0), AMR_PLAG (3  ,1, 4,0), AMR_PLAG (1  ,1, 3,0),
-    AMR_PLAG (3  ,1, 3,0), AMR_FGAIN(0  ,1, 1,0), AMR_FGAIN(1  ,1, 1,0),
-    AMR_FGAIN(2  ,1, 1,0), AMR_FGAIN(3  ,1, 1,0), AMR_PLAG (0  ,1, 2,0),
-    AMR_PLAG (2  ,1, 2,0), AMR_PLAG (1  ,1, 2,0), AMR_PLAG (3  ,1, 2,0),
-    AMR_LSF  (  0,2, 7,1), AMR_LSF  (  2,2, 0,0), AMR_PLAG (0  ,1, 1,0),
-    AMR_PLAG (2  ,1, 1,0), AMR_PLAG (0  ,1, 0,0), AMR_PLAG (2  ,1, 0,0),
-    AMR_PLAG (1  ,1, 1,0), AMR_PLAG (3  ,1, 1,0), AMR_PLAG (1  ,1, 0,0),
-    AMR_PLAG (3  ,1, 0,0), AMR_PGAIN(0  ,1, 1,0), AMR_PGAIN(1  ,1, 1,0),
-    AMR_PGAIN(2  ,1, 1,0), AMR_PGAIN(3  ,1, 1,0), AMR_FGAIN(0  ,1, 0,0),
-    AMR_FGAIN(1  ,1, 0,0), AMR_FGAIN(2  ,1, 0,0), AMR_FGAIN(3  ,1, 0,0),
-    AMR_PGAIN(0  ,1, 0,0), AMR_PGAIN(1  ,1, 0,0), AMR_PGAIN(2  ,1, 0,0),
-    AMR_PGAIN(3  ,1, 0,0), AMR_PULSE(2,1,3,13,1), AMR_PULSE(0,0,1, 1,0),
-    AMR_PULSE(1,0,1, 1,0), AMR_PULSE(2,0,1, 1,0), AMR_PULSE(3,0,1, 1,0),
-    AMR_PULSE(0,0,1, 4,0), AMR_PULSE(1,0,1, 4,0), AMR_PULSE(2,0,1, 4,0),
-    AMR_PULSE(3,0,1, 4,0), AMR_PULSE(0,0,1, 7,0), AMR_PULSE(1,0,1, 7,0),
-    AMR_PULSE(2,0,1, 7,0), AMR_PULSE(3,0,1, 7,0), AMR_PULSE(0,0,1,11,0),
-    AMR_PULSE(1,0,1,11,0), AMR_PULSE(2,0,1,11,0), AMR_PULSE(3,0,1,11,0),
-    AMR_PULSE(2,1,1, 3,0), AMR_PULSE(3,1,4,12,1), AMR_PULSE(1,1,4,12,1),
-    AMR_PULSE(0,1,4,12,1), AMR_PULSE(0,0,1, 0,0), AMR_PULSE(0,0,2,12,1),
-    AMR_PULSE(0,0,1, 5,0), AMR_PULSE(0,0,1, 8,0), AMR_PULSE(0,0,1,12,0),
-    AMR_PULSE(1,0,1, 0,0), AMR_PULSE(1,0,2,12,1), AMR_PULSE(1,0,1, 5,0),
-    AMR_PULSE(1,0,1, 8,0), AMR_PULSE(1,0,1,12,0), AMR_PULSE(2,0,1, 0,0),
-    AMR_PULSE(2,0,2,12,1), AMR_PULSE(2,0,1, 5,0), AMR_PULSE(2,0,1, 8,0),
-    AMR_PULSE(2,0,1,12,0), AMR_PULSE(3,0,1, 0,0), AMR_PULSE(3,0,2,12,1),
-    AMR_PULSE(3,0,1, 5,0), AMR_PULSE(3,0,1, 8,0), AMR_PULSE(3,0,1,12,0),
-    AMR_PULSE(0,0,1, 6,0), AMR_PULSE(1,0,1, 6,0), AMR_PULSE(2,0,1, 6,0),
-    AMR_PULSE(3,0,1, 6,0), AMR_PULSE(0,0,1,10,0), AMR_PULSE(1,0,1,10,0),
-    AMR_PULSE(2,0,1,10,0), AMR_PULSE(3,0,1,10,0), AMR_PULSE(0,0,1, 9,0),
-    AMR_PULSE(1,0,1, 9,0), AMR_PULSE(2,0,1, 9,0), AMR_PULSE(3,0,1, 9,0)
+static const AMROrder order_MODE_795[159] = {
+ AMR_LSF  (  0, 0), AMR_LSF  (  0, 1), AMR_LSF  (  0, 2), AMR_LSF  (  0, 3),
+ AMR_LSF  (  0, 4), AMR_LSF  (  0, 5), AMR_LSF  (  0, 6), AMR_LSF  (  1, 3),
+ AMR_LSF  (  1, 1), AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 5),
+ AMR_LSF  (  1, 4), AMR_LSF  (  1, 2), AMR_LSF  (  1, 6), AMR_LSF  (  1, 0),
+ AMR_LSF  (  2, 6), AMR_LSF  (  2, 4), AMR_LSF  (  2, 2), AMR_LSF  (  2, 3),
+ AMR_LSF  (  2, 7), AMR_LSF  (  2, 8), AMR_LSF  (  2, 5), AMR_FGAIN(0,   4),
+ AMR_FGAIN(1,   4), AMR_FGAIN(2,   4), AMR_FGAIN(3,   4), AMR_FGAIN(0,   3),
+ AMR_FGAIN(1,   3), AMR_FGAIN(2,   3), AMR_FGAIN(3,   3), AMR_FGAIN(0,   2),
+ AMR_FGAIN(1,   2), AMR_FGAIN(2,   2), AMR_FGAIN(3,   2), AMR_PGAIN(0,   3),
+ AMR_PGAIN(1,   3), AMR_PGAIN(2,   3), AMR_PGAIN(3,   3), AMR_PGAIN(0,   2),
+ AMR_PGAIN(1,   2), AMR_PGAIN(2,   2), AMR_PGAIN(3,   2), AMR_PLAG (0,   7),
+ AMR_PLAG (2,   7), AMR_PLAG (0,   6), AMR_PLAG (2,   6), AMR_PLAG (0,   5),
+ AMR_PLAG (2,   5), AMR_PLAG (0,   4), AMR_PLAG (2,   4), AMR_PLAG (0,   3),
+ AMR_PLAG (2,   3), AMR_PLAG (1,   5), AMR_PLAG (3,   5), AMR_PLAG (1,   4),
+ AMR_PLAG (3,   4), AMR_PLAG (1,   3), AMR_PLAG (3,   3), AMR_FGAIN(0,   1),
+ AMR_FGAIN(1,   1), AMR_FGAIN(2,   1), AMR_FGAIN(3,   1), AMR_PLAG (0,   2),
+ AMR_PLAG (2,   2), AMR_PLAG (1,   2), AMR_PLAG (3,   2), AMR_LSF  (  0, 7),
+ AMR_LSF  (  0, 8), AMR_LSF  (  2, 1), AMR_LSF  (  2, 0), AMR_PLAG (0,   1),
+ AMR_PLAG (2,   1), AMR_PLAG (0,   0), AMR_PLAG (2,   0), AMR_PLAG (1,   1),
+ AMR_PLAG (3,   1), AMR_PLAG (1,   0), AMR_PLAG (3,   0), AMR_PGAIN(0,   1),
+ AMR_PGAIN(1,   1), AMR_PGAIN(2,   1), AMR_PGAIN(3,   1), AMR_FGAIN(0,   0),
+ AMR_FGAIN(1,   0), AMR_FGAIN(2,   0), AMR_FGAIN(3,   0), AMR_PGAIN(0,   0),
+ AMR_PGAIN(1,   0), AMR_PGAIN(2,   0), AMR_PGAIN(3,   0), AMR_PULSE(2,1, 0),
+ AMR_PULSE(2,1, 1), AMR_PULSE(2,1, 2), AMR_PULSE(0,0, 1), AMR_PULSE(1,0, 1),
+ AMR_PULSE(2,0, 1), AMR_PULSE(3,0, 1), AMR_PULSE(0,0, 4), AMR_PULSE(1,0, 4),
+ AMR_PULSE(2,0, 4), AMR_PULSE(3,0, 4), AMR_PULSE(0,0, 7), AMR_PULSE(1,0, 7),
+ AMR_PULSE(2,0, 7), AMR_PULSE(3,0, 7), AMR_PULSE(0,0,11), AMR_PULSE(1,0,11),
+ AMR_PULSE(2,0,11), AMR_PULSE(3,0,11), AMR_PULSE(2,1, 3), AMR_PULSE(3,1, 0),
+ AMR_PULSE(3,1, 1), AMR_PULSE(3,1, 2), AMR_PULSE(3,1, 3), AMR_PULSE(1,1, 0),
+ AMR_PULSE(1,1, 1), AMR_PULSE(1,1, 2), AMR_PULSE(1,1, 3), AMR_PULSE(0,1, 0),
+ AMR_PULSE(0,1, 1), AMR_PULSE(0,1, 2), AMR_PULSE(0,1, 3), AMR_PULSE(0,0, 0),
+ AMR_PULSE(0,0, 2), AMR_PULSE(0,0, 3), AMR_PULSE(0,0, 5), AMR_PULSE(0,0, 8),
+ AMR_PULSE(0,0,12), AMR_PULSE(1,0, 0), AMR_PULSE(1,0, 2), AMR_PULSE(1,0, 3),
+ AMR_PULSE(1,0, 5), AMR_PULSE(1,0, 8), AMR_PULSE(1,0,12), AMR_PULSE(2,0, 0),
+ AMR_PULSE(2,0, 2), AMR_PULSE(2,0, 3), AMR_PULSE(2,0, 5), AMR_PULSE(2,0, 8),
+ AMR_PULSE(2,0,12), AMR_PULSE(3,0, 0), AMR_PULSE(3,0, 2), AMR_PULSE(3,0, 3),
+ AMR_PULSE(3,0, 5), AMR_PULSE(3,0, 8), AMR_PULSE(3,0,12), AMR_PULSE(0,0, 6),
+ AMR_PULSE(1,0, 6), AMR_PULSE(2,0, 6), AMR_PULSE(3,0, 6), AMR_PULSE(0,0,10),
+ AMR_PULSE(1,0,10), AMR_PULSE(2,0,10), AMR_PULSE(3,0,10), AMR_PULSE(0,0, 9),
+ AMR_PULSE(1,0, 9), AMR_PULSE(2,0, 9), AMR_PULSE(3,0, 9)
 };
 
-static AMROrder order_MODE_102[] = {
-    AMR_LSF  (  0,8, 8,1), AMR_LSF  (  1,9, 7,1), AMR_PLAG (0  ,6, 2,0),
-    AMR_PLAG (2  ,6, 2,0), AMR_PLAG (1  ,2, 3,0), AMR_PLAG (3  ,2, 3,0),
-    AMR_PGAIN(0  ,1, 6,0), AMR_PGAIN(0  ,2, 2,0), AMR_PGAIN(1  ,1, 6,0),
-    AMR_PGAIN(1  ,2, 2,0), AMR_PGAIN(2  ,1, 6,0), AMR_PGAIN(2  ,2, 2,0),
-    AMR_PGAIN(3  ,1, 6,0), AMR_PGAIN(3  ,2, 2,0), AMR_PLAG (0  ,2, 0,0),
-    AMR_PLAG (2  ,2, 0,0), AMR_PLAG (1  ,2, 1,0), AMR_PLAG (3  ,2, 1,0),
-    AMR_PGAIN(0  ,1, 5,0), AMR_PGAIN(1  ,1, 5,0), AMR_PGAIN(2  ,1, 5,0),
-    AMR_PGAIN(3  ,1, 5,0), AMR_LSF  (  2,1, 6,0), AMR_LSF  (  2,1, 2,0),
-    AMR_LSF  (  2,2, 3,0), AMR_LSF  (  2,2, 7,1), AMR_LSF  (  2,1, 5,0),
-    AMR_LSF  (  2,2, 0,0), AMR_PULSE(0,3,1, 0,0), AMR_PULSE(0,2,1, 0,0),
-    AMR_PULSE(0,1,1, 0,0), AMR_PULSE(0,0,1, 0,0), AMR_PULSE(1,3,1, 0,0),
-    AMR_PULSE(1,2,1, 0,0), AMR_PULSE(1,1,1, 0,0), AMR_PULSE(1,0,1, 0,0),
-    AMR_PULSE(2,3,1, 0,0), AMR_PULSE(2,2,1, 0,0), AMR_PULSE(2,1,1, 0,0),
-    AMR_PULSE(2,0,1, 0,0), AMR_PULSE(3,3,1, 0,0), AMR_PULSE(3,2,1, 0,0),
-    AMR_PULSE(3,1,1, 0,0), AMR_PULSE(3,0,1, 0,0), AMR_PGAIN(0  ,1, 1,0),
-    AMR_PGAIN(0  ,1, 4,0), AMR_PGAIN(0  ,1, 0,0), AMR_PGAIN(1  ,1, 1,0),
-    AMR_PGAIN(1  ,1, 4,0), AMR_PGAIN(1  ,1, 0,0), AMR_PGAIN(2  ,1, 1,0),
-    AMR_PGAIN(2  ,1, 4,0), AMR_PGAIN(2  ,1, 0,0), AMR_PGAIN(3  ,1, 1,0),
-    AMR_PGAIN(3  ,1, 4,0), AMR_PGAIN(3  ,1, 0,0), AMR_PLAG (1  ,1, 0,0),
-    AMR_PLAG (3  ,1, 0,0), AMR_PULSE(1,4,2, 8,0), AMR_PULSE(1,5,2, 6,1),
-    AMR_PULSE(1,5,1, 7,0), AMR_PULSE(1,4,1, 7,0), AMR_PULSE(1,5,1, 5,0),
-    AMR_PULSE(1,4,2, 9,1), AMR_PULSE(1,5,1, 6,0), AMR_PULSE(1,6,2, 5,0),
-    AMR_PULSE(1,5,1, 4,0), AMR_PULSE(1,6,1, 3,0), AMR_PULSE(1,4,1, 4,0),
-    AMR_PULSE(1,6,1, 4,0), AMR_PULSE(1,4,1, 3,0), AMR_PULSE(1,5,1, 3,0),
-    AMR_PULSE(2,4,2, 8,0), AMR_PULSE(2,5,2, 6,1), AMR_PULSE(2,5,1, 7,0),
-    AMR_PULSE(2,4,1, 7,0), AMR_PULSE(2,5,1, 5,0), AMR_PULSE(2,4,2, 9,1),
-    AMR_PULSE(2,5,1, 6,0), AMR_PULSE(2,6,2, 5,0), AMR_PULSE(2,5,1, 4,0),
-    AMR_PULSE(2,6,1, 3,0), AMR_PULSE(2,4,1, 4,0), AMR_PULSE(2,6,1, 4,0),
-    AMR_PULSE(2,4,1, 3,0), AMR_PULSE(2,5,1, 3,0), AMR_PULSE(3,4,2, 8,0),
-    AMR_PULSE(3,5,2, 6,1), AMR_PULSE(3,5,1, 7,0), AMR_PULSE(3,4,1, 7,0),
-    AMR_PULSE(3,5,1, 5,0), AMR_PULSE(3,4,2, 9,1), AMR_PULSE(3,5,1, 6,0),
-    AMR_PULSE(3,6,2, 5,0), AMR_PULSE(3,5,1, 4,0), AMR_PULSE(3,6,1, 3,0),
-    AMR_PULSE(3,4,1, 4,0), AMR_PULSE(3,6,1, 4,0), AMR_PULSE(3,4,1, 3,0),
-    AMR_PULSE(3,5,1, 3,0), AMR_PULSE(0,4,2, 8,0), AMR_PULSE(0,5,2, 6,1),
-    AMR_PULSE(0,5,1, 7,0), AMR_PULSE(0,4,1, 7,0), AMR_PULSE(0,5,1, 5,0),
-    AMR_PULSE(0,4,2, 9,1), AMR_PULSE(0,5,1, 6,0), AMR_PULSE(0,6,2, 5,0),
-    AMR_PULSE(0,5,1, 4,0), AMR_PULSE(0,6,1, 3,0), AMR_PULSE(0,4,1, 4,0),
-    AMR_PULSE(0,6,1, 4,0), AMR_PULSE(0,4,1, 3,0), AMR_PULSE(0,5,1, 3,0),
-    AMR_PULSE(3,6,1, 2,0), AMR_PULSE(3,4,1, 0,0), AMR_PULSE(3,5,1, 0,0),
-    AMR_PULSE(3,6,1, 0,0), AMR_PULSE(3,4,1, 2,0), AMR_PULSE(3,6,1, 1,0),
-    AMR_PULSE(3,4,1, 1,0), AMR_PULSE(3,5,2, 1,0), AMR_PULSE(2,6,1, 2,0),
-    AMR_PULSE(2,4,1, 0,0), AMR_PULSE(2,5,1, 0,0), AMR_PULSE(2,6,1, 0,0),
-    AMR_PULSE(2,4,1, 2,0), AMR_PULSE(2,6,1, 1,0), AMR_PULSE(2,4,1, 1,0),
-    AMR_PULSE(2,5,2, 1,0), AMR_PULSE(1,6,1, 2,0), AMR_PULSE(1,4,1, 0,0),
-    AMR_PULSE(1,5,1, 0,0), AMR_PULSE(1,6,1, 0,0), AMR_PULSE(1,4,1, 2,0),
-    AMR_PULSE(1,6,1, 1,0), AMR_PULSE(1,4,1, 1,0), AMR_PULSE(1,5,2, 1,0),
-    AMR_PULSE(0,6,1, 2,0), AMR_PULSE(0,4,1, 0,0), AMR_PULSE(0,5,1, 0,0),
-    AMR_PULSE(0,6,1, 0,0), AMR_PULSE(0,4,1, 2,0), AMR_PULSE(0,6,1, 1,0),
-    AMR_PULSE(0,4,1, 1,0), AMR_PULSE(0,5,2, 1,0)
+static const AMROrder order_MODE_102[204] = {
+ AMR_LSF  (  0, 0), AMR_LSF  (  0, 1), AMR_LSF  (  0, 2), AMR_LSF  (  0, 3),
+ AMR_LSF  (  0, 4), AMR_LSF  (  0, 5), AMR_LSF  (  0, 6), AMR_LSF  (  0, 7),
+ AMR_LSF  (  1, 0), AMR_LSF  (  1, 1), AMR_LSF  (  1, 2), AMR_LSF  (  1, 3),
+ AMR_LSF  (  1, 4), AMR_LSF  (  1, 5), AMR_LSF  (  1, 6), AMR_LSF  (  1, 7),
+ AMR_LSF  (  1, 8), AMR_PLAG (0,   7), AMR_PLAG (0,   6), AMR_PLAG (0,   5),
+ AMR_PLAG (0,   4), AMR_PLAG (0,   3), AMR_PLAG (0,   2), AMR_PLAG (2,   7),
+ AMR_PLAG (2,   6), AMR_PLAG (2,   5), AMR_PLAG (2,   4), AMR_PLAG (2,   3),
+ AMR_PLAG (2,   2), AMR_PLAG (1,   4), AMR_PLAG (1,   3), AMR_PLAG (3,   4),
+ AMR_PLAG (3,   3), AMR_PGAIN(0,   6), AMR_PGAIN(0,   3), AMR_PGAIN(0,   2),
+ AMR_PGAIN(1,   6), AMR_PGAIN(1,   3), AMR_PGAIN(1,   2), AMR_PGAIN(2,   6),
+ AMR_PGAIN(2,   3), AMR_PGAIN(2,   2), AMR_PGAIN(3,   6), AMR_PGAIN(3,   3),
+ AMR_PGAIN(3,   2), AMR_PLAG (0,   1), AMR_PLAG (0,   0), AMR_PLAG (2,   1),
+ AMR_PLAG (2,   0), AMR_PLAG (1,   2), AMR_PLAG (1,   1), AMR_PLAG (3,   2),
+ AMR_PLAG (3,   1), AMR_PGAIN(0,   5), AMR_PGAIN(1,   5), AMR_PGAIN(2,   5),
+ AMR_PGAIN(3,   5), AMR_LSF  (  2, 6), AMR_LSF  (  2, 2), AMR_LSF  (  2, 4),
+ AMR_LSF  (  2, 3), AMR_LSF  (  2, 7), AMR_LSF  (  2, 8), AMR_LSF  (  2, 5),
+ AMR_LSF  (  2, 1), AMR_LSF  (  2, 0), AMR_PULSE(0,3, 0), AMR_PULSE(0,2, 0),
+ AMR_PULSE(0,1, 0), AMR_PULSE(0,0, 0), AMR_PULSE(1,3, 0), AMR_PULSE(1,2, 0),
+ AMR_PULSE(1,1, 0), AMR_PULSE(1,0, 0), AMR_PULSE(2,3, 0), AMR_PULSE(2,2, 0),
+ AMR_PULSE(2,1, 0), AMR_PULSE(2,0, 0), AMR_PULSE(3,3, 0), AMR_PULSE(3,2, 0),
+ AMR_PULSE(3,1, 0), AMR_PULSE(3,0, 0), AMR_PGAIN(0,   1), AMR_PGAIN(0,   4),
+ AMR_PGAIN(0,   0), AMR_PGAIN(1,   1), AMR_PGAIN(1,   4), AMR_PGAIN(1,   0),
+ AMR_PGAIN(2,   1), AMR_PGAIN(2,   4), AMR_PGAIN(2,   0), AMR_PGAIN(3,   1),
+ AMR_PGAIN(3,   4), AMR_PGAIN(3,   0), AMR_PLAG (1,   0), AMR_PLAG (3,   0),
+ AMR_PULSE(1,4, 9), AMR_PULSE(1,4, 8), AMR_PULSE(1,5, 8), AMR_PULSE(1,5, 9),
+ AMR_PULSE(1,5, 7), AMR_PULSE(1,4, 7), AMR_PULSE(1,5, 5), AMR_PULSE(1,4, 5),
+ AMR_PULSE(1,4, 6), AMR_PULSE(1,5, 6), AMR_PULSE(1,6, 6), AMR_PULSE(1,6, 5),
+ AMR_PULSE(1,5, 4), AMR_PULSE(1,6, 3), AMR_PULSE(1,4, 4), AMR_PULSE(1,6, 4),
+ AMR_PULSE(1,4, 3), AMR_PULSE(1,5, 3), AMR_PULSE(2,4, 9), AMR_PULSE(2,4, 8),
+ AMR_PULSE(2,5, 8), AMR_PULSE(2,5, 9), AMR_PULSE(2,5, 7), AMR_PULSE(2,4, 7),
+ AMR_PULSE(2,5, 5), AMR_PULSE(2,4, 5), AMR_PULSE(2,4, 6), AMR_PULSE(2,5, 6),
+ AMR_PULSE(2,6, 6), AMR_PULSE(2,6, 5), AMR_PULSE(2,5, 4), AMR_PULSE(2,6, 3),
+ AMR_PULSE(2,4, 4), AMR_PULSE(2,6, 4), AMR_PULSE(2,4, 3), AMR_PULSE(2,5, 3),
+ AMR_PULSE(3,4, 9), AMR_PULSE(3,4, 8), AMR_PULSE(3,5, 8), AMR_PULSE(3,5, 9),
+ AMR_PULSE(3,5, 7), AMR_PULSE(3,4, 7), AMR_PULSE(3,5, 5), AMR_PULSE(3,4, 5),
+ AMR_PULSE(3,4, 6), AMR_PULSE(3,5, 6), AMR_PULSE(3,6, 6), AMR_PULSE(3,6, 5),
+ AMR_PULSE(3,5, 4), AMR_PULSE(3,6, 3), AMR_PULSE(3,4, 4), AMR_PULSE(3,6, 4),
+ AMR_PULSE(3,4, 3), AMR_PULSE(3,5, 3), AMR_PULSE(0,4, 9), AMR_PULSE(0,4, 8),
+ AMR_PULSE(0,5, 8), AMR_PULSE(0,5, 9), AMR_PULSE(0,5, 7), AMR_PULSE(0,4, 7),
+ AMR_PULSE(0,5, 5), AMR_PULSE(0,4, 5), AMR_PULSE(0,4, 6), AMR_PULSE(0,5, 6),
+ AMR_PULSE(0,6, 6), AMR_PULSE(0,6, 5), AMR_PULSE(0,5, 4), AMR_PULSE(0,6, 3),
+ AMR_PULSE(0,4, 4), AMR_PULSE(0,6, 4), AMR_PULSE(0,4, 3), AMR_PULSE(0,5, 3),
+ AMR_PULSE(3,6, 2), AMR_PULSE(3,4, 0), AMR_PULSE(3,5, 0), AMR_PULSE(3,6, 0),
+ AMR_PULSE(3,4, 2), AMR_PULSE(3,6, 1), AMR_PULSE(3,4, 1), AMR_PULSE(3,5, 2),
+ AMR_PULSE(3,5, 1), AMR_PULSE(2,6, 2), AMR_PULSE(2,4, 0), AMR_PULSE(2,5, 0),
+ AMR_PULSE(2,6, 0), AMR_PULSE(2,4, 2), AMR_PULSE(2,6, 1), AMR_PULSE(2,4, 1),
+ AMR_PULSE(2,5, 2), AMR_PULSE(2,5, 1), AMR_PULSE(1,6, 2), AMR_PULSE(1,4, 0),
+ AMR_PULSE(1,5, 0), AMR_PULSE(1,6, 0), AMR_PULSE(1,4, 2), AMR_PULSE(1,6, 1),
+ AMR_PULSE(1,4, 1), AMR_PULSE(1,5, 2), AMR_PULSE(1,5, 1), AMR_PULSE(0,6, 2),
+ AMR_PULSE(0,4, 0), AMR_PULSE(0,5, 0), AMR_PULSE(0,6, 0), AMR_PULSE(0,4, 2),
+ AMR_PULSE(0,6, 1), AMR_PULSE(0,4, 1), AMR_PULSE(0,5, 2), AMR_PULSE(0,5, 1)
 };
 
-static AMROrder order_MODE_122[] = {
-    AMR_LSF  (  0,7, 0,0), AMR_LSF  (  1,8, 0,0), AMR_LSF  (  2,1, 0,0),
-    AMR_LSF  (  2,8, 1,0), AMR_LSF  (  3,5, 3,0), AMR_PLAG (0  ,1, 8,0),
-    AMR_PLAG (2  ,1, 8,0), AMR_PLAG (0  ,1, 7,0), AMR_PLAG (2  ,1, 7,0),
-    AMR_PLAG (0  ,1, 6,0), AMR_PLAG (2  ,1, 6,0), AMR_PLAG (0  ,1, 5,0),
-    AMR_PLAG (2  ,1, 5,0), AMR_PLAG (0  ,1, 4,0), AMR_PLAG (2  ,1, 4,0),
-    AMR_PLAG (0  ,1, 3,0), AMR_PLAG (2  ,1, 3,0), AMR_PLAG (0  ,1, 2,0),
-    AMR_PLAG (2  ,1, 2,0), AMR_PLAG (0  ,1, 1,0), AMR_PLAG (2  ,1, 1,0),
-    AMR_PLAG (0  ,1, 0,0), AMR_PLAG (2  ,1, 0,0), AMR_PGAIN(0  ,1, 3,0),
-    AMR_PGAIN(1  ,1, 3,0), AMR_PGAIN(2  ,1, 3,0), AMR_PGAIN(3  ,1, 3,0),
-    AMR_PGAIN(0  ,1, 2,0), AMR_PGAIN(1  ,1, 2,0), AMR_PGAIN(2  ,1, 2,0),
-    AMR_PGAIN(3  ,1, 2,0), AMR_PGAIN(0  ,1, 1,0), AMR_PGAIN(1  ,1, 1,0),
-    AMR_PGAIN(2  ,1, 1,0), AMR_PGAIN(3  ,1, 1,0), AMR_FGAIN(0  ,1, 4,0),
-    AMR_FGAIN(1  ,1, 4,0), AMR_FGAIN(2  ,1, 4,0), AMR_FGAIN(3  ,1, 4,0),
-    AMR_FGAIN(0  ,1, 3,0), AMR_FGAIN(1  ,1, 3,0), AMR_FGAIN(2  ,1, 3,0),
-    AMR_FGAIN(3  ,1, 3,0), AMR_FGAIN(0  ,1, 2,0), AMR_FGAIN(1  ,1, 2,0),
-    AMR_FGAIN(2  ,1, 2,0), AMR_FGAIN(3  ,1, 2,0), AMR_PLAG (1  ,1, 5,0),
-    AMR_PLAG (3  ,1, 5,0), AMR_PLAG (1  ,1, 4,0), AMR_PLAG (3  ,1, 4,0),
-    AMR_PLAG (1  ,1, 3,0), AMR_PLAG (3  ,1, 3,0), AMR_PLAG (1  ,1, 2,0),
-    AMR_PLAG (3  ,1, 2,0), AMR_PLAG (1  ,1, 1,0), AMR_PLAG (3  ,1, 1,0),
-    AMR_LSF  (  3,3, 0,0), AMR_LSF  (  4,4, 2,0), AMR_PGAIN(0  ,1, 0,0),
-    AMR_PGAIN(1  ,1, 0,0), AMR_PGAIN(2  ,1, 0,0), AMR_PGAIN(3  ,1, 0,0),
-    AMR_FGAIN(0  ,1, 1,0), AMR_FGAIN(1  ,1, 1,0), AMR_FGAIN(2  ,1, 1,0),
-    AMR_FGAIN(3  ,1, 1,0), AMR_PULSE(0,0,1, 3,0), AMR_PULSE(1,0,1, 3,0),
-    AMR_PULSE(2,0,1, 3,0), AMR_PULSE(3,0,1, 3,0), AMR_PULSE(0,1,1, 3,0),
-    AMR_PULSE(1,1,1, 3,0), AMR_PULSE(2,1,1, 3,0), AMR_PULSE(3,1,1, 3,0),
-    AMR_FGAIN(0  ,1, 0,0), AMR_FGAIN(1  ,1, 0,0), AMR_FGAIN(2  ,1, 0,0),
-    AMR_FGAIN(3  ,1, 0,0), AMR_PULSE(0,2,1, 3,0), AMR_PULSE(1,2,1, 3,0),
-    AMR_PULSE(2,2,1, 3,0), AMR_PULSE(3,2,1, 3,0), AMR_PULSE(0,3,1, 3,0),
-    AMR_PULSE(1,3,1, 3,0), AMR_PULSE(2,3,1, 3,0), AMR_PULSE(3,3,1, 3,0),
-    AMR_PULSE(0,4,1, 3,0), AMR_PULSE(1,4,1, 3,0), AMR_PULSE(2,4,1, 3,0),
-    AMR_PULSE(3,4,1, 3,0), AMR_LSF  (  4,2, 0,0), AMR_PULSE(0,0,3,13,1),
-    AMR_PULSE(0,1,3,13,1), AMR_PULSE(0,2,3,13,1), AMR_PULSE(0,3,3,13,1),
-    AMR_PULSE(0,4,3,13,1), AMR_PULSE(1,0,3,13,1), AMR_PULSE(1,1,3,13,1),
-    AMR_PULSE(1,2,3,13,1), AMR_PULSE(1,3,3,13,1), AMR_PULSE(1,4,3,13,1),
-    AMR_PULSE(2,0,3,13,1), AMR_PULSE(2,1,3,13,1), AMR_PULSE(2,2,3,13,1),
-    AMR_PULSE(2,3,3,13,1), AMR_PULSE(2,4,3,13,1), AMR_PULSE(3,0,3,13,1),
-    AMR_PULSE(3,1,3,13,1), AMR_PULSE(3,2,3,13,1), AMR_PULSE(3,3,3,13,1),
-    AMR_PULSE(3,4,3,13,1), AMR_PULSE(0,5,3,13,1), AMR_PULSE(0,6,3,13,1),
-    AMR_PULSE(0,7,3,13,1), AMR_PULSE(0,8,3,13,1), AMR_PULSE(0,9,3,13,1),
-    AMR_PULSE(1,5,3,13,1), AMR_PULSE(1,6,3,13,1), AMR_PULSE(1,7,3,13,1),
-    AMR_PULSE(1,8,3,13,1), AMR_PULSE(1,9,3,13,1), AMR_PULSE(2,5,3,13,1),
-    AMR_PULSE(2,6,3,13,1), AMR_PULSE(2,7,3,13,1), AMR_PULSE(2,8,3,13,1),
-    AMR_PULSE(2,9,3,13,1), AMR_PULSE(3,5,3,13,1), AMR_PULSE(3,6,3,13,1),
-    AMR_PULSE(3,7,3,13,1), AMR_PULSE(3,8,3,13,1), AMR_PULSE(3,9,3,13,1),
-    AMR_PLAG (1  ,1, 0,0), AMR_PLAG (3  ,1, 0,0)
+static const AMROrder order_MODE_122[244] = {
+ AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4), AMR_LSF  (  0, 3),
+ AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0), AMR_LSF  (  1, 7),
+ AMR_LSF  (  1, 6), AMR_LSF  (  1, 5), AMR_LSF  (  1, 4), AMR_LSF  (  1, 3),
+ AMR_LSF  (  1, 2), AMR_LSF  (  1, 1), AMR_LSF  (  1, 0), AMR_LSF  (  2, 0),
+ AMR_LSF  (  2, 8), AMR_LSF  (  2, 7), AMR_LSF  (  2, 6), AMR_LSF  (  2, 5),
+ AMR_LSF  (  2, 4), AMR_LSF  (  2, 3), AMR_LSF  (  2, 2), AMR_LSF  (  2, 1),
+ AMR_LSF  (  3, 7), AMR_LSF  (  3, 6), AMR_LSF  (  3, 5), AMR_LSF  (  3, 4),
+ AMR_LSF  (  3, 3), AMR_PLAG (0,   8), AMR_PLAG (2,   8), AMR_PLAG (0,   7),
+ AMR_PLAG (2,   7), AMR_PLAG (0,   6), AMR_PLAG (2,   6), AMR_PLAG (0,   5),
+ AMR_PLAG (2,   5), AMR_PLAG (0,   4), AMR_PLAG (2,   4), AMR_PLAG (0,   3),
+ AMR_PLAG (2,   3), AMR_PLAG (0,   2), AMR_PLAG (2,   2), AMR_PLAG (0,   1),
+ AMR_PLAG (2,   1), AMR_PLAG (0,   0), AMR_PLAG (2,   0), AMR_PGAIN(0,   3),
+ AMR_PGAIN(1,   3), AMR_PGAIN(2,   3), AMR_PGAIN(3,   3), AMR_PGAIN(0,   2),
+ AMR_PGAIN(1,   2), AMR_PGAIN(2,   2), AMR_PGAIN(3,   2), AMR_PGAIN(0,   1),
+ AMR_PGAIN(1,   1), AMR_PGAIN(2,   1), AMR_PGAIN(3,   1), AMR_FGAIN(0,   4),
+ AMR_FGAIN(1,   4), AMR_FGAIN(2,   4), AMR_FGAIN(3,   4), AMR_FGAIN(0,   3),
+ AMR_FGAIN(1,   3), AMR_FGAIN(2,   3), AMR_FGAIN(3,   3), AMR_FGAIN(0,   2),
+ AMR_FGAIN(1,   2), AMR_FGAIN(2,   2), AMR_FGAIN(3,   2), AMR_PLAG (1,   5),
+ AMR_PLAG (3,   5), AMR_PLAG (1,   4), AMR_PLAG (3,   4), AMR_PLAG (1,   3),
+ AMR_PLAG (3,   3), AMR_PLAG (1,   2), AMR_PLAG (3,   2), AMR_PLAG (1,   1),
+ AMR_PLAG (3,   1), AMR_LSF  (  3, 2), AMR_LSF  (  3, 1), AMR_LSF  (  3, 0),
+ AMR_LSF  (  4, 5), AMR_LSF  (  4, 4), AMR_LSF  (  4, 3), AMR_LSF  (  4, 2),
+ AMR_PGAIN(0,   0), AMR_PGAIN(1,   0), AMR_PGAIN(2,   0), AMR_PGAIN(3,   0),
+ AMR_FGAIN(0,   1), AMR_FGAIN(1,   1), AMR_FGAIN(2,   1), AMR_FGAIN(3,   1),
+ AMR_PULSE(0,0, 3), AMR_PULSE(1,0, 3), AMR_PULSE(2,0, 3), AMR_PULSE(3,0, 3),
+ AMR_PULSE(0,1, 3), AMR_PULSE(1,1, 3), AMR_PULSE(2,1, 3), AMR_PULSE(3,1, 3),
+ AMR_FGAIN(0,   0), AMR_FGAIN(1,   0), AMR_FGAIN(2,   0), AMR_FGAIN(3,   0),
+ AMR_PULSE(0,2, 3), AMR_PULSE(1,2, 3), AMR_PULSE(2,2, 3), AMR_PULSE(3,2, 3),
+ AMR_PULSE(0,3, 3), AMR_PULSE(1,3, 3), AMR_PULSE(2,3, 3), AMR_PULSE(3,3, 3),
+ AMR_PULSE(0,4, 3), AMR_PULSE(1,4, 3), AMR_PULSE(2,4, 3), AMR_PULSE(3,4, 3),
+ AMR_LSF  (  4, 1), AMR_LSF  (  4, 0), AMR_PULSE(0,0, 0), AMR_PULSE(0,0, 1),
+ AMR_PULSE(0,0, 2), AMR_PULSE(0,1, 0), AMR_PULSE(0,1, 1), AMR_PULSE(0,1, 2),
+ AMR_PULSE(0,2, 0), AMR_PULSE(0,2, 1), AMR_PULSE(0,2, 2), AMR_PULSE(0,3, 0),
+ AMR_PULSE(0,3, 1), AMR_PULSE(0,3, 2), AMR_PULSE(0,4, 0), AMR_PULSE(0,4, 1),
+ AMR_PULSE(0,4, 2), AMR_PULSE(1,0, 0), AMR_PULSE(1,0, 1), AMR_PULSE(1,0, 2),
+ AMR_PULSE(1,1, 0), AMR_PULSE(1,1, 1), AMR_PULSE(1,1, 2), AMR_PULSE(1,2, 0),
+ AMR_PULSE(1,2, 1), AMR_PULSE(1,2, 2), AMR_PULSE(1,3, 0), AMR_PULSE(1,3, 1),
+ AMR_PULSE(1,3, 2), AMR_PULSE(1,4, 0), AMR_PULSE(1,4, 1), AMR_PULSE(1,4, 2),
+ AMR_PULSE(2,0, 0), AMR_PULSE(2,0, 1), AMR_PULSE(2,0, 2), AMR_PULSE(2,1, 0),
+ AMR_PULSE(2,1, 1), AMR_PULSE(2,1, 2), AMR_PULSE(2,2, 0), AMR_PULSE(2,2, 1),
+ AMR_PULSE(2,2, 2), AMR_PULSE(2,3, 0), AMR_PULSE(2,3, 1), AMR_PULSE(2,3, 2),
+ AMR_PULSE(2,4, 0), AMR_PULSE(2,4, 1), AMR_PULSE(2,4, 2), AMR_PULSE(3,0, 0),
+ AMR_PULSE(3,0, 1), AMR_PULSE(3,0, 2), AMR_PULSE(3,1, 0), AMR_PULSE(3,1, 1),
+ AMR_PULSE(3,1, 2), AMR_PULSE(3,2, 0), AMR_PULSE(3,2, 1), AMR_PULSE(3,2, 2),
+ AMR_PULSE(3,3, 0), AMR_PULSE(3,3, 1), AMR_PULSE(3,3, 2), AMR_PULSE(3,4, 0),
+ AMR_PULSE(3,4, 1), AMR_PULSE(3,4, 2), AMR_PULSE(0,5, 0), AMR_PULSE(0,5, 1),
+ AMR_PULSE(0,5, 2), AMR_PULSE(0,6, 0), AMR_PULSE(0,6, 1), AMR_PULSE(0,6, 2),
+ AMR_PULSE(0,7, 0), AMR_PULSE(0,7, 1), AMR_PULSE(0,7, 2), AMR_PULSE(0,8, 0),
+ AMR_PULSE(0,8, 1), AMR_PULSE(0,8, 2), AMR_PULSE(0,9, 0), AMR_PULSE(0,9, 1),
+ AMR_PULSE(0,9, 2), AMR_PULSE(1,5, 0), AMR_PULSE(1,5, 1), AMR_PULSE(1,5, 2),
+ AMR_PULSE(1,6, 0), AMR_PULSE(1,6, 1), AMR_PULSE(1,6, 2), AMR_PULSE(1,7, 0),
+ AMR_PULSE(1,7, 1), AMR_PULSE(1,7, 2), AMR_PULSE(1,8, 0), AMR_PULSE(1,8, 1),
+ AMR_PULSE(1,8, 2), AMR_PULSE(1,9, 0), AMR_PULSE(1,9, 1), AMR_PULSE(1,9, 2),
+ AMR_PULSE(2,5, 0), AMR_PULSE(2,5, 1), AMR_PULSE(2,5, 2), AMR_PULSE(2,6, 0),
+ AMR_PULSE(2,6, 1), AMR_PULSE(2,6, 2), AMR_PULSE(2,7, 0), AMR_PULSE(2,7, 1),
+ AMR_PULSE(2,7, 2), AMR_PULSE(2,8, 0), AMR_PULSE(2,8, 1), AMR_PULSE(2,8, 2),
+ AMR_PULSE(2,9, 0), AMR_PULSE(2,9, 1), AMR_PULSE(2,9, 2), AMR_PULSE(3,5, 0),
+ AMR_PULSE(3,5, 1), AMR_PULSE(3,5, 2), AMR_PULSE(3,6, 0), AMR_PULSE(3,6, 1),
+ AMR_PULSE(3,6, 2), AMR_PULSE(3,7, 0), AMR_PULSE(3,7, 1), AMR_PULSE(3,7, 2),
+ AMR_PULSE(3,8, 0), AMR_PULSE(3,8, 1), AMR_PULSE(3,8, 2), AMR_PULSE(3,9, 0),
+ AMR_PULSE(3,9, 1), AMR_PULSE(3,9, 2), AMR_PLAG (1,   0), AMR_PLAG (3,   0)
 };
 
-static AMROrder order_MODE_DTX[] = {
-    AMR_SVECTOR(  3, 0,0), AMR_LSF    (0,8, 0,0), AMR_LSF    (1,9, 0,0),
-    AMR_LSF    (2,9, 0,0), AMR_SENERGY(  6, 0,0)
+static const AMROrder order_MODE_DTX[35] = {
+ AMR_SVECTOR(   2), AMR_SVECTOR(   1), AMR_SVECTOR(   0),
+ AMR_LSF  (  0, 7), AMR_LSF  (  0, 6), AMR_LSF  (  0, 5), AMR_LSF  (  0, 4),
+ AMR_LSF  (  0, 3), AMR_LSF  (  0, 2), AMR_LSF  (  0, 1), AMR_LSF  (  0, 0),
+ AMR_LSF  (  1, 8), AMR_LSF  (  1, 7), AMR_LSF  (  1, 6), AMR_LSF  (  1, 5),
+ AMR_LSF  (  1, 4), AMR_LSF  (  1, 3), AMR_LSF  (  1, 2), AMR_LSF  (  1, 1),
+ AMR_LSF  (  1, 0), AMR_LSF  (  2, 8), AMR_LSF  (  2, 7), AMR_LSF  (  2, 6),
+ AMR_LSF  (  2, 5), AMR_LSF  (  2, 4), AMR_LSF  (  2, 3), AMR_LSF  (  2, 2),
+ AMR_LSF  (  2, 1), AMR_LSF  (  2, 0),
+ AMR_SENERGY(   5), AMR_SENERGY(   4), AMR_SENERGY(   3),
+ AMR_SENERGY(   2), AMR_SENERGY(   1), AMR_SENERGY(   0)
 };
 
 /**
@@ -464,8 +481,8 @@ static const AMROrder * const amr_unpack
     order_MODE_DTX,
 };
 
-/** number of runs of consecutive bits for each mode */
-static const uint8_t mode_runs[N_MODES] = {
+/** number of bits for each mode */
+static const uint8_t mode_bits[N_MODES] = {
     FF_ARRAY_ELEMS(order_MODE_475),
     FF_ARRAY_ELEMS(order_MODE_515),
     FF_ARRAY_ELEMS(order_MODE_59),
@@ -477,8 +494,6 @@ static const uint8_t mode_runs[N_MODES] 
     FF_ARRAY_ELEMS(order_MODE_DTX)
 };
 
-/** number of bits for each mode */
-static const uint8_t mode_bits[N_MODES] = { 95, 103, 118, 134, 148, 159, 204, 244, 35 };
 
 /**
  * Values for the lsp vector from the 4th subframe of the

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Mon Aug 10 20:42:31 2009	(r5028)
+++ amr/amrnbdec.c	Mon Aug 10 22:02:51 2009	(r5029)
@@ -134,14 +134,6 @@ static av_cold int amrnb_decode_init(AVC
     return 0;
 }
 
-inline uint16_t reverse_bits(uint16_t x)
-{
-    x = (x & 0x00FF) << 8 | (x & 0x00FF << 8) >> 8;
-    x = (x & 0x0F0F) << 4 | (x & 0x0F0F << 4) >> 4;
-    x = (x & 0x3333) << 2 | (x & 0x3333 << 2) >> 2;
-    x = (x & 0x5555) << 1 | (x & 0x5555 << 1) >> 1;
-    return x;
-}
 
 /**
  * Unpack an RFC4867 speech frame into the AMR frame mode and parameters.
@@ -174,13 +166,8 @@ static enum Mode unpack_bitstream(AMRCon
         int i;
 
         memset(&p->frame, 0, sizeof(AMRNBFrame));
-        for (i = 0; i < mode_runs[mode]; i++) {
-            uint16_t bits = get_bits(&gb, order[i].len);
-            if (order[i].rev) {
-                data[order[i].index] += reverse_bits(bits) >> order[i].shift;
-            } else
-                data[order[i].index] += bits << order[i].shift;
-        }
+        for (i = 0; i < mode_bits[mode]; i++)
+            data[order[i].index] += get_bits1(&gb) << order[i].bit;
     }
 
     return mode;


More information about the FFmpeg-soc mailing list