www.pudn.com > AVS_M_ver10.rar > pit_fr4.c


/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2007 Audio Video Coding Standard, Part ¢ú
*
* This software module was developed by AVS Audio sub-group
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the users without any
* license fee or royalty on an "as is" basis. The AVS disclaims
* any and all warranties, whether express, implied, or statutory,
* including any implied warranties of merchantability or of fitness
* for a particular purpose. In no event shall the contributors or
* the AVS be liable for any incidental, punitive, or consequential
* damages of any kind whatsoever arising from the use of this program.
*
* This disclaimer of warranty extends to the user of this program
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The AVS does not represent or warrant that the program furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of AVS, including shareware, may be
* subject to royalty fees to patent holders. Information regarding
* the AVS patent policy is available from the AVS Web site at
* http://www.avs.org.cn
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY.
************************************************************************
*/

/*-------------------------------------------------------------------*
* procedure pitch_fr4 *
* ~~~~~~~~~~~~~~~~~~~ *
* Find the closed loop pitch period with 1/4 subsample resolution. *
*-------------------------------------------------------------------*/
#include <math.h>
#include "../include/amr_plus.h"
/* locals functions */
/*-------------------------------------------------------------------*
* Function pred_lt4: *
* ~~~~~~~~~ *
*-------------------------------------------------------------------*
* Compute the result of long term prediction with fractionnal *
* interpolation of resolution 1/4. *
* *
* On return exc[0..L_subfr-1] contains the interpolated signal *
* (adaptive codebook excitation) *
*-------------------------------------------------------------------*/
void pred_lt4(
float exc[], /* in/out: excitation buffer */
int T0, /* input : integer pitch lag */
int frac, /* input : fraction of lag */
int L_subfr /* input : subframe size */
)
{
int i, j;
float s, *x0, *x1, *x2, *c1, *c2;
x0 = &amt;exc[-T0];
frac = -frac;
if (frac < 0) {
frac += PIT_UP_SAMP;
x0--;
}
for (j=0; j<L_subfr; j++)
{
x1 = x0++;
x2 = x1+1;
c1 = (float*)&amt;inter4_2[frac];
c2 = (float*)&amt;inter4_2[PIT_UP_SAMP-frac];
s = 0.0;
for(i=0; i<PIT_L_INTERPOL2; i++, c1+=PIT_UP_SAMP, c2+=PIT_UP_SAMP) {
s += (*x1--) * (*c1) + (*x2++) * (*c2);
}
exc[j] = s;
}
return;
}