[FFmpeg-soc] [soc]: r1402 - in amr: amrdata.h amrnbdec.c
superdump
subversion at mplayerhq.hu
Wed Oct 10 15:44:32 CEST 2007
Author: superdump
Date: Wed Oct 10 15:44:32 2007
New Revision: 1402
Log:
- Add AMR_SUBFRAME_SIZE definition and use it
- Correct decode_4_pulses_17bits (missing *5 in three places)
Modified:
amr/amrdata.h
amr/amrnbdec.c
Modified: amr/amrdata.h
==============================================================================
--- amr/amrdata.h (original)
+++ amr/amrdata.h Wed Oct 10 15:44:32 2007
@@ -27,7 +27,8 @@
// general definitions
-#define AMR_BLOCK_SIZE 160
+#define AMR_BLOCK_SIZE 160
+#define AMR_SUBFRAME_SIZE 40
// definition of modes for decoder
#define NO_DATA 15
Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c (original)
+++ amr/amrnbdec.c Wed Oct 10 15:44:32 2007
@@ -721,7 +721,7 @@ static void decode_pitch_vector(AVCodecC
p->cur_pitch_lag_frac += 6;
excitation_temp--;
}
- for(i=0; i<40; i++) {
+ for(i=0; i<AMR_SUBFRAME_SIZE; i++) {
// reset temp
temp = 0;
for(j=0; j<10; j++) {
@@ -748,7 +748,7 @@ static void reconstruct_fixed_code(int *
int i;
// reset the code
- memset(fixed_code, 0, AMR_BLOCK_SIZE);
+ memset(fixed_code, 0, AMR_SUBFRAME_SIZE*sizeof(int));
// assign the pulse values (+/-1) to their appropriate positions
for(i=0; i<nr_pulses; i++)
@@ -919,13 +919,13 @@ static void decode_4_pulses_17bits(int s
// find the position of the first pulse
pulse_position[0] = dgray[ fixed_index & 7]*5;
// find the position of the second pulse
- pulse_position[1] = dgray[(fixed_index >> 3) & 7] + 1;
+ pulse_position[1] = dgray[(fixed_index >> 3) & 7]*5 + 1;
// find the position of the third pulse
- pulse_position[2] = dgray[(fixed_index >> 6) & 7] + 2;
+ pulse_position[2] = dgray[(fixed_index >> 6) & 7]*5 + 2;
// find the subset of pulses used for the fourth pulse
pulse_subset = (fixed_index >> 9) & 1;
// find the position of the fourth pulse
- pulse_position[3] = dgray[(fixed_index >> 10) & 7] + pulse_subset + 3;
+ pulse_position[3] = dgray[(fixed_index >> 10) & 7]*5 + pulse_subset + 3;
// reconstruct the fixed code
reconstruct_fixed_code(fixed_code, pulse_position, sign, 4);
@@ -947,7 +947,7 @@ static void decode_8_pulses_31bits(int16
int i, pos1, pos2, sign;
// reset the code
- memset(fixed_code, 0, 40*sizeof(int));
+ memset(fixed_code, 0, AMR_SUBFRAME_SIZE*sizeof(int));
fixed2position(&fixed_index[TRACKS_MODE_102], position_index);
for(i=0; i<TRACKS_MODE_102; i++) {
@@ -981,7 +981,7 @@ static void decode_10_pulses_35bits(int1
int i, pos1, pos2, sign;
// reset the code
- memset(fixed_code, 0, 40*sizeof(int));
+ memset(fixed_code, 0, AMR_SUBFRAME_SIZE*sizeof(int));
for(i=0; i<5; i++) {
// find the position of the ith pulse
More information about the FFmpeg-soc
mailing list