www.pudn.com > lpc.zip > analys.c
/*******************************************************************
*
* ANALYS Version 50
*
*******************************************************************/
#ifdef LOWRATE
#include "defines.h"
#endif
#include "ourstuff.h"
#include "lpcdefs.h"
#include "config.ch"
/* Constants
* NF = Number of frames
* AF = Frame in which analysis is done
* OSLEN = Length of the onset buffer
* LTAU = Number of pitch lags
* SBUFL, SBUFH = Start and end index of speech buffers
* LBUFL, LBUFH = Start and end index of LPF speech buffer
* MINWIN, MAXWIN = Min and Max length of voicing (and analysis) windows
* PWLEN, PWINH, PWINL = Length, upper and lower limits of pitch window
* DVWINL, DVWINH = Default lower and upper limits of voicing window
*/
#define LPFILT_DELAY 15
#define NUM_VF 9
/* These were added by sw for testing only */
extern int_type tau_i[LTAU];
extern int_type lparray_i[LBUFH-LBUFL+1], ivarray_i[PWINH-PWINL+1];
extern int_type pearray_i[SBUFH-SBUFL+1], inarray_i[SBUFH-SBUFL+1];
extern int_type *inbuf_i, *pebuf_i, *lpbuf_i, *ivbuf_i;
extern int_type vwin_i[2][AF], awin_i[2][AF], voibuf_i[2][AF+1];
extern int_type rmsbuf_i[AF], amdf_i[LTAU], psi_i[MAXORD], rcbuf_i[MAXORD][AF];
extern int_type phi_i[MAXORD][MAXORD];
extern long_type phi_l[MAXORD][MAXORD], psi_l[MAXORD];
static int_type zpre_i[2]={0, 0};
analys( speech_i, voice, pitch, rms, rc )
int_type speech_i[];
int_type *rms, rc[];
int_type voice[2], *pitch;
{
/* Data Buffers
* INBUF Raw speech (with DC bias removed each frame)
* PEBUF Preemphasized speech
* LPBUF Low pass speech buffer
* IVBUF Inverse filtered speech
* OSBUF Indexes of onsets in speech buffers
* VWIN Voicing window indices
* AWIN Analysis window indices
* EWIN Energy window indices
* VOIBUF Voicing decisions on windows in VWIN
* RMSBUF RMS energy
* RCBUF Reflection Coefficients
*
* Pitch is handled separately from the above parameters.
* The following variables deal with pitch:
* MIDX Encoded initial pitch estimate for analysis frame
* IPITCH Initial pitch computed for frame AF (decoded from MIDX)
* PITCH The encoded pitch value (index into TAU) for the present
* frame (delayed and smoothed by Dyptrack)
*/
/* REAL INBUF(SBUFL:SBUFH), PEBUF(SBUFL:SBUFH)
REAL LPBUF(LBUFL:LBUFH), IVBUF(PWINL:PWINH) */
int_type abuf_i[MAXWIN];
static int_type osptr_i=1;
static int_type obound_i[AF];
static int_type ewin_i[2][AF];
int_type i, j;
int_type lanal_i, half;
int_type ipitch_i, minptr_i, maxptr_i, mintau_i, midx_i;
int_type ivrc_i[2];
static int_type osbuf_i[OSLEN], first=1;
if (first) {
first = 0;
for(i=0;i LFRAME) {
osbuf_i[j-1]=osbuf_i[i-1]-LFRAME;
j++;
}
}
osptr_i=j;
voibuf_i[0][0] = voibuf_i[0][1];
voibuf_i[1][0] = voibuf_i[1][1];
for( i = 0;i>12);
for(j=0;j>12);
}
}
invert_i(phi_i, psi_i, rcbuf_i);
rcchk_i(rcbuf_i);
/* Set return parameters */
voice[0] = voibuf_i[0][AF-2];
voice[1] = voibuf_i[1][AF-2];
*rms = rmsbuf_i[AF-3];
for(i = 1;i<=ORDER;i++)
rc[i] = rcbuf_i[i-1][AF-3];
}