summaryrefslogtreecommitdiff
path: root/lib/encode232.f90
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@debian.org>2015-10-18 17:55:15 +0100
committerIain R. Learmonth <irl@debian.org>2015-10-18 17:55:15 +0100
commitc720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (patch)
treeecf89ef5fb2aa173119808e84e6d2e4cc15b962c /lib/encode232.f90
Imported Upstream version 1.1.r3496upstream/1.1.r3496
Diffstat (limited to 'lib/encode232.f90')
-rw-r--r--lib/encode232.f9033
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/encode232.f90 b/lib/encode232.f90
new file mode 100644
index 00000000..bc904b48
--- /dev/null
+++ b/lib/encode232.f90
@@ -0,0 +1,33 @@
+subroutine encode232(dat,nsym,symbol)
+
+! Convolutional encoder for a K=32, r=1/2 code.
+
+ integer*1 dat(13) !User data, packed 8 bits per byte
+ integer*1 symbol(500) !Channel symbols, one bit per byte
+ integer*1 i1
+ include 'conv232.f90'
+
+ nstate=0
+ k=0
+ do j=1,nsym
+ do i=7,0,-1
+ i1=dat(j)
+ i4=i1
+ if (i4.lt.0) i4=i4+256
+ nstate=ior(ishft(nstate,1),iand(ishft(i4,-i),1))
+ n=iand(nstate,npoly1)
+ n=ieor(n,ishft(n,-16))
+ k=k+1
+ symbol(k)=partab(iand(ieor(n,ishft(n,-8)),255))
+ n=iand(nstate,npoly2)
+ n=ieor(n,ishft(n,-16))
+ k=k+1
+ symbol(k)=partab(iand(ieor(n,ishft(n,-8)),255))
+ if(k.ge.nsym) go to 100
+ enddo
+ enddo
+
+100 continue
+
+ return
+end subroutine encode232