[FFmpeg-soc] [soc]: r4935 - in amr: amrnbdata.h amrnbdec.c
cmcq
subversion at mplayerhq.hu
Tue Aug 4 01:17:46 CEST 2009
Author: cmcq
Date: Tue Aug 4 01:17:45 2009
New Revision: 4935
Log:
Map DTX bits into AMRFrame so DTX parameters can be used by name
Modified:
amr/amrnbdata.h
amr/amrnbdec.c
Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h Tue Aug 4 01:03:53 2009 (r4934)
+++ amr/amrnbdata.h Tue Aug 4 01:17:45 2009 (r4935)
@@ -93,13 +93,23 @@ typedef struct {
uint16_t pulses[10]; ///< pulses: 10 for MODE_122, 7 for MODE_102, and index and sign for others
} AMRNBSubframe;
+/**
+ * AMRNB SID frame parameters
+ */
+typedef struct {
+ uint16_t ref_vector; ///< index of reference vector
+ uint16_t energy; ///< index of logarithmic frame energy
+} AMRNBSIDFrame;
/**
* 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
+ union {
+ AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
+ AMRNBSIDFrame sid;
+ } info;
} AMRNBFrame;
@@ -110,7 +120,7 @@ typedef struct {
/** Specify an LSF parameter bit */
#define AMR_LSF(variable, bit) AMR_BIT(lsf[variable], bit)
/** Specify a subframe-specific bit */
-#define AMR_OF(frame_num, variable, bit) AMR_BIT(subframe[frame_num].variable, bit)
+#define AMR_OF(frame_num, variable, bit) AMR_BIT(info.subframe[frame_num].variable, bit)
/** Specify a pitch gain bit */
#define AMR_PGAIN(frame_num, bit) AMR_OF(frame_num, p_gain, bit)
/** Specify a fixed gain bit */
@@ -119,6 +129,10 @@ typedef struct {
#define AMR_PLAG(frame_num, bit) AMR_OF(frame_num, p_lag, bit)
/** Specify a pulse bit */
#define AMR_PULSES(frame_num, pulse_id, bit) AMR_OF(frame_num, pulses[pulse_id], bit)
+/** Specify an SID reference vector bit */
+#define AMR_SVECTOR(bit) AMR_BIT(info.sid.ref_vector, bit)
+/** Specify an SID energy index bit */
+#define AMR_SENERGY(bit) AMR_BIT(info.sid.energy, bit)
static const AMROrder order_MODE_475[95] = {
AMR_LSF(0, 7), AMR_LSF(0, 6), AMR_LSF(0, 5), AMR_LSF(0, 4),
@@ -490,13 +504,12 @@ AMR_PULSES(3, 9, 0), AMR_PULSES(3, 9, 1)
AMR_PLAG(1, 0), AMR_PLAG(3, 0)
};
-//FIXME: This order array needs to be mapped to AMRNBFrame.
static const AMROrder order_MODE_DTX[35] = {
-{ 0, 2}, { 0, 1}, { 0, 0}, { 1, 7}, { 1, 6}, { 1, 5}, { 1, 4}, { 1, 3},
-{ 1, 2}, { 1, 1}, { 1, 0}, { 2, 8}, { 2, 7}, { 2, 6}, { 2, 5}, { 2, 4},
-{ 2, 3}, { 2, 2}, { 2, 1}, { 2, 0}, { 3, 8}, { 3, 7}, { 3, 6}, { 3, 5},
-{ 3, 4}, { 3, 3}, { 3, 2}, { 3, 1}, { 3, 0}, { 4, 5}, { 4, 4}, { 4, 3},
-{ 4, 2}, { 4, 1}, { 4, 0}
+AMR_SVECTOR(2), AMR_SVECTOR(1), AMR_SVECTOR(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_SENERGY(5), AMR_SENERGY(4), AMR_SENERGY(3), AMR_SENERGY(2),
+AMR_SENERGY(1), AMR_SENERGY(0)
};
/**
Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c Tue Aug 4 01:03:53 2009 (r4934)
+++ amr/amrnbdec.c Tue Aug 4 01:17:45 2009 (r4935)
@@ -771,7 +771,8 @@ static void decode_gains(AMRContext *p,
mode >= MODE_67 ? gains_high[amr_subframe->p_gain] :
mode >= MODE_515 ? gains_low [amr_subframe->p_gain] :
// gain index is only coded in subframes 0,2 for MODE_475
- gains_MODE_475[(p->frame.subframe[subframe & 2].p_gain << 1) +
+ gains_MODE_475[(p->frame.info.subframe[subframe & 2].p_gain
+ << 1) +
(subframe & 1)];
p->pitch_gain[4] = gains[0];
@@ -1108,7 +1109,7 @@ static int amrnb_decode_frame(AVCodecCon
lsp2lpc(p->lsp[i], p->lpc[i]);
for (subframe = 0; subframe < 4; subframe++) {
- const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];
+ const AMRNBSubframe *amr_subframe = &p->frame.info.subframe[subframe];
decode_pitch_vector(p, amr_subframe, subframe);
More information about the FFmpeg-soc
mailing list