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

📄 analys.f,v

📁 lpc10-15为美军2400bps语音压缩标准的C语音源代码。
💻 F,V
📖 第 1 页 / 共 2 页
字号:
     1    VWIN, AWIN, EWIN, LFRAME, MAXWIN )*   Remove short term DC bias over the analysis window, Put result in ABUF	LANAL = AWIN(2,AF) + 1 - AWIN(1,AF)	CALL DCBIAS( LANAL, PEBUF(AWIN(1,AF)), ABUF )*       ABUF(1:LANAL) is now defined.  It is equal to*       PEBUF(AWIN(1,AF):AWIN(2,AF)) corrected for short term DC bias.*	IF ((AWIN(1,AF) .LT. SBUFL) .OR. (SBUFH .LT. AWIN(2,AF))) THEN*	   WRITE (2,999) AWIN(1,AF), AWIN(2,AF), SBUFL, SBUFH* 999	   FORMAT(1X,'AWIN (',I4,':',I4,*     1            ') goes outside of PEBUFs range (',I4,':',I4,')')*	   STOP*	END IF*	IF (MAXWIN .LT. LANAL) THEN*	   WRITE (2,998) LANAL, MAXWIN* 998	   FORMAT(1X,'LANAL (',I4,*     1            ') goes outside of ABUFs range (1:',I4,')')*	   STOP*	END IF*   Compute RMS over integer number of pitch periods within the*   analysis window.*   Note that in a hardware implementation this computation may be*   simplified by using diagonal elements of PHI computed by MLOAD.*	IF (     (EWIN(1,AF) .LT. AWIN(1,AF))*     1      .OR. (AWIN(2,AF) .LT. EWIN(2,AF))) THEN*	   WRITE (2,997) EWIN(1,AF), EWIN(2,AF), AWIN(1,AF), AWIN(2,AF)* 997	   FORMAT(1X,'EWIN (',I4,':',I4,*     1            ') goes outside of AWINs range (',I4,':',I4,')')*	   STOP*	END IF	CALL ENERGY( EWIN(2,AF)-EWIN(1,AF)+1,     1              ABUF(EWIN(1,AF)-AWIN(1,AF)+1), RMSBUF(AF) )*   Matrix load and invert, check RC's for stability*	IF (LANAL .LT. ORDER) THEN*	   WRITE (2,996) LANAL, ORDER* 996	   FORMAT(1X,'MLOAD will read outside of ABUFs defined range ',*     1            'of (1:LANAL=',I4,') because LANAL is less than',*     1            ' ORDER=',I4)*	   STOP*	END IF	CALL MLOAD( ORDER, 1, LANAL, ABUF, PHI, PSI )	CALL INVERT( ORDER, PHI, PSI, RCBUF(1,AF) )	CALL RCCHK( ORDER, RCBUF(1,AF-1), RCBUF(1,AF) )*   Set return parameters	VOICE(1) = VOIBUF(1,AF-2)	VOICE(2) = VOIBUF(2,AF-2)	RMS = RMSBUF(AF-2)	DO I = 1,ORDER	   RC(I) = RCBUF(I,AF-2)	END DO*   Print out test data*	IF(LISTL.GE.3) THEN*	   IF(LISTL.GE.4) THEN*	      IF(LISTL.GE.6) THEN*	         WRITE(FDEBUG,980) 'INBUF:',INBUF*	         WRITE(FDEBUG,980) 'LPBUF:',LPBUF*	         WRITE(FDEBUG,980) 'IVBUF:',IVBUF*	         WRITE(FDEBUG,980) 'PEBUF:',PEBUF*	      END IF*	      WRITE(FDEBUG,980) 'AMDF:',AMDF*	   END IF*	   IF(OSPTR.GT.1) WRITE(FDEBUG,970)*     1    'OSBUF Onset Locations:', (OSBUF(I),I=1,OSPTR-1)*	   IF(LISTL.GE.4) THEN*	      WRITE(FDEBUG,980) 'PHI Matrix Values:',*     1       ((PHI(I,J),J=1,ORDER),I=1,ORDER)*	      WRITE(FDEBUG,980) 'PSI Vector Values:',PSI*970	      FORMAT(1X,A,100(/1X,20I6))*980	      FORMAT(1X,A,100(/1X,10F12.1))*	   END IF*	   WRITE(FDEBUG,990)*990	   FORMAT('  FRAME   AWIN     EWIN   BIAS',T34,*     1    'V/UV  Pitch RMS',T54,*     1    'RC1     RC2     RC3     RC4     RC5     ',*     1    'RC6     RC7     RC8     RC9    RC10')*	   WRITE(FDEBUG,992) NFRAME, AWIN(1,AF), AWIN(2,AF),*     1    EWIN(1,AF), EWIN(2,AF), BIAS,*     1    VOIBUF(2,AF), IPITCH, RMSBUF(AF), (RCBUF(I,AF),I=1,ORDER)*992	   FORMAT(1X,I6,2I4,1X,2I4,F6.1,T34,I2,I8,F6.0,T50,10F8.3)*	END IF	RETURN*********************************************************************   Decode pitch index (PITCH) to pitch period (PTAU)********************************************************************	ENTRY PITDEC( PITCH, PTAU )	IF (PITCH .GE. 1 .AND. PITCH .LE. LTAU) THEN	   PTAU = TAU(PITCH)	ELSE	   PTAU = 0	END IF	RETURN	ENTRY INITANALYS ()*       Set FIRST to .FALSE., so that just in case someone calls*       INITANALYS before calling ANALYS for the first time, then this*       entry will not be called by ANALYS itself.	FIRST = .FALSE.*       Initialize local state in all subroutines that have local state.	CALL INITONSET ()	CALL INITVOICIN ()	CALL INITDYPTRK ()*       INBUF, PEBUF, LPBUF, and IVBUF were not initialized in the*       original code.  Initial values of 0 appear to be safe.	DO I = SBUFL,SBUFH	   INBUF(I) = 0.	   PEBUF(I) = 0.	END DO	DO I = LBUFL,LBUFH	   LPBUF(I) = 0.	END DO	DO I = PWINL,PWINH	   IVBUF(I) = 0.	END DO	BIAS = 0*       Although OSBUF is saved from one invocation to the next, it need*       not have an initial defined value, because OSPTR is initialized*       to 1, and only entries 1 through OSPTR-1 may be read without*       writing them first.	OSPTR = 1	DO I = 1,AF	   OBOUND(I) = 0	END DO*       Should other indices of VWIN and AWIN be initialized, or is this*       unnecessary?  If unnecessary, why?		VWIN(1,AF) = DVWINL	VWIN(2,AF) = DVWINH	AWIN(1,AF) = DVWINL	AWIN(2,AF) = DVWINH*       VOIBUF was not initialized in the original code.  I believe*       initializing it to all 0's is a safe decision, given that its*       contents are always 0/1 truth values representing the decision*       of whether a half-frame was voiced or not.	DO I = 1,2	   DO J = 0,AF	      VOIBUF(I,J) = 0	   END DO	END DO*       RMSBUF and RCBUF were also not initialized in the original code.*       Again, initial values of 0 appear to be safe.	DO I = 1,AF	   RMSBUF(I) = 0.	   DO J = 1,ORDER	      RCBUF(J,I) = 0.	   END DO	END DO	ZPRE = 0.	RETURN	END@1.8log@Added some comments about which indices of the local buffers INBUF,LPBUF, etc., get read or modified by some of the subroutine calls.  Ijust did this while trying to figure out the discrepancy between theembedded code compiled with all local variables implicitly saved, andwithout.I added some debugging write statements in hopes of finding a problem.None of them ever printed anything while running with the long inputspeech file dam9.spd provided in the distribution.@text@d6 11d241 7a247 2*       EWIN(*,J) is unused for J .LT. AF, so the following shift is*       unnecessary.a248 2	   EWIN(1,I) = EWIN(1,I+1) - LFRAME	   EWIN(2,I) = EWIN(2,I+1) - LFRAME@1.7log@Commented out access to MAXOSP, which is just a debugging variablethat was defined in the COMMON block CONTRL in contrl.fh.@text@d6 4d57 2d60 1d285 4d291 5d297 5d339 17d361 8d374 8d483 3@1.6log@Commented out trace statements.@text@d6 3d260 5a264 1	MAXOSP = MAX( MAXOSP, OSPTR )@1.5log@Added comments for ENTRY PITDEC.@text@d6 3d177 4a180 4	IF(LISTL.GE.3) THEN	   WRITE(FDEBUG,900) NFRAME900	   FORMAT(1X,//,65(2H- ),//,' ANALYSIS DATA -- FRAME',I6/)	END IFd336 29a364 29	IF(LISTL.GE.3) THEN	   IF(LISTL.GE.4) THEN	      IF(LISTL.GE.6) THEN	         WRITE(FDEBUG,980) 'INBUF:',INBUF	         WRITE(FDEBUG,980) 'LPBUF:',LPBUF	         WRITE(FDEBUG,980) 'IVBUF:',IVBUF	         WRITE(FDEBUG,980) 'PEBUF:',PEBUF	      END IF	      WRITE(FDEBUG,980) 'AMDF:',AMDF	   END IF	   IF(OSPTR.GT.1) WRITE(FDEBUG,970)     1    'OSBUF Onset Locations:', (OSBUF(I),I=1,OSPTR-1)	   IF(LISTL.GE.4) THEN	      WRITE(FDEBUG,980) 'PHI Matrix Values:',     1       ((PHI(I,J),J=1,ORDER),I=1,ORDER)	      WRITE(FDEBUG,980) 'PSI Vector Values:',PSI970	      FORMAT(1X,A,100(/1X,20I6))980	      FORMAT(1X,A,100(/1X,10F12.1))	   END IF	   WRITE(FDEBUG,990)990	   FORMAT('  FRAME   AWIN     EWIN   BIAS',T34,     1    'V/UV  Pitch RMS',T54,     1    'RC1     RC2     RC3     RC4     RC5     ',     1    'RC6     RC7     RC8     RC9    RC10')	   WRITE(FDEBUG,992) NFRAME, AWIN(1,AF), AWIN(2,AF),     1    EWIN(1,AF), EWIN(2,AF), BIAS,     1    VOIBUF(2,AF), IPITCH, RMSBUF(AF), (RCBUF(I,AF),I=1,ORDER)992	   FORMAT(1X,I6,2I4,1X,2I4,F6.1,T34,I2,I8,F6.0,T50,10F8.3)	END IF@1.4log@Added a line to INITANALYS.  See comments there.@text@d6 3d38 1a38 1*d55 11@1.3log@Rearranged the order of the local variables quite a bit, to separatethem into groups of "constants", "locals that don't need to be savedfrom one call to the next", and "local that do need to be saved fromone 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 statethat should be, and also calls the corresponding entries of thesubroutines called by ANALYS that also have local state.There used to be DATA statements in ANALYS.  I got rid of most ofthem, and added a local logical variable FIRST that calls the entryINITANALYS on the first call to ANALYS.  This is just so that one neednot remember to call INITANALYS first in order for the state to beinitialized.@text@d6 19d366 6@1.2log@Added several comments with my own personal questions about theFortran 77 meaning of the parameters passed to the subroutine PREEMP.@text@d6 4d15 19a33 1d37 4d42 7a48 1	REAL RMS, RC(ORDER), SPEECH(LFRAME)d72 22d114 1d117 1a117 1	REAL AMDF(LTAU), ABUF(MAXWIN), BIAS, TEMPd119 1a119 1	INTEGER VWIN(2,AF), AWIN(2,AF), EWIN(2,AF), VOIBUF(2,0:AF)d121 1a121 1	REAL PRECOEF, ZPREd123 8a130 5	INTEGER I, J, LANAL, HALF, TAU(LTAU)	INTEGER IPITCH, PTAU, MINPTR, MAXPTR, MINTAU, MIDX	REAL IVRC(2), PHI(MAXORD,MAXORD), PSI(MAXORD)	INTEGER BUFLIM(4)	DATA BUFLIM / SBUFL, SBUFH, LBUFL, LBUFH /a131 7	DATA PRECOEF/.9375/, ZPRE/0./	DATA BIAS/0/	DATA OSPTR/1/	DATA VWIN(1,AF) /DVWINL/	DATA VWIN(2,AF) /DVWINH/	DATA AWIN(1,AF) /DVWINL/	DATA AWIN(2,AF) /DVWINH/d136 4d151 5d183 4d201 6a216 19*       I don't understand the parameters to the PREEMP call below.  In*       the declaration of PREEMP, the first parameter is declared to be*       a real array with nsamp elements, and the second parameter is*       declared the same way.  However, the call below seems to be*       passing a single element of the array INBUF as a parameter,*       rather than a subsection of the array.*       My guess is that passing INBUF(I) means that PREEMP considers*       element I of INBUF to be element 1 of the array that is its*       first parameter, element I+1 to be element 2 of its parameter,*       and so on.  It seems like there should be a more clear way to*       represent this.*       Would the program mean the same thing in Fortran 77 if INBUF(I)*       below was replaced with INBUF(I:I+LFRAME-1)?  If it meant the*       same thing, would it be implemented by typical Fortran compilers*       any differently?  It is more clear to me what it means than the*       current code.d344 67@1.1log@Initial revision@text@d5 4a8 1* $Log$d146 19@

⌨️ 快捷键说明

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