annotate libgsmfr2/dec_main.c @ 286:251aed72925e

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