Updated decoder with better debug handling. Fixed issue with E mode crashing on some decodes

This commit is contained in:
Jordan Sherer
2019-12-07 15:53:41 -05:00
parent 04fa0f42ad
commit 3be107b348
13 changed files with 98 additions and 93 deletions
-8
View File
@@ -81,13 +81,5 @@ subroutine genjs8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
itone(k)=indx
enddo
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'tones', itone
write(99,*) '...', icos7a, '--->', NCOSTAS
close(99)
endif
return
end subroutine genjs8
+11
View File
@@ -23,6 +23,11 @@ subroutine js8_downsample(dd,newdat,f0,c1)
first=.false.
endif
if(newdat) then
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> newdat', NMAX, NDFFT1
flush(6)
endif
! Data in dd have changed, recompute the long FFT
x(1:NMAX)=dd
x(NMAX+1:NDFFT1)=0. !Zero-pad the x array
@@ -39,6 +44,12 @@ subroutine js8_downsample(dd,newdat,f0,c1)
ib=max(1,nint(fb/df))
k=0
c1=0.
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> ds', df, baud, i0, ib, it
flush(6)
endif
do i=ib,it
c1(k)=cx(i)
k=k+1
+33 -31
View File
@@ -95,6 +95,9 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
delfbest=0.
ibest=0
write(*,*) '<DecodeDebug> downsampling', fs2, dt2
flush(6)
call timer('js8_down',0)
call js8_downsample(dd0,newdat,f1,cd0) !Mix f1 to baseband and downsample
call timer('js8_down',1)
@@ -104,17 +107,15 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
smax=0.0
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'initial dt guess', i0, xdt
close(99)
write(*,*) '<DecodeDebug> initial dt guess', i0, xdt
flush(6)
endif
do idt=i0-NQSYMBOL,i0+NQSYMBOL !Search over +/- one quarter symbol
call syncjs8d(cd0,idt,ctwk,0,sync)
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'idt', idt, 'sync', sync
close(99)
write(*,*) '<DecodeDebug> ', 'idt', idt, 'sync', sync
flush(6)
endif
if(sync.gt.smax) then
smax=sync
@@ -124,9 +125,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
xdt2=ibest*dt2 !Improved estimate for DT
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'xdt2', xdt2, ibest
close(99)
write(*,*) '<DecodeDebug> ', 'xdt2', xdt2, 'ibest', ibest
flush(6)
endif
! Now peak up in frequency
@@ -143,9 +143,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
enddo
call syncjs8d(cd0,i0,ctwk,1,sync)
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'df', delf, 'sync', sync
close(99)
write(*,*) '<DecodeDebug> ', 'df', delf, 'sync', sync
flush(6)
endif
if( sync .gt. smax ) then
smax=sync
@@ -159,9 +158,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
f1=f1+delfbest !Improved estimate of DF
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'twk', xdt, f1, smax
close(99)
write(*,*) '<DecodeDebug> ', 'twk', xdt, f1, smax
flush(6)
endif
call syncjs8d(cd0,i0,ctwk,2,sync)
@@ -192,9 +190,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
nsync=is1+is2+is3
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'sync', ibest, nsync
close(99)
write(*,*) '<DecodeDebug> sync', ibest, nsync
flush(6)
endif
if(nsync .le. 6) then ! bail out
@@ -400,9 +397,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
call timer('bpd174 ',1)
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) '> bpd174 ', ipass, nharderrors, dmin
close(99)
write(*,*) '<DecodeDebug> bpd174', ipass, nharderrors, dmin
flush(6)
endif
dmin=0.0
@@ -425,9 +421,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
xsnr=-99.0
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) '> osd174', ipass, nharderrors, dmin, nharderrors + dmin, sync
close(99)
write(*,*) '<DecodeDebug> osd174', ipass, nharderrors, dmin, nharderrors + dmin, sync
flush(6)
endif
if(count(cw.eq.0).eq.174) cycle !Reject the all-zero codeword
@@ -439,12 +434,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
call chkcrc12a(decoded,nbadcrc)
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) '> crc', decoded
if(nbadcrc.eq.1) then
write(99,*) '> crc failed'
endif
close(99)
write(*,*) '<DecodeDebug> crc', decoded, 'bad', nbadcrc
flush(6)
endif
else
nharderrors=-1
@@ -459,7 +450,13 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
message(1:12)=origmsg(1:12)
call genjs8(message,mygrid6,bcontest,i3bit,msgsent,msgbits,itone)
if(lsubtract) call subtractjs8(dd0,itone,f1,xdt2)
if(lsubtract) then
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> subtract', f1, xdt2, itone
flush(6)
endif
call subtractjs8(dd0,itone,f1,xdt2)
endif
xsig=0.0
xnoi=0.0
do i=1,NN
@@ -477,6 +474,11 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
msg37=origmsg//' '
msg37(22:22) = char(48 + i3bit)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> msg', msg37, 'snr', xsnr
flush(6)
endif
return
endif
+2 -2
View File
@@ -6,7 +6,7 @@
!parameter (JZ=62) !Sync Search Space over +/- 2.5s relative to 0.5s TX start time. 2.48 = 62/4/(12000/1920) ?
parameter (NSPS=384, NTXDUR=4, NDOWNSPS=12, NDD=125, JZ=250) ! 250 Hz 31.25 baud 60 wpm -18.0dB (1.0Eb/N0) 2.52s
! parameter (NSPS=384, NTXDUR=4, NDOWNSPS=12, NDD=125, JZ=250) ! 250 Hz 31.25 baud 60 wpm -18.0dB (1.0Eb/N0) 2.52s
! parameter (NSPS=384, NTXDUR=5, NDOWNSPS=12, NDD=125, JZ=116) ! 250 Hz 31.25 baud 48 wpm -18.0dB (1.0Eb/N0) 2.52s
! parameter (NSPS=480, NTXDUR=5, NDOWNSPS=12, NDD=125, JZ=116) ! 200 Hz 25 baud 48 wpm -19.0dB (1.0Eb/N0) 3.16s
! parameter (NSPS=480, NTXDUR=6, NDOWNSPS=20, NDD=150, JZ=116) ! 200 Hz 25 baud 40 wpm -19.0dB (1.0Eb/N0) 3.16s
@@ -18,7 +18,7 @@
! parameter (NSPS=1200, NTXDUR=10, NDOWNSPS=20, NDD=100, JZ=116) ! 80 Hz 10 baud 24 wpm -23.0dB (1.0Eb/N0) 7.90s
! parameter (NSPS=1920, NTXDUR=15, NDOWNSPS=32, NDD=100, JZ=116) ! 50 Hz 6.250 baud 16 wpm -25.0dB (1.0Eb/N0) 12.64s
! parameter (NSPS=3840, NTXDUR=30, NDOWNSPS=32, NDD=94, JZ=116) ! 24 Hz 3.125 baud 8 wpm -28.0dB (1.0Eb/N0) 25.28s
! parameter (NSPS=4000, NTXDUR=30, NDOWNSPS=32, NDD=90, JZ=32) ! 24 Hz 3 baud 8 wpm -28.2dB (1.0Eb/N0) 26.33s
parameter (NSPS=4000, NTXDUR=28, NDOWNSPS=20, NDD=90, JZ=32) ! 24 Hz 3 baud 8 wpm -28.2dB (1.0Eb/N0) 26.33s
parameter (AZ=12000.0/(1.0*NSPS)*0.8d0) !Dedupe overlap in Hz
parameter (ASTART=0.5) !Start delay in seconds
+16
View File
@@ -23,6 +23,12 @@ subroutine subtractjs8(dd,itone,f0,dt)
save first
nstart=dt*12000+1
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> generating reference signal', nstart
flush(6)
endif
call genjs8refsig(itone,cref,f0)
camp=0.
do i=1,nframe
@@ -30,6 +36,11 @@ subroutine subtractjs8(dd,itone,f0,dt)
if(id.ge.1.and.id.le.NMAX) camp(i)=dd(id)*conjg(cref(i))
enddo
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> filtering', nfft
flush(6)
endif
if(first) then
! Create and normalize the filter
pi=4.0*atan(1.0)
@@ -53,6 +64,11 @@ subroutine subtractjs8(dd,itone,f0,dt)
cfilt(1:nfft)=cfilt(1:nfft)*cw(1:nfft)
call four2a(cfilt,nfft,1,1,1)
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> subtracting filtered reference', nfft
flush(6)
endif
! Subtract the reconstructed signal
do i=1,nframe
j=nstart+i-1
+2 -3
View File
@@ -134,9 +134,8 @@ subroutine syncjs8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
n=ia + indx(iz+1-i) - 1
if(red(n).lt.syncmin.or.isnan(red(n))) exit
if(NWRITELOG.eq.1) then
open(99, file="./js8.log", status="old", position="append", action="write")
write(99,*) 'red candidate', red(n), n*df, (jpeak(n)-1)*tstep
close(99)
write(*,*) '<DecodeDebug>', 'red candidate', red(n), n*df, (jpeak(n)-1)*tstep
flush(6)
endif
k=k+1
candidate0(1,k)=n*df