gsm/src/decode.c

Go to the documentation of this file.
00001 /*
00002  * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
00003  * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
00004  * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
00005  */
00006 
00007 /* $Header$ */
00008 
00009 #include <stdio.h>
00010 
00011 #include "private.h"
00012 #include "gsm.h"
00013 #include "proto.h"
00014 
00015 /*
00016  *  4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
00017  */
00018 
00019 static void Postprocessing P2((S,s),
00020    struct gsm_state  * S,
00021    register word     * s)
00022 {
00023    register int      k;
00024    register word     msr = S->msr;
00025    register word     tmp;
00026 
00027    for (k = 160; k--; s++) {
00028       tmp = (word)GSM_MULT_R( msr, 28180 );
00029       msr = GSM_ADD(*s, tmp);       /* Deemphasis       */
00030       *s  = GSM_ADD(msr, msr) & 0xFFF8;  /* Truncation & Upscaling */
00031    }
00032    S->msr = msr;
00033 }
00034 
00035 void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s),
00036    struct gsm_state  * S,
00037 
00038    word     * LARcr, /* [0..7]      IN */
00039 
00040    word     * Ncr,      /* [0..3]      IN    */
00041    word     * bcr,      /* [0..3]      IN */
00042    word     * Mcr,      /* [0..3]      IN    */
00043    word     * xmaxcr,   /* [0..3]      IN    */
00044    word     * xMcr,     /* [0..13*4]      IN */
00045 
00046    word     * s)     /* [0..159]    OUT   */
00047 {
00048    int      j, k;
00049    word     erp[40], wt[160];
00050    word     * drp = S->dp0 + 120;
00051 
00052    for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
00053 
00054       Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
00055       Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
00056 
00057       for (k = 0; k <= 39; k++) wt[ j * 40 + k ] =  drp[ k ];
00058    }
00059 
00060    Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
00061    Postprocessing(S, s);
00062 }

Generated on Thu Apr 16 06:27:32 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6