diff --git a/lib/qra/qra64/qra64_subs.c b/lib/qra/qra64/qra64_subs.c index 0d872f30c..cde155c6d 100644 --- a/lib/qra/qra64/qra64_subs.c +++ b/lib/qra/qra64/qra64_subs.c @@ -15,7 +15,7 @@ void qra64_enc_(int x[], int y[]) } void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype, - int xdec[], float* snr, int* rc) + int* iset, int xdec[], float* snr, int* rc) { /* APtype: @@ -52,12 +52,14 @@ void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype, err=qra64_apset(pqra64codec,*nc1,*nc2,*ng2,*APtype); if(err<0) printf("ERROR: qra64_apset returned %d\n",err); - *rc = qra64_decode(pqra64codec,&EbNodBEstimated,xdec,r); - *snr = EbNodBEstimated - 31.0; + if(*iset==0) { + *rc = qra64_decode(pqra64codec,&EbNodBEstimated,xdec,r); + *snr = EbNodBEstimated - 31.0; #ifdef NICO_WANTS_SNR_DUMP - fout = fopen("C:\\JTSDK\\snrdump.txt","a+"); - if ((*rc)>=0) fprintf(fout,"rc=%d snr=%.2f dB\n",*rc,EbNodBEstimated-31.0f); - fclose(fout); + fout = fopen("C:\\JTSDK\\snrdump.txt","a+"); + if ((*rc)>=0) fprintf(fout,"rc=%d snr=%.2f dB\n",*rc,EbNodBEstimated-31.0f); + fclose(fout); #endif + } } diff --git a/lib/qra64a.f90 b/lib/qra64a.f90 index 9910a9e47..d841767ca 100644 --- a/lib/qra64a.f90 +++ b/lib/qra64a.f90 @@ -17,8 +17,10 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, & real red(NZ) real x(NFFT) complex cx(0:NH) + logical first equivalence (x,cx) data icos7/2,5,6,0,4,1,3/ !Costas 7x7 pattern + data nc1z/-1/,nc2z/-1/,ng2z/-1/ common/qra64com/ss(NZ,194),s3(0:63,1:63),ccf(NZ,0:25) save @@ -99,32 +101,37 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, & mycall=mycall_12(1:6) !### May need fixing ### hiscall=hiscall_12(1:6) hisgrid=hisgrid_6(1:4) - call packcall(mycall,nmycall,ltext) - call packcall(hiscall,nhiscall,ltext) - call packgrid(hisgrid,nhisgrid,ltext) + call packcall(mycall,nc1,ltext) + call packcall(hiscall,nc2,ltext) + call packgrid(hisgrid,ng2,ltext) call packcall("CQ ",ncq,ltext) - nmycall=ncq + + if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then + do naptype=0,4 + call qra64_dec(s3,nc1,nc2,ng2,naptype,1,dat4,snr2,irc) + enddo + nc1z=nc1 + nc2z=nc2 + ng2z=ng2 + endif snr2=-99. naptype=4 - do iter=1,2 - call system_clock(count0,clkfreq) - if(iter.eq.2) nmycall=ncq - call qra64_dec(s3,nmycall,nhiscall,nhisgrid,naptype,dat4,snr2,irc) - if(irc.ge.0) then - call unpackmsg(dat4,decoded) !Unpack the user message - call fmtmsg(decoded,iz) - nft=100 + irc - nsnr=nint(snr2) - else - snr2=0. - endif - call system_clock(count1,clkfreq) - tsec=float(count1-count0)/float(clkfreq) - write(78,3900) nutc,sync,snr1,snr2,dtx,nfreq,iter,irc,tsec,decoded + call system_clock(count0,clkfreq) + call qra64_dec(s3,nc1,nc2,ng2,naptype,0,dat4,snr2,irc) + if(irc.ge.0) then + call unpackmsg(dat4,decoded) !Unpack the user message + call fmtmsg(decoded,iz) + nft=100 + irc + nsnr=nint(snr2) + else + snr2=0. + endif + call system_clock(count1,clkfreq) + tsec=float(count1-count0)/float(clkfreq) + write(78,3900) nutc,sync,snr1,snr2,dtx,nfreq,1,irc,tsec,decoded 3900 format(i4.4,3f6.1,f6.2,i5,i2,i3,f6.3,1x,a22) - if(irc.ge.0) exit - enddo + flush(78) - return + return end subroutine qra64a