Mercurial > hg > audiostuff
comparison intercom/gsm/decode.c @ 2:13be24d74cd2
import intercom-0.4.1
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Fri, 25 Jun 2010 09:57:52 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:9cadc470e3da | 2:13be24d74cd2 |
|---|---|
| 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: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/decode.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */ | |
| 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 | |
| 19 static void Postprocessing P2((S, s), | |
| 20 struct gsm_state *S, register word * s) | |
| 21 { | |
| 22 register int k; | |
| 23 register word msr = S->msr; | |
| 24 register longword ltmp; /* for GSM_ADD */ | |
| 25 register word tmp; | |
| 26 | |
| 27 for (k = 160; k--; s++) { | |
| 28 tmp = GSM_MULT_R(msr, 28180); | |
| 29 msr = GSM_ADD(*s, tmp); /* Deemphasis */ | |
| 30 #ifdef USE_ROUNDING_INSTEAD_OF_TRUNCATION | |
| 31 *s = GSM_ADD(msr, msr); /* Upscaling by 2 */ | |
| 32 *s = GSM_ADD(*s, 4) & 0xFFF8; /* Truncation */ | |
| 33 #else | |
| 34 *s = GSM_ADD(msr, msr) & 0xFFF8; /* Upscaling & Truncation */ | |
| 35 #endif | |
| 36 } | |
| 37 S->msr = msr; | |
| 38 } | |
| 39 | |
| 40 void Gsm_Decoder P8((S, LARcr, Ncr, bcr, Mcr, xmaxcr, xMcr, s), struct gsm_state *S, word * LARcr, /* [0..7] IN */ | |
| 41 word * Ncr, /* [0..3] IN */ | |
| 42 word * bcr, /* [0..3] IN */ | |
| 43 word * Mcr, /* [0..3] IN */ | |
| 44 word * xmaxcr, /* [0..3] IN */ | |
| 45 word * xMcr, /* [0..13*4] IN */ | |
| 46 word * s) | |
| 47 { /* [0..159] OUT */ | |
| 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++) | |
| 58 wt[j * 40 + k] = drp[k]; | |
| 59 } | |
| 60 | |
| 61 Gsm_Short_Term_Synthesis_Filter(S, LARcr, wt, s); | |
| 62 Postprocessing(S, s); | |
| 63 } |
