From 85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 9 Sep 2021 22:49:00 +0200 Subject: New upstream version 2.5.0~rc6+repack --- lib/77bit/messages.txt | 4 + lib/77bit/packjt77.f90 | 3 +- lib/calibrate.f90 | 4 +- lib/decode65a.f90 | 8 +- lib/decoder.f90 | 5 +- lib/encode_rs.c | 17 +-- lib/fast_decode.f90 | 1 - lib/fst4_decode.f90 | 2 +- lib/ft2/portaudio.h | 0 lib/ftrsd/ftrsd2.c | 4 +- lib/hspec.f90 | 2 +- lib/init_rs.c | 14 +-- lib/jt9.f90 | 9 +- lib/jt9a.f90 | 3 +- lib/jt9com.f90 | 1 + lib/map65_mmdec.f90 | 95 +++++++++++++++ lib/msk144signalquality.f90 | 6 +- lib/mskrtd.f90 | 2 +- lib/q65_decode.f90 | 47 +++++--- lib/qra/q65/q65.c | 21 ++-- lib/qra/q65/q65.f90 | 140 ++++++++++++++-------- lib/qra/q65/q65_encoding_modules.f90 | 223 +++++++++++++++++++++++++++++++++++ lib/qra/q65/q65_loops.f90 | 32 +++-- lib/qra/q65/q65code.f90 | 29 +++++ lib/qra/q65/qra15_65_64_irr_e23.c | 3 +- lib/spec64.f90 | 11 +- lib/symspec.f90 | 32 ----- lib/test_q65.f90 | 20 ++-- lib/twkfreq.f90 | 4 + lib/wsprd/wsprd.c | 1 + 30 files changed, 565 insertions(+), 178 deletions(-) mode change 100644 => 100755 lib/ft2/portaudio.h create mode 100644 lib/map65_mmdec.f90 create mode 100644 lib/qra/q65/q65_encoding_modules.f90 create mode 100644 lib/qra/q65/q65code.f90 (limited to 'lib') diff --git a/lib/77bit/messages.txt b/lib/77bit/messages.txt index 2100ae39..d84bba2c 100644 --- a/lib/77bit/messages.txt +++ b/lib/77bit/messages.txt @@ -94,3 +94,7 @@ KA1ABC/VEX 37 590001 FN20QI 590001 FN20QI 590001 FN20QI +CQ OE21FTDMC +K9AN K1JT R- +K9AN K1JT R+ +K1AN K1JT WXY diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index aec73c68..b8a4ac42 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -1118,7 +1118,7 @@ subroutine pack77_1(nwords,w,i3,n3,c77) irpt=irpt+35 else if(c2.eq.'R+' .or. c2.eq.'R-') then ir=1 - read(w(nwords)(2:),*) irpt + read(w(nwords)(2:),*,err=900) irpt if(irpt.ge.-50 .and. irpt.le.-31) irpt=irpt+101 irpt=irpt+35 else if(trim(w(nwords)).eq.'RRR') then @@ -1276,6 +1276,7 @@ subroutine pack77_4(nwords,w,i3,n3,c77) if(call_2(1:1).eq.'<') call_2=w(2)(2:len(trim(w(2)))-1) call chkcall(call_1,bcall_1,ok1) call chkcall(call_2,bcall_2,ok2) + if(call_1.eq.bcall_1 .and. call_2.eq.bcall_2 .and. ok1 .and. ok2) go to 900 icq=0 if(trim(w(1)).eq.'CQ' .or. (ok1.and.ok2)) then if(trim(w(1)).eq.'CQ' .and. len(trim(w(2))).le.4) go to 900 diff --git a/lib/calibrate.f90 b/lib/calibrate.f90 index a27c400a..76e70f2b 100644 --- a/lib/calibrate.f90 +++ b/lib/calibrate.f90 @@ -12,8 +12,8 @@ subroutine calibrate(data_dir,iz,a,b,rms,sigmaa,sigmab,irc) real*8 fd(NZ),deltaf(NZ),r(NZ),rmsd(NZ) integer nn(NZ) - infile=trim(data_dir)//'fmt.all' - outfile=trim(data_dir)//'fcal2.out' + infile=trim(data_dir)//'/'//'fmt.all' + outfile=trim(data_dir)//'/'//'fcal2.out' open(10,file=trim(infile),status='old',err=996) open(12,file=trim(outfile),status='unknown',err=997) diff --git a/lib/decode65a.f90 b/lib/decode65a.f90 index ec9fbd31..3b82178b 100644 --- a/lib/decode65a.f90 +++ b/lib/decode65a.f90 @@ -41,9 +41,7 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & if(nflip.eq.0) go to 900 ! Find best DF, drift, curvature, and DT. Start by downsampling to 344.53125 Hz - call timer('fil6521 ',0) call fil6521(cx,n5,c5x,n6) - call timer('fil6521 ',1) fsample=1378.125/4. @@ -60,10 +58,8 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & ! Apply AFC corrections to the time-domain signal ! Now we are back to using the 1378.125 Hz sample rate, enough to ! accommodate the full JT65C bandwidth. - a(3)=0 - call timer('twkfreq ',0) + a(3)=0 call twkfreq65(cx,n5,a) - call timer('twkfreq ',1) ! Compute spectrum for each symbol. nsym=126 @@ -71,7 +67,6 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & df=1378.125/nfft j=int(dtbest*1378.125) - call timer('sh_ffts ',0) c5a=cmplx(0.0,0.0) do k=1,nsym do i=1,nfft @@ -89,7 +84,6 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & s1(jj,k)=real(c5a(i))**2 + aimag(c5a(i))**2 enddo enddo - call timer('sh_ffts ',1) call timer('dec65b ',0) qualbest=0. diff --git a/lib/decoder.f90 b/lib/decoder.f90 index d1a53009..1e2eba9c 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -205,10 +205,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample) open(17,file=trim(temp_dir)//'/red.dat',status='unknown') open(14,file=trim(temp_dir)//'/avemsg.txt',status='unknown') call timer('dec_q65 ',0) - call my_q65%decode(q65_decoded,id2,params%nutc,params%ntr, & + nqd=1 + call my_q65%decode(q65_decoded,id2,nqd,params%nutc,params%ntr, & params%nsubmode,params%nfqso,params%ntol,params%ndepth, & params%nfa,params%nfb,logical(params%nclearave), & - single_decode,logical(params%nagain), & + single_decode,logical(params%nagain),params%max_drift, & logical(params%newdat),params%emedelay,mycall,hiscall,hisgrid, & params%nQSOProgress,ncontest,logical(params%lapcqonly),navg0) call timer('dec_q65 ',1) diff --git a/lib/encode_rs.c b/lib/encode_rs.c index 911bc36d..9d56d0bf 100644 --- a/lib/encode_rs.c +++ b/lib/encode_rs.c @@ -13,24 +13,19 @@ #endif void ENCODE_RS( -#ifdef FIXED -DTYPE *data, DTYPE *bb,int pad){ -#else -void *p,DTYPE *data, DTYPE *bb){ +#ifndef FIXED +void *p, +#endif +DTYPE *data, DTYPE *bb){ +#ifndef FIXED struct rs *rs = (struct rs *)p; #endif int i, j; DTYPE feedback; -#ifdef FIXED - /* Check pad parameter for validity */ - if(pad < 0 || pad >= NN) - return; -#endif - memset(bb,0,NROOTS*sizeof(DTYPE)); - for(i=0;i 0 ? 1000.0*pp2/pp1 : 1000.0; param[5]=ntotal_min; param[6]=ntry[0]; param[7]=1000.0*pp2; diff --git a/lib/hspec.f90 b/lib/hspec.f90 index 144ddf19..b30f4a09 100644 --- a/lib/hspec.f90 +++ b/lib/hspec.f90 @@ -20,7 +20,7 @@ subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,bmsk144, & parameter (JZ=703) character*80 line1 - character*512 datadir + character*(*) datadir character*12 mycall,hiscall integer*2 id2(0:120*12000-1) logical*1 bmsk144,bshmsg,btrain,bswl diff --git a/lib/init_rs.c b/lib/init_rs.c index a8052365..876819f8 100644 --- a/lib/init_rs.c +++ b/lib/init_rs.c @@ -28,10 +28,9 @@ void FREE_RS(void *p){ * fcr = first root of RS code generator polynomial, index form * prim = primitive element to generate polynomial roots * nroots = RS code generator polynomial degree (number of roots) - * pad = padding bytes at front of shortened block */ -void *INIT_RS(int symsize,int gfpoly,int fcr,int prim, - int nroots,int pad){ +void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned prim, + unsigned int nroots){ struct rs *rs; int i, j, sr,root,iprim; @@ -39,19 +38,16 @@ void *INIT_RS(int symsize,int gfpoly,int fcr,int prim, if(symsize < 0 || symsize > (int)(8*sizeof(DTYPE))) return NULL; /* Need version with ints rather than chars */ - if(fcr < 0 || fcr >= (1<= (1<= (1<= (1<= (1<= (1<= ((1<mm = symsize; rs->nn = (1<pad = pad; rs->alpha_to = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); if(rs->alpha_to == NULL){ diff --git a/lib/jt9.f90 b/lib/jt9.f90 index e07fd742..3bfac672 100644 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -20,7 +20,7 @@ program jt9 real*8 TRperiod character c character(len=500) optarg, infile - character wisfile*80 + character wisfile*256 !### ndepth was defined as 60001. Why??? integer :: arglen,stat,offset,remain,mode=0,flow=200,fsplit=2700, & fhigh=4000,nrxfreq=1500,ndepth=1,nexp_decode=0,nQSOProg=0 @@ -301,6 +301,9 @@ program jt9 shared_data%params%napwid=75 shared_data%params%dttol=3. if(mode.eq.164 .and. nsubmode.lt.100) nsubmode=nsubmode+100 + shared_data%params%nagain=.false. + shared_data%params%nclearave=.false. + shared_data%params%lapcqonly=.false. shared_data%params%naggressive=0 shared_data%params%n2pass=2 shared_data%params%nQSOprogress=nQSOProg @@ -322,6 +325,10 @@ program jt9 shared_data%params%nmode=mode end if shared_data%params%nsubmode=nsubmode + +!### temporary, for MAP65: + if(mode.eq.66 .and. TRperiod.eq.60) shared_data%params%emedelay=2.5 + datetime="2013-Apr-16 15:13" !### Temp shared_data%params%datetime=transfer(datetime,shared_data%params%datetime) if(mode.eq.9 .and. fsplit.ne.2700) shared_data%params%nfa=fsplit diff --git a/lib/jt9a.f90 b/lib/jt9a.f90 index b0df912c..f9399f4a 100644 --- a/lib/jt9a.f90 +++ b/lib/jt9a.f90 @@ -55,7 +55,8 @@ subroutine jt9a() if(.not.ok) call abort call flush(6) call timer('decoder ',0) - if(local_params%nmode.eq.8 .and. local_params%ndiskdat) then + if(local_params%nmode.eq.8 .and. local_params%ndiskdat .and. & + .not. local_params%nagain) then ! Early decoding pass, FT8 only, when wsjtx reads from disk nearly=41 local_params%nzhsym=nearly diff --git a/lib/jt9com.f90 b/lib/jt9com.f90 index 3a6b8759..5b2970c0 100644 --- a/lib/jt9com.f90 +++ b/lib/jt9com.f90 @@ -41,6 +41,7 @@ integer(c_int) :: naggressive logical(c_bool) :: nrobust integer(c_int) :: nexp_decode + integer(c_int) :: max_drift character(kind=c_char) :: datetime(20) character(kind=c_char) :: mycall(12) character(kind=c_char) :: mygrid(6) diff --git a/lib/map65_mmdec.f90 b/lib/map65_mmdec.f90 new file mode 100644 index 00000000..ca9f959e --- /dev/null +++ b/lib/map65_mmdec.f90 @@ -0,0 +1,95 @@ +subroutine map65_mmdec(nutc,id2,nqd,nsubmode,nfa,nfb,nfqso,ntol,newdat, & + nagain,max_drift,mycall,hiscall,hisgrid) + + use prog_args + use timer_module, only: timer + use q65_decode + + include 'jt9com.f90' + include 'timer_common.inc' + + type, extends(q65_decoder) :: counting_q65_decoder + integer :: decoded + end type counting_q65_decoder + + logical single_decode,bVHF,lnewdat,lagain,lclearave,lapcqonly + integer*2 id2(300*12000) +! type(params_block) :: params + character(len=20) :: datetime + character(len=12) :: mycall, hiscall + character(len=6) :: hisgrid + data ntr0/-1/ + save + type(counting_q65_decoder) :: my_q65 + +! Cast C character arrays to Fortran character strings +! datetime=transfer(params%datetime, datetime) +! mycall=transfer(params%mycall,mycall) +! hiscall=transfer(params%hiscall,hiscall) +! mygrid=transfer(params%mygrid,mygrid) +! hisgrid=transfer(params%hisgrid,hisgrid) + datetime=' ' + + my_q65%decoded = 0 + ncontest=0 + nQSOprogress=0 + lclearave=.false. + single_decode=.false. + lapcqonly=.false. + lnewdat=(newdat.ne.0) + lagain=(nagain.ne.0) + bVHF=.true. + emedelay=2.5 + ndepth=1 + ntrperiod=60 + + open(17,file=trim(temp_dir)//'/red.dat',status='unknown') + open(14,file=trim(temp_dir)//'/avemsg.txt',status='unknown') + + call timer('dec_q65 ',0) + call my_q65%decode(q65_decoded,id2,nqd,nutc,ntrperiod,nsubmode,nfqso, & + ntol,ndepth,nfa,nfb,lclearave,single_decode,lagain,max_drift,lnewdat, & + emedelay,mycall,hiscall,hisgrid,nQSOProgress,ncontest,lapcqonly,navg0) + call timer('dec_q65 ',1) + + return + +contains + + subroutine q65_decoded (this,nutc,snr1,nsnr,dt,freq,decoded,idec, & + nused,ntrperiod) + + use q65_decode + implicit none + + class(q65_decoder), intent(inout) :: this + integer, intent(in) :: nutc + real, intent(in) :: snr1 + integer, intent(in) :: nsnr + real, intent(in) :: dt + real, intent(in) :: freq + character(len=37), intent(in) :: decoded + integer, intent(in) :: idec + integer, intent(in) :: nused + integer, intent(in) :: ntrperiod + + if(nutc+snr1+nsnr+dt+freq+idec+nused+ntrperiod.eq.-999) stop + if(decoded.eq.'-999') stop + + cq0='q ' + write(cq0(2:2),'(i1)') idec + if(nused.ge.2) write(cq0(3:3),'(i1)') nused + nsnr0=nsnr + xdt0=dt + nfreq0=nint(freq) + msg0=decoded + + select type(this) + type is (counting_q65_decoder) + if(idec.ge.0) this%decoded = this%decoded + 1 + end select + + return + end subroutine q65_decoded + +end subroutine map65_mmdec diff --git a/lib/msk144signalquality.f90 b/lib/msk144signalquality.f90 index 3caaa349..c2ba5f6c 100644 --- a/lib/msk144signalquality.f90 +++ b/lib/msk144signalquality.f90 @@ -9,7 +9,7 @@ subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall, & character*8 date character*10 time character*5 zone - character*512 datadir + character*(*) datadir complex cframe(864) complex cross(864) @@ -191,9 +191,7 @@ subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall, & write(pcoeff_filename,'(i2.2,i2.2,i2.2,"_",i2.2,i2.2,i2.2)') & values(1)-2000,values(2),values(3),values(5),values(6),values(7) pcoeff_filename=trim(trained_dxcall)//"_"//trim(pcoeff_filename)//".pcoeff" - l1=index(datadir,char(0))-1 - datadir(l1+1:l1+1)="/" - pcoeff_filename=datadir(1:l1+1)//trim(pcoeff_filename) + pcoeff_filename=datadir//'/'//trim(pcoeff_filename) !write(*,*) 'trained - writing coefficients to: ',pcoeff_filename open(17,file=pcoeff_filename,status='new') write(17,'(i4,2f10.2,3i5,5e25.16)') navg,sqrt(chisqr),rmsdiff,NFREQLOW,NFREQHIGH,nterms,a diff --git a/lib/mskrtd.f90 b/lib/mskrtd.f90 index 3bf62180..b2a5cbb8 100644 --- a/lib/mskrtd.f90 +++ b/lib/mskrtd.f90 @@ -19,7 +19,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,hiscall, & character*80 line !Formatted line with UTC dB T Freq Msg character*12 mycall,hiscall character*37 recent_shmsgs(NSHMEM) - character*512 datadir + character*(*) datadir complex cdat(NFFT1) !Analytic signal complex c(NSPM) !Coherently averaged complex data diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 5acc15f5..cbe295ad 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -1,5 +1,9 @@ module q65_decode + integer nsnr0,nfreq0 + real xdt0 + character msg0*37,cq0*3 + type :: q65_decoder procedure(q65_decode_callback), pointer :: callback contains @@ -26,9 +30,10 @@ module q65_decode contains - subroutine decode(this,callback,iwave,nutc,ntrperiod,nsubmode,nfqso, & - ntol,ndepth,nfa0,nfb0,lclearave,single_decode,lagain,lnewdat0, & - emedelay,mycall,hiscall,hisgrid,nQSOprogress,ncontest,lapcqonly,navg0) + subroutine decode(this,callback,iwave,nqd0,nutc,ntrperiod,nsubmode,nfqso, & + ntol,ndepth,nfa0,nfb0,lclearave,single_decode,lagain,max_drift0, & + lnewdat0,emedelay,mycall,hiscall,hisgrid,nQSOprogress,ncontest, & + lapcqonly,navg0) ! Top-level routine that organizes the decoding of Q65 signals ! Input: iwave Raw data, i*2 @@ -67,15 +72,17 @@ contains integer dat4(13) !Decoded message as 12 6-bit integers integer dgen(13) logical lclearave,lnewdat0,lapcqonly,unpk77_success - logical single_decode,lagain,ex + logical single_decode,lagain complex, allocatable :: c00(:) !Analytic signal, 6000 Sa/s complex, allocatable :: c0(:) !Analytic signal, 6000 Sa/s - + ! Start by setting some parameters and allocating storage for large arrays call sec0(0,tdecode) nfa=nfa0 nfb=nfb0 + nqd=nqd0 lnewdat=lnewdat0 + max_drift=max_drift0 idec=-1 idf=0 idt=0 @@ -84,6 +91,7 @@ contains npts=ntrperiod*12000 nfft1=ntrperiod*12000 nfft2=ntrperiod*6000 + npasses=1 ! Determine the T/R sequence: iseq=0 (even), or iseq=1 (odd) n=nutc @@ -116,37 +124,40 @@ contains baud=12000.0/nsps this%callback => callback nFadingModel=1 - - inquire(file='ndepth.dat',exist=ex) - if(.not.ex) ndepth=iand(ndepth,not(3)) + 1 !Treat any ndepth as "Fast" - maxiters=67 + maxiters=33 ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1) - ibwb=min(10,ibwa+4) + ibwb=min(10,ibwa+2) if(iand(ndepth,3).ge.2) then ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1) ibwb=min(10,ibwa+5) + maxiters=67 else if(iand(ndepth,3).eq.3) then ibwa=max(1,ibwa-1) ibwb=min(10,ibwb+1) maxiters=100 endif - -! Generate codewords for full-AP list decoding - call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) +! Generate codewords for full-AP list decoding + if(ichar(hiscall(1:1)).eq.0) hiscall=' ' + if(ichar(hisgrid(1:1)).eq.0) hisgrid=' ' + ncw=0 + if(nqd.eq.1 .or. lagain) then + call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) + endif dgen=0 call q65_enc(dgen,codewords) !Initialize the Q65 codec - nused=1 iavg=0 call timer('q65_dec0',0) -! Call top-level routine in q65 module: establish sync and try for a q3 decode. +! Call top-level routine in q65 module: establish sync and try for a +! q3 or q0 decode. call q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & emedelay,xdt,f0,snr1,width,dat4,snr2,idec) -! idec=-1 !### TEMPORARY ### call timer('q65_dec0',1) +! write(*,3001) '=a',sum(abs(float(iwave))),nfqso,ntol,ndepth,xdt,f0,idec +!3001 format(a2,f15.0,3i5,f7.2,f7.1,i5) if(idec.ge.0) then - dtdec=xdt !We have a list-decode result at nfqso + dtdec=xdt !We have a q3 or q0 decode at nfqso f0dec=f0 go to 100 endif @@ -199,6 +210,7 @@ contains call q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & emedelay,xdt,f0,snr1,width,dat4,snr2,idec) call timer('list_avg',1) + if(idec.ge.0) then dtdec=xdt !We have a list-decode result from averaged data f0dec=f0 @@ -298,7 +310,6 @@ contains call timer('q65loops',0) call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, & xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec) -! idec=-1 !### TEMPORARY ### call timer('q65loops',1) if(idec.ge.0) then dtdec=xdt1 diff --git a/lib/qra/q65/q65.c b/lib/qra/q65/q65.c index f7701792..10d756d8 100644 --- a/lib/qra/q65/q65.c +++ b/lib/qra/q65/q65.c @@ -434,11 +434,14 @@ int q65_intrinsics_fastfading(q65_codec_ds *pCodec, // exponentiate and accumulate the normalization constant sumix = 0.0f; - for (k=0;k 85.0) x= 85.0; + fTemp = expf(x); + pCurIx[k]=fTemp; + sumix +=fTemp; + } // scale to a probability distribution sumix = 1.0f/sumix; @@ -663,9 +666,11 @@ int q65_check_llh(float *llh, const int* ydec, const int nN, const int nM, const float t = 0; for (k=0;ks3lim) s3(1:LL*NN)=s3lim diff --git a/lib/qra/q65/q65code.f90 b/lib/qra/q65/q65code.f90 new file mode 100644 index 00000000..d61cba91 --- /dev/null +++ b/lib/qra/q65/q65code.f90 @@ -0,0 +1,29 @@ +program q65code + use q65_encoding + + implicit none + character*37 msg37 + integer nargs + integer codeword(65),tones(85) + + nargs=iargc() + if(nargs .ne. 1) then + print*,'Usage: q65code "msg"' + goto 999 + endif + call getarg(1,msg37) + + call get_q65_tones(msg37,codeword,tones) + + write(*,*) 'Generated message plus CRC (90 bits)' + write(*,'(a8,15i4)') '6 bit : ',codeword(1:15) + write(*,'(a8,15b6.6)') 'binary: ',codeword(1:15) + write(*,*) ' ' + write(*,*) 'Codeword with CRC symbols (65 symbols)' + write(*,'(20i3)') codeword + + write(*,*) ' ' + write(*,*) 'Channel symbols (85 total)' + write(*,'(20i3)') tones + +999 end program q65code diff --git a/lib/qra/q65/qra15_65_64_irr_e23.c b/lib/qra/q65/qra15_65_64_irr_e23.c index d56e057f..88667169 100644 --- a/lib/qra/q65/qra15_65_64_irr_e23.c +++ b/lib/qra/q65/qra15_65_64_irr_e23.c @@ -494,7 +494,7 @@ static const int qra_pmat[qra_M*qra_M] = { 3, 1, 7, 5, 11, 9, 15, 13, 19, 17, 23, 21, 27, 25, 31, 29, 35, 33, 39, 37, 43, 41, 47, 45, 51, 49, 55, 53, 59, 57, 63, 61 }; - +/* // SO array static const int SO[qra_N-qra_K+1] = { 14, 2, 4, 5, 9, 13, 10, 15, 11, 6, 1, 8, 2, 12, 9, 10, @@ -515,6 +515,7 @@ static const int LOGWO[qra_N-qra_K+1] = { static const int repfact[qra_K] = { 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 3, 3 }; +*/ const qracode qra15_65_64_irr_e23 = { qra_K, diff --git a/lib/spec64.f90 b/lib/spec64.f90 index b3b7d54d..79322050 100644 --- a/lib/spec64.f90 +++ b/lib/spec64.f90 @@ -1,8 +1,7 @@ -subroutine spec64(c0,nsps,mode_q65,jpk,s3,LL,NN) +subroutine spec64(c0,npts,nsps,mode_q65,jpk,s3,LL,NN) parameter (MAXFFT=20736) -!### Fix this: - complex c0(0:1800000-1) !Complex spectrum of dd() + complex c0(0:npts-1) !Complex spectrum of dd() complex cs(0:MAXFFT-1) !Complex symbol spectrum real s3(LL,NN) !Synchronized symbol spectra real xbase0(LL),xbase(LL) @@ -21,7 +20,11 @@ subroutine spec64(c0,nsps,mode_q65,jpk,s3,LL,NN) j=j+1 ja=(k-1)*nsps + jpk jb=ja+nsps-1 - cs(0:nfft-1)=c0(ja:jb) + if(ja.lt.0) ja=0 + if(jb.gt.npts-1) jb=npts-1 + nz=jb-ja + cs(0:nz)=c0(ja:jb) + if(nz.lt.nfft-1) cs(nz+1:)=0. call four2a(cs,nsps,1,-1,1) !c2c FFT to frequency do ii=1,LL i=ii-65+mode_q65 !mode_q65 = 1 2 4 8 16 for Q65 A B C D E diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 8f5ddd09..38189a3c 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -126,35 +126,3 @@ subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, & return end subroutine symspec - -subroutine chk_samples(ihsym,k,nstop) - - integer*8 count0,count1,clkfreq - integer itime(8) - real*8 dtime,fsample - character*12 ctime - data count0/-1/,k0/99999999/,maxhsym/0/ - save count0,k0,maxhsym - - if(k.lt.k0 .or. count0.eq.-1) then - call system_clock(count0,clkfreq) - maxhsym=0 - endif -! if((mod(ihsym,100).eq.0 .or. ihsym.ge.nstop-100) .and. & -! k0.ne.99999999) then -! call system_clock(count1,clkfreq) -! dtime=dfloat(count1-count0)/dfloat(clkfreq) -! if(dtime.lt.28.0) return -! if(dtime.gt.1.d-6) fsample=(k-3456)/dtime -! call date_and_time(values=itime) -! sec=itime(7)+0.001*itime(8) -! write(ctime,3000) itime(5)-itime(4)/60,itime(6),sec -!3000 format(i2.2,':',i2.2,':',f6.3) -! write(33,3033) ctime,dtime,ihsym,nstop,k,fsample -!3033 format(a12,f12.6,2i7,i10,f15.3) -! flush(33) -! endif - k0=k - - return -end subroutine chk_samples diff --git a/lib/test_q65.f90 b/lib/test_q65.f90 index 4135a290..598de976 100644 --- a/lib/test_q65.f90 +++ b/lib/test_q65.f90 @@ -1,6 +1,6 @@ program test_q65 - character*82 cmd1,cmd2,line + character*84 cmd1,cmd2,line character*22 msg character*8 arg character*1 csubmode @@ -71,19 +71,19 @@ program test_q65 tsym=1.0/baud ! 1 2 3 4 5 6 7 -! 123456789012345678901234567890123456789012345678901234567890123456789012345' - cmd1='q65sim "K1ABC W9XYZ EN37 " A 1500 5.0 0.0 0.0 1 60 100 -10.0 > junk0' - cmd2='jt9 -3 -p 15 -L 300 -H 3000 -d 3 -b A -Q 3 -f 1500 *.wav > junk' +! 1234567890123456789012345678901234567890123456789012345678901234567890123456' + cmd1='q65sim "K1ABC W9XYZ EN37 " A 1500 5.0 0.0 0.0 1 60 100 -10.0 > junk0' + cmd2='jt9 -3 -p 15 -L 300 -H 3000 -d 3 -b A -Q 3 -f 1500 -X 32 *.wav > junk' write(cmd1(10:33),'(a)') '"'//msg//'"' cmd1(35:35)=csubmode write(cmd1(37:40),'(i4)') nf0 write(cmd1(41:45),'(f5.0)') fDop write(cmd1(46:50),'(f5.2)') dt - write(cmd1(51:54),'(f4.0)') f1 - write(cmd1(55:57),'(i3)') nstp - write(cmd1(58:61),'(i4)') ntrperiod - write(cmd1(62:66),'(i5)') nfiles + write(cmd1(51:56),'(i6)') nint(f1) + write(cmd1(57:59),'(i3)') nstp + write(cmd1(60:63),'(i4)') ntrperiod + write(cmd1(64:68),'(i5)') nfiles write(cmd2(11:13),'(i3)') ntrperiod write(cmd2(33:35),'(i3)') ndepth @@ -94,7 +94,7 @@ program test_q65 call system('rm -f *.wav') write(*,1008) ntrperiod,csubmode,ndepth,fDop,f1,nstp -1008 format('Mode:',i4,a1,' Depth:',i3,' fDop:',f6.1,' Drift:',f6.1, & +1008 format('Mode:',i4,a1,' Depth:',i3,' fDop:',f6.1,' Drift:',f8.1, & ' Steps:',i3) write(*,1010) (j,j=0,5) write(12,1010) (j,j=0,5) @@ -112,7 +112,7 @@ program test_q65 nfalse=0 naptype=0 ndecn=0 - write(cmd1(70:74),'(f5.1)') snr1 + write(cmd1(72:76),'(f5.1)') snr1 call system(cmd1) call sec0(0,tdec) call system(cmd2) diff --git a/lib/twkfreq.f90 b/lib/twkfreq.f90 index 7c240d52..5188d500 100644 --- a/lib/twkfreq.f90 +++ b/lib/twkfreq.f90 @@ -1,5 +1,9 @@ subroutine twkfreq(c3,c4,npts,fsample,a) + ! Adjust frequency of complex data + ! a(1) Hz + ! a(2) Hz/(0.5*TxT), where TxT = npts/fsample = file duration + complex c3(npts) complex c4(npts) complex w,wstep diff --git a/lib/wsprd/wsprd.c b/lib/wsprd/wsprd.c index eea667eb..8d862276 100644 --- a/lib/wsprd/wsprd.c +++ b/lib/wsprd/wsprd.c @@ -677,6 +677,7 @@ unsigned long writec2file(char *c2filename, int trmin, double freq } nwrite = fwrite(buffer, sizeof(float), 2*45000, fp); free(buffer); + fclose(fp); if( nwrite == 2*45000 ) { return nwrite; } else { -- cgit v1.2.3