FreeCalypso > hg > gsm-codec-lib
comparison libgsmfr2/dec_main.c @ 266:8821ffaa93a5
libgsmfr2: integrate decoder main function from libgsm
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 14 Apr 2024 00:36:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
265:a7b593e68ac3 | 266:8821ffaa93a5 |
---|---|
1 /* | |
2 * This C source file has been adapted from TU-Berlin libgsm source | |
3 * (src/decode.c), original notice follows: | |
4 * | |
5 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische | |
6 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for | |
7 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. | |
8 */ | |
9 | |
10 #include <stdint.h> | |
11 #include "tw_gsmfr.h" | |
12 #include "typedef.h" | |
13 #include "ed_state.h" | |
14 #include "ed_internal.h" | |
15 | |
16 /* | |
17 * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER | |
18 */ | |
19 | |
20 static void Postprocessing ( | |
21 struct gsmfr_0610_state * S, | |
22 register word * s) | |
23 { | |
24 register int k; | |
25 register word msr = S->msr; | |
26 register longword ltmp; /* for GSM_ADD */ | |
27 register word tmp; | |
28 | |
29 for (k = 160; k--; s++) { | |
30 tmp = GSM_MULT_R( msr, 28180 ); | |
31 msr = GSM_ADD(*s, tmp); /* Deemphasis */ | |
32 *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */ | |
33 } | |
34 S->msr = msr; | |
35 } | |
36 | |
37 void gsmfr_0610_decode_params(struct gsmfr_0610_state *S, | |
38 const struct gsmfr_param_frame *inp, int16_t *s) | |
39 { | |
40 int j, k; | |
41 word erp[40], wt[160]; | |
42 word * drp = S->dp0 + 120; | |
43 | |
44 for (j=0; j <= 3; j++) { | |
45 Gsm_RPE_Decoding(S, inp->xmaxc[j], inp->Mc[j], inp->xMc[j], | |
46 erp); | |
47 Gsm_Long_Term_Synthesis_Filtering(S, inp->Nc[j], inp->bc[j], | |
48 erp, drp); | |
49 | |
50 for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; | |
51 } | |
52 | |
53 Gsm_Short_Term_Synthesis_Filter(S, inp->LARc, wt, s); | |
54 Postprocessing(S, s); | |
55 } |