pred_lt3.c
上传用户:zhouyunkk
上传日期:2013-01-10
资源大小:59k
文件大小:2k
源码类别:

语音压缩

开发平台:

C/C++

  1. /*
  2.    ITU-T G.729 Annex C - Reference C code for floating point
  3.                          implementation of G.729
  4.                          Version 1.01 of 15.September.98
  5. */
  6. /*
  7. ----------------------------------------------------------------------
  8.                     COPYRIGHT NOTICE
  9. ----------------------------------------------------------------------
  10.    ITU-T G.729 Annex C ANSI C source code
  11.    Copyright (C) 1998, AT&T, France Telecom, NTT, University of
  12.    Sherbrooke.  All rights reserved.
  13. ----------------------------------------------------------------------
  14. */
  15. /*
  16.  File : PRED_LT3.C
  17.  Used for the floating point version of both
  18.  G.729 main body and G.729A
  19. */
  20. #include "typedef.h"
  21. #include "version.h"
  22. #ifdef VER_G729A
  23.  #include "ld8a.h"
  24.  #include "tab_ld8a.h"
  25. #else
  26.  #include "ld8k.h"
  27.  #include "tab_ld8k.h"
  28. #endif
  29. /*-------------------------------------------------------------------*
  30.  * Function  Pred_lt_3()                                             *
  31.  *           ~~~~~~~~~~~                                             *
  32.  *-------------------------------------------------------------------*
  33.  * Compute the result of long term prediction with fractional        *
  34.  * interpolation of resolution 1/3.                                  *
  35.  *                                                                   *
  36.  * On return exc[0..L_subfr-1] contains the interpolated signal      *
  37.  *   (adaptive codebook excitation)                                  *
  38.  *-------------------------------------------------------------------*/
  39. void pred_lt_3(         /* Compute adaptive codebook                       */
  40.   FLOAT exc[],          /* in/out: excitation vector, exc[0:l_sub-1] = out */
  41.   int t0,               /* input : pitch lag                               */
  42.   int frac,             /* input : Fraction of pitch lag (-1, 0, 1)  / 3   */
  43.   int l_subfr           /* input : length of subframe.                     */
  44. )
  45. {
  46.   int   i, j, k;
  47.   FLOAT s, *x0, *x1, *x2, *c1, *c2;
  48.   x0 = &exc[-t0];
  49.   frac = -frac;
  50.   if (frac < 0) {
  51.     frac += UP_SAMP;
  52.     x0--;
  53.   }
  54.   for (j=0; j<l_subfr; j++)
  55.   {
  56.     x1 = x0++;
  57.     x2 = x0;
  58.     c1 = &inter_3l[frac];
  59.     c2 = &inter_3l[UP_SAMP-frac];
  60.     s = (F)0.0;
  61.     for(i=0, k=0; i< L_INTER10; i++, k+=UP_SAMP)
  62.       s+= x1[-i] * c1[k] + x2[i] * c2[k];
  63.     exc[j] = s;
  64.   }
  65.   return;
  66. }