⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 voicin.c

📁 sloedgy open sip stack source code
💻 C
📖 第 1 页 / 共 3 页
字号:
	integer *af, struct lpc10_encoder_state *st)
{
    /* Initialized data */

    real *dither;
    static real vdc[100]	/* was [10][10] */ = { 0.f,1714.f,-110.f,
	    334.f,-4096.f,-654.f,3752.f,3769.f,0.f,1181.f,0.f,874.f,-97.f,
	    300.f,-4096.f,-1021.f,2451.f,2527.f,0.f,-500.f,0.f,510.f,-70.f,
	    250.f,-4096.f,-1270.f,2194.f,2491.f,0.f,-1500.f,0.f,500.f,-10.f,
	    200.f,-4096.f,-1300.f,2e3f,2e3f,0.f,-2e3f,0.f,500.f,0.f,0.f,
	    -4096.f,-1300.f,2e3f,2e3f,0.f,-2500.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
	    0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f };
    static integer nvdcl = 5;
    static real vdcl[10] = { 600.f,450.f,300.f,200.f,0.f,0.f,0.f,0.f,0.f,0.f }
	    ;

    /* System generated locals */
    integer inbuf_offset = 0, lpbuf_offset = 0, i__1, i__2 = 0;
    real r__1, r__2;

    /* Builtin functions */
    integer i_nint(real *);
    double sqrt(doublereal);

    /* Local variables */
    real ar_b__, ar_f__;
    integer *lbve, *lbue, *fbve, *fbue;
    integer snrl, i__;
    integer *ofbue, *sfbue;
    real *voice;
    integer *olbue, *slbue;
    real value[9];
    integer zc;
    logical ot;
    real qs;
    real *maxmin;
    integer vstate;
    real rc1;
    extern /* Subroutine */ int vparms_(integer *, real *, real *, integer *, 
	    integer *, real *, integer *, integer *, integer *, integer *, 
	    real *, real *, real *, real *);
    integer fbe, lbe;
    real *snr;
    real snr2;

/* 	Global Variables: 
 *       Arguments 
 * $Log: voicin.c,v $
 * Revision 1.2  2007/03/04 03:00:58  joegenbaclor
 * Removed Linux compile warnings
 *
 * Revision 1.1  2006/06/26 03:02:55  joegenbaclor
 * I have decided to include the latest development realease  of OPAL tagged Deimos Devel 1 (June 8 2006) as inegrated classes to opensipstack to avoid future version conflicts due to the fast pace in OPAL development.   This move is also aimed to reduce the size of projects using OPAL componets such as the soon to be relased OpenSIPPhone.
 *
 * Revision 2.2  2005/08/08 03:28:42  dereksmithies
 * Eradicate all "/ * within comments" messages from GCC compilations.
 *
 * Revision 2.1  2003/03/14 09:53:27  robertj
 * Updated to openH323 v1.11.7
 *
 * Revision 1.2  2002/02/15 03:57:55  yurik
 * Warnings removed during compilation, patch courtesy of Jehan Bing, jehan@bravobrava.com
 *
 * Revision 1.1  2000/06/05 04:45:12  robertj
 * Added LPC-10 2400bps codec
 *
 * Revision 1.2  1996/08/20  20:45:00  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:30:14  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: */

/* *** Read-only: initialized in setup */

/*  Files for Speech, Parameter, and Bitstream Input & Output, */
/*    and message and debug outputs. */

/* Here are the only files which use these variables: */

/* lpcsim.f setup.f trans.f error.f vqsetup.f */

/* Many files which use fdebug are not listed, since it is only used in */
/* those other files conditionally, to print trace statements. */
/* 	integer fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
/*  LPC order, Frame size, Quantization rate, Bits per frame, */
/*    Error correction */
/* Subroutine SETUP is the only place where order is assigned a value, */
/* and that value is 10.  It could increase efficiency 1% or so to */
/* declare order as a constant (i.e., a Fortran PARAMETER) instead of as 
*/
/* a variable in a COMMON block, since it is used in many places in the */
/* core of the coding and decoding routines.  Actually, I take that back. 
*/
/* At least when compiling with f2c, the upper bound of DO loops is */
/* stored in a local variable before the DO loop begins, and then that is 
*/
/* compared against on each iteration. */
/* Similarly for lframe, which is given a value of MAXFRM in SETUP. */
/* Similarly for quant, which is given a value of 2400 in SETUP.  quant */
/* is used in only a few places, and never in the core coding and */
/* decoding routines, so it could be eliminated entirely. */
/* nbits is similar to quant, and is given a value of 54 in SETUP. */
/* corrp is given a value of .TRUE. in SETUP, and is only used in the */
/* subroutines ENCODE and DECODE.  It doesn't affect the speed of the */
/* coder significantly whether it is .TRUE. or .FALSE., or whether it is 
*/
/* a constant or a variable, since it is only examined once per frame. */
/* Leaving it as a variable that is set to .TRUE.  seems like a good */
/* idea, since it does enable some error-correction capability for */
/* unvoiced frames, with no change in the coding rate, and no noticeable 
*/
/* quality difference in the decoded speech. */
/* 	integer quant, nbits */
/* *** Read/write: variables for debugging, not needed for LPC algorithm 
*/

/*  Current frame, Unstable frames, Output clip count, Max onset buffer, 
*/
/*    Debug listing detail level, Line count on listing page */

/* nframe is not needed for an embedded LPC10 at all. */
/* nunsfm is initialized to 0 in SETUP, and incremented in subroutine */
/* ERROR, which is only called from RCCHK.  When LPC10 is embedded into */
/* an application, I would recommend removing the call to ERROR in RCCHK, 
*/
/* and remove ERROR and nunsfm completely. */
/* iclip is initialized to 0 in SETUP, and incremented in entry SWRITE in 
*/
/* sread.f.  When LPC10 is embedded into an application, one might want */
/* to cause it to be incremented in a routine that takes the output of */
/* SYNTHS and sends it to an audio device.  It could be optionally */
/* displayed, for those that might want to know what it is. */
/* maxosp is never initialized to 0 in SETUP, although it probably should 
*/
/* be, and it is updated in subroutine ANALYS.  I doubt that its value */
/* would be of much interest to an application in which LPC10 is */
/* embedded. */
/* listl and lincnt are not needed for an embedded LPC10 at all. */
/* 	integer nframe, nunsfm, iclip, maxosp, listl, lincnt */
/* 	common /contrl/ fsi, fso, fpi, fpo, fbi, fbo, pbin, fmsg, fdebug */
/* 	common /contrl/ quant, nbits */
/* 	common /contrl/ nframe, nunsfm, iclip, maxosp, listl, lincnt */
/* 	Parameters/constants */
/*       Voicing coefficient and Linear Discriminant Analysis variables: 
*/
/*       Max number of VDC's and VDC levels */
/*       The following are not Fortran PARAMETER's, but they are */
/*       initialized with DATA statements, and never modified. */
/*       Actual number of VDC's and levels */
/*       Local variables that need not be saved */
/*       Note: */

/*       VALUE(1) through VALUE(8) are assigned values, but VALUE(9) */
/*       never is.  Yet VALUE(9) is read in the loop that begins "DO I = 
*/
/*       1, 9" below.  I believe that this doesn't cause any problems in 
*/
/*       this subroutine, because all VDC(9,*) array elements are 0, and 
*/
/*       this is what is multiplied by VALUE(9) in all cases.  Still, it 
*/
/*       would save a multiplication to change the loop to "DO I = 1, 8". 
*/
/*       Local state */
/*       WARNING! */

/*       VOICE, SFBUE, and SLBUE should be saved from one invocation to */
/*       the next, but they are never given an initial value. */

/*       Does Fortran 77 specify some default initial value, like 0, or */
/*       is it undefined?  If it is undefined, then this code should be */
/*       corrected to specify an initial value. */

/*       For VOICE, note that it is "shifted" in the statement that */
/*       begins "IF (HALF .EQ. 1) THEN" below.  Also, uninitialized */
/*       values in the VOICE array can only affect entries in the VOIBUF 
*/
/*       array that are for the same frame, or for an older frame.  Thus 
*/
/*       the effects of uninitialized values in VOICE cannot linger on */
/*       for more than 2 or 3 frame times. */

/*       For SFBUE and SLBUE, the effects of uninitialized values can */
/*       linger on for many frame times, because their previous values */
/*       are exponentially decayed.  Thus it is more important to choose 
*/
/*       initial values for these variables.  I would guess that a */
/*       reasonable initial value for SFBUE is REF/16, the same as used */
/*       for FBUE and OFBUE.  Similarly, SLBUE can be initialized to */
/*       REF/32, the same as for LBUE and OLBUE. */

/*       These guessed initial values should be validated by re-running */
/*       the modified program on some audio samples. */

/*   Declare and initialize filters: */

    dither = (&st->dither);
    snr = (&st->snr);
    maxmin = (&st->maxmin);
    voice = (&st->voice[0]);
    lbve = (&st->lbve);
    lbue = (&st->lbue);
    fbve = (&st->fbve);
    fbue = (&st->fbue);
    ofbue = (&st->ofbue);
    olbue = (&st->olbue);
    sfbue = (&st->sfbue);
    slbue = (&st->slbue);

    /* Parameter adjustments */
    if (vwin) {
	--vwin;
	}
    if (buflim) {
	--buflim;
	}
    if (inbuf) {
	inbuf_offset = buflim[1];
	inbuf -= inbuf_offset;
	}
    if (lpbuf) {
	lpbuf_offset = buflim[3];
	lpbuf -= lpbuf_offset;
	}
    if (ivrc) {
	--ivrc;
	}
    if (obound) {
	--obound;
	}
    if (voibuf) {
	--voibuf;
	}

    /* Function Body */

/*       The following variables are saved from one invocation to the */
/*       next, but are not initialized with DATA statements.  This is */
/*       acceptable, because FIRST is initialized ot .TRUE., and the */
/*       first time that this subroutine is then called, they are all */
/*       given initial values. */

/*       SNR */
/*       LBVE, LBUE, FBVE, FBUE, OFBUE, OLBUE */

/*       MAXMIN is initialized on the first call, assuming that HALF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -