summaryrefslogtreecommitdiff
path: root/lib/ft8var
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /lib/ft8var
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'lib/ft8var')
-rw-r--r--lib/ft8var/cwfilter.f9040
-rw-r--r--lib/ft8var/fillhashvar.f9012
-rw-r--r--lib/ft8var/four2avar.f903
-rw-r--r--lib/ft8var/ft8_decodevar.f9076
-rw-r--r--lib/ft8var/ft8_mod1.f9050
-rw-r--r--lib/ft8var/ft8apsetvar.f9082
-rw-r--r--lib/ft8var/ft8bvar.f9081
-rw-r--r--lib/ft8var/ft8mfcqvar.f9013
-rw-r--r--lib/ft8var/ft8sd1var.f9015
-rw-r--r--lib/ft8var/ft8sdvar.f9015
-rw-r--r--lib/ft8var/ft8svar.f9013
-rw-r--r--lib/ft8var/genft8sdvar.f9054
-rw-r--r--lib/ft8var/genft8var.f90209
-rw-r--r--lib/ft8var/partintft8.f9013
-rw-r--r--lib/ft8var/tone8.f9032
-rw-r--r--lib/ft8var/tone8myc.f9012
-rw-r--r--lib/ft8var/tonesdvar.f9016
17 files changed, 508 insertions, 228 deletions
diff --git a/lib/ft8var/cwfilter.f90 b/lib/ft8var/cwfilter.f90
index e305047d..1115d3de 100644
--- a/lib/ft8var/cwfilter.f90
+++ b/lib/ft8var/cwfilter.f90
@@ -1,4 +1,8 @@
-subroutine cwfilter(first)
+subroutine cwfilter(first,knowledge,render_legacy)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8sdvar_for_state
use ft8_mod1, only : cw,windowc1,windowx,pivalue,facx,mcq,m73,mrr73,mrrr,one,twopi,facc1,dt,csync,idtone25,csynccq, &
idtone25_valid, &
@@ -13,12 +17,23 @@ subroutine cwfilter(first)
integer itone(79)
integer*1 msgbits(77)
logical, intent(in) :: first
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ logical, optional, intent(in) :: render_legacy
+ logical :: emit_line
+ logical, save :: process_initialized=.false.
+ type(pack77_state), pointer :: codec
+
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
+ emit_line=.true.
+ if(present(render_legacy)) emit_line=render_legacy
!pushing callsigns from ALLCALL to memory
!note that with new, larger ALLCALL7.TXT files, dimensions of various ncall arrays may need to be increased in jt65_mod9.f90
!on 20250709 callj dim was increased from 9000 to 10000 when updated ALLCALL7.TXT file was added
if(first) then
allocate(csig0(151680))
+ if(.not.process_initialized) then
! Open the shipped read-only ALLCALL7.TXT for reading only. status='old' with
! action='read' makes a missing/unreadable file degrade cleanly to an empty
! callsign DB (handled by the count check below) instead of status='unknown'
@@ -60,9 +75,10 @@ subroutine cwfilter(first)
ncallk.lt.1 .or. ncalllm.lt.1 .or. ncalln.lt.1 .or. ncallo.lt.1 .or. ncallpq.lt.1 .or. ncallr.lt.1 .or. &
ncallst.lt.1 .or. ncalluv.lt.1 .or. ncallw.lt.1 .or. ncallxz.lt.1) then
ldbvalid=.false.
- write(*,4) 'ALLCALL7.TXT is too short or broken?','d' ! 50th position for "d"
+ if(emit_line) write(*,4) 'ALLCALL7.TXT is too short or broken?','d'
4 format(a36,13x,a1)
- call flush(6)
+ if(emit_line) call flush(6)
+ endif
endif
pivalue=4.d0*atan(1.d0)
@@ -77,10 +93,12 @@ subroutine cwfilter(first)
windowx=facx*windowx
facc1=0.01/sqrt(61440.) ! 1.0/sqrt(192000.*3200.) NFFT1*NFFT2
- mcq=2*mcq-1
- mrrr=2*mrrr-1
- m73=2*m73-1
- mrr73=2*mrr73-1
+ if(.not.process_initialized) then
+ mcq=2*mcq-1
+ mrrr=2*mrrr-1
+ m73=2*m73-1
+ mrr73=2*mrr73-1
+ endif
one=.false.
do i=0,511
@@ -118,7 +136,7 @@ subroutine cwfilter(first)
idtone25_valid(2:25)=.false.
do i=2,25
i3=-1; n3=-1
- call genft8sdvar(msgcq25(i),i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msgcq25(i),i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) cycle
if(i.eq.2) then
call gen_ft8wave(itone,79,1920,2.0,12000.0,0.0,csig0,xjunk,1,151680)
@@ -165,6 +183,7 @@ subroutine cwfilter(first)
ctwk256(i)=cmplx(cos(phi),sin(phi))
phi=mod(phi+dphi,twopi)
enddo
+ process_initialized=.true.
endif
! this filter is being used for signal subtraction
@@ -177,8 +196,9 @@ subroutine cwfilter(first)
sumw=sumw+window1(j)
enddo
cw=0.
- cw(1:NFILT1+1)=window1/sumw
- cw=cshift(cw,NFILT1/2+1)
+ do j=-NFILT1/2,NFILT1/2
+ cw(modulo(j-1,NFFT)+1)=window1(j)/sumw
+ enddo
do j=1,NFILT1/2+1
endcorr(j)=1.0/(1.0-sum(window1(j-1:NFILT1/2))/sumw)
enddo
diff --git a/lib/ft8var/fillhashvar.f90 b/lib/ft8var/fillhashvar.f90
index 851ddc13..39489a08 100644
--- a/lib/ft8var/fillhashvar.f90
+++ b/lib/ft8var/fillhashvar.f90
@@ -1,11 +1,21 @@
-subroutine fillhashvar(numthreads,lfill)
+subroutine fillhashvar(numthreads,lfill,knowledge)
use packjt77
use ft8_mod1, only : mycall,hiscall
integer, intent(in) :: numthreads
logical, intent(in) :: lfill
+ type(pack77_state), target, optional, intent(inout) :: knowledge
character*13 cw
+ if(present(knowledge)) then
+ if(lfill) then
+ call fold_queued_calls_for_state(knowledge,numthreads)
+ else
+ call prepare_configured_decode_for_state(knowledge,mycall,hiscall)
+ endif
+ return
+ endif
+
if(lfill) then
! End of a configured/var decode pass: merge per-thread successful decode
! effects into the shared callsign hash and recent-call state.
diff --git a/lib/ft8var/four2avar.f90 b/lib/ft8var/four2avar.f90
index 1653955b..80ef88b3 100644
--- a/lib/ft8var/four2avar.f90
+++ b/lib/ft8var/four2avar.f90
@@ -22,7 +22,7 @@ subroutine four2avar(a,nfft,ndim,isign,iform)
parameter (NPMAX=2100) !Max numberf of stored plans
parameter (NSMALL=16385) !Max size of "small" FFTs
complex a(nfft) !Array to be transformed
- complex aa(NSMALL) !Local copy of "small" a()
+ complex, allocatable :: aa(:) !Local copy of "small" a()
integer nn(NPMAX),ns(NPMAX),nf(NPMAX) !Params of stored plans
integer*8 nl(NPMAX),nloc !More params of plans
integer*8 plan(NPMAX) !Pointers to stored plans
@@ -76,6 +76,7 @@ subroutine four2avar(a,nfft,ndim,isign,iform)
if(nfft.le.NSMALL) then
jz=nfft
if(iform.le.0) jz=nfft/2+1
+ allocate(aa(jz))
aa(1:jz)=a(1:jz)
endif
diff --git a/lib/ft8var/ft8_decodevar.f90 b/lib/ft8var/ft8_decodevar.f90
index d7324216..4a76ed34 100644
--- a/lib/ft8var/ft8_decodevar.f90
+++ b/lib/ft8var/ft8_decodevar.f90
@@ -1,24 +1,60 @@
module ft8_decodevar
+ use packjt77, only: pack77_state
+ use decoder_engine_types, only: ft8_signal_evidence
+ use ft8var_work_types
logical ltry_a8
type :: ft8_decodervar
procedure(ft8_decodevar_callback), pointer :: callback
+ type(pack77_state), pointer :: knowledge => null()
contains
procedure :: decodevar
end type ft8_decodervar
abstract interface
- subroutine ft8_decodevar_callback (this,snr,dt,freq,decodedvar,nap,qual)
- import ft8_decodervar
+ subroutine ft8_decodevar_callback (this,snr,dt,freq,decodedvar,nap,qual,evidence)
+ import ft8_decodervar,ft8_signal_evidence
implicit none
class(ft8_decodervar), intent(inout) :: this
integer, intent(in) :: snr
integer, intent(in) :: nap
real, intent(in) :: dt,freq,qual
character(len=37), intent(in) :: decodedvar !ft8md was 26
+ type(ft8_signal_evidence), intent(in), optional :: evidence
end subroutine ft8_decodevar_callback
end interface
+ interface
+ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
+ lsubtract,tmpcqdec,tmpmyc,nagainfil,iaptype,f1,xdt,nbadcrc,lft8sdec, &
+ msg37,msg37_2,xsnr,stophint,nthr,lFreeText,ipass,lft8subpass,lspecial, &
+ lcqcand,ncqsignal,nmycsignal,npass,i3bit,lft8s,lmycallstd,lhiscallstd, &
+ levenint,loddint,lft8sd,i3,n3,nft8rxfsens,ncount,msgsrcvd,lrepliedother, &
+ lhashmsg,lqsothread,lft8lowth,lhighsens,tmpcqsig,tmpmycsig,tmpqsosig, &
+ lnohiscall,lnomycall,lnohisgrid,qual,iaptype2,progress_generation,knowledge,evidence)
+ import pack77_state,ft8_signal_evidence,tmpcqdec_struct,tmpmyc_struct, &
+ tmpcqsig_struct,tmpmycsig_struct,tmpqsosig_struct
+ real :: residual(180000),f1,xdt,xsnr,qual
+ complex :: spectrum(0:96000)
+ integer :: nQSOProgress,nfqso,nftx,napwid,iaptype,nbadcrc,nthr,ipass
+ integer :: ncqsignal,nmycsignal,npass,i3bit,i3,n3,nft8rxfsens,ncount
+ integer :: iaptype2,progress_generation
+ logical :: newdat1,lsubtract,nagainfil,lFreeText,lspecial
+ logical(kind=1) :: lft8sdec,stophint,lft8subpass,lcqcand,lft8s
+ logical(kind=1) :: lmycallstd,lhiscallstd,levenint,loddint,lft8sd
+ logical(kind=1) :: lrepliedother,lhashmsg,lqsothread,lft8lowth,lhighsens
+ logical(kind=1) :: lnohiscall,lnomycall,lnohisgrid
+ character(len=37) :: msg37,msg37_2,msgsrcvd(130)
+ type(tmpcqdec_struct) :: tmpcqdec(*)
+ type(tmpmyc_struct) :: tmpmyc(*)
+ type(tmpcqsig_struct) :: tmpcqsig(*)
+ type(tmpmycsig_struct) :: tmpmycsig(*)
+ type(tmpqsosig_struct) :: tmpqsosig(*)
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(ft8_signal_evidence), optional, intent(out) :: evidence
+ end subroutine ft8bvar
+ end interface
+
contains
subroutine decodevar(this,nQSOProgress,nfqso,nft8rxfsens,nftx, &
@@ -27,6 +63,7 @@ contains
progress_generation,residual,spectrum)
use omp_lib
+ use ft8_codec_context, only: get_ft8_codec_state
use ft8_mtd_residual, only : mtd_publish_worker,mtd_transform_phase
use decode_completion_module, only : write_decode_progress
@@ -66,6 +103,8 @@ contains
character msg37*37,msg37_2*37,msg26*37,call2*12 !ft8md msg26 was *26
character*37 msgsrcvd(130)
integer nsnr
+ type(pack77_state), pointer :: codec
+ type(ft8_signal_evidence) :: evidence
type oddtmp_struct
real freq
@@ -83,39 +122,14 @@ contains
end type eventmp_struct
type(eventmp_struct) eventmp(130)
- type tmpcqdec_struct
- real freq
- real xdt
- end type tmpcqdec_struct
type(tmpcqdec_struct) tmpcqdec(numdeccq) ! 40 sigs
-
- type tmpcqsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpcqsig_struct
type(tmpcqsig_struct), allocatable :: tmpcqsig(:) ! 20 sigs
-
- type tmpmyc_struct
- real freq
- real xdt
- end type tmpmyc_struct
type(tmpmyc_struct) tmpmyc(numdecmyc) ! 25 sigs
-
- type tmpmycsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpmycsig_struct
type(tmpmycsig_struct) tmpmycsig(nummycsig) ! 5 sigs
-
- type tmpqsosig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpqsosig_struct
type(tmpqsosig_struct) tmpqsosig(1)
+ codec => this%knowledge
+ if(.not.associated(codec)) codec => get_ft8_codec_state()
allocate(tmpcqsig(numcqsig))
oddtmp%lstate=.false.
eventmp%lstate=.false.
@@ -262,7 +276,7 @@ contains
nft8rxfsens,ncount,msgsrcvd,lrepliedother,lhashmsg,lqsothread, &
lft8lowth,lhighsens,tmpcqsig,tmpmycsig,tmpqsosig, &
lnohiscall,lnomycall,lnohisgrid,qual,iaptype2, &
- progress_generation)
+ progress_generation,codec,evidence)
nsnr=nint(xsnr)
xdt=xdt-0.5
if(nbadcrc.eq.0) then
@@ -328,7 +342,7 @@ contains
if(.not.lhidemsg) then
msg26=msg37(1:37) !ft8md was 1:26
if(associated(this%callback)) then
- call this%callback(nsnr,xdt,f1,msg26,iaptype2,qual)
+ call this%callback(nsnr,xdt,f1,msg26,iaptype2,qual,evidence)
endif
endif
diff --git a/lib/ft8var/ft8_mod1.f90 b/lib/ft8var/ft8_mod1.f90
index cd1f0d2c..435a1957 100644
--- a/lib/ft8var/ft8_mod1.f90
+++ b/lib/ft8var/ft8_mod1.f90
@@ -209,4 +209,54 @@ module ft8_mod1
end type oddqso_struct
type(oddqso_struct) oddqso(1,nmaxthreads)
+contains
+
+ subroutine reset_ft8_mod1()
+ dd8=0.
+ allmessages=''
+ allfreq=0.
+ allsnrs=0
+ ndecodes=0
+ nmsg=0
+ nintcount=0
+ nft8cycles=0
+ nlasttx=0
+ sumxdtt=0.
+ avexdt=0.
+ lastrxmsg%lstate=.false.
+ lastrxmsg%lastmsg=''
+ lastrxmsg%xdt=0.
+ odd%lstate=.false.
+ even%lstate=.false.
+ oddcopy%lstate=.false.
+ evencopy%lstate=.false.
+ odd%msg=''
+ even%msg=''
+ oddcopy%msg=''
+ evencopy%msg=''
+ calldteven%call2=''
+ calldtodd%call2=''
+ calldteven%dt=0.
+ calldtodd%dt=0.
+ incall%msg=''
+ incall%xdt=0.
+ msgroot=''
+ msgincall=''
+ xdtincall=0.
+ nincallthr=0
+ ncandallthr=0
+ idtone25_valid=.false.
+ idtone56_valid=.false.
+ idtone76_valid=.false.
+ csyncsd_valid=.false.
+ csyncsdcq_valid=.false.
+ first_osd=.true.
+ lqsomsgdcd=.false.
+ lapmyc=.false.
+ lasthcall=''
+ mycall12_0='dummy'
+ mycall12_00='dummy'
+ hiscall12_0='dummy'
+ end subroutine reset_ft8_mod1
+
end module ft8_mod1
diff --git a/lib/ft8var/ft8apsetvar.f90 b/lib/ft8var/ft8apsetvar.f90
index f23d604e..bffd2d9e 100644
--- a/lib/ft8var/ft8apsetvar.f90
+++ b/lib/ft8var/ft8apsetvar.f90
@@ -1,6 +1,7 @@
-subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
+subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads,knowledge)
use packjt77
+ use ft8_codec_context, only: get_ft8_codec_state
use ft8_mod1, only : apsym,mycall,hiscall,apsymsp,lhound,apsymdxns1,apsymdxnsrrr,mybcall,hisbcall,apcqsym,hisgrid4, &
apsymdxnsrr73,apsymdxns73,apsymmyns1,apsymmyns2,apsymmynsrr73,apsymmyns73,apsymdxstd,apsymdxnsr73, &
apsymdxns732,apsymmynsrrr
@@ -13,12 +14,25 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
logical(1), intent(in) :: lmycallstd,lhiscallstd
type(unpack77_options) :: no_record_options
type(pack77_options) :: no_tx_hash_options
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
data mycallprev/'QQ2QQ'/
data hiscallprev/'QQ1QQ'/
data lhoundprev/.false./
data first/.true./
save hiscallprev,mycallprev,lhoundprev,first
+ go to 900
+entry reset_ft8apsetvar()
+ hiscallprev='QQ1QQ'
+ mycallprev='QQ2QQ'
+ lhoundprev=.false.
+ first=.true.
+ return
+900 continue
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
+
i1=0
i3=-1
n3=-1
@@ -34,7 +48,7 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
first=.false.; mycallprev=mycall; lhoundprev=lhound
! shall hash both callsigns for making AP masks with nonstandard callsign message
- if(.not.lhound) call fillhashvar(numthreads,.true.)
+ if(.not.lhound) call fold_queued_calls_for_state(codec,numthreads)
lnohiscall=.false.
hiscallt=hiscall
@@ -51,8 +65,8 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
else; msg='CQ '//trim(hiscall)
endif
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(lhiscallstd .and. i3.ne.1 .or. .not.lhiscallstd .and. i3.ne.4 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 1
read(c77,'(77i1)',err=1) apcqsym(1:77)
@@ -62,8 +76,8 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
if(lhiscallstd .and. .not.lmycallstd) then
msg=trim(hiscall)//' '//trim(hiscall)//' RRR'
i3=0; n3=0
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 2
read(c77,'(58i1)',err=2) apsymdxstd(1:58)
@@ -73,16 +87,16 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
if(.not.lhound .and. .not.lhiscallstd .and. len_trim(hiscall).gt.2) then
! nonstandard DXCall searching
msg='<W9XYZ> '//trim(hiscall)//' RR73'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.4 .or. .not.unpk77_successvar) go to 3
read(c77,'(77i1)',err=3) apsymdxnsrr73(1:77)
apsymdxnsrr73=2*apsymdxnsrr73-1
msg='<W9XYZ> '//trim(hiscall)//' 73'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.4 .or. .not.unpk77_successvar) go to 4
read(c77,'(77i1)',err=4) apsymdxns73(1:77)
@@ -93,28 +107,28 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
if(.not.lhound .and. .not.lmycallstd .and. len_trim(mycall).gt.2) then
if(lhiscallstd) then
msg='<'//trim(mycall)//'> '//trim(hiscall)//' -15'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
if(i3.ne.1 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 5
read(c77,'(58i1)',err=5) apsymmyns2(1:58)
apsymmyns2=2*apsymmyns2-1
nlenmyc=len_trim(mycall)
msg=trim(mycall)//' <'//trim(hiscall)//'> RR73'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 6
read(c77,'(77i1)',err=6) apsymmynsrr73(1:77)
apsymmynsrr73=2*apsymmynsrr73-1
msg=trim(mycall)//' <'//trim(hiscall)//'> 73'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 7
read(c77,'(77i1)',err=7) apsymmyns73(1:77)
apsymmyns73=2*apsymmyns73-1
msg=trim(mycall)//' <'//trim(hiscall)//'> RRR'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 15
read(c77,'(77i1)',err=15) apsymmynsrrr(1:77)
apsymmynsrrr=2*apsymmynsrrr-1
@@ -122,8 +136,8 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
else if(lnohiscall) then
msg='<'//trim(mycall)//'> ZZ1ZZZ -15'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
if(i3.ne.1 .or. msgchk.ne.msg .or. .not.unpk77_successvar) go to 8
read(c77,'(29i1)',err=8) apsymmyns1(1:29)
apsymmyns1=2*apsymmyns1-1
@@ -135,8 +149,8 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
if(.not.lhound .and. lmycallstd .and. (lhiscallstd .or. lnohiscall)) then
msg=trim(mycall)//' '//trim(hiscallt)//' RRR'
i3=0; n3=0
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 9
read(c77,'(58i1)',err=9) apsym(1:58)
@@ -147,8 +161,8 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
! standard messages from Fox, always base callsigns
if(len_trim(hisbcall).gt.2 .and. len_trim(mybcall).gt.2) then
msg=trim(mybcall)//' '//trim(hisbcall)//' -15'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_successvar) go to 9
read(c77,'(58i1)',err=9) apsym(1:58)
@@ -160,8 +174,8 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
! special messages
msg=trim(mycall)//' RR73; '//trim(mycall)//' <'//trim(hiscallt)//'> -16'
i3=0; n3=1
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
i1=0; i1=index(msgchk,'<'); if(i1.lt.15) return
if(i3.ne.0 .or. msg(1:i1).ne.msgchk(1:i1) .or. .not.unpk77_successvar) go to 10
@@ -171,32 +185,32 @@ subroutine ft8apsetvar(lmycallstd,lhiscallstd,numthreads)
if(.not.lhound .and. lmycallstd .and. .not.lhiscallstd .and. len_trim(hiscall).gt.2) then
msg=trim(mycall)//' <'//trim(hiscall)//'> -16' ! report, rreport
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.1 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 11
read(c77,'(58i1)',err=11) apsymdxns1(1:58)
apsymdxns1=2*apsymdxns1-1
msg='<'//trim(mycall)//'> '//trim(hiscall)//' RRR'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 12
read(c77,'(77i1)',err=12) apsymdxnsrrr(1:77)
apsymdxnsrrr=2*apsymdxnsrrr-1
msg='<'//trim(mycall)//'> '//trim(hiscall)//' RR73'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 13
read(c77,'(77i1)',err=13) apsymdxnsr73(1:77)
apsymdxnsr73=2*apsymdxnsr73-1
msg='<'//trim(mycall)//'> '//trim(hiscall)//' 73'
- call pack77(msg,i3,n3,c77,no_tx_hash_options)
- call unpack77_configured(c77,1,msgchk,unpk77_successvar,no_record_options)
+ call pack77_for_state(codec,msg,i3,n3,c77,no_tx_hash_options)
+ call unpack77_configured_for_state(codec,c77,1,msgchk,unpk77_successvar,no_record_options)
!read(c77(75:77),'(b3)') k3; print *,'i3 =',k3; print *,msgchk
if(i3.ne.4 .or. msg.ne.msgchk .or. .not.unpk77_successvar) go to 14
read(c77,'(77i1)',err=14) apsymdxns732(1:77)
diff --git a/lib/ft8var/ft8bvar.f90 b/lib/ft8var/ft8bvar.f90
index caf1d94c..5e774347 100644
--- a/lib/ft8var/ft8bvar.f90
+++ b/lib/ft8var/ft8bvar.f90
@@ -5,9 +5,14 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
nmycsignal,npass,i3bit,lft8s,lmycallstd,lhiscallstd,levenint,loddint,lft8sd, &
i3,n3,nft8rxfsens,ncount,msgsrcvd,lrepliedother,lhashmsg,lqsothread, &
lft8lowth,lhighsens,tmpcqsig,tmpmycsig,tmpqsosig,lnohiscall, &
- lnomycall,lnohisgrid,qual,iaptype2,progress_generation)
-
- use packjt77, only : unpack77, unpack77_configured, unpack77_options
+ lnomycall,lnohisgrid,qual,iaptype2,progress_generation,knowledge,evidence)
+
+ use packjt77, only : pack77_state,unpack77_configured_for_state,unpack77_options
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: ft8sd1var,ft8sdvar,ft8svar,ft8mfcqvar,tonesdvar, &
+ ft8var_tones_from_77bits
+ use ft8var_work_types
+ use decoder_engine_types, only: ft8_signal_evidence,engine_payload_decoded
use ft8_mtd_residual, only : mtd_commit_subtraction,mtd_mark_spectrum_current, &
mtd_refresh_candidate
use decode_completion_module, only : write_decode_progress
@@ -56,40 +61,24 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
lcqdxcsig,lcqdxcnssig,lqsocandave,lcall1hash,lqsosigtype3,lqso73,lqsorr73, &
lqsorrr,lfoxspecrpt,lfoxstdr73,lapcqonly,lcall2hash,lskipnotap
integer iaptype2
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
+ type(ft8_signal_evidence), optional, intent(out) :: evidence
+ character(len=37) :: decoded_payload_message
+ logical :: has_decoded_payload
- type tmpcqdec_struct
- real freq
- real xdt
- end type tmpcqdec_struct
type(tmpcqdec_struct) tmpcqdec(numdeccq)
-
- type tmpcqsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpcqsig_struct
type(tmpcqsig_struct) tmpcqsig(numcqsig) ! 20 sigs 24 threads
-
- type tmpmyc_struct
- real freq
- real xdt
- end type tmpmyc_struct
type(tmpmyc_struct) tmpmyc(numdecmyc)
-
- type tmpmycsig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpmycsig_struct
type(tmpmycsig_struct) tmpmycsig(nummycsig) ! 5 sigs
-
- type tmpqsosig_struct
- real freq
- real xdt
- complex cs(0:7,79)
- end type tmpqsosig_struct
type(tmpqsosig_struct) tmpqsosig(1)
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
+ if(present(evidence)) evidence=ft8_signal_evidence()
+ has_decoded_payload=.false.
+ decoded_payload_message=''
+ itone=0
iaptype2 = 99 !ft8md
max_iterations=30
@@ -256,7 +245,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
cd0=cd3
endif
if(iqso.eq.4) then
- call tonesdvar(msgd,lcq)
+ call tonesdvar(msgd,lcq,codec)
if(.not.ldeepsync) go to 32
cd0=cd1
endif
@@ -732,7 +721,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
32 if(lsd) then
if(iqso.eq.4 .and. .not.ldeepsync) go to 64
- call ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
+ call ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq,codec)
if(lft8sd) then
if(levenint) then
evencopy(isd)%lstate=.false.
@@ -766,7 +755,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
go to 2
endif
else
- call ft8mfcqvar(s8,itone,msgd,msg37,lft8sd)
+ call ft8mfcqvar(s8,itone,msgd,msg37,lft8sd,codec)
if(lft8sd) then
if(levenint) then
evencopy(isd)%lstate=.false.
@@ -812,7 +801,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. .not.lhiscallstd)) then
if(.not.lft8sdec .and. dfqso.lt.2.0) then
if(lvirtual2 .or. lvirtual3) srr=0.0
- call ft8svar(s82,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
+ call ft8svar(s82,srr,itone,msg37,lft8s,nft8rxfsens,stophint,codec)
if(lft8s) then
if(index(msg37,'<').gt.0) then
lhashmsg=.true.
@@ -2176,7 +2165,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. &
.not.lhiscallstd)) then
if(.not.lft8sdec .and. .not.stophint .and. dfqso.lt.2.0) then
- call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
+ call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint,codec)
if(lft8s) then
if(index(msg37,'<').gt.0) then
lhashmsg=.true.
@@ -2195,7 +2184,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
endif
if(lsd .and. isubp2.eq.3 .and. nbadcrc.eq.1 .and. srr.lt.7.0) then ! low DR setups shall not try FT8SDvar for strong signals
- call ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
+ call ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq,codec)
if(lft8sd) then
if(levenint) then
evencopy(isd)%lstate=.false.
@@ -2275,7 +2264,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
! and n3.eq.5 for USA calls with EU VHF
! added .or. n3.eq.2 .or. n3.eq.8 .or. n3.eq.9 as test for EU VHF
!print*,'did not cycle at line 2248'
- call unpack77_configured(c77,1,msg37,unpk77_successvar, &
+ call unpack77_configured_for_state(codec,c77,1,msg37,unpk77_successvar, &
unpack77_options(thread_index=nthr))
if(.not.unpk77_successvar) then
if(lqsothread .and. (.not.lhound .and. iaptype.ge.3 .or. lhound .and. &
@@ -2283,7 +2272,7 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
if(.not.lqsomsgdcd .and. .not.(.not.lmycallstd .and. &
.not.lhiscallstd)) then
if(.not.lft8sdec .and. .not.stophint .and. dfqso.lt.2.0) then
- call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
+ call ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint,codec)
if(lft8s) then
if(index(msg37,'<').gt.0) then
lhashmsg=.true.
@@ -2310,7 +2299,10 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
lcall1hash=.false.
if(msg37(1:1).eq.'<') lcall1hash=.true.
nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message.
- call get_tones_from_77bits(message77,itone)
+ call ft8var_tones_from_77bits(message77,itone)
+ has_decoded_payload=.true.
+ decoded_payload_message=msg37
+ if(present(evidence)) evidence%payload77=message77
! 0.1 K1ABC RR73; W9XYZ <KH1/KH7Z> -11 28 28 10 5 71 DXpedition Mode
i3bit=0
if(i3.eq.0 .and. n3.eq.1) i3bit=1
@@ -2956,6 +2948,17 @@ subroutine ft8bvar(residual,spectrum,newdat1,nQSOProgress,nfqso,nftx,napwid, &
endif
endif
+ if(present(evidence) .and. nbadcrc.eq.0) then
+ if(all(itone(1:7).eq.icos7)) then
+ evidence%tones=int(itone,kind=1)
+ evidence%has_tones=1
+ endif
+ evidence%has_waveform_start=1
+ evidence%waveform_start_seconds=xdt
+ evidence%method=iaptype2
+ if(has_decoded_payload .and. msg37.eq.decoded_payload_message) &
+ evidence%payload_origin=engine_payload_decoded
+ endif
return
end subroutine ft8bvar
diff --git a/lib/ft8var/ft8mfcqvar.f90 b/lib/ft8var/ft8mfcqvar.f90
index bd58058e..52662227 100644
--- a/lib/ft8var/ft8mfcqvar.f90
+++ b/lib/ft8var/ft8mfcqvar.f90
@@ -1,5 +1,9 @@
-subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd)
+subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd,knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8sdvar_for_state
use ft8_mod1, only : idtone25,idtone25_valid
real, intent(in) :: s8(0:7,79)
@@ -8,12 +12,17 @@ subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd)
integer itone(79),mrs(58),mrs2(58)
integer*1 msgbits(77)
logical(1) lft8sd
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
+
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
if(len_trim(msgd).lt.6) return
idtone25(1,1:58)=0
idtone25_valid(1)=.false.
i3=-1; n3=-1
- call genft8sdvar(msgd,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msgd,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) return
idtone25(1,1:29)=itone(8:36)
idtone25(1,30:58)=itone(44:72)
diff --git a/lib/ft8var/ft8sd1var.f90 b/lib/ft8var/ft8sd1var.f90
index 3c6fd2c5..b5260fbd 100644
--- a/lib/ft8var/ft8sd1var.f90
+++ b/lib/ft8var/ft8sd1var.f90
@@ -1,4 +1,8 @@
-subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
+subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq,knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8sdvar_for_state
use ft8_mod1, only : mycall
real, intent(in) :: s8(0:7,79)
@@ -10,6 +14,11 @@ subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
integer*1 msgbits(77)
logical(1), intent(in) :: lcq
logical(1) lft8sd,lr73,lgrid,lmatched(58),valid4(4)
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
+
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
lmatched=.false.; lr73=.false.; lgrid=.false.
itonedem=11
@@ -40,7 +49,7 @@ subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
if(lcq .or. lgrid .or. lr73) then
i3=-1; n3=-1
msg372=msgd
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg372,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) return
idtone(1:29)=itone(8:36)
idtone(30:58)=itone(44:72)
@@ -49,7 +58,7 @@ subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq)
do i=1,4
msg372=msg4(i)
i3=-1; n3=-1
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg372,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) cycle
valid4(i)=.true.
idtone4(i,1:29)=itone(8:36)
diff --git a/lib/ft8var/ft8sdvar.f90 b/lib/ft8var/ft8sdvar.f90
index f6332e64..8eaf7e9a 100644
--- a/lib/ft8var/ft8sdvar.f90
+++ b/lib/ft8var/ft8sdvar.f90
@@ -1,4 +1,8 @@
-subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
+subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq,knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8sdvar_for_state
use ft8_mod1, only : mycall
real, intent(in) :: s8(0:7,79)
@@ -10,6 +14,11 @@ subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
integer*1 msgbits(77)
logical(1), intent(in) :: lcq
logical(1) lft8sd,lmatched(58),valid4(4)
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
+
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
if(index(msgd,' RR73').gt.0 .or. index(msgd,' 73').gt.0) return ! do not process 73 messages
! do not process messages with grid
@@ -38,7 +47,7 @@ subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
if(lcq) then
i3=-1; n3=-1
msg372=msgd
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg372,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) return
idtone(1:29)=itone(8:36)
idtone(30:58)=itone(44:72)
@@ -47,7 +56,7 @@ subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq)
do i=1,4
msg372=msg4(i)
i3=-1; n3=-1
- call genft8sdvar(msg372,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg372,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) cycle
valid4(i)=.true.
idtone4(i,1:29)=itone(8:36)
diff --git a/lib/ft8var/ft8svar.f90 b/lib/ft8var/ft8svar.f90
index 1d0cc4fc..b8eb3aab 100644
--- a/lib/ft8var/ft8svar.f90
+++ b/lib/ft8var/ft8svar.f90
@@ -1,5 +1,9 @@
-subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
+subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint,knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8sdvar_for_state
use ft8_mod1, only : itone56,idtone56,msg,nlasttx,lastrxmsg,mycall,hiscall, &
idtone56_valid
@@ -14,6 +18,11 @@ subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
logical(1), intent(in) :: stophint
logical(1), intent(out) :: lft8s
logical(1) lmatched(58),lmycall,lhiscall,lrrr,lr73,lcallingrprt,lastrrprt,lastreport,lgrid
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
+
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
! taken from ft8_mod1
! integer itone56(56,79),idtone56(56,58)
@@ -59,7 +68,7 @@ subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint)
itone56(53,1:79)=0
idtone56_valid(53)=.false.
i3=-1; n3=-1
- call genft8sdvar(lastrxmsg(1)%lastmsg,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,lastrxmsg(1)%lastmsg,i3,n3,msgsent37,msgbits,itone)
if(i3.ge.0) then
msg(53)=lastrxmsg(1)%lastmsg
idtone56(53,1:29)=itone(8:36)
diff --git a/lib/ft8var/genft8sdvar.f90 b/lib/ft8var/genft8sdvar.f90
index ae2ca408..36eefda6 100644
--- a/lib/ft8var/genft8sdvar.f90
+++ b/lib/ft8var/genft8sdvar.f90
@@ -1,46 +1,14 @@
subroutine genft8sdvar(msg,i3,n3,msgsent,msgbits,itone)
-
-! Encode an FT8 message, producing array itone().
-
- use packjt77
- use ft8_mod1, only : icos7,graymap
- character msg*37,msgsent*37,c77*77
- integer*1 msgbits(77),codeword(174)
- integer itone(79)
- logical unpk77_successvar
-
- i3=-1
- n3=-1
- call pack77(msg,i3,n3,c77,pack77_options(record_tx_hashes=.false.))
- ! SD thresholds are calibrated for classic Type 1/2 templates only.
- if(.not.(i3.ge.0 .and. (i3.eq.1 .or. i3.eq.2) .and. &
- index(msg,'<').eq.0)) then
- i3=-1
- n3=-1
- endif
- if(i3.lt.0) go to 1
- call unpack77_configured(c77,0,msgsent,unpk77_successvar, &
- unpack77_options(record_hashes=.false.,record_recent_calls=.false.))
- read(c77,'(77i1)',err=1) msgbits
- if(unpk77_successvar) go to 2
-1 msgbits=0
- itone=0
- msgsent='*** bad message *** '
- go to 900
-
-2 call encode174_91var(msgbits,codeword) !Encode the test message
-
-! Message structure: S7 D29 S7 D29 S7
- itone(1:7)=icos7; itone(37:43)=icos7; itone(73:79)=icos7
- k=7
- do j=1,58
- i=3*j -2
- k=k+1
- if(j.eq.30) k=k+7
- indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
- itone(k)=graymap(indx)
- enddo
-
-900 return
+ use ft8var_codec_context, only: genft8sdvar_for_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use packjt77, only: pack77_state
+ implicit none
+ character(len=37), intent(in) :: msg
+ integer, intent(out) :: i3,n3,itone(79)
+ character(len=37), intent(out) :: msgsent
+ integer(kind=1), intent(out) :: msgbits(77)
+ type(pack77_state), pointer :: state
+ state => get_ft8_codec_state()
+ call genft8sdvar_for_state(state,msg,i3,n3,msgsent,msgbits,itone)
end subroutine genft8sdvar
diff --git a/lib/ft8var/genft8var.f90 b/lib/ft8var/genft8var.f90
index 86defc7e..3d901bce 100644
--- a/lib/ft8var/genft8var.f90
+++ b/lib/ft8var/genft8var.f90
@@ -1,39 +1,174 @@
-subroutine genft8var(msg,i3,n3,ntxhash,msgsent,msgbits,itone)
+module ft8var_work_types
+ implicit none
+ type :: tmpcqdec_struct
+ real :: freq,xdt
+ end type
+ type :: tmpcqsig_struct
+ real :: freq,xdt
+ complex :: cs(0:7,79)
+ end type
+ type :: tmpmyc_struct
+ real :: freq,xdt
+ end type
+ type :: tmpmycsig_struct
+ real :: freq,xdt
+ complex :: cs(0:7,79)
+ end type
+ type :: tmpqsosig_struct
+ real :: freq,xdt
+ complex :: cs(0:7,79)
+ end type
+end module ft8var_work_types
+
+module ft8var_codec_context
+ use packjt77, only: pack77_state,pack77_for_state,unpack77_configured_for_state, &
+ pack77_options,unpack77_options
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8_mod1, only: icos7,graymap
+ implicit none
+ private
+ public :: genft8var_for_state,genft8sdvar_for_state,ft8var_tones_from_77bits
+ public :: tonesdvar,ft8sd1var,ft8sdvar,ft8svar,ft8mfcqvar
+
+ interface
+ subroutine tonesdvar(msgd,lcq,knowledge)
+ import pack77_state
+ character(len=37) :: msgd
+ logical(kind=1) :: lcq
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ end subroutine
+ subroutine ft8sd1var(s8,itone,msgd,msg37,lft8sd,lcq,knowledge)
+ import pack77_state
+ real :: s8(0:7,79)
+ integer :: itone(79)
+ character(len=37) :: msgd,msg37
+ logical(kind=1) :: lft8sd,lcq
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ end subroutine
+ subroutine ft8sdvar(s8,srr,itone,msgd,msg37,lft8sd,lcq,knowledge)
+ import pack77_state
+ real :: s8(0:7,79),srr
+ integer :: itone(79)
+ character(len=37) :: msgd,msg37
+ logical(kind=1) :: lft8sd,lcq
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ end subroutine
+ subroutine ft8svar(s8,srr,itone,msg37,lft8s,nft8rxfsens,stophint,knowledge)
+ import pack77_state
+ real :: s8(0:7,79),srr
+ integer :: itone(79),nft8rxfsens
+ character(len=37) :: msg37
+ logical(kind=1) :: lft8s,stophint
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ end subroutine
+ subroutine ft8mfcqvar(s8,itone,msgd,msg37,lft8sd,knowledge)
+ import pack77_state
+ real :: s8(0:7,79)
+ integer :: itone(79)
+ character(len=37) :: msgd,msg37
+ logical(kind=1) :: lft8sd
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ end subroutine
+ end interface
+
+contains
+
+ subroutine genft8var_for_state(state,msg,i3,n3,ntxhash,msgsent,msgbits,itone)
+ type(pack77_state), target, intent(inout) :: state
+ character(len=37), intent(in) :: msg
+ integer, intent(inout) :: i3,n3
+ integer, intent(in) :: ntxhash
+ character(len=37), intent(out) :: msgsent
+ integer(kind=1), intent(out) :: msgbits(77)
+ integer, intent(out) :: itone(79)
+ character(len=77) :: c77
+ logical :: unpacked
+
+ call pack77_for_state(state,msg,i3,n3,c77,pack77_options(record_tx_hashes=ntxhash.eq.1))
+ call unpack77_configured_for_state(state,c77,0,msgsent,unpacked, &
+ unpack77_options(record_hashes=.false.,record_recent_calls=.false.))
+ read(c77,'(77i1)',err=10) msgbits
+ if(unpacked) then
+ call ft8var_tones_from_77bits(msgbits,itone)
+ return
+ endif
+10 msgbits=0
+ itone=0
+ msgsent='*** bad message ***'
+ end subroutine genft8var_for_state
-! Encode an FT8 message, producing array itone().
-
- use packjt77
- use ft8_mod1, only : icos7,graymap
- character msg*37,msgsent*37,c77*77
- integer*1 msgbits(77),codeword(174)
- integer itone(79)
- logical unpk77_successvar
-
- call pack77(msg,i3,n3,c77, &
- pack77_options(record_tx_hashes=ntxhash.eq.1))
- call unpack77_configured(c77,0,msgsent,unpk77_successvar, &
- unpack77_options(record_hashes=.false.,record_recent_calls=.false.))
- read(c77,'(77i1)',err=1) msgbits
- if(unpk77_successvar) go to 2
-1 msgbits=0
- itone=0
- msgsent='*** bad message *** '
- go to 900
-
-entry get_tones_from_77bits(msgbits,itone)
-
-2 call encode174_91var(msgbits,codeword) !Encode the test message
-
-! Message structure: S7 D29 S7 D29 S7
- itone(1:7)=icos7; itone(37:43)=icos7; itone(73:79)=icos7
- k=7
- do j=1,58
- i=3*j -2
- k=k+1
- if(j.eq.30) k=k+7
- indx=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
- itone(k)=graymap(indx)
- enddo
-
-900 return
+ subroutine genft8sdvar_for_state(state,msg,i3,n3,msgsent,msgbits,itone)
+ type(pack77_state), target, intent(inout) :: state
+ character(len=37), intent(in) :: msg
+ integer, intent(out) :: i3,n3
+ character(len=37), intent(out) :: msgsent
+ integer(kind=1), intent(out) :: msgbits(77)
+ integer, intent(out) :: itone(79)
+ character(len=77) :: c77
+ logical :: unpacked
+
+ i3=-1
+ n3=-1
+ call pack77_for_state(state,msg,i3,n3,c77,pack77_options(record_tx_hashes=.false.))
+ if(.not.(i3.ge.0 .and. (i3.eq.1 .or. i3.eq.2) .and. index(msg,'<').eq.0)) then
+ i3=-1
+ n3=-1
+ endif
+ if(i3.ge.0) then
+ call unpack77_configured_for_state(state,c77,0,msgsent,unpacked, &
+ unpack77_options(record_hashes=.false.,record_recent_calls=.false.))
+ read(c77,'(77i1)',err=20) msgbits
+ if(unpacked) then
+ call ft8var_tones_from_77bits(msgbits,itone)
+ return
+ endif
+ endif
+20 msgbits=0
+ itone=0
+ msgsent='*** bad message ***'
+ end subroutine genft8sdvar_for_state
+
+ subroutine ft8var_tones_from_77bits(msgbits,itone)
+ integer(kind=1), intent(in) :: msgbits(77)
+ integer, intent(out) :: itone(79)
+ integer(kind=1) :: codeword(174)
+ integer :: i,j,k,indx
+
+ call encode174_91var(msgbits,codeword)
+ itone(1:7)=icos7
+ itone(37:43)=icos7
+ itone(73:79)=icos7
+ k=7
+ do j=1,58
+ i=3*j-2
+ k=k+1
+ if(j.eq.30) k=k+7
+ indx=codeword(i)*4+codeword(i+1)*2+codeword(i+2)
+ itone(k)=graymap(indx)
+ enddo
+ end subroutine ft8var_tones_from_77bits
+end module ft8var_codec_context
+
+subroutine genft8var(msg,i3,n3,ntxhash,msgsent,msgbits,itone)
+ use ft8var_codec_context, only: genft8var_for_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use packjt77, only: pack77_state
+ implicit none
+ character(len=37), intent(in) :: msg
+ integer, intent(inout) :: i3,n3
+ integer, intent(in) :: ntxhash
+ character(len=37), intent(out) :: msgsent
+ integer(kind=1), intent(out) :: msgbits(77)
+ integer, intent(out) :: itone(79)
+ type(pack77_state), pointer :: state
+ state => get_ft8_codec_state()
+ call genft8var_for_state(state,msg,i3,n3,ntxhash,msgsent,msgbits,itone)
end subroutine genft8var
+
+subroutine get_tones_from_77bits(msgbits,itone)
+ use ft8var_codec_context, only: ft8var_tones_from_77bits
+ implicit none
+ integer(kind=1), intent(in) :: msgbits(77)
+ integer, intent(out) :: itone(79)
+ call ft8var_tones_from_77bits(msgbits,itone)
+end subroutine get_tones_from_77bits
diff --git a/lib/ft8var/partintft8.f90 b/lib/ft8var/partintft8.f90
index 6b696bad..7ef8ab8c 100644
--- a/lib/ft8var/partintft8.f90
+++ b/lib/ft8var/partintft8.f90
@@ -1,7 +1,12 @@
-subroutine partintft8(ndelay,nutc)
+subroutine partintft8(ndelay,nutc,render_legacy)
use ft8_mod1, only : dd8
real rnd
+ logical, optional, intent(in) :: render_legacy
+ logical :: emit_line
+
+ emit_line=.true.
+ if(present(render_legacy)) emit_line=render_legacy
if(ndelay.gt.120) ndelay=120
numsamp=nint(float(ndelay)*1200)
@@ -10,9 +15,9 @@ subroutine partintft8(ndelay,nutc)
call random_number(rnd)
dd8(i)=10.0*rnd-5.
enddo
- write(*,2) nutc,'partial loss of data','d'
+ if(emit_line) write(*,2) nutc,'partial loss of data','d'
2 format(i6.6,2x,a20,21x,a1)
- call flush(6)
+ if(emit_line) call flush(6)
return
-end subroutine partintft8 \ No newline at end of file
+end subroutine partintft8
diff --git a/lib/ft8var/tone8.f90 b/lib/ft8var/tone8.f90
index 63e21e94..b2b61de8 100644
--- a/lib/ft8var/tone8.f90
+++ b/lib/ft8var/tone8.f90
@@ -1,4 +1,8 @@
-subroutine tone8(lmycallstd,lhiscallstd)
+subroutine tone8(lmycallstd,lhiscallstd,knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8var_for_state
use ft8_mod1, only : itone56,idtone56,msg,csynce,mycall,hiscall,idtonecqdxcns,idtonedxcns73,mybcall,hisbcall,lhound, &
idtone56_valid, &
@@ -9,6 +13,8 @@ subroutine tone8(lmycallstd,lhiscallstd)
integer itone(79),itone1(79)
integer*1 msgbits(77)
logical(1), intent(in) :: lmycallstd,lhiscallstd
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
logical(1) valid_first
data rpt/'-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', &
@@ -22,6 +28,8 @@ subroutine tone8(lmycallstd,lhiscallstd)
! integer itone56(56,79),idtone56(56,58)
! character*37 msg(56)
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
idtone56(1:56,1:58)=0
itone56(1:56,1:79)=0
idtone56_valid(1:56)=.false.
@@ -30,12 +38,12 @@ subroutine tone8(lmycallstd,lhiscallstd)
if(lhound .and. len_trim(mybcall).gt.2 .and. len_trim(hisbcall).gt.2) then
msg37=''; msg37=trim(mybcall)//' '//trim(hisbcall)//' RR73'
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
idtonefox73(1:29)=itone(8:36)
idtonefox73(30:58)=itone(44:72)
msg37=''; msg37=trim(mybcall)//' RR73; '//trim(mybcall)//' <'//trim(hiscall)//'> -12'
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
idtonespec(1:29)=itone(8:36)
idtonespec(30:58)=itone(44:72)
endif
@@ -43,12 +51,12 @@ subroutine tone8(lmycallstd,lhiscallstd)
if(.not.lhiscallstd .and. len(trim(hiscall)).gt.2) then
msg37=''; msg37='CQ '//trim(hiscall)
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
idtonecqdxcns(1:29)=itone(8:36)
idtonecqdxcns(30:58)=itone(44:72)
msg37=''; msg37='<AA1AAA> '//trim(hiscall)//' 73'
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
idtonedxcns73(1:29)=itone(8:36)
idtonedxcns73(30:58)=itone(44:72)
endif
@@ -64,7 +72,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
msg(i)=msg37
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(i,itone,i3.ge.0,i.eq.1)
enddo
go to 2
@@ -74,7 +82,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
do i=1,52
msg37=''; msg37=trim(mycall)//' '//trim(hiscall14)//' '//trim(rpt(i))
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(i,itone,i3.ge.0,i.eq.1)
msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
msg(i)=msg37
@@ -82,7 +90,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
do i=54,56
msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)//' '//trim(rpt(i))
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(i,itone,i3.ge.0,.false.)
msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
msg(i)=msg37
@@ -90,7 +98,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)
msg(53)=msg37
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(53,itone,i3.ge.0,.false.)
go to 2
endif
@@ -99,7 +107,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
do i=1,52
msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)//' '//trim(rpt(i))
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(i,itone,i3.ge.0,i.eq.1)
msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
msg(i)=msg37
@@ -107,7 +115,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
do i=54,56
msg37=''; msg37=trim(mycall)//' '//trim(hiscall14)//' '//trim(rpt(i))
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(i,itone,i3.ge.0,.false.)
msg37=''; msg37=trim(mycall)//' '//trim(hiscall)//' '//trim(rpt(i))
msg(i)=msg37
@@ -115,7 +123,7 @@ subroutine tone8(lmycallstd,lhiscallstd)
msg37=''; msg37=trim(mycall14)//' '//trim(hiscall)
msg(53)=msg37
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
call store_tone_slot(53,itone,i3.ge.0,.false.)
go to 2
endif
diff --git a/lib/ft8var/tone8myc.f90 b/lib/ft8var/tone8myc.f90
index 83f05568..f478a52b 100644
--- a/lib/ft8var/tone8myc.f90
+++ b/lib/ft8var/tone8myc.f90
@@ -1,13 +1,21 @@
-subroutine tone8myc()
+subroutine tone8myc(knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8var_for_state
use ft8_mod1, only : idtonemyc,mycall
character msg37*37,msgsent37*37
integer itone(79)
integer*1 msgbits(77)
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
msg37=''; msg37=trim(mycall)//' AA1AAA FN25'
i3=-1; n3=-1
- call genft8var(msg37,i3,n3,0,msgsent37,msgbits,itone)
+ call genft8var_for_state(codec,msg37,i3,n3,0,msgsent37,msgbits,itone)
idtonemyc(1:29)=itone(8:36); idtonemyc(30:58)=itone(44:72)
return
diff --git a/lib/ft8var/tonesdvar.f90 b/lib/ft8var/tonesdvar.f90
index 50d3cb00..462ce2b6 100644
--- a/lib/ft8var/tonesdvar.f90
+++ b/lib/ft8var/tonesdvar.f90
@@ -1,4 +1,8 @@
-subroutine tonesdvar(msgd,lcq)
+subroutine tonesdvar(msgd,lcq,knowledge)
+
+ use packjt77, only: pack77_state
+ use ft8_codec_context, only: get_ft8_codec_state
+ use ft8var_codec_context, only: genft8sdvar_for_state
use ft8_mod1, only : csyncsd,csyncsdcq,itone76,idtone76,msgsd76, &
idtone76_valid,csyncsd_valid,csyncsdcq_valid
@@ -10,6 +14,8 @@ subroutine tonesdvar(msgd,lcq)
integer*1 msgbits(77)
logical(1), intent(in) :: lcq
logical(1) lgrid,lr73,valid_first
+ type(pack77_state), target, optional, intent(inout) :: knowledge
+ type(pack77_state), pointer :: codec
data rpt/'+09 ','+08 ','+07 ','+06 ','+05 ','+04 ','+03 ','+02 ','+01 ','+00 ', &
'-01 ','-02 ','-03 ','-04 ','-05 ','-06 ','-07 ','-08 ','-09 ','-10 ', &
@@ -25,6 +31,8 @@ subroutine tonesdvar(msgd,lcq)
! character*37 msgsd76(76)
! complex csyncsd(0:18,32),csyncsdcq(0:71,32)
+ codec => get_ft8_codec_state()
+ if(present(knowledge)) codec => knowledge
lgrid=.false.; lr73=.false.
valid_first=.false.
idtone76(1:76,1:58)=0
@@ -39,7 +47,7 @@ subroutine tonesdvar(msgd,lcq)
if(lcq) then
msg37=msgd
i3=-1; n3=-1
- call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg37,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) return
else
c1=' '; c2=' '
@@ -58,7 +66,7 @@ subroutine tonesdvar(msgd,lcq)
msg37=trim(c1)//' '//trim(c2)//' '//trim(rpt(i))
msgsd76(i)=msg37
i3=-1; n3=-1
- call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg37,i3,n3,msgsent37,msgbits,itone)
if(i3.lt.0) cycle
if(i.eq.1) then
itone1=itone
@@ -73,7 +81,7 @@ subroutine tonesdvar(msgd,lcq)
msg37=trim(c1)//' '//trim(c2)//' '//trim(grid)
msgsd76(76)=msg37
i3=-1; n3=-1
- call genft8sdvar(msg37,i3,n3,msgsent37,msgbits,itone)
+ call genft8sdvar_for_state(codec,msg37,i3,n3,msgsent37,msgbits,itone)
if(i3.ge.0) then
idtone76(76,1:29)=itone(8:36)
idtone76(76,30:58)=itone(44:72)