diff options
| author | Christoph Berg <christoph.berg@credativ.de> | 2019-03-11 14:19:23 +0100 |
|---|---|---|
| committer | Christoph Berg <christoph.berg@credativ.de> | 2019-03-11 14:19:23 +0100 |
| commit | 200de07a95209a55d6019ba87f0abc78d302bf4c (patch) | |
| tree | 3b2922eb5d89b01ad214cae492e871c3bfb5df18 /lib | |
| parent | e0737c56c1e384e05064a0c6e1ac46979371041b (diff) | |
New upstream version 2.0.1+repackupstream/2.0.1+repack
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/77bit/encode77.f90 | 2 | ||||
| -rw-r--r-- | lib/77bit/packjt77.f90 | 203 | ||||
| -rw-r--r-- | lib/decoder.f90 | 60 | ||||
| -rw-r--r-- | lib/ft8.f90 | 49 | ||||
| -rw-r--r-- | lib/ft8/chkcrc13a.f90 | 48 | ||||
| -rw-r--r-- | lib/ft8/chkcrc14a.f90 | 48 | ||||
| -rw-r--r-- | lib/ft8/extractmessage174.f90 | 4 | ||||
| -rw-r--r-- | lib/ft8/extractmessage174_91.f90 | 4 | ||||
| -rw-r--r-- | lib/ft8/ft8apset.f90 | 28 | ||||
| -rw-r--r-- | lib/ft8/ft8b.f90 | 17 | ||||
| -rw-r--r-- | lib/ft8/genft8.f90 | 2 | ||||
| -rw-r--r-- | lib/ft8_decode.f90 | 1 | ||||
| -rw-r--r-- | lib/ft8dec.f90 | 111 | ||||
| -rw-r--r-- | lib/genmsk_128_90.f90 | 2 | ||||
| -rw-r--r-- | lib/ldpcsim128_90.f90 | 4 | ||||
| -rw-r--r-- | lib/msk144decodeframe.f90 | 2 | ||||
| -rw-r--r-- | lib/msk40decodeframe.f90 | 2 | ||||
| -rw-r--r-- | lib/mskrtd.f90 | 14 | ||||
| -rw-r--r-- | lib/qra/qra64/qra64.c | 2 | ||||
| -rw-r--r-- | lib/update_msk40_hasharray.f90 (renamed from lib/update_hasharray.f90) | 4 | ||||
| -rw-r--r-- | lib/wsprd/wsprd.c | 25 |
21 files changed, 421 insertions, 211 deletions
diff --git a/lib/77bit/encode77.f90 b/lib/77bit/encode77.f90 index 987efc4f..4b2a1355 100644 --- a/lib/77bit/encode77.f90 +++ b/lib/77bit/encode77.f90 @@ -34,7 +34,7 @@ program encode77 i3=-1 n3=-1 call pack77(msg0(1:37),i3,n3,c77) - call unpack77(c77,msg,unpk77_success) + call unpack77(c77,1,msg,unpk77_success) cerr=' ' if(msg.ne.msg0(1:37)) cerr='*' if(i3.eq.0) write(*,1004) i3,n3,cerr,msg0(1:37),msg diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index 645da5bf..1ee37f5c 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -2,10 +2,15 @@ module packjt77 ! These variables are accessible from outside via "use packjt77": parameter (MAXHASH=1000,MAXRECENT=10) - character*13 callsign(MAXHASH) - integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH) - integer n28a,n28b,nzhash - character*13 recent_calls(MAXRECENT) + character (len=13), dimension(1:1024) :: calls10='' + character (len=13), dimension(1:4096) :: calls12='' + character (len=13), dimension(1:MAXHASH) :: calls22='' + character (len=13), dimension(1:MAXRECENT) :: recent_calls='' + character (len=13) :: mycall13='' + character (len=13) :: dxcall13='' + integer, dimension(1:MAXHASH) :: ihash22=-1 + integer :: nzhash=0 + integer n28a,n28b contains @@ -14,15 +19,13 @@ subroutine hash10(n10,c13) character*13 c13 c13='<...>' - do i=1,nzhash - if(ihash10(i).eq.n10) then - c13=callsign(i) - c13='<'//trim(c13)//'>'//' ' - go to 900 - endif - enddo + if(n10.lt.1 .or. n10.gt.1024) return + if(len(trim(calls10(n10))).gt.0) then + c13=calls10(n10) + c13='<'//trim(c13)//'>' + endif + return -900 return end subroutine hash10 subroutine hash12(n12,c13) @@ -30,15 +33,13 @@ subroutine hash12(n12,c13) character*13 c13 c13='<...>' - do i=1,nzhash - if(ihash12(i).eq.n12) then - c13=callsign(i) - c13='<'//trim(c13)//'>'//' ' - go to 900 - endif - enddo + if(n12.lt.1 .or. n12.gt.4096) return + if(len(trim(calls12(n12))).gt.0) then + c13=calls12(n12) + c13='<'//trim(c13)//'>' + endif + return -900 return end subroutine hash12 @@ -49,8 +50,8 @@ subroutine hash22(n22,c13) c13='<...>' do i=1,nzhash if(ihash22(i).eq.n22) then - c13=callsign(i) - c13='<'//trim(c13)//'>'//' ' + c13=calls22(i) + c13='<'//trim(c13)//'>' go to 900 endif enddo @@ -79,46 +80,37 @@ end function ihashcall subroutine save_hash_call(c13,n10,n12,n22) character*13 c13,cw - logical first - data first/.true./ - save first - - if(first) then - ihash10=-1 - ihash12=-1 - ihash22=-1 - callsign=' ' - nzhash=0 - first=.false. - endif - + cw=c13 if(cw(1:1).eq.' ' .or. cw(1:5).eq.'<...>') return if(cw(1:1).eq.'<') cw=cw(2:) i=index(cw,'>') if(i.gt.0) cw(i:)=' ' + if(len(trim(cw)) .lt. 3) return + n10=ihashcall(cw,10) + if(n10.ge.1 .and. n10 .le. 1024 .and. cw.ne.mycall13) calls10(n10)=cw + n12=ihashcall(cw,12) + if(n12.ge.1 .and. n12 .le. 4096 .and. cw.ne.mycall13) calls12(n12)=cw + n22=ihashcall(cw,22) - do i=1,nzhash - if(ihash22(i).eq.n22) go to 900 !This one is already in the table - enddo + if(any(ihash22.eq.n22)) then ! If entry exists, make sure callsign is the most recently received one + where(ihash22.eq.n22) calls22=cw + go to 900 + endif ! New entry: move table down, making room for new one at the top - ihash10(MAXHASH:2:-1)=ihash10(MAXHASH-1:1:-1) - ihash12(MAXHASH:2:-1)=ihash12(MAXHASH-1:1:-1) ihash22(MAXHASH:2:-1)=ihash22(MAXHASH-1:1:-1) ! Add the new entry - callsign(MAXHASH:2:-1)=callsign(MAXHASH-1:1:-1) - ihash10(1)=n10 - ihash12(1)=n12 + calls22(MAXHASH:2:-1)=calls22(MAXHASH-1:1:-1) ihash22(1)=n22 - callsign(1)=cw + calls22(1)=cw if(nzhash.lt.MAXHASH) nzhash=nzhash+1 - -900 return +900 continue + return end subroutine save_hash_call subroutine pack77(msg0,i3,n3,c77) @@ -154,7 +146,7 @@ subroutine pack77(msg0,i3,n3,c77) ! Check 0.5 (telemetry) 5 i0=index(msg,' ') - c18=msg(1:i0-1)//' ' + c18=msg(1:i0-1) c18=adjustr(c18) ntel=-99 read(c18,1005,err=6) ntel @@ -190,8 +182,13 @@ subroutine pack77(msg0,i3,n3,c77) 900 return end subroutine pack77 -subroutine unpack77(c77,msg,unpk77_success) - +subroutine unpack77(c77,nrx,msg,unpk77_success) +! +! nrx=1 when unpacking a received message +! nrx=0 when unpacking a to-be-transmitted message +! the value of nrx is used to decide when mycall13 or dxcall13 should +! be used in place of a callsign from the hashtable +! parameter (NSEC=84) !Number of ARRL Sections parameter (NUSCAN=65) !Number of US states and Canadian provinces parameter (MAXGRID4=32400) @@ -200,6 +197,7 @@ subroutine unpack77(c77,msg,unpk77_success) character*77 c77 character*37 msg character*13 call_1,call_2,call_3 + character*13 mycall13_0,dxcall13_0 character*11 c11 character*3 crpt,cntx character*3 cmult(NUSCAN) @@ -207,7 +205,9 @@ subroutine unpack77(c77,msg,unpk77_success) character*4 grid4,cserial character*3 csec(NSEC) character*38 c + integer hashmy10,hashmy12,hashmy22,hashdx10,hashdx12,hashdx22 logical unpk28_success,unpk77_success + logical dxcall13_set,mycall13_set data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/ data csec/ & @@ -228,7 +228,32 @@ subroutine unpack77(c77,msg,unpk77_success) "SD ","TN ","TX ","UT ","VT ","VA ","WA ","WV ","WI ","WY ", & "NB ","NS ","QC ","ON ","MB ","SK ","AB ","BC ","NWT","NF ", & "LB ","NU ","YT ","PEI","DC "/ + data dxcall13_set/.false./ + data mycall13_set/.false./ + data mycall13_0/''/ + data dxcall13_0/''/ + + save hashmy10,hashmy12,hashmy22,hashdx10,hashdx12,hashdx22 + + if(mycall13.ne.mycall13_0) then + if(len(trim(mycall13)).gt.2) then + mycall13_set=.true. + mycall13_0=mycall13 + call save_hash_call(mycall13,hashmy10,hashmy12,hashmy22) + else + mycall13_set=.false. + endif + endif + if(dxcall13.ne.dxcall13_0) then + if(len(trim(dxcall13)).gt.2) then + dxcall13_set=.true. + dxcall13_0=dxcall13 + hashdx10=ihashcall(dxcall13,10) + hashdx12=ihashcall(dxcall13,12) + hashdx22=ihashcall(dxcall13,22) + endif + endif unpk77_success=.true. ! Check for bad data @@ -261,13 +286,13 @@ subroutine unpack77(c77,msg,unpk77_success) call unpack28(n28b,call_2,unpk28_success) if(.not.unpk28_success .or. n28b.le.2) unpk77_success=.false. call hash10(n10,call_3) - if(call_3(1:1).eq.'<') then - msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)// & - ' '//crpt - else - msg=trim(call_1)//' RR73; '//trim(call_2)//' <'//trim(call_3)// & - '> '//crpt - endif + if(nrx.eq.1 .and. & + dxcall13_set .and. & + hashdx10.eq.n10) call_3='<'//trim(dxcall13)//'>' + if(nrx.eq.0 .and. & + mycall13_set .and. & + n10.eq.hashmy10) call_3='<'//trim(mycall13)//'>' + msg=trim(call_1)//' RR73; '//trim(call_2)//' '//trim(call_3)//' '//crpt else if(i3.eq.0 .and. n3.eq.2) then ! 0.2 PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 70 EU VHF contest read(c77,1020) n28a,ip,ir,irpt,iserial,igrid6 @@ -275,7 +300,7 @@ subroutine unpack77(c77,msg,unpk77_success) call unpack28(n28a,call_1,unpk28_success) if(.not.unpk28_success .or. n28a.le.2) unpk77_success=.false. nrs=52+irpt - if(ip.eq.1) call_1=trim(call_1)//'/P'//' ' + if(ip.eq.1) call_1=trim(call_1)//'/P' write(cexch,1022) nrs,iserial 1022 format(i2,i4.4) n=igrid6 @@ -438,14 +463,25 @@ subroutine unpack77(c77,msg,unpk77_success) n58=n58/38 enddo call hash12(n12,call_3) - if(iflip.eq.0) then - call_1=call_3 - call_2=adjustl(c11)//' ' + if(iflip.eq.0) then ! 12 bit hash for TO call + call_1=call_3 + call_2=adjustl(c11)//' ' call add_call_to_recent_calls(call_2) - else - call_1=adjustl(c11)//' ' - call_2=call_3 + if(nrx.eq.1 .and. & + dxcall13_set .and. mycall13_set .and. & + call_2.eq.dxcall13 .and. & + n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>' + if(nrx.eq.1 .and. & + mycall13_set .and. & + index(call_1,'<...>').gt.0 .and. & + n12.eq.hashmy12 ) call_1='<'//trim(mycall13)//'>' + else ! 12 bit hash for DE call + call_1=adjustl(c11) + call_2=call_3 call add_call_to_recent_calls(call_1) + if(nrx.eq.0 .and. & + mycall13_set .and. & + n12.eq.hashmy12) call_2='<'//trim(mycall13)//'>' endif if(icq.eq.0) then if(nrpt.eq.0) msg=trim(call_1)//' '//trim(call_2) @@ -523,7 +559,7 @@ subroutine pack28(c13,n28) go to 900 endif if(nlet.ge.1 .and. nlet.le.4 .and. nnum.eq.0) then - c4=c13(4:n)//' ' + c4=c13(4:n) c4=adjustr(c4) m=0 do i=1,4 @@ -541,6 +577,9 @@ subroutine pack28(c13,n28) ! Check for <...> callsign if(c13(1:1).eq.'<')then call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table + i2=index(c13,'>') + c13=c13(2:i2-1) + n22=ihashcall(c13,22) n28=NTOKENS + n22 go to 900 endif @@ -566,6 +605,7 @@ subroutine pack28(c13,n28) npdig.ge.iarea-1 .or. nslet.gt.3) then ! Treat this as a nonstandard callsign: compute its 22-bit hash call save_hash_call(c13,n10,n12,n22) !Save callsign in hash table + n22=ihashcall(c13,n22) n28=NTOKENS + n22 go to 900 endif @@ -653,7 +693,7 @@ subroutine unpack28(n28_0,c13,success) i5=n/27 i6=n-27*i5 c13=c1(i1+1:i1+1)//c2(i2+1:i2+1)//c3(i3+1:i3+1)//c4(i4+1:i4+1)// & - c4(i5+1:i5+1)//c4(i6+1:i6+1)//' ' + c4(i5+1:i5+1)//c4(i6+1:i6+1) c13=adjustl(c13) 900 i0=index(c13,' ') @@ -718,7 +758,7 @@ subroutine pack77_01(nwords,w,i3,n3,c77) ! Pack a Type 0.1 message: DXpedition mode ! Example message: "K1ABC RR73; W9XYZ <KH1/KH7Z> -11" 28 28 10 5 - character*13 w(19) + character*13 w(19),c13 character*77 c77 character*6 bcall_1,bcall_2 logical ok1,ok2 @@ -744,6 +784,9 @@ subroutine pack77_01(nwords,w,i3,n3,c77) call pack28(w(1),n28a) call pack28(w(3),n28b) call save_hash_call(w(4),n10,n12,n22) + i2=index(w(4),'>') + c13=w(4)(2:i2-1) + n10=ihashcall(c13,10) write(c77,1010) n28a,n28b,n10,n5,n3,i3 1010 format(2b28.28,b10.10,b5.5,2b3.3) @@ -777,13 +820,14 @@ subroutine pack77_02(nwords,w,i3,n3,c77) ! Type 0.2: PA3XYZ/P R 590003 IO91NP 28 1 1 3 12 25 70 EU VHF contest i3=0 n3=2 - ip=0 - c13=w(1) - i=index(w(1),'/P') + i=index(w(1)//' ','/P ') if(i.ge.4) then ip=1 - c13=w(1)(1:i-1)//' ' - endif + c13=w(1)(1:i-1) + else + ip=0 + c13=w(1) + end if call pack28(c13,n28a) ir=0 if(w(2)(1:2).eq.'R ') ir=1 @@ -924,22 +968,24 @@ subroutine pack77_1(nwords,w,i3,n3,c77) ! 1 WA9XYZ/R KA1ABC/R R FN42 28 1 28 1 1 15 74 Standard msg ! 2 PA3XYZ/P GM4ABC/P R JO22 28 1 28 1 1 15 74 EU VHF contest -10 if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. & - w(3)(1:2).eq.'R ')) then +10 i1psuffix=index(w(1)//' ' ,'/P ') + i2psuffix=index(w(2)//' ','/P ') + if(nwords.eq.2 .or. nwords.eq.3 .or. (nwords.eq.4 .and. & + w(3)(1:2).eq.'R ')) then n3=0 i3=1 !Type 1: Standard message, possibly with "/R" - if(index(w(1),'/P').ge.4 .or. index(w(2),'/P').ge.4) i3=2 !Type 2, with "/P" + if (i1psuffix.ge.4.or.i2psuffix.ge.4) i3=2 !Type 2, with "/P" endif - c13=bcall_1//' ' + c13=bcall_1 if(c13(1:3).eq.'CQ_' .or. w(1)(1:1).eq.'<') c13=w(1) call pack28(c13,n28a) - c13=bcall_2//' ' + c13=bcall_2 if(w(2)(1:1).eq.'<') c13=w(2) call pack28(c13,n28b) ipa=0 ipb=0 - if(index(w(1),'/P').ge.4 .or. index(w(1),'/R').ge.4) ipa=1 - if(index(w(2),'/P').ge.4 .or. index(w(2),'/R').ge.4) ipb=1 + if(i1psuffix.ge.4.or.index(w(1)//' ','/R ').ge.4) ipa=1 + if(i2psuffix.ge.4.or.index(w(2)//' ','/R ').ge.4) ipb=1 grid4=w(nwords)(1:4) if(is_grid4(grid4)) then @@ -1200,6 +1246,7 @@ subroutine add_call_to_recent_calls(callsign) character*13 callsign logical ladd + ! only add if the callsign is not already on the list ladd=.true. do i=1,MAXRECENT-1 ! if callsign is at the end of the list add it again diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 730c59d1..218a6cbf 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -263,7 +263,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) 1010 format('<DecodeFinished>',2i4) call flush(6) close(13) - close(19) + if(ncontest.eq.5) close(19) if(params%nmode.eq.4 .or. params%nmode.eq.65) close(14) return @@ -517,34 +517,36 @@ contains write(13,1002) params%nutc,nint(sync),snr,dt,freq,0,decoded0 1002 format(i6.6,i4,i5,f6.1,f8.0,i4,3x,a37,' FT8') - i1=index(decoded0,' ') - i2=i1 + index(decoded0(i1+1:),' ') - i3=i2 + index(decoded0(i2+1:),' ') - if(i1.ge.3 .and. i2.ge.7 .and. i3.ge.10) then - c1=decoded0(1:i1-1)//' ' - c2=decoded0(i1+1:i2-1) - g2=decoded0(i2+1:i3-1) - b0=c1.eq.mycall - if(c1(1:3).eq.'DE ' .and. index(c2,'/').ge.2) b0=.true. - if(len(trim(c1)).ne.len(trim(mycall))) then - i4=index(trim(c1),trim(mycall)) - i5=index(trim(mycall),trim(c1)) - if(i4.ge.1 .or. i5.ge.1) b0=.true. - endif - b1=i3-i2.eq.5 .and. isgrid4(g2) - b2=i3-i2.eq.1 - if(b0 .and. (b1.or.b2) .and. nint(freq).ge.1000) then - n=params%nutc - n30=(3600*(n/10000) + 60*mod((n/100),100) + mod(n,100))/30 - if(n30.lt.n30z) nwrap=nwrap+5760 !New UTC day, handle the wrap - n30z=n30 - n30=n30+nwrap - nfox=nfox+1 - c2fox(nfox)=c2 - g2fox(nfox)=g2 - nsnrfox(nfox)=snr - nfreqfox(nfox)=nint(freq) - n30fox(nfox)=n30 + if(ncontest.eq.5) then + i1=index(decoded0,' ') + i2=i1 + index(decoded0(i1+1:),' ') + i3=i2 + index(decoded0(i2+1:),' ') + if(i1.ge.3 .and. i2.ge.7 .and. i3.ge.10) then + c1=decoded0(1:i1-1)//' ' + c2=decoded0(i1+1:i2-1) + g2=decoded0(i2+1:i3-1) + b0=c1.eq.mycall + if(c1(1:3).eq.'DE ' .and. index(c2,'/').ge.2) b0=.true. + if(len(trim(c1)).ne.len(trim(mycall))) then + i4=index(trim(c1),trim(mycall)) + i5=index(trim(mycall),trim(c1)) + if(i4.ge.1 .or. i5.ge.1) b0=.true. + endif + b1=i3-i2.eq.5 .and. isgrid4(g2) + b2=i3-i2.eq.1 + if(b0 .and. (b1.or.b2) .and. nint(freq).ge.1000) then + n=params%nutc + n30=(3600*(n/10000) + 60*mod((n/100),100) + mod(n,100))/30 + if(n30.lt.n30z) nwrap=nwrap+5760 !New UTC day, handle the wrap + n30z=n30 + n30=n30+nwrap + if(nfox.lt.MAXFOX) nfox=nfox+1 + c2fox(nfox)=c2 + g2fox(nfox)=g2 + nsnrfox(nfox)=snr + nfreqfox(nfox)=nint(freq) + n30fox(nfox)=n30 + endif endif endif diff --git a/lib/ft8.f90 b/lib/ft8.f90 new file mode 100644 index 00000000..aacff17d --- /dev/null +++ b/lib/ft8.f90 @@ -0,0 +1,49 @@ +program ft8 + + integer*2 iwave(15*12000) + logical lft8apon,lapcqonly,nagain,newdat + character*12 mycall12,hiscall12 + character*6 hisgrid6 + character arg*8,infile*80 + integer ihdr(11) + + nargs=iargc() + if(nargs.lt.3) then + print*,'Usage: ft8 nfa nfb ndepth infile' + print*,'Example: ft8 200 4000 3 181201_180315.wav' + go to 999 + endif + call getarg(1,arg) + read(arg,*) nfa + call getarg(2,arg) + read(arg,*) nfb + call getarg(3,arg) + read(arg,*) ndepth + nfiles=nargs-3 + + nQSOProgress=0 + nfqso=1500 + nftx=0 + newdat=.true. + nutc=0 + ncontest=0 + nagain=.false. + lft8apon=.false. + lapcqonly=.false. + napwid=75 + mycall12='K1ABC' + hiscall12='W9XYZ' + hisgrid6='EN37wb' + + do ifile=1,nfiles + call getarg(3+ifile,infile) + open(10,file=infile,status='old',access='stream') + read(10) ihdr,iwave + close(10) + + call ft8dec(iwave,nQSOProgress,nfqso,nftx,newdat, & + nutc,nfa,nfb,ndepth,ncontest,nagain,lft8apon,lapcqonly, & + napwid,mycall12,hiscall12,hisgrid6) + enddo + +999 end program ft8 diff --git a/lib/ft8/chkcrc13a.f90 b/lib/ft8/chkcrc13a.f90 index 74259cfc..25e14584 100644 --- a/lib/ft8/chkcrc13a.f90 +++ b/lib/ft8/chkcrc13a.f90 @@ -1,24 +1,24 @@ -subroutine chkcrc13a(decoded,nbadcrc)
-
- use crc
- integer*1 decoded(90)
- integer*1, target:: i1Dec8BitBytes(12)
- character*90 cbits
-
-! Write decoded bits into cbits: 77-bit message plus 13-bit CRC
- write(cbits,1000) decoded
-1000 format(90i1)
- read(cbits,1001) i1Dec8BitBytes
-1001 format(12b8)
- read(cbits,1002) ncrc13 !Received CRC13
-1002 format(77x,b13)
-
- i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32+16+8)
- i1Dec8BitBytes(11:12)=0
- icrc13=crc13(c_loc(i1Dec8BitBytes),12) !CRC13 computed from 77 msg bits
-
- nbadcrc=1
- if(ncrc13.eq.icrc13) nbadcrc=0
-
- return
-end subroutine chkcrc13a
+subroutine chkcrc13a(decoded,nbadcrc) + + use crc + integer*1 decoded(90) + integer*1, target:: i1Dec8BitBytes(12) + character*90 cbits + +! Write decoded bits into cbits: 77-bit message plus 13-bit CRC + write(cbits,1000) decoded +1000 format(90i1) + read(cbits,1001) i1Dec8BitBytes +1001 format(12b8) + read(cbits,1002) ncrc13 !Received CRC13 +1002 format(77x,b13) + + i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),transfer(128+64+32+16+8,0_1)) + i1Dec8BitBytes(11:12)=0 + icrc13=crc13(c_loc(i1Dec8BitBytes),12) !CRC13 computed from 77 msg bits + + nbadcrc=1 + if(ncrc13.eq.icrc13) nbadcrc=0 + + return +end subroutine chkcrc13a diff --git a/lib/ft8/chkcrc14a.f90 b/lib/ft8/chkcrc14a.f90 index d9d3d7a4..9ecda9b2 100644 --- a/lib/ft8/chkcrc14a.f90 +++ b/lib/ft8/chkcrc14a.f90 @@ -1,24 +1,24 @@ -subroutine chkcrc14a(decoded,nbadcrc)
-
- use crc
- integer*1 decoded(91)
- integer*1, target:: i1Dec8BitBytes(12)
- character*91 cbits
-
-! Write decoded bits into cbits: 77-bit message plus 14-bit CRC
- write(cbits,1000) decoded
-1000 format(91i1)
- read(cbits,1001) i1Dec8BitBytes
-1001 format(12b8)
- read(cbits,1002) ncrc14 !Received CRC14
-1002 format(77x,b14)
-
- i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32+16+8)
- i1Dec8BitBytes(11:12)=0
- icrc14=crc14(c_loc(i1Dec8BitBytes),12) !CRC14 computed from 77 msg bits
-
- nbadcrc=1
- if(ncrc14.eq.icrc14) nbadcrc=0
-
- return
-end subroutine chkcrc14a
+subroutine chkcrc14a(decoded,nbadcrc) + + use crc + integer*1 decoded(91) + integer*1, target:: i1Dec8BitBytes(12) + character*91 cbits + +! Write decoded bits into cbits: 77-bit message plus 14-bit CRC + write(cbits,1000) decoded +1000 format(91i1) + read(cbits,1001) i1Dec8BitBytes +1001 format(12b8) + read(cbits,1002) ncrc14 !Received CRC14 +1002 format(77x,b14) + + i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),transfer(128+64+32+16+8,0_1)) + i1Dec8BitBytes(11:12)=0 + icrc14=crc14(c_loc(i1Dec8BitBytes),12) !CRC14 computed from 77 msg bits + + nbadcrc=1 + if(ncrc14.eq.icrc14) nbadcrc=0 + + return +end subroutine chkcrc14a diff --git a/lib/ft8/extractmessage174.f90 b/lib/ft8/extractmessage174.f90 index 4bac6694..252547c4 100644 --- a/lib/ft8/extractmessage174.f90 +++ b/lib/ft8/extractmessage174.f90 @@ -17,7 +17,7 @@ subroutine extractmessage174(decoded,msgreceived,ncrcflag) read(cbits,1002) ncrc12 !Received CRC12 1002 format(75x,b12) - i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32) + i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),transfer(128+64+32,0_1)) i1Dec8BitBytes(11)=0 icrc12=crc12(c_loc(i1Dec8BitBytes),11) !CRC12 computed from 75 msg bits @@ -26,7 +26,7 @@ subroutine extractmessage174(decoded,msgreceived,ncrcflag) do ibyte=1,12 itmp=0 do ibit=1,6 - itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*6+ibit)) + itmp=ishft(itmp,1)+iand(1_1,decoded((ibyte-1)*6+ibit)) enddo i4Dec6BitWords(ibyte)=itmp enddo diff --git a/lib/ft8/extractmessage174_91.f90 b/lib/ft8/extractmessage174_91.f90 index d2d3019e..ecc14246 100644 --- a/lib/ft8/extractmessage174_91.f90 +++ b/lib/ft8/extractmessage174_91.f90 @@ -17,7 +17,7 @@ subroutine extractmessage174_91(decoded,msgreceived,ncrcflag) read(cbits,1002) ncrc14 !Received CRC12 1002 format(77x,b14) - i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32+16+8) + i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),transfer(128+64+32+16+8,0_1)) i1Dec8BitBytes(11:12)=0 icrc14=crc14(c_loc(i1Dec8BitBytes),12) !CRC12 computed from 75 msg bits @@ -26,7 +26,7 @@ subroutine extractmessage174_91(decoded,msgreceived,ncrcflag) do ibyte=1,12 itmp=0 do ibit=1,6 - itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*6+ibit)) + itmp=ishft(itmp,1)+iand(1_1,decoded((ibyte-1)*6+ibit)) enddo i4Dec6BitWords(ibyte)=itmp enddo diff --git a/lib/ft8/ft8apset.f90 b/lib/ft8/ft8apset.f90 index 15eddd05..56a18c4f 100644 --- a/lib/ft8/ft8apset.f90 +++ b/lib/ft8/ft8apset.f90 @@ -1,22 +1,21 @@ subroutine ft8apset(mycall12,hiscall12,apsym) use packjt77 character*77 c77 - character*37 msg + character*37 msg,msgchk character*12 mycall12,hiscall12,hiscall integer apsym(58) - logical nohiscall + logical nohiscall,unpk77_success - if(len(trim(mycall12)).eq.0) then - apsym=0 - apsym(1)=99 - apsym(30)=99 - return - endif + apsym=0 + apsym(1)=99 + apsym(30)=99 + + if(len(trim(mycall12)).lt.3) return nohiscall=.false. hiscall=hiscall12 - if(len(trim(hiscall)).eq.0) then - hiscall="K9ABC" + if(len(trim(hiscall)).lt.3) then + hiscall=mycall12 ! use mycall for dummy hiscall - mycall won't be hashed. nohiscall=.true. endif @@ -24,12 +23,9 @@ subroutine ft8apset(mycall12,hiscall12,apsym) ! msg=trim(mycall12)//' '//trim(hiscall)//' RRR' call pack77(msg,i3,n3,c77) - if(i3.ne.1) then - apsym=0 - apsym(1)=99 - apsym(30)=99 - return - endif + call unpack77(c77,1,msgchk,unpk77_success) + + if(i3.ne.1 .or. (msg.ne.msgchk) .or. .not.unpk77_success) return read(c77,'(58i1)',err=1) apsym(1:58) apsym=2*apsym-1 diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index 5db48341..6fbb0368 100644 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -8,12 +8,11 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & include 'ft8_params.f90' parameter(NP2=2812) character*37 msg37 - character*12 mycall12,hiscall12,hiscall12_0 + character*12 mycall12,hiscall12 character*77 c77 - character*13 c13 real a(5) real s8(0:7,NN) - real s2(0:511),s2l(0:511) + real s2(0:511) real bmeta(174),bmetb(174),bmetc(174) real llra(174),llrb(174),llrc(174),llrd(174) !Soft symbols real dd0(15*12000) @@ -43,7 +42,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & data mrr73/0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1/ data first/.true./ data graymap/0,1,3,2,5,6,4,7/ - save nappasses,naptypes,ncontest0,one,hiscall12_0 + save nappasses,naptypes,ncontest0,one if(first.or.(ncontest.ne.ncontest0)) then @@ -87,11 +86,8 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & ncontest0=ncontest endif - if(hiscall12.ne.hiscall12_0) then - c13=hiscall12//' ' - call save_hash_call(c13,n10,n12,n22) - hiscall12_0=hiscall12 - endif + dxcall13=hiscall12 + mycall13=mycall12 max_iterations=30 nharderrors=-1 @@ -190,7 +186,6 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & print*,"Error - nsym must be 1, 2, or 3." endif enddo - s2l(0:nt-1)=log(s2(0:nt-1)+1e-32) i32=1+(k-1)*3+(ihalf-1)*87 if(nsym.eq.1) ibmax=2 if(nsym.eq.2) ibmax=5 @@ -396,7 +391,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, & if(i3.gt.4 .or. (i3.eq.0.and.n3.gt.5)) then cycle endif - call unpack77(c77,msg37,unpk77_success) + call unpack77(c77,1,msg37,unpk77_success) if(.not.unpk77_success) then cycle endif diff --git a/lib/ft8/genft8.f90 b/lib/ft8/genft8.f90 index bf3116b8..41ff546c 100644 --- a/lib/ft8/genft8.f90 +++ b/lib/ft8/genft8.f90 @@ -17,7 +17,7 @@ subroutine genft8(msg,i3,n3,msgsent,msgbits,itone) i3=-1 n3=-1 call pack77(msg,i3,n3,c77) - call unpack77(c77,msgsent,unpk77_success) + call unpack77(c77,0,msgsent,unpk77_success) read(c77,'(77i1)',err=1) msgbits if(unpk77_success) go to 2 1 msgbits=0 diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index e29fa921..8cfd8600 100644 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -61,7 +61,6 @@ contains save s,dd,mycall12_0 if(mycall12.ne.mycall12_0) then - call my_hash(mycall12) mycall12_0=mycall12 endif diff --git a/lib/ft8dec.f90 b/lib/ft8dec.f90 new file mode 100644 index 00000000..2dea2a91 --- /dev/null +++ b/lib/ft8dec.f90 @@ -0,0 +1,111 @@ +subroutine ft8dec(iwave,nQSOProgress,nfqso,nftx,newdat, & + nutc,nfa,nfb,ndepth,ncontest,nagain,lft8apon,lapcqonly, & + napwid,mycall12,hiscall12,hisgrid6) +! use wavhdr + use timer_module, only: timer + include 'ft8/ft8_params.f90' +! type(hdr) h + + parameter (MAXCAND=300) + real s(NH1,NHSYM) + real sbase(NH1) + real candidate(3,MAXCAND) + real dd(15*12000) + logical, intent(in) :: lft8apon,lapcqonly,nagain + logical newdat,lsubtract,ldupe + character*12 mycall12,hiscall12,mycall12_0 + character*6 hisgrid6 + integer*2 iwave(15*12000) + integer apsym2(58) + character datetime*13,msg37*37 +! character message*22 + character*37 allmessages(100) + integer allsnrs(100) + data mycall12_0/'dummy'/ + save s,dd,mycall12_0 + + if(mycall12.ne.mycall12_0) then + mycall12_0=mycall12 + endif + + write(datetime,1001) nutc !### TEMPORARY ### +1001 format("000000_",i6.6) + + call ft8apset(mycall12,hiscall12,apsym2) + dd=iwave + ndecodes=0 + allmessages=' ' + allsnrs=0 + ifa=nfa + ifb=nfb + if(nagain) then + ifa=nfqso-10 + ifb=nfqso+10 + endif + +! For now: +! ndepth=1: no subtraction, 1 pass, belief propagation only +! ndepth=2: subtraction, 3 passes, belief propagation only +! ndepth=3: subtraction, 3 passes, bp+osd + if(ndepth.eq.1) npass=1 + if(ndepth.ge.2) npass=3 + do ipass=1,npass + newdat=.true. ! Is this a problem? I hijacked newdat. + syncmin=1.5 + if(ipass.eq.1) then + lsubtract=.true. + if(ndepth.eq.1) lsubtract=.false. + elseif(ipass.eq.2) then + n2=ndecodes + if(ndecodes.eq.0) cycle + lsubtract=.true. + elseif(ipass.eq.3) then + if((ndecodes-n2).eq.0) cycle + lsubtract=.false. + endif + call timer('sync8 ',0) + maxc=MAXCAND + call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,s,candidate, & + ncand,sbase) + call timer('sync8 ',1) + do icand=1,ncand + sync=candidate(3,icand) + f1=candidate(1,icand) + xdt=candidate(2,icand) + xbase=10.0**(0.1*(sbase(nint(f1/3.125))-40.0)) + nsnr0=min(99,nint(10.0*log10(sync) - 25.5)) !### empirical ### + call timer('ft8b ',0) + call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndepth,lft8apon, & + lapcqonly,napwid,lsubtract,nagain,ncontest,iaptype,mycall12, & + hiscall12,sync,f1,xdt,xbase,apsym2,nharderrors,dmin, & + nbadcrc,iappass,iera,msg37,xsnr) + call timer('ft8b ',1) + nsnr=nint(xsnr) + xdt=xdt-0.5 + hd=nharderrors+dmin + if(nbadcrc.eq.0) then + ldupe=.false. + do id=1,ndecodes + if(msg37.eq.allmessages(id).and.nsnr.le.allsnrs(id)) ldupe=.true. + enddo + if(.not.ldupe) then + ndecodes=ndecodes+1 + allmessages(ndecodes)=msg37 + allsnrs(ndecodes)=nsnr + endif +! write(81,1004) nutc,ncand,icand,ipass,iaptype,iappass, & +! nharderrors,dmin,hd,min(sync,999.0),nint(xsnr), & +! xdt,nint(f1),msg37 +!1004 format(i6.6,2i4,3i2,i3,3f6.1,i4,f6.2,i5,2x,a37) +! flush(81) + if(.not.ldupe) then + qual=1.0-(nharderrors+dmin)/60.0 ! scale qual to [0.0,1.0] + write(*,1010) min(sync,999.0),nsnr,xdt,nint(f1), & + iaptype,qual,msg37 +1010 format(f5.1,i4,f5.2,i5,i3,f5.1,1x,a37) + endif + endif + enddo + enddo + return +end subroutine ft8dec diff --git a/lib/genmsk_128_90.f90 b/lib/genmsk_128_90.f90 index bfd175db..6e35d725 100644 --- a/lib/genmsk_128_90.f90 +++ b/lib/genmsk_128_90.f90 @@ -82,7 +82,7 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype) i3=-1 n3=-1 call pack77(message,i3,n3,c77) - call unpack77(c77,msgsent,unpk77_success) !Unpack to get msgsent + call unpack77(c77,0,msgsent,unpk77_success) !Unpack to get msgsent if(ichk.eq.1) go to 999 read(c77,"(77i1)") msgbits call encode_128_90(msgbits,codeword) diff --git a/lib/ldpcsim128_90.f90 b/lib/ldpcsim128_90.f90 index 05b424b7..2b6baf40 100644 --- a/lib/ldpcsim128_90.f90 +++ b/lib/ldpcsim128_90.f90 @@ -48,7 +48,7 @@ program ldpcsim128_90 i3=0 n3=1 call pack77(msg,i3,n3,c77) - call unpack77(c77,msgsent,unpk77_success) + call unpack77(c77,0,msgsent,unpk77_success) read(c77,'(77i1)') msgbits write(*,*) "message sent ",msgsent @@ -108,7 +108,7 @@ program ldpcsim128_90 ! If the decoder finds a valid codeword, nharderrors will be .ge. 0. if( nharderrors .ge. 0 ) then write(c77,'(77i1)') message77 - call unpack77(c77,msgreceived,unpk77_success) + call unpack77(c77,1,msgreceived,unpk77_success) nhw=count(cw.ne.codeword) if(nhw.eq.0) then ! this is a good decode ngood=ngood+1 diff --git a/lib/msk144decodeframe.f90 b/lib/msk144decodeframe.f90 index 19da8493..a2dbd0df 100644 --- a/lib/msk144decodeframe.f90 +++ b/lib/msk144decodeframe.f90 @@ -104,7 +104,7 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess) if( (i3.eq.0.and.(n3.eq.1 .or. n3.eq.3 .or. n3.eq.4 .or. n3.gt.5)) .or. i3.eq.3 .or. i3.gt.4 ) then nsuccess=0 else - call unpack77(c77,msgreceived,unpk77_success) + call unpack77(c77,1,msgreceived,unpk77_success) if(.not.unpk77_success) nsuccess=0 endif endif diff --git a/lib/msk40decodeframe.f90 b/lib/msk40decodeframe.f90 index 2023412e..277f89de 100644 --- a/lib/msk40decodeframe.f90 +++ b/lib/msk40decodeframe.f90 @@ -128,7 +128,7 @@ subroutine msk40decodeframe(c,mycall,hiscall,xsnr,bswl,nhasharray, & imsg=0 do i=1,16 - imsg=ishft(imsg,1)+iand(1,decoded(17-i)) + imsg=ishft(imsg,1)+iand(1_1,decoded(17-i)) enddo nrxrpt=iand(imsg,15) nrxhash=(imsg-nrxrpt)/16 diff --git a/lib/mskrtd.f90 b/lib/mskrtd.f90 index 622c05f3..7cc68807 100644 --- a/lib/mskrtd.f90 +++ b/lib/mskrtd.f90 @@ -18,7 +18,6 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & character*37 msglast,msglastswl !Used for dupechecking character*80 line !Formatted line with UTC dB T Freq Msg character*12 mycall,hiscall - character*13 mycall13 character*6 mygrid character*37 recent_shmsgs(NSHMEM) character*512 datadir @@ -55,7 +54,8 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & 1,1,1,1,1,1,1,0/ data xmc/2.0,4.5,2.5,3.5/ !Used to set time at center of averaging mask save first,tsec0,nutc00,pnoise,cdat,msglast,msglastswl, & - nsnrlast,nsnrlastswl,nhasharray,recent_shmsgs,mycall13 + nsnrlast,nsnrlastswl,nhasharray,recent_shmsgs +! nsnrlast,nsnrlastswl,nhasharray,recent_shmsgs,mycall13 if(first) then tsec0=tsec @@ -71,15 +71,15 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & msglastswl=' ' nsnrlast=-99 nsnrlastswl=-99 - mycall13=mycall//" " - call save_hash_call(mycall13,n10,n12,n22) ! Make sure that my callsign is in hashtable + mycall13=mycall//' ' + dxcall13=hiscall//' ' first=.false. endif fc=nrxfreq -! Reset if mycall changes - if(mycall13(1:12).ne.mycall) first=.true. +! Reset if mycall or dxcall changes + if(mycall13(1:12).ne.mycall .or. dxcall13(1:12).ne.hiscall) first=.true. ! Dupe checking setup if(nutc00.ne.nutc0 .or. tsec.lt.tsec0) then ! reset dupe checker @@ -211,7 +211,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & msglast=msgreceived nsnrlast=nsnr if(.not. bshdecode) then - call update_hasharray(nhasharray) + call update_msk40_hasharray(nhasharray) endif write(line,1021) nutc0,nsnr,tdec,nint(fest),decsym,msgreceived,char(0) 1021 format(i6.6,i4,f5.1,i5,a4,a37,a1) diff --git a/lib/qra/qra64/qra64.c b/lib/qra/qra64/qra64.c index 0e9e141e..6470cedb 100644 --- a/lib/qra/qra64/qra64.c +++ b/lib/qra/qra64/qra64.c @@ -242,7 +242,7 @@ void qra64_encode(qra64codec *pcodec, int *y, const int *x) // otherwise when a [cq mycall ?] msg is sent we reset the APTYPE_BOTHCALLS // look if the msg sent is a std type message (bit15 of grid field = 0) - if ((x[9]&0x80)==1) + if ((x[9]&0x80)) return; // no, it's a text message, nothing to do // It's a [hiscall mycall grid] message diff --git a/lib/update_hasharray.f90 b/lib/update_msk40_hasharray.f90 index baf50329..64886b41 100644 --- a/lib/update_hasharray.f90 +++ b/lib/update_msk40_hasharray.f90 @@ -1,4 +1,4 @@ -subroutine update_hasharray(nhasharray) +subroutine update_msk40_hasharray(nhasharray) use packjt77 character*37 hashmsg @@ -22,4 +22,4 @@ subroutine update_hasharray(nhasharray) enddo enddo -end subroutine update_hasharray +end subroutine update_msk40_hasharray diff --git a/lib/wsprd/wsprd.c b/lib/wsprd/wsprd.c index 2e4c3c23..3fb15f5a 100644 --- a/lib/wsprd/wsprd.c +++ b/lib/wsprd/wsprd.c @@ -1254,7 +1254,7 @@ int main(int argc, char *argv[]) not_decoded=1; int osd_decode=0; int ib=1, blocksize; - int n1,n2; + int n1,n2,n3,nadd,nu,ntype; while( ib <= nblocksize && not_decoded ) { blocksize=ib; idt=0; ii=0; @@ -1311,12 +1311,23 @@ int main(int argc, char *argv[]) unpack50(message,&n1,&n2); if( !unpackcall(n1,callsign) ) break; callsign[12]=0; - ihash=nhash(callsign,strlen(callsign),(uint32_t)146); - if(strncmp(hashtab+ihash*13,callsign,13)==0) { - not_decoded=0; - osd_decode =1; - break; - } + ntype = (n2&127) - 64; + if( (ntype >= 0) && (ntype <= 62) ) { + nu = ntype%10; + if( !(nu == 0 || nu == 3 || nu == 7) ) { + nadd=nu; + if( nu > 3 ) nadd=nu-3; + if( nu > 7 ) nadd=nu-7; + n3=n2/128+32768*(nadd-1); + if( !unpackpfx(n3,callsign) ) break; + } + ihash=nhash(callsign,strlen(callsign),(uint32_t)146); + if(strncmp(hashtab+ihash*13,callsign,13)==0) { + not_decoded=0; + osd_decode =1; + break; + } + } } } |
