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

📄 vparms.f,v

📁 lpc10-15为美军2400bps语音压缩标准的C语音源代码。
💻 F,V
字号:
head	1.6;access;symbols;locks; strict;comment	@* @;1.6date	96.03.29.18.01.16;	author jaf;	state Exp;branches;next	1.5;1.5date	96.03.19.00.02.02;	author jaf;	state Exp;branches;next	1.4;1.4date	96.03.18.22.22.59;	author jaf;	state Exp;branches;next	1.3;1.3date	96.03.18.22.22.17;	author jaf;	state Exp;branches;next	1.2;1.2date	96.03.13.15.02.58;	author jaf;	state Exp;branches;next	1.1;1.1date	96.02.07.14.50.42;	author jaf;	state Exp;branches;next	;desc@@1.6log@Added some more comments about the range of INBUF and LPBUF that canbe read.  Note that it is possible for index VWIN(2)+1 to be read fromINBUF, which might be outside of its defined range, although that willrequire more careful checking.@text@************************************************************************	VPARMS Version 50** $Log: vparms.f,v $* Revision 1.5  1996/03/19  00:02:02  jaf* I just noticed that the argument DITHER is modified inside of this* subroutine.  Comments were added explaining the possible final values.** Revision 1.4  1996/03/18  22:22:59  jaf* Finishing the job I said I did with the last check-in comments.** Revision 1.3  1996/03/18  22:22:17  jaf* Just added a few comments about which array indices of the arguments* are used, and mentioning that this subroutine has no local state.** Revision 1.2  1996/03/13  15:02:58  jaf* Comments added explaining that none of the local variables of this* subroutine need to be saved from one invocation to the next.** Revision 1.1  1996/02/07 14:50:42  jaf* Initial revision**************************************************************************  Calculate voicing parameters:** Input:*  VWIN   - Voicing window limits*           Indices 1 through 2 read.*  INBUF  - Input speech buffer*           Indices START-1 through STOP read,*           where START and STOP are defined in the code (only written once).*           Note that STOP can be as large as VWIN(2)+1 !*  LPBUF  - Low pass filtered speech*           Indices START-MINTAU through STOP+MINTAU read,*           where START and STOP are defined in the code (only written once).*  BUFLIM - Array bounds for INBUF and LPBUF*           Indices 1 through 4 read.*  HALF   - Half frame (1 or 2)*  MINTAU - Lag corresponding to minimum AMDF value (pitch estimate)* Input/Output:*  DITHER - Zero crossing threshold*           The resulting value might be the negation of the input*           value.  It might always be the same as the input value,*           if the DO loop below always executes an even number of times.* Output: (all of them are written on every call)*  ZC     - Zero crossing rate*  LBE    - Low band energy (sum of magnitudes - SM)*  FBE    - Full band energy (SM)*  QS     - Ratio of 6 dB/oct preemphasized energy to full band energy*  RC1    - First reflection coefficient*  AR_B   - Product of the causal forward and reverse pitch*           prediction gains*  AR_F   - Product of the noncausal forward and reverse pitch*           prediction gains* Internal:*  OLDSGN - Previous sign of dithered signal*  VLEN   - Length of voicing window*  START  - Lower address of current half of voicing window*  STOP   - Upper address of current half of voicing window*  E_0    - Energy of LPF speech (sum of squares - SS)*  E_B    - Energy of LPF speech backward one pitch period (SS)*  E_F    - Energy of LPF speech forward one pitch period (SS)*  R_B    - Autocovariance of LPF speech backward one pitch period*  R_F    - Autocovariance of LPF speech forward one pitch period*  LP_RMS - Energy of LPF speech (sum of magnitudes - SM)*  AP_RMS - Energy of all-pass speech (SM)*  E_PRE  - Energy of 6dB preemphasized speech (SM)*  E0AP   - Energy of all-pass speech (SS)** This subroutine has no local state.*	SUBROUTINE VPARMS( VWIN, INBUF, LPBUF, BUFLIM, HALF, DITHER, MINTAU,     1    ZC, LBE, FBE, QS, RC1, AR_B, AR_F )*       Arguments	INTEGER VWIN(2), BUFLIM(4)	REAL INBUF(BUFLIM(1):BUFLIM(2))	REAL LPBUF(BUFLIM(3):BUFLIM(4))	INTEGER HALF	REAL DITHER	INTEGER MINTAU, ZC, LBE, FBE	REAL QS, RC1, AR_B, AR_F*       Local variables that need not be saved	INTEGER I, VLEN, START, STOP	REAL OLDSGN, E_0, E_B, R_B, LP_RMS, AP_RMS, E_PRE, E0AP	REAL E_F, R_F*   Calculate zero crossings (ZC) and several energy and correlation*   measures on low band and full band speech.  Each measure is taken*   over either the first or the second half of the voicing window,*   depending on the variable HALF.	LP_RMS = 0.	AP_RMS = 0.	E_PRE = 0.	E0AP = 0.	RC1 = 0.	E_0 = 0.	E_B = 0.	E_F = 0.	R_F = 0.	R_B = 0.	ZC = 0	VLEN = VWIN(2) - VWIN(1) + 1	START = VWIN(1) + (HALF-1)*VLEN/2 + 1	STOP = START + VLEN/2 - 1* * I'll use the symbol HVL in the table below to represent the value* VLEN/2.  Note that if VLEN is odd, then HVL should be rounded down,* i.e., HVL = (VLEN-1)/2.* * HALF  START          STOP* * 1     VWIN(1)+1      VWIN(1)+HVL* 2     VWIN(1)+HVL+1  VWIN(1)+2*HVL* * Note that if VLEN is even and HALF is 2, then STOP will be* VWIN(1)+VLEN = VWIN(2)+1.  That could be bad, if that index of INBUF* is undefined.* 	OLDSGN = SIGN( 1., INBUF(START-1)-DITHER )	DO I = START, STOP	   LP_RMS = LP_RMS + ABS(LPBUF(I))	   AP_RMS = AP_RMS + ABS(INBUF(I))	   E_PRE = E_PRE + ABS(INBUF(I)-INBUF(I-1))	   E0AP = E0AP + INBUF(I)**2	   RC1 = RC1 + INBUF(I)*INBUF(I-1)	   E_0 = E_0 + LPBUF(I)**2	   E_B = E_B + LPBUF(I-MINTAU)**2	   E_F = E_F + LPBUF(I+MINTAU)**2	   R_F = R_F + LPBUF(I)*LPBUF(I+MINTAU)	   R_B = R_B + LPBUF(I)*LPBUF(I-MINTAU)	   IF( SIGN(1.,INBUF(I)+DITHER) .NE. OLDSGN ) THEN	      ZC = ZC + 1	      OLDSGN = -OLDSGN	   END IF	   DITHER = -DITHER	END DO*   Normalized short-term autocovariance coefficient at unit sample delay	RC1 = RC1 / MAX(E0AP,1.)*   Ratio of the energy of the first difference signal (6 dB/oct preemphasis)*   to the energy of the full band signal	QS = E_PRE / MAX(2.*AP_RMS,1.)*   aR_b is the product of the forward and reverse prediction gains,*   looking backward in time (the causal case).	AR_B = (R_B / MAX(E_B,1.)) * (R_B / MAX(E_0,1.))*   aR_f is the same as aR_b, but looking forward in time (non causal case).	AR_F = (R_F / MAX(E_F,1.)) * (R_F / MAX(E_0,1.))*   Normalize ZC, LBE, and FBE to old fixed window length of 180.*   (The fraction 90/VLEN has a range of .58 to 1)	ZC =       NINT( ZC*2     * (90./VLEN) )	LBE = MIN( NINT( LP_RMS/4 * (90./VLEN) ), 32767 )	FBE = MIN( NINT( AP_RMS/4 * (90./VLEN) ), 32767 )	RETURN	END@1.5log@I just noticed that the argument DITHER is modified inside of thissubroutine.  Comments were added explaining the possible final values.@text@d6 4d35 1d48 1a48 1* Output:d114 14@1.4log@Finishing the job I said I did with the last check-in comments.@text@d6 3d37 2d40 3a42 1*  MINTAU - Lag corresponding to minimum AMDF value (pitch estimate)@1.3log@Just added a few comments about which array indices of the argumentsare used, and mentioning that this subroutine has no local state.@text@d6 4d61 2a62 1@1.2log@Comments added explaining that none of the local variables of thissubroutine need to be saved from one invocation to the next.@text@d6 4d18 1a18 1* Inputs:d20 1d22 2d25 2d28 1d32 1a32 1* Outputs:d61 1a61 1*       Parametersd71 1a71 4*       Local variables*       *       None of these need to have their values saved from one*       invocation to the next.@1.1log@Initial revision@text@d5 4a8 1* $Log$d50 16a65 5	INTEGER BUFLIM(4), VWIN(2)	REAL INBUF(BUFLIM(1):BUFLIM(2)), LPBUF(BUFLIM(3):BUFLIM(4))	INTEGER HALF, ZC, LBE, FBE, MINTAU	REAL DITHER, QS, RC1, AR_B	REAL AR_F@

⌨️ 快捷键说明

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