bugfix.notes
上传用户:szhypcb168
上传日期:2007-01-06
资源大小:2187k
文件大小:17k
- Date: Wed, 24 Mar 93 12:30:44 -0500
- From: kabal@aldebaran.ee.mcgill.ca (Peter Kabal)
- Message-Id: <9303241730.AA07509@aldebaran.EE.McGill.CA>
- To: jpcampb@afterlife.ncsc.mil (Joe Campbell)
- Subject: celp distribution
- Content-Length: 17181
- X-Lines: 539
- Status: RO
- Joe, I grabbed the latest version from furmint.nectar.cs.cmu.edu. Vince
- Cale has now put everything in a tar.Z file. I had grabbed the stuff earlier
- when it was just loose in some directories. Some of the stuff has been badly
- mangled. I ran a diff with the latest version, and there is an apology
- in the comments to the effect that he has messed up the ifdefs. Indeed he
- has, that is why the C-version does not run.
- I suggest you send him (and me), the correct celp.c and makefile. That
- should put the distribution back in order. There are other bits and
- pieces lying around which probably were not in the original distribution.
- Back to the Fortran version. The version I have now runs on both Sun and
- DEC without further modification. The DEC version complains about speech
- differences, but after processing the DEC and Sun output files measure
- up to within 80 dB. The DEC output file is slightly longer than the Sun,
- but that is presumably due to differences in how they handle partial
- records at the end.
- Fortran routines for 1016 CELP
- The following renames were required:
- bitperm.h -> bitpermute.h
- bitprot.h -> bitprotect.h
- cbgain.tlb -> cbgain.table
- cbsearch.f -> cbsearch.F
- csub.f -> csub.F
- dcodham.f -> decodeham.f
- disto.f -> distortion.f
- encodham.f -> encodeham.f
- gaindcod.f -> gaindecode.f
- gainncd2.f -> gainencode2.f
- gainncod.f -> gainencode.f
- ldelaynr.f -> ldelay_nr.f
- lsp34.tbl -> lsp34.table
- lspd34.f -> lspdecode34.f
- mexcite.f -> mexcite.F
- mtrxgen.f -> matrixgen.f
- pgain.tbl -> pagain.table
- ptdcode.f -> pitchdecode.f
- ptncod.f -> pitchencode.f
- postfilt.f -> postfilt2.f
- read_err.f -> read_error.f
- readme.mke -> readme.make
- savesg.f -> save_sg.f
- smcbgn.f -> smoothcbgain.f
- smpgn.f -> smoothpgain.f
- smt.f -> smoothtau.f
- wrterr.f -> write_error.f
- In addition, the following routines were more extensively modified and
- renamed:
- celp.f -> celp.F changes + ultrix changes
- cli.f -> cli.F changes + ultrix changes
- iodisk.f -> iodisk.F changes + ultrix changes
- makefile.mke -> Makefile
- psearch.f -> psearch.F changes + ultrix changes
- Sun refers to Fortran under SunOS 4.1.3.
- DEC refers to DEC Fortran 3.2 running under Ultrix 4.2.
- Changes:
- (1) "implicit undefined" is a Sun'ism. The equivalent for DEC is
- "implicit none". However, the best strategy is not to have such a
- statement at all. Both Sun & DEC Fortran accept the -u option which
- turns on this option without having to modify the source. This is
- the preferred way for portable code. This affects ALL fortran routines.
- (2) DEC Fortran (and the F77 standard) do not allow null character strings.
- Since strings are padded with blanks anyway, the portable solution is
- to use ' ' instead of ''. (cli.F)
- (3) Both Sun and DEC use the extension .F to signify that the file contains
- conditionals which need the C-preprocessor.
- (4) Consider a file which is read only. For Sun an OPEN succeeds on this
- file, and only if one attempts to write will an error be signalled.
- For DEC, an open fails unless the "readonly" option is specified in
- the open. The readonly option is ignored by Sun, but with a warning.
- I have put conditionals (ifdef ultrix) around such changes.
- (5) The interpretation of the record size for unformatted reads is according
- to the F77 standard in terms of "processor defined units". Sun uses
- bytes and DEC uses longwords (4 bytes). I have put conditionals around
- such changes. (iodisk.F)
- (6) The routine celp.f (renamed to celp.F) had a number of unexplained
- errors. First the header had been mangled so that comment characters
- were not in place on some statements. Second, the reference to
- bitprotect treated it as a character, when in fact it is an integer.
- Third the only routine available is postfilt2, yet the code calls out
- postfilt.
- (7) There are some incompatibilities for an unformatted read of a character
- string in routine cli.F. The F77 standard indicates that on the
- external record, the string should be in quotes. I changed this to a
- formatted read.
- (8) The code in psearch.F had some consistency checks on parameter values.
- With DEC Fortran, these were optimized right out of the code. This
- made part of the code unreachable, causing a compilation error.
- Here are my diffs (not including the "implicit undefined" stuff which applies
- practically to all files).
- *** celp32/celp.f Mon Oct 26 17:19:36 1992
- --- ../celp-1016/celp32/celp.F Wed Mar 10 17:32:26 1993
- ***************
- *** 7,13 ****
- * resulting from this code. Further reproduction or distribution *
- * of this code without prior written permission of the U.S. *
- * Government is prohibited. See NCS Technical Information Bulletin *
- ! * on FS 1016 CELP Speech Coding. * * *
- ***************************************************************************
- C
- C ROUTINE
- --- 7,14 ----
- * resulting from this code. Further reproduction or distribution *
- * of this code without prior written permission of the U.S. *
- * Government is prohibited. See NCS Technical Information Bulletin *
- ! * on FS 1016 CELP Speech Coding. *
- ! * *
- ***************************************************************************
- C
- C ROUTINE
- ***************
- *** 146,152 ****
- C**************************************************************************
- C*-
- program celp
- ! implicit undefined (a-z)
- include 'ccsub.com'
- convex #include "ccsub.com"
- real sold(maxll), snew(maxll), ssub(maxll)
- --- 147,153 ----
- C**************************************************************************
- C*-
- program celp
- !
- include 'ccsub.com'
- convex #include "ccsub.com"
- real sold(maxll), snew(maxll), ssub(maxll)
- ***************
- *** 285,292 ****
- --- 286,295 ----
- c This issue can be reviewed by reading the UNIX man pages
- c on ieee floating point (man -k ieee).
- c
- + #ifdef sun
- call abrupt_underflow()
- #include <f77/f77_floatingpoint.h>
- + #endif
- cSUN? call ieee_handler("set", "underflow", SIGFPE_DEFAULT)
- c
- c *** parse the command line
- ***************
- *** 377,385 ****
- c
- c *bit stream channel file
- if (analy) then
- ! open(unit=25, file=ofile(1:oflen)//'.chan')
- else
- open(unit=25, file=ifile(1:iflen)//'.chan', status='old')
- end if
- c
- c *quantizer design (data collection) files
- --- 380,393 ----
- c
- c *bit stream channel file
- if (analy) then
- ! open(unit=25, file=ofile(1:oflen)//'.chan', status='new')
- else
- + #ifdef ultrix
- + open(unit=25, file=ifile(1:iflen)//'.chan', status='old',
- + - readonly)
- + #else
- open(unit=25, file=ifile(1:iflen)//'.chan', status='old')
- + #endif
- end if
- c
- c *quantizer design (data collection) files
- ***************
- *** 387,393 ****
- --- 395,406 ----
- copt open(unit=21, file='pgain.data')
- c
- c *read stochastic code book vector file (by 20)
- + #ifdef ultrix
- + open(unit=11, file='./codebook.h', status='old', err=112,
- + - readonly)
- + #else
- open(unit=11, file='./codebook.h', status='old', err=112)
- + #endif
- i = 1
- do 110 j = 1, (2*(maxncsize-1)+l)/20
- read(11, *, err=112) (x(k), k=i,i-1+20)
- ***************
- *** 400,406 ****
- --- 413,424 ----
- 115 continue
- c
- c *read adaptive code book index (pitch delay) file
- + #ifdef ultrix
- + open(unit=12, file='./pdelay.h', status='old', err=122,
- + - readonly)
- + #else
- open(unit=12, file='./pdelay.h', status='old', err=122)
- + #endif
- do 120 i = 0, maxpd-1
- read(12, *, err=122) pdelay(i)
- 120 continue
- ***************
- *** 412,419 ****
- --- 430,444 ----
- c *read pitch delay coding tables for bit assignment
- c *pdencode.h for encoding, pddecode.h for decoding
- c *generate pdtabi for delta delay coding
- + #ifdef ultrix
- + open(unit=13, file='./pdencode.h', status='old', err=132,
- + - readonly)
- + open(unit=14, file='./pddecode.h', status='old', err=142,
- + - readonly)
- + #else
- open(unit=13, file='./pdencode.h', status='old', err=132)
- open(unit=14, file='./pddecode.h', status='old', err=142)
- + #endif
- do 130 i = 0, maxpd-1
- read(13, '(z)', err=132) pdencode(i)
- read(14, *, err=142) pddecode(i)
- ***************
- *** 427,441 ****
- 145 continue
- c
- c *read bit protection file
- open(unit=15, file='./bitprotect.h', status='old', err=152)
- ! read(15, *, err=152) bitprotect(1:codelength2)
- close(15)
- go to 155
- 152 stop ' celp: Problem with file "bitprotect.h"'
- 155 continue
- c
- c *read bit permutation file (by 12)
- open(unit=16, file='./bitpermute.h', status='old', err=162)
- i = 1
- do 160 j = 1, streambits/12
- read(16, *, err=162) (bitpermute(k), k=i,i+11)
- --- 452,476 ----
- 145 continue
- c
- c *read bit protection file
- + #ifdef ultrix
- + open(unit=15, file='./bitprotect.h', status='old', err=152,
- + - readonly)
- + #else
- open(unit=15, file='./bitprotect.h', status='old', err=152)
- ! #endif
- ! read(15, *, err=152) (bitprotect(i),i=1,codelength2)
- close(15)
- go to 155
- 152 stop ' celp: Problem with file "bitprotect.h"'
- 155 continue
- c
- c *read bit permutation file (by 12)
- + #ifdef ultrix
- + open(unit=16, file='./bitpermute.h', status='old', err=162,
- + - readonly)
- + #else
- open(unit=16, file='./bitpermute.h', status='old', err=162)
- + #endif
- i = 1
- do 160 j = 1, streambits/12
- read(16, *, err=162) (bitpermute(k), k=i,i+11)
- ***************
- *** 916,922 ****
- c
- c *** post filtering
- c
- ! call postfilt(vdecoded(k),l,alpha,beta,ip,op,dp1,dp2,dp3,dp4)
- canaly call postfilt(v(k),l,alpha,beta,ip,op,dp1,dp2,dp3,dp4)
- clocomp call postfilt2(vdecoded(k),l,alpha,beta,ip,op,dp1,dp2,dp3,dp4)
- c
- --- 951,957 ----
- c
- c *** post filtering
- c
- ! call postfilt2(vdecoded(k),l,alpha,beta,ip,op,dp1,dp2,dp3,dp4)
- canaly call postfilt(v(k),l,alpha,beta,ip,op,dp1,dp2,dp3,dp4)
- clocomp call postfilt2(vdecoded(k),l,alpha,beta,ip,op,dp1,dp2,dp3,dp4)
- c
- *** celp32/cli.f Mon Oct 26 17:19:37 1992
- --- ../celp-1016/celp32/cli.F Wed Mar 10 20:28:50 1993
- ***************
- *** 152,158 ****
- c
- c note: ncsize, no, and gamma are passed through common
- c
- - implicit undefined(a-z)
- include 'ccsub.com'
- convex #include "ccsub.com"
- character*80 ifile, ofile, stype*10
- --- 152,157 ----
- ***************
- *** 174,180 ****
- logical flag, qflag
- c
- data switch /'-i','-o', '-p', '-q', '-m', '-l', '-c'/
- ! data pfile /''/, qfile /''/, mfile /''/, lfile /'celp.log'/
- data type /'cbgain', 'pitch', 'spectrum'/
- data qtype /'kang','log','max2','arcsin','none'/
- c
- --- 173,179 ----
- logical flag, qflag
- c
- data switch /'-i','-o', '-p', '-q', '-m', '-l', '-c'/
- ! data pfile /' '/, qfile /' '/, mfile /' '/, lfile /'celp.log'/
- data type /'cbgain', 'pitch', 'spectrum'/
- data qtype /'kang','log','max2','arcsin','none'/
- c
- ***************
- *** 225,232 ****
- c *** read input parameter file if requested
- c (all parameters are required)
- c
- ! if (pfile .ne. '') then
- open(unit=69, file=pfile)
- read(69, *) ncsize
- read(69, *) l
- read(69, *) ll
- --- 224,235 ----
- c *** read input parameter file if requested
- c (all parameters are required)
- c
- ! if (pfile .ne. ' ') then
- ! #ifdef ultrix
- ! open(unit=69, file=pfile, status='OLD', readonly)
- ! #else
- open(unit=69, file=pfile)
- + #endif
- read(69, *) ncsize
- read(69, *) l
- read(69, *) ll
- ***************
- *** 243,257 ****
- if (mxsw2 .ne. 1) mxsw = .false.
- c
- read(69, *) prewt
- ! read(69, *) pstype
- close(unit=69)
- end if
- c
- c *** read quantization characteristics file if requested
- c (not all parameters are required)
- c
- ! if (qfile .ne. '') then
- open(unit=70, file=qfile)
- do 300 i = 1, maxtype
- read(70, 69) temp
- 69 format(a)
- --- 246,264 ----
- if (mxsw2 .ne. 1) mxsw = .false.
- c
- read(69, *) prewt
- ! read(69, '(A)') pstype
- close(unit=69)
- end if
- c
- c *** read quantization characteristics file if requested
- c (not all parameters are required)
- c
- ! if (qfile .ne. ' ') then
- ! #ifdef ultrix
- ! open(unit=70, file=qfile, status='OLD', readonly)
- ! #else
- open(unit=70, file=qfile)
- + #endif
- do 300 i = 1, maxtype
- read(70, 69) temp
- 69 format(a)
- ***************
- *** 299,306 ****
- c
- c *** read bit error characteristics file if requested
- c
- ! if (mfile .ne. '') then
- open(unit=72, file=mfile)
- do 74 i = 1, bits
- read(72, 73) mask(i)
- 73 format(i1)
- --- 306,317 ----
- c
- c *** read bit error characteristics file if requested
- c
- ! if (mfile .ne. ' ') then
- ! #ifdef ultrix
- ! open(unit=72, file=mfile, status='OLD', readonly)
- ! #else
- open(unit=72, file=mfile)
- + #endif
- do 74 i = 1, bits
- read(72, 73) mask(i)
- 73 format(i1)
- ***************
- *** 397,408 ****
- --- 408,427 ----
- if (lfile .ne. 'none') then
- if (lfile .eq. 'celp.log') then
- cvax open(unit=71, file=lfile, access='append')
- + #ifdef ultrix
- + open(unit=71, file=lfile, status='UNKNOWN')
- + #else
- open(unit=71, file=lfile)
- + #endif
- 601 read(71, 69, end=602) temp
- goto 601
- 602 continue
- else
- + #ifdef ultrix
- + open(unit=71, file=lfile, status='NEW')
- + #else
- open(unit=71, file=lfile)
- + #endif
- end if
- write(71, *) getlog(), host, fdate()
- write(71, *)' Program: '//prog(1:lnblnk(prog))
- *** celp32/iodisk.f Mon Oct 26 17:19:42 1992
- --- ../celp-1016/celp32/iodisk.F Fri Mar 12 11:11:33 1993
- ***************
- *** 41,47 ****
- C**************************************************************************
- C*-
- function iodisk(mode, lun, fname, nrec, iar, size)
- ! implicit undefined(a-z)
- integer mode, lun, nrec, size, iodisk
- integer*2 iar(size)
- character*(*) fname
- --- 41,47 ----
- C**************************************************************************
- C*-
- function iodisk(mode, lun, fname, nrec, iar, size)
- !
- integer mode, lun, nrec, size, iodisk
- integer*2 iar(size)
- character*(*) fname
- ***************
- *** 68,81 ****
- --- 68,93 ----
- nrec = nrec+1
- else if (mode .eq. 3) then
- c *open file for read
- + #ifdef ultrix
- + if (mod(size,2).ne.0) stop 'frame size must be even'
- open(lun, file=fname, access='direct', status='old',
- + + recl=size/2, readonly, err=333)
- + #else
- + open(lun, file=fname, access='direct', status='old',
- + recl=2*size, err=333)
- + #endif
- else if (mode .eq. 4) then
- c *open file for write
- c *unlink = UNIX file delete
- call unlink(fname)
- + #ifdef ultrix
- + if (mod(size,2).ne.0) stop 'frame size must be even'
- + open(lun, file=fname, access='direct', status='new',
- + + recl=size/2, err=444)
- + #else
- open(lun, file=fname, access='direct', status='new',
- + recl=2*size, err=444)
- + #endif
- else if (mode .eq. -1) then
- c *close file
- close(lun, err=555)
- *** celp32/psearch.f Mon Oct 26 17:19:50 1992
- --- ../celp-1016/celp32/psearch.F Wed Mar 10 20:33:25 1993
- ***************
- *** 83,89 ****
- C**************************************************************************
- C*-
- subroutine psearch(s, l)
- ! implicit undefined (a-z)
- integer l
- real s(l)
- include 'ccsub.com'
- --- 83,89 ----
- C**************************************************************************
- C*-
- subroutine psearch(s, l)
- !
- integer l
- real s(l)
- include 'ccsub.com'
- ***************
- *** 102,107 ****
- --- 102,110 ----
- real v0(maxbufptr), v0shift(maxlp), frac
- c *length of truncated impulse response
- parameter (len = 30)
- + save oldptr, submult
- + c
- + data oldptr/1/
- c
- c Choose type of pitch delay search:
- c
- ***************
- *** 132,146 ****
- stop ' psearch: incorrect pitch search type (pstype)'
- end if
- c
- - save oldptr, submult
- - c
- - data oldptr/1/
- c
- c
- if (len .gt. l) stop ' psearch: impulse response too long'
- c
- bufptr = mmax+no+2*l+maxnp-1
- ! if (maxlp .lt. maxl) stop ' psearch: maxlp < maxl'
- #ifdef SUNGRAPH
- c *save impulse response in file 'pitch'
- call save_sg(pitch_ir_vid,h,l,'save pitch_ir_vid')
- --- 135,146 ----
- stop ' psearch: incorrect pitch search type (pstype)'
- end if
- c
- c
- c
- if (len .gt. l) stop ' psearch: impulse response too long'
- c
- bufptr = mmax+no+2*l+maxnp-1
- !
- #ifdef SUNGRAPH
- c *save impulse response in file 'pitch'
- call save_sg(pitch_ir_vid,h,l,'save pitch_ir_vid')
- ***************
- *** 159,165 ****
- --- 159,170 ----
- bb(3) = 0.0
- bb(1) = mmin
- c *load pitch submultiple delay table
- + #ifdef ultrix
- + open(unit=8, file='./submult.h', status='old', err=22,
- + - readonly)
- + #else
- open(unit=8, file='./submult.h', status='old', err=22)
- + #endif
- do 20 i = 0, maxpd-1
- read(8, *, err=22) (submult(i,j), j=0,3)
- 20 continue