723e226a568ef84abd813fdeb3deaadfb4403587
2 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
3 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
4 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
10 #include "gsm610_priv.h"
12 /* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
14 * After A-law to linear conversion (or directly from the
15 * Ato D converter) the following scaling is assumed for
16 * input to the RPE-LTP algorithm:
18 * in: 0.1.....................12
19 * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.*
21 * Where S is the sign bit, v a valid bit, and * a "don't care" bit.
22 * The original signal is called sop[..]
24 * out: 0.1................... 12
25 * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
32 word
* so
) /* [0..159] IN/OUT */
36 longword L_z2
= S
->L_z2
;
51 /* 4.2.1 Downscaling of the input signal
53 SO
= SASR_W( *s
, 3 ) << 2;
56 assert (SO
>= -0x4000); /* downscaled by */
57 assert (SO
<= 0x3FFC); /* previous routine. */
60 /* 4.2.2 Offset compensation
62 * This part implements a high-pass filter and requires extended
63 * arithmetic precision for the recursive part of this filter.
64 * The input of this procedure is the array so[0...159] and the
65 * output the array sof[ 0...159 ].
67 /* Compute the non-recursive part
70 s1
= SO
- z1
; /* s1 = gsm_sub( *so, z1 ); */
73 assert(s1
!= MIN_WORD
);
75 /* Compute the recursive part
80 /* Execution of a 31 bv 16 bits multiplication
83 msp
= SASR_L( L_z2
, 15 );
84 lsp
= L_z2
-((longword
)msp
<<15); /* gsm_L_sub(L_z2,(msp<<15)); */
86 L_s2
+= GSM_MULT_R( lsp
, 32735 );
87 L_temp
= (longword
)msp
* 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
88 L_z2
= GSM_L_ADD( L_temp
, L_s2
);
90 /* Compute sof[k] with rounding
92 L_temp
= GSM_L_ADD( L_z2
, 16384 );
97 msp
= GSM_MULT_R( mp
, -28180 );
98 mp
= SASR_L( L_temp
, 15 );
99 *so
++ = GSM_ADD( mp
, msp
);