1b815c7f3Sopenharmony_ci/* 2b815c7f3Sopenharmony_ci * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 3b815c7f3Sopenharmony_ci * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 4b815c7f3Sopenharmony_ci * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 5b815c7f3Sopenharmony_ci */ 6b815c7f3Sopenharmony_ci 7b815c7f3Sopenharmony_ci#include <stdio.h> 8b815c7f3Sopenharmony_ci 9b815c7f3Sopenharmony_ci#include "gsm610_priv.h" 10b815c7f3Sopenharmony_ci 11b815c7f3Sopenharmony_ci/* 12b815c7f3Sopenharmony_ci * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER 13b815c7f3Sopenharmony_ci */ 14b815c7f3Sopenharmony_ci 15b815c7f3Sopenharmony_cistatic void Postprocessing ( 16b815c7f3Sopenharmony_ci struct gsm_state * S, 17b815c7f3Sopenharmony_ci register int16_t * s) 18b815c7f3Sopenharmony_ci{ 19b815c7f3Sopenharmony_ci register int k ; 20b815c7f3Sopenharmony_ci register int16_t msr = S->msr ; 21b815c7f3Sopenharmony_ci register int16_t tmp ; 22b815c7f3Sopenharmony_ci 23b815c7f3Sopenharmony_ci for (k = 160 ; k-- ; s++) 24b815c7f3Sopenharmony_ci { tmp = GSM_MULT_R (msr, 28180) ; 25b815c7f3Sopenharmony_ci msr = GSM_ADD (*s, tmp) ; /* Deemphasis */ 26b815c7f3Sopenharmony_ci *s = GSM_ADD (msr, msr) & 0xFFF8 ; /* Truncation & Upscaling */ 27b815c7f3Sopenharmony_ci } 28b815c7f3Sopenharmony_ci S->msr = msr ; 29b815c7f3Sopenharmony_ci} 30b815c7f3Sopenharmony_ci 31b815c7f3Sopenharmony_civoid Gsm_Decoder ( 32b815c7f3Sopenharmony_ci struct gsm_state * S, 33b815c7f3Sopenharmony_ci 34b815c7f3Sopenharmony_ci int16_t * LARcr, /* [0..7] IN */ 35b815c7f3Sopenharmony_ci 36b815c7f3Sopenharmony_ci int16_t * Ncr, /* [0..3] IN */ 37b815c7f3Sopenharmony_ci int16_t * bcr, /* [0..3] IN */ 38b815c7f3Sopenharmony_ci int16_t * Mcr, /* [0..3] IN */ 39b815c7f3Sopenharmony_ci int16_t * xmaxcr, /* [0..3] IN */ 40b815c7f3Sopenharmony_ci int16_t * xMcr, /* [0..13*4] IN */ 41b815c7f3Sopenharmony_ci 42b815c7f3Sopenharmony_ci int16_t * s) /* [0..159] OUT */ 43b815c7f3Sopenharmony_ci{ 44b815c7f3Sopenharmony_ci int j, k ; 45b815c7f3Sopenharmony_ci int16_t erp [40], wt [160] ; 46b815c7f3Sopenharmony_ci int16_t *drp = S->dp0 + 120 ; 47b815c7f3Sopenharmony_ci 48b815c7f3Sopenharmony_ci for (j = 0 ; j <= 3 ; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) 49b815c7f3Sopenharmony_ci { Gsm_RPE_Decoding (/*-S,-*/ *xmaxcr, *Mcr, xMcr, erp) ; 50b815c7f3Sopenharmony_ci Gsm_Long_Term_Synthesis_Filtering (S, *Ncr, *bcr, erp, drp) ; 51b815c7f3Sopenharmony_ci 52b815c7f3Sopenharmony_ci for (k = 0 ; k <= 39 ; k++) wt [j * 40 + k] = drp [k] ; 53b815c7f3Sopenharmony_ci } 54b815c7f3Sopenharmony_ci 55b815c7f3Sopenharmony_ci Gsm_Short_Term_Synthesis_Filter (S, LARcr, wt, s) ; 56b815c7f3Sopenharmony_ci Postprocessing (S, s) ; 57b815c7f3Sopenharmony_ci} 58b815c7f3Sopenharmony_ci 59