summaryrefslogtreecommitdiff
path: root/lib/ft8/encode174_91_nocrc.f90
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-05-11 22:17:58 +0200
committerChristoph Berg <myon@debian.org>2020-05-11 22:17:58 +0200
commit32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (patch)
treec6e107c1ee4d70610e43a7912e57c720334a08c7 /lib/ft8/encode174_91_nocrc.f90
parent08299e8b2bf50ba90daf570f57def529dd29d6e7 (diff)
New upstream version 2.2.0~rc1+repackupstream/2.2.0_rc1+repack
Diffstat (limited to 'lib/ft8/encode174_91_nocrc.f90')
-rw-r--r--lib/ft8/encode174_91_nocrc.f9049
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/ft8/encode174_91_nocrc.f90 b/lib/ft8/encode174_91_nocrc.f90
new file mode 100644
index 00000000..371e8317
--- /dev/null
+++ b/lib/ft8/encode174_91_nocrc.f90
@@ -0,0 +1,49 @@
+subroutine encode174_91_nocrc(message,codeword)
+!
+! Encode a 91-bit message and return a 174-bit codeword.
+!
+ use, intrinsic :: iso_c_binding
+ use iso_c_binding, only: c_loc,c_size_t
+ use crc
+
+ integer, parameter:: N=174, K=91, M=N-K
+ character*91 tmpchar
+ integer*1 codeword(N)
+ integer*1 gen(M,K)
+ integer*1 message(K)
+ integer*1 pchecks(M)
+ integer*1, target :: i1MsgBytes(12)
+ include "ldpc_174_91_c_generator.f90"
+ logical first
+ data first/.true./
+ save first,gen
+
+ if( first ) then ! fill the generator matrix
+ gen=0
+ do i=1,M
+ do j=1,23
+ read(g(i)(j:j),"(Z1)") istr
+ ibmax=4
+ if(j.eq.23) ibmax=3
+ do jj=1, ibmax
+ icol=(j-1)*4+jj
+ if( btest(istr,4-jj) ) gen(i,icol)=1
+ enddo
+ enddo
+ enddo
+ first=.false.
+ endif
+
+ do i=1,M
+ nsum=0
+ do j=1,K
+ nsum=nsum+message(j)*gen(i,j)
+ enddo
+ pchecks(i)=mod(nsum,2)
+ enddo
+
+ codeword(1:K)=message
+ codeword(K+1:N)=pchecks
+
+ return
+end subroutine encode174_91_nocrc