diff --git a/lib/js8/js8dec.f90 b/lib/js8/js8dec.f90 index 3f41dc0..1b3fd47 100644 --- a/lib/js8/js8dec.f90 +++ b/lib/js8/js8dec.f90 @@ -33,7 +33,6 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly integer naptypes(0:5,4) ! (nQSOProgress, decoding pass) maximum of 4 passes for now integer*1, target:: i1hiscall(12) complex cd0(0:NP-1) - complex ctwk(NDOWNSPS) complex csymb(NDOWNSPS) complex cs(0:7, NN) logical first,newdat,lsubtract,lapon,lapcqonly,nagain @@ -120,7 +119,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly endif do idt=i0-NQSYMBOL,i0+NQSYMBOL !Search over +/- one quarter symbol - call syncjs8d(cd0,icos,idt,ctwk,0,sync) + call syncjs8d(cd0,icos,idt,0.0,sync) if(NWRITELOG.eq.1) then write(*,*) ' idt', idt, 'sync', sync @@ -146,23 +145,9 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly ! Search over +/- 1/2*nfsrch Hz (i.e., +/- 2.5Hz) do ifr=-NFSRCH,NFSRCH - ! compute the ctwk samples at the delta frequency to by used in syncjs8d - ! to detect peaks at frequencies +/- 2.5 Hz so we can align the decoder - ! for the best possible chance at decoding. - ! - ! NOTE: this does not need to compute the entire set of samples for the - ! costas arrays...it only needs to do it for the delta frequency - ! whose conjugate is multiplied against each csync array in syncjs8d - delf=ifr*0.5 - dphi=twopi*delf*dt2 - phi=0.0 - do i=1,NDOWNSPS - ctwk(i)=cmplx(cos(phi),sin(phi)) - phi=mod(phi+dphi,twopi) - enddo - call syncjs8d(cd0,icos,i0,ctwk,1,sync) + call syncjs8d(cd0,icos,i0,delf,sync) if(NWRITELOG.eq.1) then write(*,*) ' df', delf, 'sync', sync @@ -188,7 +173,7 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly flush(6) endif - call syncjs8d(cd0,icos,i0,ctwk,0,sync) + call syncjs8d(cd0,icos,i0,0.0,sync) if(NWRITELOG.eq.1) then write(*,*) ' ibest', ibest @@ -199,7 +184,6 @@ subroutine js8dec(dd0,icos,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly do k=1,NN i1=ibest+(k-1)*NDOWNSPS csymb=cmplx(0.0,0.0) - !if( i1.ge.1 .and. i1+31 .le. NP2 ) csymb=cd0(i1:i1+31) if( i1.ge.0 .and. i1+(NDOWNSPS-1) .le. NP2-1 ) csymb=cd0(i1:i1+(NDOWNSPS-1)) call four2a(csymb,NDOWNSPS,1,-1,1) s2(0:7,k)=abs(csymb(1:8))/1e3 diff --git a/lib/js8/syncjs8d.f90 b/lib/js8/syncjs8d.f90 index 67e3170..2c578a4 100644 --- a/lib/js8/syncjs8d.f90 +++ b/lib/js8/syncjs8d.f90 @@ -1,13 +1,14 @@ -subroutine syncjs8d(cd0,icos,i0,ctwk,itwk,sync) +subroutine syncjs8d(cd0,icos,i0,delf,sync) ! Compute sync power for a complex, downsampled JS8 signal. !include 'js8_params.f90' parameter(NP=NMAX/NDOWN, NP2=NN*NDOWNSPS) complex cd0(0:NP-1) complex csynca(0:6,NDOWNSPS),csyncb(0:6,NDOWNSPS),csyncc(0:6,NDOWNSPS) - complex csync2(NDOWNSPS) + complex csync2a(NDOWNSPS),csync2b(NDOWNSPS),csync2c(NDOWNSPS) complex ctwk(NDOWNSPS) complex z1,z2,z3 + real delf logical first integer icos data first/.true./ @@ -67,8 +68,26 @@ subroutine syncjs8d(cd0,icos,i0,ctwk,itwk,sync) first=.false. endif - sync=0 + ! compute the ctwk samples at the delta frequency to by used to detect peaks + ! at frequencies +/- delf so we can align the decoder for the best possible + ! chance at decoding. + ! + ! NOTE: this does not need to compute the entire set of samples for the + ! costas arrays...it only needs to do it for the delta frequency + ! whose conjugate is multiplied against each csync arrays for those + ! coastas signals + if(delf.ne.0.0) then + fs2=12000.0/NDOWN + dt2=1.0/fs2 + dphi=twopi*delf*dt2 + phi=0.0 + do i=1,NDOWNSPS + ctwk(i)=cmplx(cos(phi),sin(phi)) + phi=mod(phi+dphi,twopi) + enddo + endif + sync=0 do i=0,6 i1=i0+i*NDOWNSPS i2=i1+36*NDOWNSPS @@ -78,17 +97,17 @@ subroutine syncjs8d(cd0,icos,i0,ctwk,itwk,sync) z2=0. z3=0. - csync2=csynca(i,1:NDOWNSPS) - if(itwk.eq.1) csync2=ctwk*csync2 - if(i1.ge.0 .and. i1+NDOWNSPS-1.le.NP2-1) z1=sum(cd0(i1:i1+NDOWNSPS-1)*conjg(csync2)) + csync2a=csynca(i,1:NDOWNSPS) + if(delf.ne.0.0) csync2a=ctwk*csync2a + if(i1.ge.0 .and. i1+NDOWNSPS-1.le.NP2-1) z1=sum(cd0(i1:i1+NDOWNSPS-1)*conjg(csync2a)) - csync2=csyncb(i,1:NDOWNSPS) - if(itwk.eq.1) csync2=ctwk*csync2 - if(i2.ge.0 .and. i2+NDOWNSPS-1.le.NP2-1) z2=sum(cd0(i2:i2+NDOWNSPS-1)*conjg(csync2)) + csync2b=csyncb(i,1:NDOWNSPS) + if(delf.ne.0.0) csync2b=ctwk*csync2b + if(i2.ge.0 .and. i2+NDOWNSPS-1.le.NP2-1) z2=sum(cd0(i2:i2+NDOWNSPS-1)*conjg(csync2b)) - csync2=csyncc(i,1:NDOWNSPS) - if(itwk.eq.1) csync2=ctwk*csync2 - if(i3.ge.0 .and. i3+NDOWNSPS-1.le.NP2-1) z3=sum(cd0(i3:i3+NDOWNSPS-1)*conjg(csync2)) + csync2c=csyncc(i,1:NDOWNSPS) + if(delf.ne.0.0) csync2c=ctwk*csync2c + if(i3.ge.0 .and. i3+NDOWNSPS-1.le.NP2-1) z3=sum(cd0(i3:i3+NDOWNSPS-1)*conjg(csync2c)) sync = sync + p(z1) + p(z2) + p(z3) diff --git a/media/tests/A_3_1.wav b/media/tests/A_3_1.wav deleted file mode 100644 index 565ff25..0000000 Binary files a/media/tests/A_3_1.wav and /dev/null differ diff --git a/media/tests/A_3_3.wav b/media/tests/A_3_3.wav new file mode 100644 index 0000000..c6a9860 Binary files /dev/null and b/media/tests/A_3_3.wav differ