www.pudn.com > p_voice.rar > PRED_LT3.C


/* 
   ITU-T G.729 Annex C - Reference C code for floating point 
                         implementation of G.729 
                         Version 1.01 of 15.September.98 
*/ 
 
/* 
---------------------------------------------------------------------- 
                    COPYRIGHT NOTICE 
---------------------------------------------------------------------- 
   ITU-T G.729 Annex C ANSI C source code 
   Copyright (C) 1998, AT&T, France Telecom, NTT, University of 
   Sherbrooke.  All rights reserved. 
 
---------------------------------------------------------------------- 
*/ 
 
/* 
 File : PRED_LT3.C 
*/ 
 
#include "typedef.h" 
#include "ld8k.h" 
#include "tab_ld8k.h" 
 
/*-------------------------------------------------------------------* 
* Function  Pred_lt_3()                                             * 
*           ~~~~~~~~~~~                                             * 
*-------------------------------------------------------------------* 
* Compute the result of long term prediction with fractional        * 
* interpolation of resolution 1/3.                                  * 
*                                                                   * 
* On return exc[0..L_subfr-1] contains the interpolated signal      * 
*   (adaptive codebook excitation)                                  * 
*-------------------------------------------------------------------*/ 
 
void pred_lt_3(         /* Compute adaptive codebook                       */ 
    FLOAT exc[],          /* in/out: excitation vector, exc[0:l_sub-1] = out */ 
    int t0,               /* input : pitch lag                               */ 
    int frac,             /* input : Fraction of pitch lag (-1, 0, 1)  / 3   */ 
    int l_subfr           /* input : length of subframe.                     */ 
) 
{ 
    int   i, j, k; 
    FLOAT s, *x0, *x1, *x2, *c1, *c2; 
     
    x0 = &exc[-t0]; 
     
    frac = -frac; 
    if (frac < 0) { 
        frac += UP_SAMP; 
        x0--; 
    } 
     
    for (j=0; j