mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 23:57:10 -04:00
Add extractmessage144.f90
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6779 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
c8a4452966
commit
0de0a5dbe8
@ -329,6 +329,7 @@ set (wsjt_FSRCS
|
||||
lib/ephem.f90
|
||||
lib/extract.f90
|
||||
lib/extract4.f90
|
||||
lib/extractmessage144.f90
|
||||
lib/fano232.f90
|
||||
lib/fast9.f90
|
||||
lib/fast_decode.f90
|
||||
@ -386,7 +387,6 @@ set (wsjt_FSRCS
|
||||
lib/jt9_decode.f90
|
||||
lib/jt9fano.f90
|
||||
lib/JTMSKsim.f90
|
||||
lib/msk144sim.f90
|
||||
lib/jtmsk_decode.f90
|
||||
lib/jtmsk_short.f90
|
||||
lib/ldpcsim.f90
|
||||
@ -401,6 +401,7 @@ set (wsjt_FSRCS
|
||||
lib/mskdt.f90
|
||||
lib/msk144d.f90
|
||||
lib/msk144_decode.f90
|
||||
lib/msk144sim.f90
|
||||
lib/options.f90
|
||||
lib/packjt.f90
|
||||
lib/pctile.f90
|
||||
|
43
lib/extractmessage144.f90
Normal file
43
lib/extractmessage144.f90
Normal file
@ -0,0 +1,43 @@
|
||||
subroutine extractmessage144(decoded,msgreceived,nhashflag)
|
||||
use iso_c_binding, only: c_loc,c_size_t
|
||||
use packjt
|
||||
use hashing
|
||||
|
||||
character*22 msgreceived
|
||||
integer*1 decoded(80)
|
||||
integer*1, target:: i1Dec8BitBytes(10)
|
||||
integer*1 i1hashdec
|
||||
integer*4 i4Dec6BitWords(12)
|
||||
|
||||
! Collapse 80 decoded bits to 10 bytes. Bytes 1-9 are the message, byte 10 is the hash
|
||||
do ibyte=1,10
|
||||
itmp=0
|
||||
do ibit=1,8
|
||||
itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*8+ibit))
|
||||
enddo
|
||||
i1Dec8BitBytes(ibyte)=itmp
|
||||
enddo
|
||||
|
||||
! Calculate the hash using the first 9 bytes.
|
||||
ihashdec=nhash(c_loc(i1Dec8BitBytes),int(9,c_size_t),146)
|
||||
ihashdec=2*iand(ihashdec,255)
|
||||
|
||||
! Compare calculated hash with received byte 10 - if they agree, keep the message.
|
||||
i1hashdec=ihashdec
|
||||
if( i1hashdec .eq. i1Dec8BitBytes(10) ) then
|
||||
! Good hash --- unpack 72-bit message
|
||||
do ibyte=1,12
|
||||
itmp=0
|
||||
do ibit=1,6
|
||||
itmp=ishft(itmp,1)+iand(1,decoded((ibyte-1)*6+ibit))
|
||||
enddo
|
||||
i4Dec6BitWords(ibyte)=itmp
|
||||
enddo
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived)
|
||||
nhashflag=1
|
||||
else
|
||||
msgreceived=' '
|
||||
nhashflag=-1
|
||||
endif
|
||||
return
|
||||
end subroutine extractmessage144
|
Loading…
Reference in New Issue
Block a user