1 /*
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.
5 */
6
7 #include <stdio.h>
8
9 #include "gsm610_priv.h"
10
11 /*
12 * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
13 */
14
Postprocessing(struct gsm_state * S,register int16_t * s)15 static void Postprocessing (
16 struct gsm_state * S,
17 register int16_t * s)
18 {
19 register int k ;
20 register int16_t msr = S->msr ;
21 register int16_t tmp ;
22
23 for (k = 160 ; k-- ; s++)
24 { tmp = GSM_MULT_R (msr, 28180) ;
25 msr = GSM_ADD (*s, tmp) ; /* Deemphasis */
26 *s = GSM_ADD (msr, msr) & 0xFFF8 ; /* Truncation & Upscaling */
27 }
28 S->msr = msr ;
29 }
30
Gsm_Decoder(struct gsm_state * S,int16_t * LARcr,int16_t * Ncr,int16_t * bcr,int16_t * Mcr,int16_t * xmaxcr,int16_t * xMcr,int16_t * s)31 void Gsm_Decoder (
32 struct gsm_state * S,
33
34 int16_t * LARcr, /* [0..7] IN */
35
36 int16_t * Ncr, /* [0..3] IN */
37 int16_t * bcr, /* [0..3] IN */
38 int16_t * Mcr, /* [0..3] IN */
39 int16_t * xmaxcr, /* [0..3] IN */
40 int16_t * xMcr, /* [0..13*4] IN */
41
42 int16_t * s) /* [0..159] OUT */
43 {
44 int j, k ;
45 int16_t erp [40], wt [160] ;
46 int16_t *drp = S->dp0 + 120 ;
47
48 for (j = 0 ; j <= 3 ; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13)
49 { Gsm_RPE_Decoding (/*-S,-*/ *xmaxcr, *Mcr, xMcr, erp) ;
50 Gsm_Long_Term_Synthesis_Filtering (S, *Ncr, *bcr, erp, drp) ;
51
52 for (k = 0 ; k <= 39 ; k++) wt [j * 40 + k] = drp [k] ;
53 }
54
55 Gsm_Short_Term_Synthesis_Filter (S, LARcr, wt, s) ;
56 Postprocessing (S, s) ;
57 }
58
59