www.pudn.com > lpc.zip > preemp_i.c


/********************************************************************
*
*	PREEMP Version 48
*
********************************************************************
*
*   Preemphasize speech with      ( 1 - .9375z**-1 )  [old preemphasis]
*   cascaded with ( 1 + .2z**-1 ) / ( 1 + .5z**-1 )   [6 db/oct ramp]
*
* Inputs:
*  NSAMP  - Number of samples to filter
*  INBUF  - Input speech buffer
*  COEF	  - Preemphasis coeficient
* Output:
*  PEBUF  - Preemphasized speech buffer (can be equal to INBUF)
*  Z      - Filter state
*/
#include "ourstuff.h"

preemp_i( inbuf_i, pebuf_i, nsamp, coef, z )
int_type nsamp;
int_type *inbuf_i, *pebuf_i, coef, *z;
{
int_type i;
int_type temp=0;

for(i=1; i<=nsamp; i++) {
	temp = inbuf_i[i] - *z + ((long_type)coef*(long_type)*(z+1))>>12;
	*(z+1) = *z;
	*z = inbuf_i[i];
	pebuf_i[i] = temp;
}


}