Asterisk - The Open Source Telephony Project GIT-master-f36a736
gsm/src/decode.c
Go to the documentation of this file.
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/* $Header$ */
8
9#include <stdio.h>
10
11#include "private.h"
12#include "gsm.h"
13#include "proto.h"
14
15/*
16 * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
17 */
18
19static void Postprocessing P2((S,s),
20 struct gsm_state * S,
21 register word * s)
22{
23 register int k;
24 register word msr = S->msr;
25 register word tmp;
26
27 for (k = 160; k--; s++) {
28 tmp = (word)GSM_MULT_R( msr, 28180 );
29 msr = GSM_ADD(*s, tmp); /* Deemphasis */
30 *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
31 }
32 S->msr = msr;
33}
34
35void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s),
36 struct gsm_state * S,
37
38 word * LARcr, /* [0..7] IN */
39
40 word * Ncr, /* [0..3] IN */
41 word * bcr, /* [0..3] IN */
42 word * Mcr, /* [0..3] IN */
43 word * xmaxcr, /* [0..3] IN */
44 word * xMcr, /* [0..13*4] IN */
45
46 word * s) /* [0..159] OUT */
47{
48 int j, k;
49 word erp[40], wt[160];
50 word * drp = S->dp0 + 120;
51
52 for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
53
54 Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
55 Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
56
57 for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
58 }
59
60 Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
61 Postprocessing(S, s);
62}
#define S(e)
static int tmp()
Definition: bt_open.c:389
short word
#define GSM_MULT_R(a, b)
static word GSM_ADD(longword a, longword b)
void Gsm_Decoder P8((S, LARcr, Ncr, bcr, Mcr, xmaxcr, xMcr, s), struct gsm_state *S, word *LARcr, word *Ncr, word *bcr, word *Mcr, word *xmaxcr, word *xMcr, word *s)
static void Postprocessing P2((S, s), struct gsm_state *S, register word *s)