[FFmpeg-soc] [soc]: r4064 - in amr: amrnbfloatdata.h amrnbfloatdec.c
kmalaussene
subversion at mplayerhq.hu
Tue Feb 17 07:56:39 CET 2009
Author: kmalaussene
Date: Tue Feb 17 07:56:39 2009
New Revision: 4064
Log:
Replace the array amr_prms and its index by a AMRNBFrame structure:
it makes the code clearer and allow for some simplifications.
Modified:
amr/amrnbfloatdata.h
amr/amrnbfloatdec.c
Modified: amr/amrnbfloatdata.h
==============================================================================
--- amr/amrnbfloatdata.h Mon Feb 16 22:42:43 2009 (r4063)
+++ amr/amrnbfloatdata.h Tue Feb 17 07:56:39 2009 (r4064)
@@ -84,186 +84,405 @@ typedef struct AMROrder {
/**************************** tables *****************************/
+/**
+ * AMRNB unpacked data subframe
+ */
+typedef struct {
+ uint16_t p_lag; ///< index to decode the pitch lag
+ uint16_t p_gain; ///< index to decode the pitch gain
+ uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_122 and MODE_795
+ uint16_t pulses[10]; ///< pulses: 10 for MODE_122, 7 for MODE_102, and index and sign for others
+} AMRNBSubframe;
+
+
+/**
+ * AMRNB unpacked data frame
+ */
+typedef struct {
+ uint16_t lsf[5]; ///< lsf parameters: 5 parameters for MODE_122, only 3 for other modes
+ AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
+} AMRNBFrame;
// The following order* tables are used to reorder the bitstream into the bit
// allocation format as in the specification. The bits are grouped into three
// classes of importance. See the specification for more information.
+#define AMR_LSF(variable, bit) {offsetof(AMRNBFrame, lsf[variable]) >> 1, bit}
+
+#define AMR_OF(frame_num, variable, bit) {offsetof(AMRNBFrame, subframe[frame_num].variable)>>1, bit}
+#define AMR_PGAIN(frame_num, bit) AMR_OF(frame_num, p_gain, bit)
+#define AMR_FIXED_GAIN(frame_num, bit) AMR_OF(frame_num, fixed_gain, bit)
+#define AMR_PLAG(frame_num, bit) AMR_OF(frame_num, p_lag, bit)
+#define AMR_PULSES(frame_num, pulse_id, bit) AMR_OF(frame_num, pulses[pulse_id], bit)
+
static const AMROrder order_MODE_475[95] = {
-{ 0, 7}, { 0, 6}, { 0, 5}, { 0, 4}, { 0, 3}, { 0, 2}, { 0, 1}, { 0, 0},
-{ 1, 7}, { 1, 6}, { 1, 5}, { 1, 4}, { 1, 3}, { 1, 2}, { 1, 1}, { 1, 0},
-{ 3, 7}, { 3, 6}, { 3, 5}, { 3, 4}, { 3, 3}, { 3, 2}, { 7, 3}, { 7, 2},
-{10, 3}, {10, 2}, {14, 3}, {14, 2}, { 6, 0}, { 6, 1}, { 6, 2}, { 6, 3},
-{13, 0}, {13, 1}, {13, 2}, {13, 3}, { 2, 5}, { 2, 4}, { 2, 2}, { 2, 0},
-{13, 4}, {13, 5}, {13, 6}, {13, 7}, { 3, 1}, { 3, 0}, { 6, 4}, { 6, 5},
-{ 6, 6}, { 6, 7}, { 5, 1}, { 5, 0}, { 2, 6}, { 2, 3}, { 2, 1}, { 7, 1},
-{ 7, 0}, { 9, 1}, { 9, 0}, {10, 1}, {10, 0}, {12, 1}, {12, 0}, {14, 1},
-{14, 0}, {16, 1}, {16, 0}, { 4, 5}, { 4, 4}, { 4, 2}, { 4, 1}, { 8, 5},
-{ 8, 4}, { 8, 2}, { 8, 1}, {11, 5}, {11, 4}, {11, 2}, {11, 1}, {15, 5},
-{15, 4}, {15, 2}, {15, 1}, { 4, 3}, { 8, 3}, {11, 3}, {15, 3}, { 4, 0},
-{ 8, 0}, {11, 0}, {15, 0}, { 4, 6}, { 8, 6}, {11, 6}, {15, 6}
+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_PULSES(0, 1, 1), AMR_PULSES(0, 1, 0),
+AMR_LSF(2, 6), AMR_LSF(2, 3), AMR_LSF(2, 1),
+AMR_PLAG(1, 1), AMR_PLAG(1, 0), AMR_PULSES(1, 1, 1), AMR_PULSES(1, 1, 0),
+AMR_PLAG(2, 1), AMR_PLAG(2, 0), AMR_PULSES(2, 1, 1), AMR_PULSES(2, 1, 0),
+AMR_PLAG(3, 1), AMR_PLAG(3, 0), AMR_PULSES(3, 1, 1), AMR_PULSES(3, 1, 0),
+AMR_PULSES(0, 0, 5), AMR_PULSES(0, 0, 4), AMR_PULSES(0, 0, 2), AMR_PULSES(0, 0, 1),
+AMR_PULSES(1, 0, 5), AMR_PULSES(1, 0, 4), AMR_PULSES(1, 0, 2), AMR_PULSES(1, 0, 1),
+AMR_PULSES(2, 0, 5), AMR_PULSES(2, 0, 4), AMR_PULSES(2, 0, 2), AMR_PULSES(2, 0, 1),
+AMR_PULSES(3, 0, 5), AMR_PULSES(3, 0, 4), AMR_PULSES(3, 0, 2), AMR_PULSES(3, 0, 1),
+AMR_PULSES(0, 0, 3), AMR_PULSES(1, 0, 3), AMR_PULSES(2, 0, 3), AMR_PULSES(3, 0, 3),
+AMR_PULSES(0, 0, 0), AMR_PULSES(1, 0, 0), AMR_PULSES(2, 0, 0), AMR_PULSES(3, 0, 0),
+AMR_PULSES(0, 0, 6), AMR_PULSES(1, 0, 6), AMR_PULSES(2, 0, 6), AMR_PULSES(3, 0, 6)
};
static const AMROrder order_MODE_515[103] = {
-{ 0, 0}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7},
-{ 1, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7},
-{ 3, 7}, { 3, 6}, { 3, 5}, { 3, 4}, { 3, 3}, { 7, 3}, {11, 3}, {15, 3},
-{ 6, 0}, { 6, 1}, { 6, 2}, {10, 0}, {10, 1}, {10, 2}, {14, 0}, {14, 1},
-{14, 2}, {18, 0}, {18, 1}, {18, 2}, { 6, 3}, {10, 3}, {14, 3}, {18, 3},
-{ 3, 2}, { 7, 2}, {11, 2}, {15, 2}, { 2, 4}, { 6, 4}, {10, 4}, {14, 4},
-{18, 4}, { 3, 1}, { 7, 1}, {11, 1}, { 2, 5}, { 2, 2}, { 2, 0}, { 6, 5},
-{10, 5}, {14, 5}, {18, 5}, { 2, 1}, { 3, 0}, { 7, 0}, {11, 0}, {15, 1},
-{ 2, 3}, { 2, 6}, {15, 0}, { 5, 0}, { 5, 1}, { 9, 0}, { 9, 1}, {13, 0},
-{ 4, 2}, { 8, 2}, {12, 2}, {16, 2}, {13, 1}, {17, 0}, {17, 1}, { 4, 1},
-{ 8, 1}, {12, 1}, {16, 1}, { 4, 5}, { 8, 5}, { 4, 4}, { 8, 4}, {12, 5},
-{12, 4}, {16, 5}, {16, 4}, { 4, 6}, { 8, 6}, {12, 6}, {16, 6}, { 4, 0},
-{ 8, 0}, {12, 0}, {16, 0}, { 4, 3}, { 8, 3}, {12, 3}, {16, 3}
+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_PULSES(0, 1, 0), AMR_PULSES(0, 1, 1), AMR_PULSES(1, 1, 0), AMR_PULSES(1, 1, 1),
+AMR_PULSES(2, 1, 0), AMR_PULSES(0, 0, 2), AMR_PULSES(1, 0, 2), AMR_PULSES(2, 0, 2),
+AMR_PULSES(3, 0, 2), AMR_PULSES(2, 1, 1), AMR_PULSES(3, 1, 0), AMR_PULSES(3, 1, 1),
+AMR_PULSES(0, 0, 1), AMR_PULSES(1, 0, 1), AMR_PULSES(2, 0, 1), AMR_PULSES(3, 0, 1),
+AMR_PULSES(0, 0, 5), AMR_PULSES(1, 0, 5), AMR_PULSES(0, 0, 4), AMR_PULSES(1, 0, 4),
+AMR_PULSES(2, 0, 5), AMR_PULSES(2, 0, 4), AMR_PULSES(3, 0, 5), AMR_PULSES(3, 0, 4),
+AMR_PULSES(0, 0, 6), AMR_PULSES(1, 0, 6), AMR_PULSES(2, 0, 6), AMR_PULSES(3, 0, 6),
+AMR_PULSES(0, 0, 0), AMR_PULSES(1, 0, 0), AMR_PULSES(2, 0, 0), AMR_PULSES(3, 0, 0),
+AMR_PULSES(0, 0, 3), AMR_PULSES(1, 0, 3), AMR_PULSES(2, 0, 3), AMR_PULSES(3, 0, 3)
};
static const AMROrder order_MODE_59[118] = {
-{ 0, 7}, { 0, 6}, { 0, 3}, { 0, 2}, { 0, 4}, { 0, 1}, { 0, 0}, { 0, 5},
-{ 1, 3}, { 1, 1}, { 1, 8}, { 1, 7}, { 1, 5}, { 1, 4}, { 1, 2}, { 1, 6},
-{ 1, 0}, { 3, 5}, {11, 5}, { 3, 4}, {11, 4}, { 3, 6}, {11, 6}, { 3, 7},
-{11, 7}, { 3, 3}, {11, 3}, { 7, 3}, {15, 3}, { 6, 0}, {10, 0}, {14, 0},
-{18, 0}, { 3, 2}, {11, 2}, { 7, 2}, {15, 2}, { 6, 1}, {10, 1}, {14, 1},
-{18, 1}, { 7, 1}, {15, 1}, { 3, 1}, {11, 1}, { 3, 0}, {11, 0}, { 6, 2},
-{10, 2}, {14, 2}, {18, 2}, { 6, 3}, {10, 3}, {14, 3}, {18, 3}, { 6, 4},
-{10, 4}, {14, 4}, {18, 4}, { 2, 6}, { 2, 4}, { 2, 2}, { 2, 3}, { 2, 7},
-{ 2, 8}, { 2, 5}, { 2, 1}, {17, 0}, { 5, 1}, {13, 1}, {17, 1}, { 9, 1},
-{ 9, 0}, { 5, 0}, {13, 0}, { 2, 0}, { 6, 5}, {10, 5}, {14, 5}, {18, 5},
-{ 7, 0}, {15, 0}, { 4, 2}, { 8, 2}, {12, 2}, {16, 2}, { 4, 3}, { 8, 3},
-{12, 3}, {16, 3}, { 4, 6}, { 8, 6}, {12, 6}, {16, 6}, { 4, 7}, { 8, 7},
-{12, 7}, {16, 7}, { 4, 8}, { 8, 8}, {12, 8}, {16, 8}, { 4, 0}, { 8, 0},
-{12, 0}, {16, 0}, { 4, 1}, { 8, 1}, {12, 1}, {16, 1}, { 4, 4}, { 8, 4},
-{12, 4}, {16, 4}, { 4, 5}, { 8, 5}, {12, 5}, {16, 5}
+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_PULSES(3, 1, 0), AMR_PULSES(0, 1, 1), AMR_PULSES(2, 1, 1), AMR_PULSES(3, 1, 1),
+AMR_PULSES(1, 1, 1), AMR_PULSES(1, 1, 0), AMR_PULSES(0, 1, 0), AMR_PULSES(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_PULSES(0, 0, 2), AMR_PULSES(1, 0, 2), AMR_PULSES(2, 0, 2), AMR_PULSES(3, 0, 2),
+AMR_PULSES(0, 0, 3), AMR_PULSES(1, 0, 3), AMR_PULSES(2, 0, 3), AMR_PULSES(3, 0, 3),
+AMR_PULSES(0, 0, 6), AMR_PULSES(1, 0, 6), AMR_PULSES(2, 0, 6), AMR_PULSES(3, 0, 6),
+AMR_PULSES(0, 0, 7), AMR_PULSES(1, 0, 7), AMR_PULSES(2, 0, 7), AMR_PULSES(3, 0, 7),
+AMR_PULSES(0, 0, 8), AMR_PULSES(1, 0, 8), AMR_PULSES(2, 0, 8), AMR_PULSES(3, 0, 8),
+AMR_PULSES(0, 0, 0), AMR_PULSES(1, 0, 0), AMR_PULSES(2, 0, 0), AMR_PULSES(3, 0, 0),
+AMR_PULSES(0, 0, 1), AMR_PULSES(1, 0, 1), AMR_PULSES(2, 0, 1), AMR_PULSES(3, 0, 1),
+AMR_PULSES(0, 0, 4), AMR_PULSES(1, 0, 4), AMR_PULSES(2, 0, 4), AMR_PULSES(3, 0, 4),
+AMR_PULSES(0, 0, 5), AMR_PULSES(1, 0, 5), AMR_PULSES(2, 0, 5), AMR_PULSES(3, 0, 5)
};
static const AMROrder order_MODE_67[134] = {
-{ 0, 7}, { 0, 6}, { 0, 3}, { 0, 4}, { 0, 2}, { 0, 1}, { 1, 3}, { 0, 0},
-{ 0, 5}, { 1, 8}, { 1, 7}, { 1, 5}, { 1, 1}, { 1, 4}, { 1, 2}, { 1, 6},
-{ 3, 5}, {11, 5}, { 3, 4}, {11, 4}, { 3, 6}, {11, 6}, { 3, 7}, {11, 7},
-{ 3, 3}, {11, 3}, { 1, 0}, { 7, 3}, {15, 3}, { 7, 2}, {15, 2}, { 3, 2},
-{11, 2}, { 7, 1}, {15, 1}, { 6, 6}, {10, 6}, {14, 6}, {18, 6}, { 3, 1},
-{11, 1}, { 6, 3}, {10, 3}, {14, 3}, {18, 3}, { 6, 2}, {10, 2}, {14, 2},
-{18, 2}, { 7, 0}, {15, 0}, { 3, 0}, {11, 0}, { 2, 6}, { 2, 2}, { 6, 1},
-{10, 1}, {14, 1}, {18, 1}, { 2, 4}, { 2, 3}, { 2, 7}, { 2, 8}, { 2, 5},
-{ 2, 1}, { 2, 0}, { 6, 4}, {10, 4}, {14, 4}, {18, 4}, { 5, 0}, { 9, 0},
-{13, 0}, {17, 0}, { 6, 0}, {10, 0}, {14, 0}, {18, 0}, { 5, 1}, { 9, 1},
-{13, 1}, {17, 1}, {18, 5}, {14, 5}, {10, 5}, { 6, 5}, { 5, 2}, { 9, 2},
-{13, 2}, {17, 2}, { 4, 2}, { 8, 2}, {12, 2}, {16, 2}, { 4, 5}, { 8, 5},
-{12, 5}, {16, 5}, { 4, 6}, { 8, 6}, {12, 6}, {16, 6}, { 4, 9}, { 8, 9},
-{12, 9}, {16, 9}, { 4,10}, { 8,10}, {12,10}, {16,10}, { 4, 0}, { 8, 0},
-{12, 0}, {16, 0}, { 4, 1}, { 8, 1}, {12, 1}, {16, 1}, { 4, 3}, { 8, 3},
-{12, 3}, {16, 3}, { 4, 4}, { 8, 4}, {12, 4}, {16, 4}, { 4, 7}, { 8, 7},
-{12, 7}, {16, 7}, { 4, 8}, { 8, 8}, {12, 8}, {16, 8}
+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_PULSES(0, 1, 0), AMR_PULSES(1, 1, 0),
+AMR_PULSES(2, 1, 0), AMR_PULSES(3, 1, 0), AMR_PGAIN(0, 0), AMR_PGAIN(1, 0), AMR_PGAIN(2, 0), AMR_PGAIN(3, 0), AMR_PULSES(0, 1, 1), AMR_PULSES(1, 1, 1),
+AMR_PULSES(2, 1, 1), AMR_PULSES(3, 1, 1), AMR_PGAIN(3, 5), AMR_PGAIN(2, 5), AMR_PGAIN(1, 5), AMR_PGAIN(0, 5), AMR_PULSES(0, 1, 2), AMR_PULSES(1, 1, 2),
+AMR_PULSES(2, 1, 2), AMR_PULSES(3, 1, 2), AMR_PULSES(0, 0, 2), AMR_PULSES(1, 0, 2), AMR_PULSES(2, 0, 2), AMR_PULSES(3, 0, 2), AMR_PULSES(0, 0, 5), AMR_PULSES(1, 0, 5),
+AMR_PULSES(2, 0, 5), AMR_PULSES(3, 0, 5), AMR_PULSES(0, 0, 6), AMR_PULSES(1, 0, 6), AMR_PULSES(2, 0, 6), AMR_PULSES(3, 0, 6), AMR_PULSES(0, 0, 9), AMR_PULSES(1, 0, 9),
+AMR_PULSES(2, 0, 9), AMR_PULSES(3, 0, 9), AMR_PULSES(0, 0, 10), AMR_PULSES(1, 0, 10), AMR_PULSES(2, 0, 10), AMR_PULSES(3, 0, 10), AMR_PULSES(0, 0, 0), AMR_PULSES(1, 0, 0),
+AMR_PULSES(2, 0, 0), AMR_PULSES(3, 0, 0), AMR_PULSES(0, 0, 1), AMR_PULSES(1, 0, 1), AMR_PULSES(2, 0, 1), AMR_PULSES(3, 0, 1), AMR_PULSES(0, 0, 3), AMR_PULSES(1, 0, 3),
+AMR_PULSES(2, 0, 3), AMR_PULSES(3, 0, 3), AMR_PULSES(0, 0, 4), AMR_PULSES(1, 0, 4), AMR_PULSES(2, 0, 4), AMR_PULSES(3, 0, 4), AMR_PULSES(0, 0, 7), AMR_PULSES(1, 0, 7),
+AMR_PULSES(2, 0, 7), AMR_PULSES(3, 0, 7), AMR_PULSES(0, 0, 8), AMR_PULSES(1, 0, 8), AMR_PULSES(2, 0, 8), AMR_PULSES(3, 0, 8)
};
static const AMROrder order_MODE_74[148] = {
-{ 0, 7}, { 0, 6}, { 0, 5}, { 0, 4}, { 0, 3}, { 0, 2}, { 0, 1}, { 0, 0},
-{ 1, 8}, { 1, 7}, { 1, 6}, { 1, 5}, { 1, 4}, { 1, 3}, { 1, 2}, { 1, 1},
-{ 1, 0}, { 3, 7}, {11, 7}, { 3, 6}, {11, 6}, { 3, 5}, {11, 5}, { 3, 4},
-{11, 4}, { 3, 3}, {11, 3}, { 6, 6}, {10, 6}, {14, 6}, {18, 6}, { 6, 5},
-{10, 5}, {14, 5}, {18, 5}, { 6, 3}, {10, 3}, {14, 3}, {18, 3}, { 6, 2},
-{10, 2}, {14, 2}, {18, 2}, { 7, 4}, {15, 4}, { 7, 3}, {15, 3}, { 2, 4},
-{ 2, 3}, { 2, 2}, { 2, 8}, { 2, 7}, { 2, 6}, { 3, 2}, { 7, 2}, {11, 2},
-{15, 2}, { 6, 1}, {10, 1}, {14, 1}, {18, 1}, { 2, 5}, { 2, 1}, { 2, 0},
-{ 5, 0}, { 9, 0}, {13, 0}, {17, 0}, { 6, 0}, {10, 0}, {14, 0}, {18, 0},
-{ 5, 1}, { 9, 1}, {13, 1}, {17, 1}, { 5, 2}, { 9, 2}, { 6, 4}, {10, 4},
-{14, 4}, {18, 4}, {13, 2}, {17, 2}, { 5, 3}, { 9, 3}, {13, 3}, {17, 3},
-{ 3, 1}, { 3, 0}, { 7, 1}, { 7, 0}, {11, 1}, {11, 0}, {15, 1}, {15, 0},
-{ 4, 5}, { 4, 4}, { 4, 3}, { 4, 2}, { 4, 1}, { 4, 0}, { 8, 5}, { 8, 4},
-{ 8, 3}, { 8, 2}, { 8, 1}, { 8, 0}, {12, 5}, {12, 4}, {12, 3}, {12, 2},
-{12, 1}, {12, 0}, {16, 5}, {16, 4}, {16, 3}, {16, 2}, {16, 1}, {16, 0},
-{ 4,12}, { 8,12}, {12,12}, {16,12}, { 4,11}, { 8,11}, {12,11}, {16,11},
-{ 4,10}, { 8,10}, {12,10}, {16,10}, { 4, 9}, { 8, 9}, {12, 9}, {16, 9},
-{ 4, 8}, { 8, 8}, {12, 8}, {16, 8}, { 4, 7}, { 8, 7}, {12, 7}, {16, 7},
-{ 4, 6}, { 8, 6}, {12, 6}, {16, 6}
+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_PULSES(0, 1, 0), AMR_PULSES(1, 1, 0), AMR_PULSES(2, 1, 0), AMR_PULSES(3, 1, 0),
+AMR_PGAIN(0, 0), AMR_PGAIN(1, 0), AMR_PGAIN(2, 0), AMR_PGAIN(3, 0),
+AMR_PULSES(0, 1, 1), AMR_PULSES(1, 1, 1), AMR_PULSES(2, 1, 1), AMR_PULSES(3, 1, 1),
+AMR_PULSES(0, 1, 2), AMR_PULSES(1, 1, 2),
+AMR_PGAIN(0, 4), AMR_PGAIN(1, 4), AMR_PGAIN(2, 4), AMR_PGAIN(3, 4),
+AMR_PULSES(2, 1, 2), AMR_PULSES(3, 1, 2), AMR_PULSES(0, 1, 3), AMR_PULSES(1, 1, 3),
+AMR_PULSES(2, 1, 3), AMR_PULSES(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_PULSES(0, 0, 5), AMR_PULSES(0, 0, 4), AMR_PULSES(0, 0, 3), AMR_PULSES(0, 0, 2), AMR_PULSES(0, 0, 1), AMR_PULSES(0, 0, 0),
+AMR_PULSES(1, 0, 5), AMR_PULSES(1, 0, 4), AMR_PULSES(1, 0, 3), AMR_PULSES(1, 0, 2), AMR_PULSES(1, 0, 1), AMR_PULSES(1, 0, 0),
+AMR_PULSES(2, 0, 5), AMR_PULSES(2, 0, 4), AMR_PULSES(2, 0, 3), AMR_PULSES(2, 0, 2), AMR_PULSES(2, 0, 1), AMR_PULSES(2, 0, 0),
+AMR_PULSES(3, 0, 5), AMR_PULSES(3, 0, 4), AMR_PULSES(3, 0, 3), AMR_PULSES(3, 0, 2), AMR_PULSES(3, 0, 1), AMR_PULSES(3, 0, 0),
+AMR_PULSES(0, 0, 12), AMR_PULSES(1, 0, 12), AMR_PULSES(2, 0, 12), AMR_PULSES(3, 0, 12),
+AMR_PULSES(0, 0, 11), AMR_PULSES(1, 0, 11), AMR_PULSES(2, 0, 11), AMR_PULSES(3, 0, 11),
+AMR_PULSES(0, 0, 10), AMR_PULSES(1, 0, 10), AMR_PULSES(2, 0, 10), AMR_PULSES(3, 0, 10),
+AMR_PULSES(0, 0, 9), AMR_PULSES(1, 0, 9), AMR_PULSES(2, 0, 9), AMR_PULSES(3, 0, 9),
+AMR_PULSES(0, 0, 8), AMR_PULSES(1, 0, 8), AMR_PULSES(2, 0, 8), AMR_PULSES(3, 0, 8),
+AMR_PULSES(0, 0, 7), AMR_PULSES(1, 0, 7), AMR_PULSES(2, 0, 7), AMR_PULSES(3, 0, 7),
+AMR_PULSES(0, 0, 6), AMR_PULSES(1, 0, 6), AMR_PULSES(2, 0, 6), AMR_PULSES(3, 0, 6)
};
static const AMROrder order_MODE_795[159] = {
-{ 0, 0}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 1, 3},
-{ 1, 1}, { 1, 8}, { 1, 7}, { 1, 5}, { 1, 4}, { 1, 2}, { 1, 6}, { 1, 0},
-{ 2, 6}, { 2, 4}, { 2, 2}, { 2, 3}, { 2, 7}, { 2, 8}, { 2, 5}, { 7, 4},
-{12, 4}, {17, 4}, {22, 4}, { 7, 3}, {12, 3}, {17, 3}, {22, 3}, { 7, 2},
-{12, 2}, {17, 2}, {22, 2}, { 6, 3}, {11, 3}, {16, 3}, {21, 3}, { 6, 2},
-{11, 2}, {16, 2}, {21, 2}, { 3, 7}, {13, 7}, { 3, 6}, {13, 6}, { 3, 5},
-{13, 5}, { 3, 4}, {13, 4}, { 3, 3}, {13, 3}, { 8, 5}, {18, 5}, { 8, 4},
-{18, 4}, { 8, 3}, {18, 3}, { 7, 1}, {12, 1}, {17, 1}, {22, 1}, { 3, 2},
-{13, 2}, { 8, 2}, {18, 2}, { 0, 7}, { 0, 8}, { 2, 1}, { 2, 0}, { 3, 1},
-{13, 1}, { 3, 0}, {13, 0}, { 8, 1}, {18, 1}, { 8, 0}, {18, 0}, { 6, 1},
-{11, 1}, {16, 1}, {21, 1}, { 7, 0}, {12, 0}, {17, 0}, {22, 0}, { 6, 0},
-{11, 0}, {16, 0}, {21, 0}, {15, 0}, {15, 1}, {15, 2}, { 4, 1}, { 9, 1},
-{14, 1}, {19, 1}, { 4, 4}, { 9, 4}, {14, 4}, {19, 4}, { 4, 7}, { 9, 7},
-{14, 7}, {19, 7}, { 4,11}, { 9,11}, {14,11}, {19,11}, {15, 3}, {20, 0},
-{20, 1}, {20, 2}, {20, 3}, {10, 0}, {10, 1}, {10, 2}, {10, 3}, { 5, 0},
-{ 5, 1}, { 5, 2}, { 5, 3}, { 4, 0}, { 4, 2}, { 4, 3}, { 4, 5}, { 4, 8},
-{ 4,12}, { 9, 0}, { 9, 2}, { 9, 3}, { 9, 5}, { 9, 8}, { 9,12}, {14, 0},
-{14, 2}, {14, 3}, {14, 5}, {14, 8}, {14,12}, {19, 0}, {19, 2}, {19, 3},
-{19, 5}, {19, 8}, {19,12}, { 4, 6}, { 9, 6}, {14, 6}, {19, 6}, { 4,10},
-{ 9,10}, {14,10}, {19,10}, { 4, 9}, { 9, 9}, {14, 9}, {19, 9}
+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_FIXED_GAIN(0, 4), AMR_FIXED_GAIN(1, 4), AMR_FIXED_GAIN(2, 4), AMR_FIXED_GAIN(3, 4),
+AMR_FIXED_GAIN(0, 3), AMR_FIXED_GAIN(1, 3), AMR_FIXED_GAIN(2, 3), AMR_FIXED_GAIN(3, 3),
+AMR_FIXED_GAIN(0, 2), AMR_FIXED_GAIN(1, 2), AMR_FIXED_GAIN(2, 2), AMR_FIXED_GAIN(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_FIXED_GAIN(0, 1), AMR_FIXED_GAIN(1, 1), AMR_FIXED_GAIN(2, 1), AMR_FIXED_GAIN(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_FIXED_GAIN(0, 0), AMR_FIXED_GAIN(1, 0), AMR_FIXED_GAIN(2, 0), AMR_FIXED_GAIN(3, 0),
+AMR_PGAIN(0, 0), AMR_PGAIN(1, 0), AMR_PGAIN(2, 0), AMR_PGAIN(3, 0),
+AMR_PULSES(2, 1, 0), AMR_PULSES(2, 1, 1), AMR_OF(2, pulses[1], 2),
+AMR_PULSES(0, 0, 1), AMR_PULSES(1, 0, 1), AMR_PULSES(2, 0, 1), AMR_PULSES(3, 0, 1),
+AMR_PULSES(0, 0, 4), AMR_PULSES(1, 0, 4), AMR_PULSES(2, 0, 4), AMR_PULSES(3, 0, 4),
+AMR_PULSES(0, 0, 7), AMR_PULSES(1, 0, 7), AMR_PULSES(2, 0, 7), AMR_PULSES(3, 0, 7),
+AMR_PULSES(0, 0, 11), AMR_PULSES(1, 0, 11), AMR_PULSES(2, 0, 11), AMR_PULSES(3, 0, 11),
+AMR_OF(2, pulses[1], 3),
+AMR_PULSES(3, 1, 0), AMR_PULSES(3, 1, 1), AMR_PULSES(3, 1, 2), AMR_PULSES(3, 1, 3),
+AMR_PULSES(1, 1, 0), AMR_PULSES(1, 1, 1), AMR_PULSES(1, 1, 2), AMR_PULSES(1, 1, 3),
+AMR_PULSES(0, 1, 0), AMR_PULSES(0, 1, 1), AMR_PULSES(0, 1, 2), AMR_PULSES(0, 1, 3),
+AMR_PULSES(0, 0, 0), AMR_PULSES(0, 0, 2), AMR_PULSES(0, 0, 3), AMR_PULSES(0, 0, 5),
+AMR_PULSES(0, 0, 8), AMR_PULSES(0, 0, 12),
+AMR_PULSES(1, 0, 0), AMR_PULSES(1, 0, 2), AMR_PULSES(1, 0, 3), AMR_PULSES(1, 0, 5), AMR_PULSES(1, 0, 8), AMR_PULSES(1, 0, 12),
+AMR_PULSES(2, 0, 0), AMR_PULSES(2, 0, 2), AMR_PULSES(2, 0, 3), AMR_PULSES(2, 0, 5), AMR_PULSES(2, 0, 8), AMR_PULSES(2, 0, 12),
+AMR_PULSES(3, 0, 0), AMR_PULSES(3, 0, 2), AMR_PULSES(3, 0, 3), AMR_PULSES(3, 0, 5), AMR_PULSES(3, 0, 8), AMR_PULSES(3, 0, 12),
+AMR_PULSES(0, 0, 6), AMR_PULSES(1, 0, 6), AMR_PULSES(2, 0, 6), AMR_PULSES(3, 0, 6),
+AMR_PULSES(0, 0, 10), AMR_PULSES(1, 0, 10), AMR_PULSES(2, 0, 10), AMR_PULSES(3, 0, 10),
+AMR_PULSES(0, 0, 9), AMR_PULSES(1, 0, 9), AMR_PULSES(2, 0, 9), AMR_OF(3, pulses[0], 9)
};
static const AMROrder order_MODE_102[204] = {
-{ 0, 0}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7},
-{ 1, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7},
-{ 1, 8}, { 3, 7}, { 3, 6}, { 3, 5}, { 3, 4}, { 3, 3}, { 3, 2}, {21, 7},
-{21, 6}, {21, 5}, {21, 4}, {21, 3}, {21, 2}, {12, 4}, {12, 3}, {30, 4},
-{30, 3}, {11, 6}, {11, 3}, {11, 2}, {20, 6}, {20, 3}, {20, 2}, {29, 6},
-{29, 3}, {29, 2}, {38, 6}, {38, 3}, {38, 2}, { 3, 1}, { 3, 0}, {21, 1},
-{21, 0}, {12, 2}, {12, 1}, {30, 2}, {30, 1}, {11, 5}, {20, 5}, {29, 5},
-{38, 5}, { 2, 6}, { 2, 2}, { 2, 4}, { 2, 3}, { 2, 7}, { 2, 8}, { 2, 5},
-{ 2, 1}, { 2, 0}, { 7, 0}, { 6, 0}, { 5, 0}, { 4, 0}, {16, 0}, {15, 0},
-{14, 0}, {13, 0}, {25, 0}, {24, 0}, {23, 0}, {22, 0}, {34, 0}, {33, 0},
-{32, 0}, {31, 0}, {11, 1}, {11, 4}, {11, 0}, {20, 1}, {20, 4}, {20, 0},
-{29, 1}, {29, 4}, {29, 0}, {38, 1}, {38, 4}, {38, 0}, {12, 0}, {30, 0},
-{17, 9}, {17, 8}, {18, 8}, {18, 9}, {18, 7}, {17, 7}, {18, 5}, {17, 5},
-{17, 6}, {18, 6}, {19, 6}, {19, 5}, {18, 4}, {19, 3}, {17, 4}, {19, 4},
-{17, 3}, {18, 3}, {26, 9}, {26, 8}, {27, 8}, {27, 9}, {27, 7}, {26, 7},
-{27, 5}, {26, 5}, {26, 6}, {27, 6}, {28, 6}, {28, 5}, {27, 4}, {28, 3},
-{26, 4}, {28, 4}, {26, 3}, {27, 3}, {35, 9}, {35, 8}, {36, 8}, {36, 9},
-{36, 7}, {35, 7}, {36, 5}, {35, 5}, {35, 6}, {36, 6}, {37, 6}, {37, 5},
-{36, 4}, {37, 3}, {35, 4}, {37, 4}, {35, 3}, {36, 3}, { 8, 9}, { 8, 8},
-{ 9, 8}, { 9, 9}, { 9, 7}, { 8, 7}, { 9, 5}, { 8, 5}, { 8, 6}, { 9, 6},
-{10, 6}, {10, 5}, { 9, 4}, {10, 3}, { 8, 4}, {10, 4}, { 8, 3}, { 9, 3},
-{37, 2}, {35, 0}, {36, 0}, {37, 0}, {35, 2}, {37, 1}, {35, 1}, {36, 2},
-{36, 1}, {28, 2}, {26, 0}, {27, 0}, {28, 0}, {26, 2}, {28, 1}, {26, 1},
-{27, 2}, {27, 1}, {19, 2}, {17, 0}, {18, 0}, {19, 0}, {17, 2}, {19, 1},
-{17, 1}, {18, 2}, {18, 1}, {10, 2}, { 8, 0}, { 9, 0}, {10, 0}, { 8, 2},
-{10, 1}, { 8, 1}, { 9, 2}, { 9, 1}
+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_PULSES(0, 3, 0), AMR_PULSES(0, 2, 0), AMR_PULSES(0, 1, 0), AMR_PULSES(0, 0, 0),
+AMR_PULSES(1, 3, 0), AMR_PULSES(1, 2, 0), AMR_PULSES(1, 1, 0), AMR_PULSES(1, 0, 0),
+AMR_PULSES(2, 3, 0), AMR_PULSES(2, 2, 0), AMR_PULSES(2, 1, 0), AMR_PULSES(2, 0, 0),
+AMR_PULSES(3, 3, 0), AMR_PULSES(3, 2, 0), AMR_PULSES(3, 1, 0), AMR_PULSES(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_PULSES(1, 4, 9), AMR_PULSES(1, 4, 8), AMR_PULSES(1, 5, 8), AMR_PULSES(1, 5, 9),
+AMR_PULSES(1, 5, 7), AMR_PULSES(1, 4, 7), AMR_PULSES(1, 5, 5), AMR_PULSES(1, 4, 5),
+AMR_PULSES(1, 4, 6), AMR_PULSES(1, 5, 6), AMR_PULSES(1, 6, 6), AMR_PULSES(1, 6, 5),
+AMR_PULSES(1, 5, 4), AMR_PULSES(1, 6, 3), AMR_PULSES(1, 4, 4), AMR_PULSES(1, 6, 4),
+AMR_PULSES(1, 4, 3), AMR_PULSES(1, 5, 3),
+AMR_PULSES(2, 4, 9), AMR_PULSES(2, 4, 8), AMR_PULSES(2, 5, 8), AMR_PULSES(2, 5, 9),
+AMR_PULSES(2, 5, 7), AMR_PULSES(2, 4, 7), AMR_PULSES(2, 5, 5), AMR_PULSES(2, 4, 5),
+AMR_PULSES(2, 4, 6), AMR_PULSES(2, 5, 6), AMR_PULSES(2, 6, 6), AMR_PULSES(2, 6, 5),
+AMR_PULSES(2, 5, 4), AMR_PULSES(2, 6, 3), AMR_PULSES(2, 4, 4), AMR_PULSES(2, 6, 4),
+AMR_PULSES(2, 4, 3), AMR_PULSES(2, 5, 3),
+AMR_PULSES(3, 4, 9), AMR_PULSES(3, 4, 8), AMR_PULSES(3, 5, 8), AMR_PULSES(3, 5, 9),
+AMR_PULSES(3, 5, 7), AMR_PULSES(3, 4, 7), AMR_PULSES(3, 5, 5), AMR_PULSES(3, 4, 5),
+AMR_PULSES(3, 4, 6), AMR_PULSES(3, 5, 6), AMR_PULSES(3, 6, 6), AMR_PULSES(3, 6, 5),
+AMR_PULSES(3, 5, 4), AMR_PULSES(3, 6, 3), AMR_PULSES(3, 4, 4), AMR_PULSES(3, 6, 4),
+AMR_PULSES(3, 4, 3), AMR_PULSES(3, 5, 3),
+AMR_PULSES(0, 4, 9), AMR_PULSES(0, 4, 8), AMR_PULSES(0, 5, 8), AMR_PULSES(0, 5, 9),
+AMR_PULSES(0, 5, 7), AMR_PULSES(0, 4, 7), AMR_PULSES(0, 5, 5), AMR_PULSES(0, 4, 5),
+AMR_PULSES(0, 4, 6), AMR_PULSES(0, 5, 6), AMR_PULSES(0, 6, 6), AMR_PULSES(0, 6, 5),
+AMR_PULSES(0, 5, 4), AMR_PULSES(0, 6, 3), AMR_PULSES(0, 4, 4), AMR_PULSES(0, 6, 4),
+AMR_PULSES(0, 4, 3), AMR_PULSES(0, 5, 3),
+AMR_PULSES(3, 6, 2), AMR_PULSES(3, 4, 0), AMR_PULSES(3, 5, 0), AMR_PULSES(3, 6, 0),
+AMR_PULSES(3, 4, 2), AMR_PULSES(3, 6, 1), AMR_PULSES(3, 4, 1), AMR_PULSES(3, 5, 2),
+AMR_PULSES(3, 5, 1),
+AMR_PULSES(2, 6, 2), AMR_PULSES(2, 4, 0), AMR_PULSES(2, 5, 0), AMR_PULSES(2, 6, 0),
+AMR_PULSES(2, 4, 2), AMR_PULSES(2, 6, 1), AMR_PULSES(2, 4, 1), AMR_PULSES(2, 5, 2),
+AMR_PULSES(2, 5, 1),
+AMR_PULSES(1, 6, 2), AMR_PULSES(1, 4, 0), AMR_PULSES(1, 5, 0), AMR_PULSES(1, 6, 0),
+AMR_PULSES(1, 4, 2), AMR_PULSES(1, 6, 1), AMR_PULSES(1, 4, 1), AMR_PULSES(1, 5, 2),
+AMR_PULSES(1, 5, 1),
+AMR_PULSES(0, 6, 2), AMR_PULSES(0, 4, 0), AMR_PULSES(0, 5, 0), AMR_PULSES(0, 6, 0),
+AMR_PULSES(0, 4, 2), AMR_PULSES(0, 6, 1), AMR_PULSES(0, 4, 1), AMR_PULSES(0, 5, 2),
+AMR_PULSES(0, 5, 1)
};
static const AMROrder order_MODE_122[244] = {
-{ 0, 6}, { 0, 5}, { 0, 4}, { 0, 3}, { 0, 2}, { 0, 1}, { 0, 0}, { 1, 7},
-{ 1, 6}, { 1, 5}, { 1, 4}, { 1, 3}, { 1, 2}, { 1, 1}, { 1, 0}, { 2, 0},
-{ 2, 8}, { 2, 7}, { 2, 6}, { 2, 5}, { 2, 4}, { 2, 3}, { 2, 2}, { 2, 1},
-{ 3, 7}, { 3, 6}, { 3, 5}, { 3, 4}, { 3, 3}, { 5, 8}, {31, 8}, { 5, 7},
-{31, 7}, { 5, 6}, {31, 6}, { 5, 5}, {31, 5}, { 5, 4}, {31, 4}, { 5, 3},
-{31, 3}, { 5, 2}, {31, 2}, { 5, 1}, {31, 1}, { 5, 0}, {31, 0}, { 6, 3},
-{19, 3}, {32, 3}, {45, 3}, { 6, 2}, {19, 2}, {32, 2}, {45, 2}, { 6, 1},
-{19, 1}, {32, 1}, {45, 1}, {17, 4}, {30, 4}, {43, 4}, {56, 4}, {17, 3},
-{30, 3}, {43, 3}, {56, 3}, {17, 2}, {30, 2}, {43, 2}, {56, 2}, {18, 5},
-{44, 5}, {18, 4}, {44, 4}, {18, 3}, {44, 3}, {18, 2}, {44, 2}, {18, 1},
-{44, 1}, { 3, 2}, { 3, 1}, { 3, 0}, { 4, 5}, { 4, 4}, { 4, 3}, { 4, 2},
-{ 6, 0}, {19, 0}, {32, 0}, {45, 0}, {17, 1}, {30, 1}, {43, 1}, {56, 1},
-{ 7, 3}, {20, 3}, {33, 3}, {46, 3}, { 8, 3}, {21, 3}, {34, 3}, {47, 3},
-{17, 0}, {30, 0}, {43, 0}, {56, 0}, { 9, 3}, {22, 3}, {35, 3}, {48, 3},
-{10, 3}, {23, 3}, {36, 3}, {49, 3}, {11, 3}, {24, 3}, {37, 3}, {50, 3},
-{ 4, 1}, { 4, 0}, { 7, 0}, { 7, 1}, { 7, 2}, { 8, 0}, { 8, 1}, { 8, 2},
-{ 9, 0}, { 9, 1}, { 9, 2}, {10, 0}, {10, 1}, {10, 2}, {11, 0}, {11, 1},
-{11, 2}, {20, 0}, {20, 1}, {20, 2}, {21, 0}, {21, 1}, {21, 2}, {22, 0},
-{22, 1}, {22, 2}, {23, 0}, {23, 1}, {23, 2}, {24, 0}, {24, 1}, {24, 2},
-{33, 0}, {33, 1}, {33, 2}, {34, 0}, {34, 1}, {34, 2}, {35, 0}, {35, 1},
-{35, 2}, {36, 0}, {36, 1}, {36, 2}, {37, 0}, {37, 1}, {37, 2}, {46, 0},
-{46, 1}, {46, 2}, {47, 0}, {47, 1}, {47, 2}, {48, 0}, {48, 1}, {48, 2},
-{49, 0}, {49, 1}, {49, 2}, {50, 0}, {50, 1}, {50, 2}, {12, 0}, {12, 1},
-{12, 2}, {13, 0}, {13, 1}, {13, 2}, {14, 0}, {14, 1}, {14, 2}, {15, 0},
-{15, 1}, {15, 2}, {16, 0}, {16, 1}, {16, 2}, {25, 0}, {25, 1}, {25, 2},
-{26, 0}, {26, 1}, {26, 2}, {27, 0}, {27, 1}, {27, 2}, {28, 0}, {28, 1},
-{28, 2}, {29, 0}, {29, 1}, {29, 2}, {38, 0}, {38, 1}, {38, 2}, {39, 0},
-{39, 1}, {39, 2}, {40, 0}, {40, 1}, {40, 2}, {41, 0}, {41, 1}, {41, 2},
-{42, 0}, {42, 1}, {42, 2}, {51, 0}, {51, 1}, {51, 2}, {52, 0}, {52, 1},
-{52, 2}, {53, 0}, {53, 1}, {53, 2}, {54, 0}, {54, 1}, {54, 2}, {55, 0},
-{55, 1}, {55, 2}, {18, 0}, {44, 0}
+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_FIXED_GAIN(0, 4), AMR_FIXED_GAIN(1, 4), AMR_FIXED_GAIN(2, 4), AMR_FIXED_GAIN(3, 4),
+AMR_FIXED_GAIN(0, 3), AMR_FIXED_GAIN(1, 3), AMR_FIXED_GAIN(2, 3), AMR_FIXED_GAIN(3, 3),
+AMR_FIXED_GAIN(0, 2), AMR_FIXED_GAIN(1, 2), AMR_FIXED_GAIN(2, 2), AMR_FIXED_GAIN(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_FIXED_GAIN(0, 1), AMR_FIXED_GAIN(1, 1), AMR_FIXED_GAIN(2, 1), AMR_FIXED_GAIN(3, 1),
+AMR_PULSES(0, 0, 3), AMR_PULSES(1, 0, 3), AMR_PULSES(2, 0, 3), AMR_PULSES(3, 0, 3),
+AMR_PULSES(0, 1, 3), AMR_PULSES(1, 1, 3), AMR_PULSES(2, 1, 3), AMR_PULSES(3, 1, 3),
+AMR_FIXED_GAIN(0, 0), AMR_FIXED_GAIN(1, 0), AMR_FIXED_GAIN(2, 0), AMR_FIXED_GAIN(3, 0),
+AMR_PULSES(0, 2, 3), AMR_PULSES(1, 2, 3), AMR_PULSES(2, 2, 3), AMR_PULSES(3, 2, 3),
+AMR_PULSES(0, 3, 3), AMR_PULSES(1, 3, 3), AMR_PULSES(2, 3, 3), AMR_PULSES(3, 3, 3),
+AMR_PULSES(0, 4, 3), AMR_PULSES(1, 4, 3), AMR_PULSES(2, 4, 3), AMR_PULSES(3, 4, 3),
+AMR_LSF(4, 1), AMR_LSF(4, 0),
+AMR_PULSES(0, 0, 0), AMR_PULSES(0, 0, 1), AMR_PULSES(0, 0, 2),
+AMR_PULSES(0, 1, 0), AMR_PULSES(0, 1, 1), AMR_PULSES(0, 1, 2),
+AMR_PULSES(0, 2, 0), AMR_PULSES(0, 2, 1), AMR_PULSES(0, 2, 2),
+AMR_PULSES(0, 3, 0), AMR_PULSES(0, 3, 1), AMR_PULSES(0, 3, 2),
+AMR_PULSES(0, 4, 0), AMR_PULSES(0, 4, 1), AMR_PULSES(0, 4, 2),
+AMR_PULSES(1, 0, 0), AMR_PULSES(1, 0, 1), AMR_PULSES(1, 0, 2),
+AMR_PULSES(1, 1, 0), AMR_PULSES(1, 1, 1), AMR_PULSES(1, 1, 2),
+AMR_PULSES(1, 2, 0), AMR_PULSES(1, 2, 1), AMR_PULSES(1, 2, 2),
+AMR_PULSES(1, 3, 0), AMR_PULSES(1, 3, 1), AMR_PULSES(1, 3, 2),
+AMR_PULSES(1, 4, 0), AMR_PULSES(1, 4, 1), AMR_PULSES(1, 4, 2),
+AMR_PULSES(2, 0, 0), AMR_PULSES(2, 0, 1), AMR_PULSES(2, 0, 2),
+AMR_PULSES(2, 1, 0), AMR_PULSES(2, 1, 1), AMR_PULSES(2, 1, 2),
+AMR_PULSES(2, 2, 0), AMR_PULSES(2, 2, 1), AMR_PULSES(2, 2, 2),
+AMR_PULSES(2, 3, 0), AMR_PULSES(2, 3, 1), AMR_PULSES(2, 3, 2),
+AMR_PULSES(2, 4, 0), AMR_PULSES(2, 4, 1), AMR_PULSES(2, 4, 2),
+AMR_PULSES(3, 0, 0), AMR_PULSES(3, 0, 1), AMR_PULSES(3, 0, 2),
+AMR_PULSES(3, 1, 0), AMR_PULSES(3, 1, 1), AMR_PULSES(3, 1, 2),
+AMR_PULSES(3, 2, 0), AMR_PULSES(3, 2, 1), AMR_PULSES(3, 2, 2),
+AMR_PULSES(3, 3, 0), AMR_PULSES(3, 3, 1), AMR_PULSES(3, 3, 2),
+AMR_PULSES(3, 4, 0), AMR_PULSES(3, 4, 1), AMR_PULSES(3, 4, 2),
+AMR_PULSES(0, 5, 0), AMR_PULSES(0, 5, 1), AMR_PULSES(0, 5, 2),
+AMR_PULSES(0, 6, 0), AMR_PULSES(0, 6, 1), AMR_PULSES(0, 6, 2),
+AMR_PULSES(0, 7, 0), AMR_PULSES(0, 7, 1), AMR_PULSES(0, 7, 2),
+AMR_PULSES(0, 8, 0), AMR_PULSES(0, 8, 1), AMR_PULSES(0, 8, 2),
+AMR_PULSES(0, 9, 0), AMR_PULSES(0, 9, 1), AMR_PULSES(0, 9, 2),
+AMR_PULSES(1, 5, 0), AMR_PULSES(1, 5, 1), AMR_PULSES(1, 5, 2),
+AMR_PULSES(1, 6, 0), AMR_PULSES(1, 6, 1), AMR_PULSES(1, 6, 2),
+AMR_PULSES(1, 7, 0), AMR_PULSES(1, 7, 1), AMR_PULSES(1, 7, 2),
+AMR_PULSES(1, 8, 0), AMR_PULSES(1, 8, 1), AMR_PULSES(1, 8, 2),
+AMR_PULSES(1, 9, 0), AMR_PULSES(1, 9, 1), AMR_PULSES(1, 9, 2),
+AMR_PULSES(2, 5, 0), AMR_PULSES(2, 5, 1), AMR_PULSES(2, 5, 2),
+AMR_PULSES(2, 6, 0), AMR_PULSES(2, 6, 1), AMR_PULSES(2, 6, 2),
+AMR_PULSES(2, 7, 0), AMR_PULSES(2, 7, 1), AMR_PULSES(2, 7, 2),
+AMR_PULSES(2, 8, 0), AMR_PULSES(2, 8, 1), AMR_PULSES(2, 8, 2),
+AMR_PULSES(2, 9, 0), AMR_PULSES(2, 9, 1), AMR_PULSES(2, 9, 2),
+AMR_PULSES(3, 5, 0), AMR_PULSES(3, 5, 1), AMR_PULSES(3, 5, 2),
+AMR_PULSES(3, 6, 0), AMR_PULSES(3, 6, 1), AMR_PULSES(3, 6, 2),
+AMR_PULSES(3, 7, 0), AMR_PULSES(3, 7, 1), AMR_PULSES(3, 7, 2),
+AMR_PULSES(3, 8, 0), AMR_PULSES(3, 8, 1), AMR_PULSES(3, 8, 2),
+AMR_PULSES(3, 9, 0), AMR_PULSES(3, 9, 1), AMR_PULSES(3, 9, 2),
+AMR_PLAG(1, 0), AMR_PLAG(3, 0)
};
static const AMROrder order_MODE_DTX[35] = {
Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c Mon Feb 16 22:42:43 2009 (r4063)
+++ amr/amrnbfloatdec.c Tue Feb 17 07:56:39 2009 (r4064)
@@ -42,7 +42,7 @@ typedef struct AMRContext {
GetBitContext gb;
- int16_t amr_prms[PRMS_MODE_122]; ///< decoded AMR parameters (lsf coefficients, codebook indexes, etc)
+ AMRNBFrame frame; ///< decoded AMR parameters (lsf coefficients, codebook indexes, etc)
int bad_frame_indicator; ///< bad frame ? 1 : 0
int cur_frame_mode; ///< current frame mode
int cur_frame_type; ///< current frame type
@@ -140,9 +140,6 @@ enum Mode decode_bitstream(AMRContext *p
int i;
const AMROrder *order;
- // reset amr_prms
- memset(p->amr_prms, 0, PRMS_MODE_122 * sizeof(int16_t));
-
// initialize get_bits
init_get_bits(&p->gb, buf, buf_size*8);
skip_bits(&p->gb, 1);
@@ -199,8 +196,11 @@ enum Mode decode_bitstream(AMRContext *p
// reorder the bitstream to match the bit allocation in the specification
if((p->cur_frame_type != RX_NO_DATA) && (p->cur_frame_type != RX_SPEECH_BAD)) {
+ uint16_t *data = (uint16_t *)&p->frame;
+
+ memset(&p->frame, 0, sizeof(AMRNBFrame));
for(i=0; i<mode_bits[mode]; i++) {
- p->amr_prms[ order[i].array_element ] += get_bits1(&p->gb) * (1<< order[i].bit_mask);
+ data[order[i].array_element] += get_bits1(&p->gb) * (1<< order[i].bit_mask);
}
}
@@ -278,21 +278,22 @@ static void lsf2lsp_for_mode122(AMRConte
static void lsf2lsp_5(AMRContext *p)
{
+ const uint16_t *lsf_param = p->frame.lsf;
float prev_lsf[LP_FILTER_ORDER]; // previous quantized LSF vectors
const float *lsf_quantizer[5];
int i;
- lsf_quantizer[0] = lsf_5_1[p->amr_prms[0]];
- lsf_quantizer[1] = lsf_5_2[p->amr_prms[1]];
- lsf_quantizer[2] = lsf_5_3[p->amr_prms[2] >> 1];
- lsf_quantizer[3] = lsf_5_4[p->amr_prms[3]];
- lsf_quantizer[4] = lsf_5_5[p->amr_prms[4]];
+ lsf_quantizer[0] = lsf_5_1[lsf_param[0]];
+ lsf_quantizer[1] = lsf_5_2[lsf_param[1]];
+ lsf_quantizer[2] = lsf_5_3[lsf_param[2] >> 1];
+ lsf_quantizer[3] = lsf_5_4[lsf_param[3]];
+ lsf_quantizer[4] = lsf_5_5[lsf_param[4]];
for(i=0; i<LP_FILTER_ORDER;i++)
prev_lsf[i] = p->prev_lsf_r[i]*PRED_FAC_MODE_122 + lsf_5_mean[i];
- lsf2lsp_for_mode122(p, p->lsp[1], prev_lsf, lsf_quantizer, 0, p->amr_prms[2] & 1, 0);
- lsf2lsp_for_mode122(p, p->lsp[3], prev_lsf, lsf_quantizer, 2, p->amr_prms[2] & 1, 1);
+ lsf2lsp_for_mode122(p, p->lsp[1], prev_lsf, lsf_quantizer, 0, lsf_param[2] & 1, 0);
+ lsf2lsp_for_mode122(p, p->lsp[3], prev_lsf, lsf_quantizer, 2, lsf_param[2] & 1, 1);
// interpolate LSP vectors at subframes 1 and 3
weighted_vector_sumf(p->lsp[0], p->prev_lsp_sub4, p->lsp[1], 0.5, 0.5, LP_FILTER_ORDER);
@@ -307,18 +308,19 @@ static void lsf2lsp_5(AMRContext *p)
static void lsf2lsp_3(AMRContext *p)
{
+ const uint16_t *lsf_param = p->frame.lsf;
float lsf_r[LP_FILTER_ORDER]; // residual LSF vector
float lsf_q[LP_FILTER_ORDER]; // quantified LSF vector
const float *lsf_quantizer;
int i;
- lsf_quantizer = (p->cur_frame_mode == MODE_795 ? lsf_3_1_MODE_795 : lsf_3_1)[p->amr_prms[0]];
+ lsf_quantizer = (p->cur_frame_mode == MODE_795 ? lsf_3_1_MODE_795 : lsf_3_1)[lsf_param[0]];
memcpy(lsf_r, lsf_quantizer, 3*sizeof(float));
- lsf_quantizer = lsf_3_2[p->amr_prms[1] << (p->cur_frame_mode <= MODE_515)];
+ lsf_quantizer = lsf_3_2[lsf_param[1] << (p->cur_frame_mode <= MODE_515)];
memcpy(lsf_r + 3, lsf_quantizer, 3*sizeof(float));
- lsf_quantizer = (p->cur_frame_mode <= MODE_515 ? lsf_3_3_MODE_515 : lsf_3_3)[p->amr_prms[2]];
+ lsf_quantizer = (p->cur_frame_mode <= MODE_515 ? lsf_3_3_MODE_515 : lsf_3_3)[lsf_param[2]];
memcpy(lsf_r + 6, lsf_quantizer, 4*sizeof(float));
// calculate mean-removed LSF vector and add mean
@@ -962,8 +964,6 @@ static int amrnb_decode_frame(AVCodecCon
AMRContext *p = avctx->priv_data; // pointer to private data
float *buf_out = data; // pointer to the output data buffer
int i, subframe; // counters
- int index = 0; // index counter (different modes
- // advance through amr_prms differently)
int gains_index_MODE_475 = 0; // MODE_475 gains index coded every other subframe
enum Mode speech_mode = MODE_475; // ???
@@ -975,13 +975,9 @@ static int amrnb_decode_frame(AVCodecCon
if(p->cur_frame_mode == MODE_122) {
// decode split-matrix quantized lsf vector indexes to lsp vectors
lsf2lsp_5(p);
- // advance index into amr_prms
- index += 5;
}else {
// decode split-matrix quantized lsf vector indexes to an lsp vector
lsf2lsp_3(p);
- // advance index into amr_prms
- index += 3;
}
// convert LSP vectors to LPC coefficient vectors
@@ -995,7 +991,7 @@ static int amrnb_decode_frame(AVCodecCon
/*** end of LPC coefficient decoding ***/
for(subframe = 0; subframe < 4; subframe++) {
-
+ const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];
/*** adaptive code book (pitch) vector decoding ***/
// find the search range
@@ -1009,11 +1005,10 @@ static int amrnb_decode_frame(AVCodecCon
// decode integer and fractional parts of pitch lag from parsed pitch
// index
if(p->cur_frame_mode == MODE_122) {
- decode_pitch_lag_6(p, p->amr_prms[index], subframe);
+ decode_pitch_lag_6(p, amr_subframe->p_lag, subframe);
}else {
- decode_pitch_lag_3(p, p->amr_prms[index], subframe);
+ decode_pitch_lag_3(p, amr_subframe->p_lag, subframe);
}
- index++;
// interpolate the past excitation at the pitch lag to obtain the pitch
// vector
@@ -1026,32 +1021,25 @@ static int amrnb_decode_frame(AVCodecCon
switch(p->cur_frame_mode) {
case MODE_475:
case MODE_515:
- decode_2_pulses_9bits(p->amr_prms[index], p->amr_prms[index+1], subframe, p->fixed_vector);
- index += 2;
+ decode_2_pulses_9bits(amr_subframe->pulses[0], amr_subframe->pulses[1], subframe, p->fixed_vector);
break;
case MODE_59:
- decode_2_pulses_11bits(p->amr_prms[index], p->amr_prms[index+1], p->fixed_vector);
- index += 2;
+ decode_2_pulses_11bits(amr_subframe->pulses[0], amr_subframe->pulses[1], p->fixed_vector);
break;
case MODE_67:
- decode_3_pulses_14bits(p->amr_prms[index], p->amr_prms[index+1], p->fixed_vector);
- index += 2;
+ decode_3_pulses_14bits(amr_subframe->pulses[0], amr_subframe->pulses[1], p->fixed_vector);
break;
case MODE_74:
case MODE_795:
- decode_4_pulses_17bits(p->amr_prms[index], p->amr_prms[index+1], p->fixed_vector);
- index += 2;
+ decode_4_pulses_17bits(amr_subframe->pulses[0], amr_subframe->pulses[1], p->fixed_vector);
break;
case MODE_102:
- decode_8_pulses_31bits(&p->amr_prms[index], p->fixed_vector);
- index += 7;
+ decode_8_pulses_31bits(amr_subframe->pulses, p->fixed_vector);
break;
case MODE_122:
// decode pitch gain
- p->pitch_gain[4] = qua_gain_pit[p->amr_prms[index]];
- index++;
- decode_10_pulses_35bits(&p->amr_prms[index], p->fixed_vector);
- index += 10;
+ p->pitch_gain[4] = qua_gain_pit[amr_subframe->p_gain];
+ decode_10_pulses_35bits(amr_subframe->pulses, p->fixed_vector);
break;
default:
break;
@@ -1066,27 +1054,21 @@ static int amrnb_decode_frame(AVCodecCon
// decode pitch gain and fixed gain correction factor
if(p->cur_frame_mode == MODE_122) {
- p->fixed_gain_factor = qua_gain_code[p->amr_prms[index]];
- index++;
+ p->fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain];
}else if(p->cur_frame_mode == MODE_795) {
- p->pitch_gain[4] = qua_gain_pit[p->amr_prms[index]];
- index++;
- p->fixed_gain_factor = qua_gain_code[p->amr_prms[index]];
- index++;
+ p->pitch_gain[4] = qua_gain_pit[amr_subframe->p_gain];
+ p->fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain];
}else if(p->cur_frame_mode == MODE_67 || p->cur_frame_mode == MODE_74 ||
p->cur_frame_mode == MODE_102) {
- p->pitch_gain[4] = gains_high[p->amr_prms[index]][0];
- p->fixed_gain_factor = gains_high[p->amr_prms[index]][1];
- index++;
+ p->pitch_gain[4] = gains_high[amr_subframe->p_gain][0];
+ p->fixed_gain_factor = gains_high[amr_subframe->p_gain][1];
}else if(p->cur_frame_mode == MODE_515 || p->cur_frame_mode == MODE_59) {
- p->pitch_gain[4] = gains_low[p->amr_prms[index]][0];
- p->fixed_gain_factor = gains_low[p->amr_prms[index]][1];
- index++;
+ p->pitch_gain[4] = gains_low[amr_subframe->p_gain][0];
+ p->fixed_gain_factor = gains_low[amr_subframe->p_gain][1];
}else {
// gain index is only coded in subframes 0,2
if(!(subframe&1)) {
- gains_index_MODE_475 = p->amr_prms[index]<<1;
- index++;
+ gains_index_MODE_475 = amr_subframe->p_gain<<1;
}
p->pitch_gain[4] = gains_MODE_475[gains_index_MODE_475 + (subframe&1)][0];
p->fixed_gain_factor = gains_MODE_475[gains_index_MODE_475 + (subframe&1)][1];
More information about the FFmpeg-soc
mailing list