19#define Short_term_analysis_filtering Short_term_analysis_filteringx
28static void Decoding_of_the_coded_Log_Area_Ratios
P2((
LARc,LARpp),
58#define STEP( B_TIMES_TWO, MIC, INVA ) \
59 temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
60 temp1 = GSM_SUB( temp1, B_TIMES_TWO ); \
61 temp1 = (word)GSM_MULT_R( INVA, temp1 ); \
62 *LARpp++ = GSM_ADD( temp1, temp1 );
64 STEP( 0, -32, 13107 );
65 STEP( 0, -32, 13107 );
66 STEP( 4096, -16, 13107 );
67 STEP( -5120, -16, 13107 );
69 STEP( 188, -8, 19223 );
70 STEP( -3584, -8, 17476 );
71 STEP( -682, -4, 31454 );
72 STEP( -2288, -4, 29708 );
95static void Coefficients_0_12
P3((LARpp_j_1, LARpp_j, LARp),
96 register word * LARpp_j_1,
97 register word * LARpp_j,
102 for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
108static void Coefficients_13_26
P3((LARpp_j_1, LARpp_j, LARp),
109 register word * LARpp_j_1,
110 register word * LARpp_j,
111 register word * LARp)
114 for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
119static void Coefficients_27_39
P3((LARpp_j_1, LARpp_j, LARp),
120 register word * LARpp_j_1,
121 register word * LARpp_j,
122 register word * LARp)
126 for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
133static void Coefficients_40_159
P2((LARpp_j, LARp),
134 register word * LARpp_j,
135 register word * LARp)
139 for (i = 1; i <= 8; i++, LARp++, LARpp_j++)
145static void LARp_to_rp
P1((LARp),
146 register word * LARp)
156 for (i = 1; i <= 8; i++, LARp++) {
169 *LARp = - ((temp < 11059) ? temp << 1
170 : ((temp < 20070) ? temp + 11059
171 :
GSM_ADD( temp >> 2, 26112 )));
174 *LARp = (temp < 11059) ? temp << 1
175 : ((temp < 20070) ? temp + 11059
176 :
GSM_ADD( temp >> 2, 26112 ));
183#ifndef Short_term_analysis_filtering
190static void Short_term_analysis_filtering
P4((u0,rp0,k_n,s),
207 register word * u_top = u0 + 8;
208 register word * s_top = s + k_n;
211 register word *u, *rp ;
214 for (rp=rp0, u=u0; u<u_top;) {
219 u_out = ui + (((rpi*
di)+0x4000)>>15);
220 di =
di + (((rpi*ui)+0x4000)>>15);
222 if ((u_out == (
word)u_out) && (
di == (
word)
di))
continue;
234#if defined(USE_FLOAT_MUL) && defined(FAST)
236static void Fast_Short_term_analysis_filtering
P4((u,rp,k_n,s),
248 register float scalef = 3.0517578125e-5;
249 register float sav,
di, temp;
251 for (i = 0; i < 8; ++i) {
253 rpf[i] = rp[i] * scalef;
257 for (i = 0; i < 8; ++i) {
258 register float rpfi = rpf[i];
259 register float ufi = uf[i];
262 temp = rpfi *
di + ufi;
268 for (i = 0; i < 8; ++i) u[i] = uf[i];
281static void Short_term_synthesis_filtering
P5((
S,rrp,k,wt,sr),
289 register word * v =
S->v;
303 tmp2 = (( tmp1 * tmp2 + 16384) >> 15) ;
306 if (sri != (
word)sri) {
312 tmp1 = (( tmp1 * sri + 16384) >> 15) ;
315 if (tmp1 != (
word)tmp1) {
320 *sr++ = v[0] = (
word)sri;
325#if defined(FAST) && defined(USE_FLOAT_MUL)
327static void Fast_Short_term_synthesis_filtering
P5((
S,rrp,k,wt,sr),
335 register word * v =
S->v;
338 float va[9], rrpa[8];
339 register float scalef = 3.0517578125e-5, temp;
341 for (i = 0; i < 8; ++i) {
343 rrpa[i] = (float)rrp[i] * scalef;
346 register float sri = *wt++;
348 sri -= rrpa[i] * va[i];
349 if (sri < -32768.) sri = -32768.;
350 else if (sri > 32767.) sri = 32767.;
352 temp = va[i] + rrpa[i] * sri;
353 if (temp < -32768.) temp = -32768.;
354 else if (temp > 32767.) temp = 32767.;
359 for (i = 0; i < 9; ++i) v[i] = va[i];
364void Gsm_Short_Term_Analysis_Filter
P3((
S,
LARc,s),
372 word * LARpp_j =
S->LARpp[
S->j ];
373 word * LARpp_j_1 =
S->LARpp[
S->j ^= 1 ];
378#if defined(FAST) && defined(USE_FLOAT_MUL)
379# define FILTER (* (S->fast \
380 ? Fast_Short_term_analysis_filtering \
381 : Short_term_analysis_filtering ))
384# define FILTER Short_term_analysis_filtering
387 Decoding_of_the_coded_Log_Area_Ratios(
LARc, LARpp_j );
389 Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
393 Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
395 FILTER(
S->u, LARp, 14, s + 13);
397 Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
399 FILTER(
S->u, LARp, 13, s + 27);
401 Coefficients_40_159( LARpp_j, LARp);
403 FILTER(
S->u, LARp, 120, s + 40);
407void Gsm_Short_Term_Synthesis_Filter
P4((
S, LARcr, wt, s),
416 word * LARpp_j =
S->LARpp[
S->j ];
417 word * LARpp_j_1 =
S->LARpp[
S->j ^=1 ];
422#if defined(FAST) && defined(USE_FLOAT_MUL)
424# define FILTER (* (S->fast \
425 ? Fast_Short_term_synthesis_filtering \
426 : Short_term_synthesis_filtering ))
428# define FILTER Short_term_synthesis_filtering
431 Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j );
433 Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
437 Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
439 FILTER(
S, LARp, 14, wt + 13, s + 13 );
441 Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
443 FILTER(
S, LARp, 13, wt + 27, s + 27 );
445 Coefficients_40_159( LARpp_j, LARp );
447 FILTER(
S, LARp, 120, wt + 40, s + 40);
static word GSM_ADD(longword a, longword b)
#define STEP(B_TIMES_TWO, MIC, INVA)
static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc, LARpp), word *LARc, word *LARpp)
static void Short_term_analysis_filtering P4((u0, rp0, k_n, s), register word *u0, register word *rp0, register int k_n, register word *s)
static void Short_term_synthesis_filtering P5((S, rrp, k, wt, sr), struct gsm_state *S, register word *rrp, register int k, register word *wt, register word *sr)
static void LARp_to_rp P1((LARp), register word *LARp)
static void Coefficients_0_12 P3((LARpp_j_1, LARpp_j, LARp), register word *LARpp_j_1, register word *LARpp_j, register word *LARp)