📄 analys.c
字号:
/*$Log: analys.c,v $Revision 1.1.1.1 2001/11/19 19:50:13 smorlatFirst cvs.Revision 1.1.1.1 2001/08/08 21:29:08 simonFirst import * Revision 1.2 1996/08/20 20:16:01 jaf * Removed all static local variables that were SAVE'd in the Fortran * code, and put them in struct lpc10_encoder_state that is passed as an * argument. * * Removed init function, since all initialization is now done in * init_lpc10_encoder_state(). * * Revision 1.1 1996/08/19 22:29:08 jaf * Initial revision **/#ifdef P_R_O_T_O_T_Y_P_E_Sextern int analys_(real *speech, integer *voice, integer *pitch, real *rms, real *rc, struct lpc10_encoder_state *st);/* comlen contrl_ 12 *//*:ref: preemp_ 14 5 6 6 4 6 6 *//*:ref: onset_ 14 7 6 4 4 4 4 4 4 *//*:ref: placev_ 14 11 4 4 4 4 4 4 4 4 4 4 4 *//*:ref: lpfilt_ 14 4 6 6 4 4 *//*:ref: ivfilt_ 14 5 6 6 4 4 6 *//*:ref: tbdm_ 14 8 6 4 4 4 6 4 4 4 *//*:ref: voicin_ 14 12 4 6 6 4 4 6 6 4 6 4 4 4 *//*:ref: dyptrk_ 14 6 6 4 4 4 4 4 *//*:ref: placea_ 14 9 4 4 4 4 4 4 4 4 4 *//*:ref: dcbias_ 14 3 4 6 6 *//*:ref: energy_ 14 3 4 6 6 *//*:ref: mload_ 14 6 4 4 4 6 6 6 *//*:ref: invert_ 14 4 4 6 6 6 *//*:ref: rcchk_ 14 3 4 6 6 *//*:ref: initonset_ 14 0 *//*:ref: initvoicin_ 14 0 *//*:ref: initdyptrk_ 14 0 *//* Rerunning f2c -P may change prototypes or declarations. */#endif/* -- translated by f2c (version 19951025). You must link the resulting object file with the libraries: -lf2c -lm (in that order)*/#include "f2c.h"/* Common Block Declarations */extern struct { integer order, lframe; logical corrp;} contrl_;#define contrl_1 contrl_/* Table of constant values */static integer c__10 = 10;static integer c__181 = 181;static integer c__720 = 720;static integer c__3 = 3;static integer c__90 = 90;static integer c__156 = 156;static integer c__307 = 307;static integer c__462 = 462;static integer c__312 = 312;static integer c__60 = 60;static integer c__1 = 1;/* ****************************************************************** *//* ANALYS Version 55 *//* $Log: analys.c,v $/* Revision 1.1.1.1 2001/11/19 19:50:13 smorlat/* First cvs./*/* Revision 1.1.1.1 2001/08/08 21:29:08 simon/* First import/* * Revision 1.2 1996/08/20 20:16:01 jaf * Removed all static local variables that were SAVE'd in the Fortran * code, and put them in struct lpc10_encoder_state that is passed as an * argument. * * Removed init function, since all initialization is now done in * init_lpc10_encoder_state(). * * Revision 1.1 1996/08/19 22:29:08 jaf * Initial revision * *//* Revision 1.9 1996/05/23 19:41:07 jaf *//* Commented out some unnecessary lines that were reading uninitialized *//* values. *//* Revision 1.8 1996/03/27 23:57:55 jaf *//* Added some comments about which indices of the local buffers INBUF, *//* LPBUF, etc., get read or modified by some of the subroutine calls. I *//* just did this while trying to figure out the discrepancy between the *//* embedded code compiled with all local variables implicitly saved, and *//* without. *//* I added some debugging write statements in hopes of finding a problem. *//* None of them ever printed anything while running with the long input *//* speech file dam9.spd provided in the distribution. *//* Revision 1.7 1996/03/27 18:06:20 jaf *//* Commented out access to MAXOSP, which is just a debugging variable *//* that was defined in the COMMON block CONTRL in contrl.fh. *//* Revision 1.6 1996/03/26 19:31:33 jaf *//* Commented out trace statements. *//* Revision 1.5 1996/03/21 15:19:35 jaf *//* Added comments for ENTRY PITDEC. *//* Revision 1.4 1996/03/19 20:54:27 jaf *//* Added a line to INITANALYS. See comments there. *//* Revision 1.3 1996/03/19 20:52:49 jaf *//* Rearranged the order of the local variables quite a bit, to separate *//* them into groups of "constants", "locals that don't need to be saved *//* from one call to the next", and "local that do need to be saved from *//* one call to the next". *//* Several locals in the last set should have been given initial values, *//* but weren't. I gave them all initial values of 0. *//* Added a separate ENTRY INITANALYS that initializes all local state *//* that should be, and also calls the corresponding entries of the *//* subroutines called by ANALYS that also have local state. *//* There used to be DATA statements in ANALYS. I got rid of most of *//* them, and added a local logical variable FIRST that calls the entry *//* INITANALYS on the first call to ANALYS. This is just so that one need *//* not remember to call INITANALYS first in order for the state to be *//* initialized. *//* Revision 1.2 1996/03/11 23:29:32 jaf *//* Added several comments with my own personal questions about the *//* Fortran 77 meaning of the parameters passed to the subroutine PREEMP. *//* Revision 1.1 1996/02/07 14:42:29 jaf *//* Initial revision *//* ****************************************************************** *//* SUBROUTINE ANALYS *//* Input: *//* SPEECH *//* Indices 1 through LFRAME read. *//* Output: *//* VOICE *//* Indices 1 through 2 written. *//* PITCH *//* Written in subroutine DYPTRK, and then perhaps read and written *//* some more. *//* RMS *//* Written. *//* RC *//* Indices 1 through ORDER written (ORDER defined in contrl.fh). *//* This subroutine maintains local state from one call to the next. If *//* you want to switch to using a new audio stream for this filter, or *//* reinitialize its state for any other reason, call the ENTRY *//* INITANALYS. *//* ENTRY PITDEC *//* Input: *//* PITCH - Encoded pitch index *//* Output: *//* PTAU - Decoded pitch period *//* This entry has no local state. It accesses a "constant" array *//* declared in ANALYS. *//* Subroutine */ int analys_(real *speech, integer *voice, integer *pitch, real *rms, real *rc, struct lpc10_encoder_state *st){ /* Initialized data */ static integer tau[60] = { 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34, 35,36,37,38,39,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72, 74,76,78,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136, 140,144,148,152,156 }; static integer buflim[4] = { 181,720,25,720 }; static real precoef = .9375f; /* System generated locals */ integer i__1; /* Local variables */ real amdf[60]; integer half; real abuf[156]; real *bias; extern /* Subroutine */ int tbdm_(real *, integer *, integer *, integer *, real *, integer *, integer *, integer *); integer *awin; integer midx, ewin[6] /* was [2][3] */; real ivrc[2], temp; real *zpre; integer *vwin; integer i__, j, lanal; extern /* Subroutine */ int rcchk_(integer *, real *, real *), mload_( integer *, integer *, integer *, real *, real *, real *); real *inbuf, *pebuf; real *lpbuf, *ivbuf; real *rcbuf; integer *osbuf; extern /* Subroutine */ int onset_(real *, integer *, integer *, integer * , integer *, integer *, integer *, struct lpc10_encoder_state *); integer *osptr; extern /* Subroutine */ placea_(integer *, integer * , integer *, integer *, integer *, integer *, integer *, integer * , integer *), dcbias_(integer *, real *, real *), placev_(integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *, integer *); integer ipitch; integer *obound; extern /* Subroutine */ int preemp_(real *, real *, integer *, real *, real *), voicin_(integer *, real *, real *, integer *, integer *, real *, real *, integer *, real *, integer *, integer *, integer *, struct lpc10_encoder_state *); integer *voibuf; integer mintau; real *rmsbuf; extern /* Subroutine */ int lpfilt_(real *, real *, integer *, integer *), ivfilt_(real *, real *, integer *, integer *, real *), energy_( integer *, real *, real *), invert_(integer *, real *, real *, real *); integer minptr, maxptr; extern /* Subroutine */ int dyptrk_(real *, integer *, integer *, integer *, integer *, integer *, struct lpc10_encoder_state *); real phi[100] /* was [10][10] */, psi[10];/* $Log: analys.c,v $/* Revision 1.1.1.1 2001/11/19 19:50:13 smorlat/* First cvs./*/* Revision 1.1.1.1 2001/08/08 21:29:08 simon/* First import/* * Revision 1.2 1996/08/20 20:16:01 jaf * Removed all static local variables that were SAVE'd in the Fortran * code, and put them in struct lpc10_encoder_state that is passed as an * argument. * * Removed init function, since all initialization is now done in * init_lpc10_encoder_state(). * * Revision 1.1 1996/08/19 22:29:08 jaf * Initial revision * *//* Revision 1.3 1996/03/29 22:03:47 jaf *//* Removed definitions for any constants that were no longer used. *//* Revision 1.2 1996/03/26 19:34:33 jaf *//* Added comments indicating which constants are not needed in an *//* application that uses the LPC-10 coder. *//* Revision 1.1 1996/02/07 14:43:51 jaf *//* Initial revision *//* LPC Configuration parameters: *//* Frame size, Prediction order, Pitch period *//* Arguments to ANALYS *//* $Log: analys.c,v $/* Revision 1.1.1.1 2001/11/19 19:50:13 smorlat/* First cvs./*/* Revision 1.1.1.1 2001/08/08 21:29:08 simon/* First import/* * Revision 1.2 1996/08/20 20:16:01 jaf * Removed all static local variables that were SAVE'd in the Fortran * code, and put them in struct lpc10_encoder_state that is passed as an * argument. * * Removed init function, since all initialization is now done in * init_lpc10_encoder_state(). * * Revision 1.1 1996/08/19 22:29:08 jaf * Initial revision * *//* Revision 1.3 1996/03/29 22:05:55 jaf *//* Commented out the common block variables that are not needed by the *//* embedded version. *//* Revision 1.2 1996/03/26 19:34:50 jaf *//* Added comments indicating which constants are not needed in an *//* application that uses the LPC-10 coder. *//* Revision 1.1 1996/02/07 14:44:09 jaf *//* Initial revision *//* LPC Processing control variables: */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -