[FFmpeg-soc] [soc]: r4083 - in amr: amrnbfloatdata.h amrnbfloatdec.c
kmalaussene
subversion at mplayerhq.hu
Wed Feb 18 01:28:12 CET 2009
Author: kmalaussene
Date: Wed Feb 18 01:28:12 2009
New Revision: 4083
Log:
Create pulses_nb_per_mode table and use it in decode_fixed_vector to replace pulse_nb.
Modified:
amr/amrnbfloatdata.h
amr/amrnbfloatdec.c
Modified: amr/amrnbfloatdata.h
==============================================================================
--- amr/amrnbfloatdata.h Wed Feb 18 01:17:52 2009 (r4082)
+++ amr/amrnbfloatdata.h Wed Feb 18 01:28:12 2009 (r4083)
@@ -2039,6 +2039,11 @@ static const float b60[61] = {
#define TRACKS 5
#define TRACKS_MODE_102 4
+/**
+ * number of pulses per mode
+ */
+static const uint8_t pulses_nb_per_mode[] = {2, 2, 2, 3, 4, 4, 8, 10};
+
// track start positions for algebraic code book routines
static const uint8_t track_position[16] = { 0, 2, 0, 3, 0, 2, 0, 3, 1, 3, 2, 4, 1, 4, 1, 4 };
Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c Wed Feb 18 01:17:52 2009 (r4082)
+++ amr/amrnbfloatdec.c Wed Feb 18 01:28:12 2009 (r4083)
@@ -620,36 +620,32 @@ static void decode_fixed_vector(float *f
}else if(mode == MODE_102) {
decode_8_pulses_31bits(pulses, fixed_vector);
}else {
- int pulse_position[4], pulse_subset, pulse_nb;
+ int pulse_position[4], pulse_subset;
const int fixed_index = pulses[0];
if(mode <= MODE_515) {
- pulse_nb = 2;
pulse_subset = ((fixed_index >> 3) & 8) + (subframe << 1);
pulse_position[0] = ( fixed_index & 7)*5 + track_position[pulse_subset];
pulse_position[1] = ((fixed_index >> 3) & 7)*5 + track_position[pulse_subset + 1];
}else if(mode == MODE_59) {
- pulse_nb = 2;
pulse_subset = ((fixed_index & 1) << 1) + 1;
pulse_position[0] = ((fixed_index >> 1) & 7)*5 + pulse_subset;
pulse_subset = (fixed_index >> 4) & 3;
pulse_position[1] = ((fixed_index >> 6) & 7)*5 + pulse_subset + (pulse_subset == 3 ? 1 : 0);
}else if(mode == MODE_67) {
- pulse_nb = 3;
pulse_position[0] = ( fixed_index & 7)*5;
pulse_subset = (fixed_index >> 2) & 2;
pulse_position[1] = ((fixed_index >> 4) & 7)*5 + pulse_subset + 1;
pulse_subset = (fixed_index >> 6) & 2;
pulse_position[2] = ((fixed_index >> 8) & 7)*5 + pulse_subset + 2;
}else { // mode <= MODE_795
- pulse_nb = 4;
pulse_position[0] = gray_decode[ fixed_index & 7]*5;
pulse_position[1] = gray_decode[(fixed_index >> 3) & 7]*5 + 1;
pulse_position[2] = gray_decode[(fixed_index >> 6) & 7]*5 + 2;
pulse_subset = (fixed_index >> 9) & 1;
pulse_position[3] = gray_decode[(fixed_index >> 10) & 7]*5 + pulse_subset + 3;
}
- reconstruct_fixed_vector(pulse_position, pulses[1], pulse_nb, fixed_vector);
+ reconstruct_fixed_vector(pulse_position, pulses[1], pulses_nb_per_mode[mode], fixed_vector);
}
}
More information about the FFmpeg-soc
mailing list