annotate intercom/gsm/decode.c @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents 13be24d74cd2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
1 /*
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
2 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
3 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
4 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
5 */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
6
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
7 /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/decode.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
8
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
9 #include <stdio.h>
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
10
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
11 #include "private.h"
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
12 #include "gsm.h"
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
13 #include "proto.h"
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
14
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
15 /*
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
16 * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
17 */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
18
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
19 static void Postprocessing P2((S, s),
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
20 struct gsm_state *S, register word * s)
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
21 {
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22 register int k;
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
23 register word msr = S->msr;
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24 register longword ltmp; /* for GSM_ADD */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25 register word tmp;
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 for (k = 160; k--; s++) {
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28 tmp = GSM_MULT_R(msr, 28180);
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29 msr = GSM_ADD(*s, tmp); /* Deemphasis */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30 #ifdef USE_ROUNDING_INSTEAD_OF_TRUNCATION
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 *s = GSM_ADD(msr, msr); /* Upscaling by 2 */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 *s = GSM_ADD(*s, 4) & 0xFFF8; /* Truncation */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33 #else
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34 *s = GSM_ADD(msr, msr) & 0xFFF8; /* Upscaling & Truncation */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35 #endif
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36 }
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37 S->msr = msr;
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38 }
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
39
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
40 void Gsm_Decoder P8((S, LARcr, Ncr, bcr, Mcr, xmaxcr, xMcr, s), struct gsm_state *S, word * LARcr, /* [0..7] IN */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
41 word * Ncr, /* [0..3] IN */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
42 word * bcr, /* [0..3] IN */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
43 word * Mcr, /* [0..3] IN */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
44 word * xmaxcr, /* [0..3] IN */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
45 word * xMcr, /* [0..13*4] IN */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
46 word * s)
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
47 { /* [0..159] OUT */
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
48 int j, k;
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
49 word erp[40], wt[160];
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
50 word *drp = S->dp0 + 120;
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
51
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
52 for (j = 0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
53
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
54 Gsm_RPE_Decoding(S, *xmaxcr, *Mcr, xMcr, erp);
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
55 Gsm_Long_Term_Synthesis_Filtering(S, *Ncr, *bcr, erp, drp);
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
56
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
57 for (k = 0; k <= 39; k++)
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
58 wt[j * 40 + k] = drp[k];
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
59 }
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
60
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
61 Gsm_Short_Term_Synthesis_Filter(S, LARcr, wt, s);
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
62 Postprocessing(S, s);
13be24d74cd2 import intercom-0.4.1
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
63 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.