From 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 9 Jan 2025 22:12:06 +0100 Subject: New upstream version 2.7.0~rc8+repack --- lib/ftrsd/Makefile | 106 +- lib/ftrsd/Makefile.sfrsd | 60 +- lib/ftrsd/Makefile.sfrsd3 | 76 +- lib/ftrsd/decode_rs.c | 536 +- lib/ftrsd/encode_rs.c | 94 +- lib/ftrsd/extract2.f90 | 290 +- lib/ftrsd/ftrsd2.c | 426 +- lib/ftrsd/ftrsd_paper/Makefile | 80 +- lib/ftrsd/ftrsd_paper/binomial.c | 138 +- lib/ftrsd/ftrsd_paper/binomial_subs.c | 110 +- lib/ftrsd/ftrsd_paper/bmdata-rf.dat | 22 +- lib/ftrsd/ftrsd_paper/bmdata.dat | 16 +- lib/ftrsd/ftrsd_paper/bmtheory25.dat | 86 +- lib/ftrsd/ftrsd_paper/bmtheory40.dat | 86 +- lib/ftrsd/ftrsd_paper/bmtheory43.dat | 86 +- lib/ftrsd/ftrsd_paper/bodide.f90 | 108 +- lib/ftrsd/ftrsd_paper/bodide.lab | 8 +- lib/ftrsd/ftrsd_paper/fig_bodide.gnuplot | 48 +- lib/ftrsd/ftrsd_paper/fig_ntrials_vs_nhard.gnuplot | 28 +- lib/ftrsd/ftrsd_paper/fig_psuccess.gnuplot | 50 +- lib/ftrsd/ftrsd_paper/fig_wer.gnuplot | 46 +- lib/ftrsd/ftrsd_paper/fig_wer2.gnuplot | 46 +- lib/ftrsd/ftrsd_paper/fig_wer3.gnuplot | 42 +- lib/ftrsd/ftrsd_paper/ftdata-10.dat | 20 +- lib/ftrsd/ftrsd_paper/ftdata-100.dat | 20 +- lib/ftrsd/ftrsd_paper/ftdata-1000.dat | 18 +- lib/ftrsd/ftrsd_paper/ftdata-10000.dat | 22 +- lib/ftrsd/ftrsd_paper/ftdata-100000.dat | 22 +- lib/ftrsd/ftrsd_paper/ftrsd.lyx | 6578 ++++++++++---------- lib/ftrsd/ftrsd_paper/kvasd-12.dat | 16 +- lib/ftrsd/ftrsd_paper/kvasd-15.dat | 18 +- lib/ftrsd/ftrsd_paper/kvasd-8.dat | 16 +- lib/ftrsd/ftrsd_paper/mfsk.f90 | 66 +- lib/ftrsd/ftrsd_paper/prob.f90 | 82 +- lib/ftrsd/ftrsd_paper/psuccess.lab | 28 +- lib/ftrsd/ftrsd_paper/stats-100000-24db-3.dat | 1860 +++--- lib/ftrsd/ftrsd_paper/stats_0.0 | 54 +- lib/ftrsd/ftrsd_paper/stats_0.2 | 54 +- lib/ftrsd/ftrsd_paper/stats_1.0 | 54 +- lib/ftrsd/ftrsd_paper/wer2.lab | 12 +- lib/ftrsd/ftrsdap.c | 454 +- lib/ftrsd/init_rs.c | 238 +- lib/ftrsd/int.h | 108 +- lib/ftrsd/rs2.h | 32 +- lib/ftrsd/rsdtest.f90 | 68 +- lib/ftrsd/sfrsd.c | 274 +- lib/ftrsd/sfrsd2.h | 6 +- lib/ftrsd/sfrsd3.c | 486 +- 48 files changed, 6597 insertions(+), 6597 deletions(-) (limited to 'lib/ftrsd') diff --git a/lib/ftrsd/Makefile b/lib/ftrsd/Makefile index 46486498..61b1357e 100755 --- a/lib/ftrsd/Makefile +++ b/lib/ftrsd/Makefile @@ -1,53 +1,53 @@ -# Makefile for Windows in JTSDK-PY environment - -# Re-direct stdout and stderr: cmd.exe bash -# make > junk 2>&1 make &> junk - -CC = gcc -FC = gfortran - -FFLAGS = -O2 -DWIN32 -fbounds-check -fno-second-underscore -Wall \ - -Wno-conversion -Wno-character-truncation -CFLAGS = -I. -DWIN32 -DWin32 -DBIGSYM -DHAVE_STRUCT_TIMESPEC - -# Default rules -%.o: %.c - ${CC} ${CFLAGS} -c $< -%.o: %.f - ${FC} ${FFLAGS} -c $< -%.o: %.F - ${FC} ${FFLAGS} -c $< -%.o: %.f90 - ${FC} ${FFLAGS} -c $< -%.o: %.F90 - ${FC} ${FFLAGS} -c $< - -all: libftrsd.a - -OBJS1 = extract2.o ftrsd2.o init_rs_int.o encode_rs_int.o decode_rs_int.o -libftrsd.a: $(OBJS1) - ar cr libftrsd.a $(OBJS1) - ranlib libftrsd.a - cp libftrsd.a .. - -# Build rsdtest -OBJS2 = rsdtest.o -rsdtest: $(OBJS2) ../libjt.a - $(FC) -o rsdtest $(OBJS2) libftrsd.a ../libjt.a ../libpthreadGC2.a - -ftrsd: ftrsd.o encode_rs_int.o decode_rs_int.o init_rs_int.o - gcc -g -o $@ $^ - -encode_rs_int.o: encode_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -decode_rs_int.o: decode_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -init_rs_int.o: init_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -.PHONY : clean - -clean: - rm -rf *.o libjt.a rsdtest ftrsd +# Makefile for Windows in JTSDK-PY environment + +# Re-direct stdout and stderr: cmd.exe bash +# make > junk 2>&1 make &> junk + +CC = gcc +FC = gfortran + +FFLAGS = -O2 -DWIN32 -fbounds-check -fno-second-underscore -Wall \ + -Wno-conversion -Wno-character-truncation +CFLAGS = -I. -DWIN32 -DWin32 -DBIGSYM -DHAVE_STRUCT_TIMESPEC + +# Default rules +%.o: %.c + ${CC} ${CFLAGS} -c $< +%.o: %.f + ${FC} ${FFLAGS} -c $< +%.o: %.F + ${FC} ${FFLAGS} -c $< +%.o: %.f90 + ${FC} ${FFLAGS} -c $< +%.o: %.F90 + ${FC} ${FFLAGS} -c $< + +all: libftrsd.a + +OBJS1 = extract2.o ftrsd2.o init_rs_int.o encode_rs_int.o decode_rs_int.o +libftrsd.a: $(OBJS1) + ar cr libftrsd.a $(OBJS1) + ranlib libftrsd.a + cp libftrsd.a .. + +# Build rsdtest +OBJS2 = rsdtest.o +rsdtest: $(OBJS2) ../libjt.a + $(FC) -o rsdtest $(OBJS2) libftrsd.a ../libjt.a ../libpthreadGC2.a + +ftrsd: ftrsd.o encode_rs_int.o decode_rs_int.o init_rs_int.o + gcc -g -o $@ $^ + +encode_rs_int.o: encode_rs.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +decode_rs_int.o: decode_rs.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +init_rs_int.o: init_rs.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +.PHONY : clean + +clean: + rm -rf *.o libjt.a rsdtest ftrsd diff --git a/lib/ftrsd/Makefile.sfrsd b/lib/ftrsd/Makefile.sfrsd index fe859532..3f68f7ed 100755 --- a/lib/ftrsd/Makefile.sfrsd +++ b/lib/ftrsd/Makefile.sfrsd @@ -1,30 +1,30 @@ -srcdir = . -prefix = /usr/local -exec_prefix=${prefix} -CC=gcc - -CFLAGS=-I/usr/local/include -Wall -O2 - -all: encode_rs_int.o decode_rs_int.o init_rs_int.o sfrsd2.o sfrsd.o sfrsd - -encode_rs_int.o: encode_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -decode_rs_int.o: decode_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -init_rs_int.o: init_rs.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -sfrsd2.o: sfrsd2.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -sfrsd.o: sfrsd.c - gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ - -sfrsd: sfrsd.o encode_rs_int.o decode_rs_int.o init_rs_int.o sfrsd2.o - gcc -g -o $@ $^ - -clean: - rm -f *.o *.a sfrsd - +srcdir = . +prefix = /usr/local +exec_prefix=${prefix} +CC=gcc + +CFLAGS=-I/usr/local/include -Wall -O2 + +all: encode_rs_int.o decode_rs_int.o init_rs_int.o sfrsd2.o sfrsd.o sfrsd + +encode_rs_int.o: encode_rs.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +decode_rs_int.o: decode_rs.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +init_rs_int.o: init_rs.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +sfrsd2.o: sfrsd2.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +sfrsd.o: sfrsd.c + gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ + +sfrsd: sfrsd.o encode_rs_int.o decode_rs_int.o init_rs_int.o sfrsd2.o + gcc -g -o $@ $^ + +clean: + rm -f *.o *.a sfrsd + diff --git a/lib/ftrsd/Makefile.sfrsd3 b/lib/ftrsd/Makefile.sfrsd3 index 2e4d1900..93023f31 100755 --- a/lib/ftrsd/Makefile.sfrsd3 +++ b/lib/ftrsd/Makefile.sfrsd3 @@ -1,38 +1,38 @@ -# Makefile for Windows in JTSDK-PY environment - -# Re-direct stdout and stderr: cmd.exe bash -# make > junk 2>&1 make &> junk - -CC = gcc -FC = gfortran - -FFLAGS = -O2 -DWIN32 -fbounds-check -fno-second-underscore -Wall \ - -Wno-conversion -Wno-character-truncation -CFLAGS = -I. -DWIN32 -DWin32 -DBIGSYM -DHAVE_STRUCT_TIMESPEC - -# Default rules -%.o: %.c - ${CC} ${CFLAGS} -c $< -%.o: %.f - ${FC} ${FFLAGS} -c $< -%.o: %.F - ${FC} ${FFLAGS} -c $< -%.o: %.f90 - ${FC} ${FFLAGS} -c $< -%.o: %.F90 - ${FC} ${FFLAGS} -c $< - -all: rsdtest - -# Build rsdtest -OBJS2 = rsdtest.o extract2.o demod64b.o sfrsd3.o -rsdtest: $(OBJS2) ../libjt.a - $(FC) -o rsdtest $(OBJS2) ../libjt.a ../libpthreadGC2.a - -sfrsd: sfrsd.o encode_rs_int.o decode_rs_int.o init_rs_int.o - gcc -g -o $@ $^ - -.PHONY : clean - -clean: - rm -rf *.o libjt.a rsdtest sfrsd +# Makefile for Windows in JTSDK-PY environment + +# Re-direct stdout and stderr: cmd.exe bash +# make > junk 2>&1 make &> junk + +CC = gcc +FC = gfortran + +FFLAGS = -O2 -DWIN32 -fbounds-check -fno-second-underscore -Wall \ + -Wno-conversion -Wno-character-truncation +CFLAGS = -I. -DWIN32 -DWin32 -DBIGSYM -DHAVE_STRUCT_TIMESPEC + +# Default rules +%.o: %.c + ${CC} ${CFLAGS} -c $< +%.o: %.f + ${FC} ${FFLAGS} -c $< +%.o: %.F + ${FC} ${FFLAGS} -c $< +%.o: %.f90 + ${FC} ${FFLAGS} -c $< +%.o: %.F90 + ${FC} ${FFLAGS} -c $< + +all: rsdtest + +# Build rsdtest +OBJS2 = rsdtest.o extract2.o demod64b.o sfrsd3.o +rsdtest: $(OBJS2) ../libjt.a + $(FC) -o rsdtest $(OBJS2) ../libjt.a ../libpthreadGC2.a + +sfrsd: sfrsd.o encode_rs_int.o decode_rs_int.o init_rs_int.o + gcc -g -o $@ $^ + +.PHONY : clean + +clean: + rm -rf *.o libjt.a rsdtest sfrsd diff --git a/lib/ftrsd/decode_rs.c b/lib/ftrsd/decode_rs.c index 04e26825..990b687a 100755 --- a/lib/ftrsd/decode_rs.c +++ b/lib/ftrsd/decode_rs.c @@ -1,268 +1,268 @@ -/* Reed-Solomon decoder - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - * Modified by Steve Franke, K9AN, for use in a soft-symbol RS decoder - */ - -#ifdef DEBUG -#include -#endif - -#include -#include - -#define min(a,b) ((a) < (b) ? (a) : (b)) - -#ifdef FIXED -#include "fixed.h" -#elif defined(BIGSYM) -#include "int.h" -#else -#include "char.h" -#endif - -int DECODE_RS( -#ifndef FIXED - void *p, -#endif - DTYPE *data, int *eras_pos, int no_eras, int calc_syn){ - -#ifndef FIXED - struct rs *rs = (struct rs *)p; -#endif - int deg_lambda, el, deg_omega; - int i, j, r,k; - DTYPE u,q,tmp,num1,num2,den,discr_r; - DTYPE lambda[NROOTS+1]; // Err+Eras Locator poly - static DTYPE s[51]; // and syndrome poly - DTYPE b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; - DTYPE root[NROOTS], reg[NROOTS+1], loc[NROOTS]; - int syn_error, count; - - if( calc_syn ) { - /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */ - for(i=0;i 0) { - /* Init lambda to be the erasure locator polynomial */ - lambda[1] = ALPHA_TO[MODNN(PRIM*(NN-1-eras_pos[0]))]; - for (i = 1; i < no_eras; i++) { - u = MODNN(PRIM*(NN-1-eras_pos[i])); - for (j = i+1; j > 0; j--) { - tmp = INDEX_OF[lambda[j - 1]]; - if(tmp != A0) - lambda[j] ^= ALPHA_TO[MODNN(u + tmp)]; - } - } - -#if DEBUG >= 1 - /* Test code that verifies the erasure locator polynomial just constructed - Needed only for decoder debugging. */ - - /* find roots of the erasure location polynomial */ - for(i=1;i<=no_eras;i++) - reg[i] = INDEX_OF[lambda[i]]; - - count = 0; - for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) { - q = 1; - for (j = 1; j <= no_eras; j++) - if (reg[j] != A0) { - reg[j] = MODNN(reg[j] + j); - q ^= ALPHA_TO[reg[j]]; - } - if (q != 0) - continue; - /* store root and error location number indices */ - root[count] = i; - loc[count] = k; - count++; - } - if (count != no_eras) { - printf("count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras); - count = -1; - goto finish; - } -#if DEBUG >= 2 - printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n"); - for (i = 0; i < count; i++) - printf("%d ", loc[i]); - printf("\n"); -#endif -#endif - } - for(i=0;i 0; j--){ - if (reg[j] != A0) { - reg[j] = MODNN(reg[j] + j); - q ^= ALPHA_TO[reg[j]]; - } - } - if (q != 0) - continue; /* Not a root */ - /* store root (index-form) and error location number */ -#if DEBUG>=2 - printf("count %d root %d loc %d\n",count,i,k); -#endif - root[count] = i; - loc[count] = k; - /* If we've already found max possible roots, - * abort the search to save time - */ - if(++count == deg_lambda) - break; - } - if (deg_lambda != count) { - /* - * deg(lambda) unequal to number of roots => uncorrectable - * error detected - */ - count = -1; - goto finish; - } - /* - * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo - * x**NROOTS). in index form. Also find deg(omega). - */ - deg_omega = 0; - for (i = 0; i < NROOTS;i++){ - tmp = 0; - j = (deg_lambda < i) ? deg_lambda : i; - for(;j >= 0; j--){ - if ((s[i - j] != A0) && (lambda[j] != A0)) - tmp ^= ALPHA_TO[MODNN(s[i - j] + lambda[j])]; - } - if(tmp != 0) - deg_omega = i; - omega[i] = INDEX_OF[tmp]; - } - omega[NROOTS] = A0; - - /* - * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = - * inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form - */ - for (j = count-1; j >=0; j--) { - num1 = 0; - for (i = deg_omega; i >= 0; i--) { - if (omega[i] != A0) - num1 ^= ALPHA_TO[MODNN(omega[i] + i * root[j])]; - } - num2 = ALPHA_TO[MODNN(root[j] * (FCR - 1) + NN)]; - den = 0; - - /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ - for (i = min(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) { - if(lambda[i+1] != A0) - den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])]; - } - if (den == 0) { -#if DEBUG >= 1 - printf("\n ERROR: denominator = 0\n"); -#endif - count = -1; - goto finish; - } - /* Apply error to data */ - if (num1 != 0) { - data[loc[j]] ^= ALPHA_TO[MODNN(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])]; - } - } -finish: - if(eras_pos != NULL){ - for(i=0;i +#endif + +#include +#include + +#define min(a,b) ((a) < (b) ? (a) : (b)) + +#ifdef FIXED +#include "fixed.h" +#elif defined(BIGSYM) +#include "int.h" +#else +#include "char.h" +#endif + +int DECODE_RS( +#ifndef FIXED + void *p, +#endif + DTYPE *data, int *eras_pos, int no_eras, int calc_syn){ + +#ifndef FIXED + struct rs *rs = (struct rs *)p; +#endif + int deg_lambda, el, deg_omega; + int i, j, r,k; + DTYPE u,q,tmp,num1,num2,den,discr_r; + DTYPE lambda[NROOTS+1]; // Err+Eras Locator poly + static DTYPE s[51]; // and syndrome poly + DTYPE b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; + DTYPE root[NROOTS], reg[NROOTS+1], loc[NROOTS]; + int syn_error, count; + + if( calc_syn ) { + /* form the syndromes; i.e., evaluate data(x) at roots of g(x) */ + for(i=0;i 0) { + /* Init lambda to be the erasure locator polynomial */ + lambda[1] = ALPHA_TO[MODNN(PRIM*(NN-1-eras_pos[0]))]; + for (i = 1; i < no_eras; i++) { + u = MODNN(PRIM*(NN-1-eras_pos[i])); + for (j = i+1; j > 0; j--) { + tmp = INDEX_OF[lambda[j - 1]]; + if(tmp != A0) + lambda[j] ^= ALPHA_TO[MODNN(u + tmp)]; + } + } + +#if DEBUG >= 1 + /* Test code that verifies the erasure locator polynomial just constructed + Needed only for decoder debugging. */ + + /* find roots of the erasure location polynomial */ + for(i=1;i<=no_eras;i++) + reg[i] = INDEX_OF[lambda[i]]; + + count = 0; + for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) { + q = 1; + for (j = 1; j <= no_eras; j++) + if (reg[j] != A0) { + reg[j] = MODNN(reg[j] + j); + q ^= ALPHA_TO[reg[j]]; + } + if (q != 0) + continue; + /* store root and error location number indices */ + root[count] = i; + loc[count] = k; + count++; + } + if (count != no_eras) { + printf("count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras); + count = -1; + goto finish; + } +#if DEBUG >= 2 + printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n"); + for (i = 0; i < count; i++) + printf("%d ", loc[i]); + printf("\n"); +#endif +#endif + } + for(i=0;i 0; j--){ + if (reg[j] != A0) { + reg[j] = MODNN(reg[j] + j); + q ^= ALPHA_TO[reg[j]]; + } + } + if (q != 0) + continue; /* Not a root */ + /* store root (index-form) and error location number */ +#if DEBUG>=2 + printf("count %d root %d loc %d\n",count,i,k); +#endif + root[count] = i; + loc[count] = k; + /* If we've already found max possible roots, + * abort the search to save time + */ + if(++count == deg_lambda) + break; + } + if (deg_lambda != count) { + /* + * deg(lambda) unequal to number of roots => uncorrectable + * error detected + */ + count = -1; + goto finish; + } + /* + * Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo + * x**NROOTS). in index form. Also find deg(omega). + */ + deg_omega = 0; + for (i = 0; i < NROOTS;i++){ + tmp = 0; + j = (deg_lambda < i) ? deg_lambda : i; + for(;j >= 0; j--){ + if ((s[i - j] != A0) && (lambda[j] != A0)) + tmp ^= ALPHA_TO[MODNN(s[i - j] + lambda[j])]; + } + if(tmp != 0) + deg_omega = i; + omega[i] = INDEX_OF[tmp]; + } + omega[NROOTS] = A0; + + /* + * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = + * inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form + */ + for (j = count-1; j >=0; j--) { + num1 = 0; + for (i = deg_omega; i >= 0; i--) { + if (omega[i] != A0) + num1 ^= ALPHA_TO[MODNN(omega[i] + i * root[j])]; + } + num2 = ALPHA_TO[MODNN(root[j] * (FCR - 1) + NN)]; + den = 0; + + /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ + for (i = min(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) { + if(lambda[i+1] != A0) + den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])]; + } + if (den == 0) { +#if DEBUG >= 1 + printf("\n ERROR: denominator = 0\n"); +#endif + count = -1; + goto finish; + } + /* Apply error to data */ + if (num1 != 0) { + data[loc[j]] ^= ALPHA_TO[MODNN(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])]; + } + } +finish: + if(eras_pos != NULL){ + for(i=0;i - -#ifdef FIXED -#include "fixed.h" -#elif defined(BIGSYM) -#include "int.h" -#else -#include "char.h" -#endif - -void ENCODE_RS( -#ifndef FIXED -void *p, -#endif -DTYPE *data, DTYPE *bb){ -#ifndef FIXED - struct rs *rs = (struct rs *)p; -#endif - int i, j; - DTYPE feedback; - - memset(bb,0,NROOTS*sizeof(DTYPE)); - - for(i=0;i + +#ifdef FIXED +#include "fixed.h" +#elif defined(BIGSYM) +#include "int.h" +#else +#include "char.h" +#endif + +void ENCODE_RS( +#ifndef FIXED +void *p, +#endif +DTYPE *data, DTYPE *bb){ +#ifndef FIXED + struct rs *rs = (struct rs *)p; +#endif + int i, j; + DTYPE feedback; + + memset(bb,0,NROOTS*sizeof(DTYPE)); + + for(i=0;i -#include -#include -#include -#include -#include "rs2.h" - -static void *rs; -void getpp_(int workdat[], float *pp); - -void ftrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], - int* ntrials0, int correct[], int param[], int ntry[]) -{ - int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63]; - int workdat[63]; - int indexes[63]; - int era_pos[51]; - int i, j, numera, nerr, nn=63; - int ntrials = *ntrials0; - int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768; - int ntotal=0,ntotal_min=32768,ncandidates; - int nera_best=0; - float pp,pp1,pp2; - static unsigned int nseed; - -// Power-percentage symbol metrics - composite gnnf/hf - int perr[8][8] = { - { 4, 9, 11, 13, 14, 14, 15, 15}, - { 2, 20, 20, 30, 40, 50, 50, 50}, - { 7, 24, 27, 40, 50, 50, 50, 50}, - {13, 25, 35, 46, 52, 70, 50, 50}, - {17, 30, 42, 54, 55, 64, 71, 70}, - {25, 39, 48, 57, 64, 66, 77, 77}, - {32, 45, 54, 63, 66, 75, 78, 83}, - {51, 58, 57, 66, 72, 77, 82, 86}}; - - -// Initialize the KA9Q Reed-Solomon encoder/decoder - unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51; - rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0); - -// Reverse the received symbol vectors for BM decoder - for (i=0; i<63; i++) { - rxdat[i]=mrsym[62-i]; - rxprob[i]=mrprob[62-i]; - rxdat2[i]=mr2sym[62-i]; - rxprob2[i]=mr2prob[62-i]; - } - -// Sort rxprob to find indexes of the least reliable symbols - int k, pass, tmp, nsym=63; - int probs[63]; - for (i=0; i<63; i++) { - indexes[i]=i; - probs[i]=rxprob[i]; - } - for (pass = 1; pass <= nsym-1; pass++) { - for (k = 0; k < nsym - pass; k++) { - if( probs[k] < probs[k+1] ) { - tmp = probs[k]; - probs[k] = probs[k+1]; - probs[k+1] = tmp; - tmp = indexes[k]; - indexes[k] = indexes[k+1]; - indexes[k+1] = tmp; - } - } - } - -// See if we can decode using BM HDD, and calculate the syndrome vector. - memset(era_pos,0,51*sizeof(int)); - numera=0; - memcpy(workdat,rxdat,sizeof(rxdat)); - nerr=decode_rs_int(rs,workdat,era_pos,numera,1); - if( nerr >= 0 ) { - // Hard-decision decoding succeeded. Save codeword and some parameters. - nhard=0; - for (i=0; i<63; i++) { - if( workdat[i] != rxdat[i] ) nhard=nhard+1; - } - memcpy(correct,workdat,63*sizeof(int)); - param[0]=0; - param[1]=nhard; - param[2]=0; - param[3]=0; - param[4]=0; - param[5]=0; - param[7]=1000*1000; - ntry[0]=0; - return; - } - -/* -Hard-decision decoding failed. Try the FT soft-decision method. -Generate random erasure-locator vectors and see if any of them -decode. This will generate a list of "candidate" codewords. The -soft distance between each candidate codeword and the received -word is estimated by finding the largest (pp1) and second-largest -(pp2) outputs from a synchronized filter-bank operating on the -symbol spectra, and using these to decide which candidate -codeword is "best". -*/ - - nseed=1; //Seed for random numbers - float ratio; - int thresh, nsum; - int thresh0[63]; - ncandidates=0; - nsum=0; - int ii,jj; - for (i=0; i= 0 ) { - // We have a candidate codeword. Find its hard and soft distance from - // the received word. Also find pp1 and pp2 from the full array - // s3(64,63) of synchronized symbol spectra. - ncandidates=ncandidates+1; - nhard=0; - nsoft=0; - for (i=0; i<63; i++) { - if(workdat[i] != rxdat[i]) { - nhard=nhard+1; - if(workdat[i] != rxdat2[i]) { - nsoft=nsoft+rxprob[i]; - } - } - } - nsoft=63*nsoft/nsum; - ntotal=nsoft+nhard; - - getpp_(workdat,&pp); - if(pp>pp1) { - pp2=pp1; - pp1=pp; - nsoft_min=nsoft; - nhard_min=nhard; - ntotal_min=ntotal; - memcpy(correct,workdat,63*sizeof(int)); - nera_best=numera; - ntry[0]=k; - } else { - if(pp>pp2 && pp!=pp1) pp2=pp; - } - if(nhard_min <= 41 && ntotal_min <= 71) break; - } - if(k == ntrials) ntry[0]=k; - } - - param[0]=ncandidates; - param[1]=nhard_min; - param[2]=nsoft_min; - param[3]=nera_best; - param[4]= pp1 > 0 ? 1000.0*pp2/pp1 : 1000.0; - param[5]=ntotal_min; - param[6]=ntry[0]; - param[7]=1000.0*pp2; - param[8]=1000.0*pp1; - if(param[0]==0) param[2]=-1; - return; -} +/* + ftrsd2.c + + A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. + + This decoding scheme is built around Phil Karn's Berlekamp-Massey + errors and erasures decoder. The approach is inspired by a number of + publications, including the stochastic Chase decoder described + in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., + IEEE Communications Letters, Vol. 14, No. 9, September 2010 and + "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- + and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. + + Steve Franke K9AN and Joe Taylor K1JT + */ + +#include +#include +#include +#include +#include +#include "rs2.h" + +static void *rs; +void getpp_(int workdat[], float *pp); + +void ftrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], + int* ntrials0, int correct[], int param[], int ntry[]) +{ + int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63]; + int workdat[63]; + int indexes[63]; + int era_pos[51]; + int i, j, numera, nerr, nn=63; + int ntrials = *ntrials0; + int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768; + int ntotal=0,ntotal_min=32768,ncandidates; + int nera_best=0; + float pp,pp1,pp2; + static unsigned int nseed; + +// Power-percentage symbol metrics - composite gnnf/hf + int perr[8][8] = { + { 4, 9, 11, 13, 14, 14, 15, 15}, + { 2, 20, 20, 30, 40, 50, 50, 50}, + { 7, 24, 27, 40, 50, 50, 50, 50}, + {13, 25, 35, 46, 52, 70, 50, 50}, + {17, 30, 42, 54, 55, 64, 71, 70}, + {25, 39, 48, 57, 64, 66, 77, 77}, + {32, 45, 54, 63, 66, 75, 78, 83}, + {51, 58, 57, 66, 72, 77, 82, 86}}; + + +// Initialize the KA9Q Reed-Solomon encoder/decoder + unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51; + rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0); + +// Reverse the received symbol vectors for BM decoder + for (i=0; i<63; i++) { + rxdat[i]=mrsym[62-i]; + rxprob[i]=mrprob[62-i]; + rxdat2[i]=mr2sym[62-i]; + rxprob2[i]=mr2prob[62-i]; + } + +// Sort rxprob to find indexes of the least reliable symbols + int k, pass, tmp, nsym=63; + int probs[63]; + for (i=0; i<63; i++) { + indexes[i]=i; + probs[i]=rxprob[i]; + } + for (pass = 1; pass <= nsym-1; pass++) { + for (k = 0; k < nsym - pass; k++) { + if( probs[k] < probs[k+1] ) { + tmp = probs[k]; + probs[k] = probs[k+1]; + probs[k+1] = tmp; + tmp = indexes[k]; + indexes[k] = indexes[k+1]; + indexes[k+1] = tmp; + } + } + } + +// See if we can decode using BM HDD, and calculate the syndrome vector. + memset(era_pos,0,51*sizeof(int)); + numera=0; + memcpy(workdat,rxdat,sizeof(rxdat)); + nerr=decode_rs_int(rs,workdat,era_pos,numera,1); + if( nerr >= 0 ) { + // Hard-decision decoding succeeded. Save codeword and some parameters. + nhard=0; + for (i=0; i<63; i++) { + if( workdat[i] != rxdat[i] ) nhard=nhard+1; + } + memcpy(correct,workdat,63*sizeof(int)); + param[0]=0; + param[1]=nhard; + param[2]=0; + param[3]=0; + param[4]=0; + param[5]=0; + param[7]=1000*1000; + ntry[0]=0; + return; + } + +/* +Hard-decision decoding failed. Try the FT soft-decision method. +Generate random erasure-locator vectors and see if any of them +decode. This will generate a list of "candidate" codewords. The +soft distance between each candidate codeword and the received +word is estimated by finding the largest (pp1) and second-largest +(pp2) outputs from a synchronized filter-bank operating on the +symbol spectra, and using these to decide which candidate +codeword is "best". +*/ + + nseed=1; //Seed for random numbers + float ratio; + int thresh, nsum; + int thresh0[63]; + ncandidates=0; + nsum=0; + int ii,jj; + for (i=0; i= 0 ) { + // We have a candidate codeword. Find its hard and soft distance from + // the received word. Also find pp1 and pp2 from the full array + // s3(64,63) of synchronized symbol spectra. + ncandidates=ncandidates+1; + nhard=0; + nsoft=0; + for (i=0; i<63; i++) { + if(workdat[i] != rxdat[i]) { + nhard=nhard+1; + if(workdat[i] != rxdat2[i]) { + nsoft=nsoft+rxprob[i]; + } + } + } + nsoft=63*nsoft/nsum; + ntotal=nsoft+nhard; + + getpp_(workdat,&pp); + if(pp>pp1) { + pp2=pp1; + pp1=pp; + nsoft_min=nsoft; + nhard_min=nhard; + ntotal_min=ntotal; + memcpy(correct,workdat,63*sizeof(int)); + nera_best=numera; + ntry[0]=k; + } else { + if(pp>pp2 && pp!=pp1) pp2=pp; + } + if(nhard_min <= 41 && ntotal_min <= 71) break; + } + if(k == ntrials) ntry[0]=k; + } + + param[0]=ncandidates; + param[1]=nhard_min; + param[2]=nsoft_min; + param[3]=nera_best; + param[4]= pp1 > 0 ? 1000.0*pp2/pp1 : 1000.0; + param[5]=ntotal_min; + param[6]=ntry[0]; + param[7]=1000.0*pp2; + param[8]=1000.0*pp1; + if(param[0]==0) param[2]=-1; + return; +} diff --git a/lib/ftrsd/ftrsd_paper/Makefile b/lib/ftrsd/ftrsd_paper/Makefile index 924948ab..a594397a 100755 --- a/lib/ftrsd/ftrsd_paper/Makefile +++ b/lib/ftrsd/ftrsd_paper/Makefile @@ -1,40 +1,40 @@ -CC = gcc -FC = gfortran - -# Default rules -%.o: %.c - ${CC} ${CFLAGS} -c $< -%.o: %.f - ${FC} ${FFLAGS} -c $< -%.o: %.F - ${FC} ${FFLAGS} -c $< -%.o: %.f90 - ${FC} ${FFLAGS} -c $< -%.o: %.F90 - ${FC} ${FFLAGS} -c $< - -all: mfsk probs.out - -OBJS1 = prob.o binomial_subs.o -prob: $(OBJS1) - $(FC) -o prob $(OBJS1) - -OBJS2 = mfsk.o binomial_subs.o -mfsk: $(OBJS2) - $(FC) -o mfsk $(OBJS2) - -OBJS3 = bodide.o binomial_subs.o -bodide: $(OBJS3) - $(FC) -o bodide $(OBJS3) - - -probs.out: prob -# x N X s - prob 35 63 40 40 > probs.out - prob 37 63 40 45 >> probs.out - prob 37 53 40 45 >> probs.out - prob 38 53 40 47 >> probs.out - -clean: - rm -rf *.o prob probs.out - +CC = gcc +FC = gfortran + +# Default rules +%.o: %.c + ${CC} ${CFLAGS} -c $< +%.o: %.f + ${FC} ${FFLAGS} -c $< +%.o: %.F + ${FC} ${FFLAGS} -c $< +%.o: %.f90 + ${FC} ${FFLAGS} -c $< +%.o: %.F90 + ${FC} ${FFLAGS} -c $< + +all: mfsk probs.out + +OBJS1 = prob.o binomial_subs.o +prob: $(OBJS1) + $(FC) -o prob $(OBJS1) + +OBJS2 = mfsk.o binomial_subs.o +mfsk: $(OBJS2) + $(FC) -o mfsk $(OBJS2) + +OBJS3 = bodide.o binomial_subs.o +bodide: $(OBJS3) + $(FC) -o bodide $(OBJS3) + + +probs.out: prob +# x N X s + prob 35 63 40 40 > probs.out + prob 37 63 40 45 >> probs.out + prob 37 53 40 45 >> probs.out + prob 38 53 40 47 >> probs.out + +clean: + rm -rf *.o prob probs.out + diff --git a/lib/ftrsd/ftrsd_paper/binomial.c b/lib/ftrsd/ftrsd_paper/binomial.c index c4180250..fcbdafd9 100755 --- a/lib/ftrsd/ftrsd_paper/binomial.c +++ b/lib/ftrsd/ftrsd_paper/binomial.c @@ -1,69 +1,69 @@ -#include -#include - -/* Original code copied from - http://rosettacode.org/wiki/Evaluate_binomial_coefficients -*/ - -/* We go to some effort to handle overflow situations */ - -static unsigned long gcd_ui(unsigned long x, unsigned long y) { - unsigned long t; - if (y < x) { t = x; x = y; y = t; } - while (y > 0) { - t = y; y = x % y; x = t; /* y1 <- x0 % y0 ; x1 <- y0 */ - } - return x; -} - -unsigned long binomial(unsigned long n, unsigned long k) { - unsigned long d, g, r = 1; - if (k == 0) return 1; - if (k == 1) return n; - if (k >= n) return (k == n); - if (k > n/2) k = n-k; - for (d = 1; d <= k; d++) { - if (r >= ULONG_MAX/n) { /* Possible overflow */ - unsigned long nr, dr; /* reduced numerator / denominator */ - g = gcd_ui(n, d); nr = n/g; dr = d/g; - g = gcd_ui(r, dr); r = r/g; dr = dr/g; - if (r >= ULONG_MAX/nr) return 0; /* Unavoidable overflow */ - r *= nr; - r /= dr; - n--; - } else { - r *= n--; - r /= d; - } - } - return r; -} - -int main() { - - //Get test results - printf("%lu\n", binomial(5, 3)); // 10 - printf("%lu\n", binomial(40, 19)); // 131282408400 - printf("%lu\n", binomial(67, 31)); // 11923179284862717872 - - // Compute special cases for paper on TF soft-decision RS decoder: - double a,b,c,p; - a=(double)binomial(40, 35); - b=(double)binomial(23, 5); - c=(double)binomial(63, 40); - p=a*b/c; - printf("%e %e %e %e\n",a,b,c,p); - - a=(double)binomial(40, 36); - b=(double)binomial(23, 4); - c=(double)binomial(63, 40); - p=a*b/c; - printf("%e %e %e %e\n",a,b,c,p); - - a=(double)binomial(40, 37); - b=(double)binomial(23, 8); - c=(double)binomial(63, 45); - p=a*b/c; - printf("%e %e %e %e\n",a,b,c,p); - return 0; -} +#include +#include + +/* Original code copied from + http://rosettacode.org/wiki/Evaluate_binomial_coefficients +*/ + +/* We go to some effort to handle overflow situations */ + +static unsigned long gcd_ui(unsigned long x, unsigned long y) { + unsigned long t; + if (y < x) { t = x; x = y; y = t; } + while (y > 0) { + t = y; y = x % y; x = t; /* y1 <- x0 % y0 ; x1 <- y0 */ + } + return x; +} + +unsigned long binomial(unsigned long n, unsigned long k) { + unsigned long d, g, r = 1; + if (k == 0) return 1; + if (k == 1) return n; + if (k >= n) return (k == n); + if (k > n/2) k = n-k; + for (d = 1; d <= k; d++) { + if (r >= ULONG_MAX/n) { /* Possible overflow */ + unsigned long nr, dr; /* reduced numerator / denominator */ + g = gcd_ui(n, d); nr = n/g; dr = d/g; + g = gcd_ui(r, dr); r = r/g; dr = dr/g; + if (r >= ULONG_MAX/nr) return 0; /* Unavoidable overflow */ + r *= nr; + r /= dr; + n--; + } else { + r *= n--; + r /= d; + } + } + return r; +} + +int main() { + + //Get test results + printf("%lu\n", binomial(5, 3)); // 10 + printf("%lu\n", binomial(40, 19)); // 131282408400 + printf("%lu\n", binomial(67, 31)); // 11923179284862717872 + + // Compute special cases for paper on TF soft-decision RS decoder: + double a,b,c,p; + a=(double)binomial(40, 35); + b=(double)binomial(23, 5); + c=(double)binomial(63, 40); + p=a*b/c; + printf("%e %e %e %e\n",a,b,c,p); + + a=(double)binomial(40, 36); + b=(double)binomial(23, 4); + c=(double)binomial(63, 40); + p=a*b/c; + printf("%e %e %e %e\n",a,b,c,p); + + a=(double)binomial(40, 37); + b=(double)binomial(23, 8); + c=(double)binomial(63, 45); + p=a*b/c; + printf("%e %e %e %e\n",a,b,c,p); + return 0; +} diff --git a/lib/ftrsd/ftrsd_paper/binomial_subs.c b/lib/ftrsd/ftrsd_paper/binomial_subs.c index e32f5046..be4a0ae5 100755 --- a/lib/ftrsd/ftrsd_paper/binomial_subs.c +++ b/lib/ftrsd/ftrsd_paper/binomial_subs.c @@ -1,55 +1,55 @@ -#include -#include - -/* Original code copied from - http://rosettacode.org/wiki/Evaluate_binomial_coefficients -*/ - -/* We go to some effort to handle overflow situations */ - -static unsigned long long gcd_ui(unsigned long long x, unsigned long long y) { - unsigned long long t; - if (y < x) { t = x; x = y; y = t; } - while (y > 0) { - t = y; y = x % y; x = t; /* y1 <- x0 % y0 ; x1 <- y0 */ - } - return x; -} - -unsigned long long binomial(unsigned long long n, unsigned long long k) { - unsigned long long d, g, r = 1; - if (k == 0) return 1; - if (k == 1) return n; - if (k >= n) return (k == n); - if (k > n/2) k = n-k; - for (d = 1; d <= k; d++) { - if (r >= ULLONG_MAX/n) { /* Possible overflow */ - unsigned long long nr, dr; /* reduced numerator / denominator */ - g = gcd_ui(n, d); nr = n/g; dr = d/g; - g = gcd_ui(r, dr); r = r/g; dr = dr/g; - if (r >= ULLONG_MAX/nr) return 0; /* Unavoidable overflow */ - r *= nr; - r /= dr; - n--; - } else { - r *= n--; - r /= d; - } - } - return r; -} - -unsigned long long binomial_(int *n, int *k) -{ - // printf("n=%d k=%d %lu\n",*n,*k,binomial(*n,*k)); - return binomial(*n,*k); -} - -double hypergeo_(int *x, int *NN, int *XX, int *s) -{ - double a,b,c; - a=(double)binomial(*XX, *x); - b=(double)binomial(*NN-*XX, *s-*x); - c=(double)binomial(*NN, *s); - return a*b/c; -} +#include +#include + +/* Original code copied from + http://rosettacode.org/wiki/Evaluate_binomial_coefficients +*/ + +/* We go to some effort to handle overflow situations */ + +static unsigned long long gcd_ui(unsigned long long x, unsigned long long y) { + unsigned long long t; + if (y < x) { t = x; x = y; y = t; } + while (y > 0) { + t = y; y = x % y; x = t; /* y1 <- x0 % y0 ; x1 <- y0 */ + } + return x; +} + +unsigned long long binomial(unsigned long long n, unsigned long long k) { + unsigned long long d, g, r = 1; + if (k == 0) return 1; + if (k == 1) return n; + if (k >= n) return (k == n); + if (k > n/2) k = n-k; + for (d = 1; d <= k; d++) { + if (r >= ULLONG_MAX/n) { /* Possible overflow */ + unsigned long long nr, dr; /* reduced numerator / denominator */ + g = gcd_ui(n, d); nr = n/g; dr = d/g; + g = gcd_ui(r, dr); r = r/g; dr = dr/g; + if (r >= ULLONG_MAX/nr) return 0; /* Unavoidable overflow */ + r *= nr; + r /= dr; + n--; + } else { + r *= n--; + r /= d; + } + } + return r; +} + +unsigned long long binomial_(int *n, int *k) +{ + // printf("n=%d k=%d %lu\n",*n,*k,binomial(*n,*k)); + return binomial(*n,*k); +} + +double hypergeo_(int *x, int *NN, int *XX, int *s) +{ + double a,b,c; + a=(double)binomial(*XX, *x); + b=(double)binomial(*NN-*XX, *s-*x); + c=(double)binomial(*NN, *s); + return a*b/c; +} diff --git a/lib/ftrsd/ftrsd_paper/bmdata-rf.dat b/lib/ftrsd/ftrsd_paper/bmdata-rf.dat index 443804be..17d53312 100755 --- a/lib/ftrsd/ftrsd_paper/bmdata-rf.dat +++ b/lib/ftrsd/ftrsd_paper/bmdata-rf.dat @@ -1,11 +1,11 @@ -fspread0 0.2, BM (ntrials=0) --22.0 0.09 --21.5 0.20 --21.0 0.36 --20.5 0.55 --20.0 0.69 --19.5 0.83 --19.0 0.91 --18.5 0.960 --18.0 0.978 --17.5 0.987 +fspread0 0.2, BM (ntrials=0) +-22.0 0.09 +-21.5 0.20 +-21.0 0.36 +-20.5 0.55 +-20.0 0.69 +-19.5 0.83 +-19.0 0.91 +-18.5 0.960 +-18.0 0.978 +-17.5 0.987 diff --git a/lib/ftrsd/ftrsd_paper/bmdata.dat b/lib/ftrsd/ftrsd_paper/bmdata.dat index 053c9024..987bbbba 100755 --- a/lib/ftrsd/ftrsd_paper/bmdata.dat +++ b/lib/ftrsd/ftrsd_paper/bmdata.dat @@ -1,8 +1,8 @@ --24.5 0.000 --24.0 0.006 --23.5 0.046 0.066 --23.0 0.250 0.305 --22.5 0.630 0.701 --22.0 0.900 0.945 --21.5 0.992 0.9974 --21.0 0.99987 +-24.5 0.000 +-24.0 0.006 +-23.5 0.046 0.066 +-23.0 0.250 0.305 +-22.5 0.630 0.701 +-22.0 0.900 0.945 +-21.5 0.992 0.9974 +-21.0 0.99987 diff --git a/lib/ftrsd/ftrsd_paper/bmtheory25.dat b/lib/ftrsd/ftrsd_paper/bmtheory25.dat index cd5bac0f..de854562 100755 --- a/lib/ftrsd/ftrsd_paper/bmtheory25.dat +++ b/lib/ftrsd/ftrsd_paper/bmtheory25.dat @@ -1,43 +1,43 @@ -Es/No P(word error) ----------------------- - 0.0 0.9008E+00 0.1000E+01 - 0.5 0.8877E+00 0.1000E+01 - 1.0 0.8724E+00 0.1000E+01 - 1.5 0.8545E+00 0.1000E+01 - 2.0 0.8338E+00 0.1000E+01 - 2.5 0.8096E+00 0.1000E+01 - 3.0 0.7817E+00 0.1000E+01 - 3.5 0.7496E+00 0.1000E+01 - 4.0 0.7128E+00 0.1000E+01 - 4.5 0.6712E+00 0.1000E+01 - 5.0 0.6246E+00 0.9998E+00 - 5.5 0.5731E+00 0.9964E+00 - 6.0 0.5170E+00 0.9629E+00 - 6.5 0.4572E+00 0.7979E+00 - 7.0 0.3949E+00 0.4327E+00 - 7.5 0.3316E+00 0.1100E+00 - 8.0 0.2696E+00 0.9707E-02 - 8.5 0.2109E+00 0.2303E-03 - 9.0 0.1578E+00 0.1170E-05 - 9.5 0.1121E+00 0.1027E-08 -10.0 0.7499E-01 0.1263E-12 -10.5 0.4684E-01 0.1768E-17 -11.0 0.2703E-01 0.2282E-23 -11.5 0.1426E-01 0.2200E-30 -12.0 0.6789E-02 -.1348E-32 -12.5 0.2879E-02 -.1733E-32 -13.0 0.1072E-02 -.2119E-32 -13.5 0.3448E-03 0.3081E-32 -14.0 0.9421E-04 0.3852E-33 -14.5 0.2148E-04 -.1156E-32 -15.0 0.4006E-05 -.1733E-32 -15.5 0.5984E-06 0.2215E-32 -16.0 0.6994E-07 -.4430E-32 -16.5 0.6230E-08 -.3081E-32 -17.0 0.4105E-09 -.2889E-32 -17.5 0.1934E-10 -.1926E-33 -18.0 0.6266E-12 0.3852E-32 -18.5 0.1335E-13 -.1926E-33 -19.0 0.1777E-15 0.2119E-32 -19.5 0.1396E-17 0.1733E-32 -20.0 0.6076E-20 -.3852E-33 +Es/No P(word error) +---------------------- + 0.0 0.9008E+00 0.1000E+01 + 0.5 0.8877E+00 0.1000E+01 + 1.0 0.8724E+00 0.1000E+01 + 1.5 0.8545E+00 0.1000E+01 + 2.0 0.8338E+00 0.1000E+01 + 2.5 0.8096E+00 0.1000E+01 + 3.0 0.7817E+00 0.1000E+01 + 3.5 0.7496E+00 0.1000E+01 + 4.0 0.7128E+00 0.1000E+01 + 4.5 0.6712E+00 0.1000E+01 + 5.0 0.6246E+00 0.9998E+00 + 5.5 0.5731E+00 0.9964E+00 + 6.0 0.5170E+00 0.9629E+00 + 6.5 0.4572E+00 0.7979E+00 + 7.0 0.3949E+00 0.4327E+00 + 7.5 0.3316E+00 0.1100E+00 + 8.0 0.2696E+00 0.9707E-02 + 8.5 0.2109E+00 0.2303E-03 + 9.0 0.1578E+00 0.1170E-05 + 9.5 0.1121E+00 0.1027E-08 +10.0 0.7499E-01 0.1263E-12 +10.5 0.4684E-01 0.1768E-17 +11.0 0.2703E-01 0.2282E-23 +11.5 0.1426E-01 0.2200E-30 +12.0 0.6789E-02 -.1348E-32 +12.5 0.2879E-02 -.1733E-32 +13.0 0.1072E-02 -.2119E-32 +13.5 0.3448E-03 0.3081E-32 +14.0 0.9421E-04 0.3852E-33 +14.5 0.2148E-04 -.1156E-32 +15.0 0.4006E-05 -.1733E-32 +15.5 0.5984E-06 0.2215E-32 +16.0 0.6994E-07 -.4430E-32 +16.5 0.6230E-08 -.3081E-32 +17.0 0.4105E-09 -.2889E-32 +17.5 0.1934E-10 -.1926E-33 +18.0 0.6266E-12 0.3852E-32 +18.5 0.1335E-13 -.1926E-33 +19.0 0.1777E-15 0.2119E-32 +19.5 0.1396E-17 0.1733E-32 +20.0 0.6076E-20 -.3852E-33 diff --git a/lib/ftrsd/ftrsd_paper/bmtheory40.dat b/lib/ftrsd/ftrsd_paper/bmtheory40.dat index 473509d0..4903ef5c 100755 --- a/lib/ftrsd/ftrsd_paper/bmtheory40.dat +++ b/lib/ftrsd/ftrsd_paper/bmtheory40.dat @@ -1,43 +1,43 @@ -Es/No P(word error) ----------------------- - 0.0 0.9008E+00 0.1000E+01 - 0.5 0.8877E+00 0.1000E+01 - 1.0 0.8724E+00 0.1000E+01 - 1.5 0.8545E+00 0.1000E+01 - 2.0 0.8338E+00 0.9999E+00 - 2.5 0.8096E+00 0.9991E+00 - 3.0 0.7817E+00 0.9944E+00 - 3.5 0.7496E+00 0.9713E+00 - 4.0 0.7128E+00 0.8887E+00 - 4.5 0.6712E+00 0.6883E+00 - 5.0 0.6246E+00 0.3865E+00 - 5.5 0.5731E+00 0.1310E+00 - 6.0 0.5170E+00 0.2215E-01 - 6.5 0.4572E+00 0.1536E-02 - 7.0 0.3949E+00 0.3562E-04 - 7.5 0.3316E+00 0.2223E-06 - 8.0 0.2696E+00 0.2951E-09 - 8.5 0.2109E+00 0.6449E-13 - 9.0 0.1578E+00 0.1758E-17 - 9.5 0.1121E+00 0.4426E-23 -10.0 0.7499E-01 0.7428E-30 -10.5 0.4684E-01 -.1733E-32 -11.0 0.2703E-01 0.1348E-32 -11.5 0.1426E-01 0.2985E-32 -12.0 0.6789E-02 -.1348E-32 -12.5 0.2879E-02 -.1733E-32 -13.0 0.1072E-02 -.2119E-32 -13.5 0.3448E-03 0.3081E-32 -14.0 0.9421E-04 0.3852E-33 -14.5 0.2148E-04 -.1156E-32 -15.0 0.4006E-05 -.1733E-32 -15.5 0.5984E-06 0.2215E-32 -16.0 0.6994E-07 -.4430E-32 -16.5 0.6230E-08 -.3081E-32 -17.0 0.4105E-09 -.2889E-32 -17.5 0.1934E-10 -.1926E-33 -18.0 0.6266E-12 0.3852E-32 -18.5 0.1335E-13 -.1926E-33 -19.0 0.1777E-15 0.2119E-32 -19.5 0.1396E-17 0.1733E-32 -20.0 0.6076E-20 -.3852E-33 +Es/No P(word error) +---------------------- + 0.0 0.9008E+00 0.1000E+01 + 0.5 0.8877E+00 0.1000E+01 + 1.0 0.8724E+00 0.1000E+01 + 1.5 0.8545E+00 0.1000E+01 + 2.0 0.8338E+00 0.9999E+00 + 2.5 0.8096E+00 0.9991E+00 + 3.0 0.7817E+00 0.9944E+00 + 3.5 0.7496E+00 0.9713E+00 + 4.0 0.7128E+00 0.8887E+00 + 4.5 0.6712E+00 0.6883E+00 + 5.0 0.6246E+00 0.3865E+00 + 5.5 0.5731E+00 0.1310E+00 + 6.0 0.5170E+00 0.2215E-01 + 6.5 0.4572E+00 0.1536E-02 + 7.0 0.3949E+00 0.3562E-04 + 7.5 0.3316E+00 0.2223E-06 + 8.0 0.2696E+00 0.2951E-09 + 8.5 0.2109E+00 0.6449E-13 + 9.0 0.1578E+00 0.1758E-17 + 9.5 0.1121E+00 0.4426E-23 +10.0 0.7499E-01 0.7428E-30 +10.5 0.4684E-01 -.1733E-32 +11.0 0.2703E-01 0.1348E-32 +11.5 0.1426E-01 0.2985E-32 +12.0 0.6789E-02 -.1348E-32 +12.5 0.2879E-02 -.1733E-32 +13.0 0.1072E-02 -.2119E-32 +13.5 0.3448E-03 0.3081E-32 +14.0 0.9421E-04 0.3852E-33 +14.5 0.2148E-04 -.1156E-32 +15.0 0.4006E-05 -.1733E-32 +15.5 0.5984E-06 0.2215E-32 +16.0 0.6994E-07 -.4430E-32 +16.5 0.6230E-08 -.3081E-32 +17.0 0.4105E-09 -.2889E-32 +17.5 0.1934E-10 -.1926E-33 +18.0 0.6266E-12 0.3852E-32 +18.5 0.1335E-13 -.1926E-33 +19.0 0.1777E-15 0.2119E-32 +19.5 0.1396E-17 0.1733E-32 +20.0 0.6076E-20 -.3852E-33 diff --git a/lib/ftrsd/ftrsd_paper/bmtheory43.dat b/lib/ftrsd/ftrsd_paper/bmtheory43.dat index c0e552be..b22ab8d8 100755 --- a/lib/ftrsd/ftrsd_paper/bmtheory43.dat +++ b/lib/ftrsd/ftrsd_paper/bmtheory43.dat @@ -1,43 +1,43 @@ -Es/No P(word error) ----------------------- - 0.0 0.9008E+00 0.1000E+01 - 0.5 0.8877E+00 0.1000E+01 - 1.0 0.8724E+00 0.9999E+00 - 1.5 0.8545E+00 0.9996E+00 - 2.0 0.8338E+00 0.9977E+00 - 2.5 0.8096E+00 0.9889E+00 - 3.0 0.7817E+00 0.9559E+00 - 3.5 0.7496E+00 0.8599E+00 - 4.0 0.7128E+00 0.6586E+00 - 4.5 0.6712E+00 0.3780E+00 - 5.0 0.6246E+00 0.1397E+00 - 5.5 0.5731E+00 0.2826E-01 - 6.0 0.5170E+00 0.2632E-02 - 6.5 0.4572E+00 0.9396E-04 - 7.0 0.3949E+00 0.1052E-05 - 7.5 0.3316E+00 0.2965E-08 - 8.0 0.2696E+00 0.1650E-11 - 8.5 0.2109E+00 0.1388E-15 - 9.0 0.1578E+00 0.1316E-20 - 9.5 0.1121E+00 0.1021E-26 -10.0 0.7499E-01 -.9630E-33 -10.5 0.4684E-01 -.1733E-32 -11.0 0.2703E-01 0.1348E-32 -11.5 0.1426E-01 0.2985E-32 -12.0 0.6789E-02 -.1348E-32 -12.5 0.2879E-02 -.1733E-32 -13.0 0.1072E-02 -.2119E-32 -13.5 0.3448E-03 0.3081E-32 -14.0 0.9421E-04 0.3852E-33 -14.5 0.2148E-04 -.1156E-32 -15.0 0.4006E-05 -.1733E-32 -15.5 0.5984E-06 0.2215E-32 -16.0 0.6994E-07 -.4430E-32 -16.5 0.6230E-08 -.3081E-32 -17.0 0.4105E-09 -.2889E-32 -17.5 0.1934E-10 -.1926E-33 -18.0 0.6266E-12 0.3852E-32 -18.5 0.1335E-13 -.1926E-33 -19.0 0.1777E-15 0.2119E-32 -19.5 0.1396E-17 0.1733E-32 -20.0 0.6076E-20 -.3852E-33 +Es/No P(word error) +---------------------- + 0.0 0.9008E+00 0.1000E+01 + 0.5 0.8877E+00 0.1000E+01 + 1.0 0.8724E+00 0.9999E+00 + 1.5 0.8545E+00 0.9996E+00 + 2.0 0.8338E+00 0.9977E+00 + 2.5 0.8096E+00 0.9889E+00 + 3.0 0.7817E+00 0.9559E+00 + 3.5 0.7496E+00 0.8599E+00 + 4.0 0.7128E+00 0.6586E+00 + 4.5 0.6712E+00 0.3780E+00 + 5.0 0.6246E+00 0.1397E+00 + 5.5 0.5731E+00 0.2826E-01 + 6.0 0.5170E+00 0.2632E-02 + 6.5 0.4572E+00 0.9396E-04 + 7.0 0.3949E+00 0.1052E-05 + 7.5 0.3316E+00 0.2965E-08 + 8.0 0.2696E+00 0.1650E-11 + 8.5 0.2109E+00 0.1388E-15 + 9.0 0.1578E+00 0.1316E-20 + 9.5 0.1121E+00 0.1021E-26 +10.0 0.7499E-01 -.9630E-33 +10.5 0.4684E-01 -.1733E-32 +11.0 0.2703E-01 0.1348E-32 +11.5 0.1426E-01 0.2985E-32 +12.0 0.6789E-02 -.1348E-32 +12.5 0.2879E-02 -.1733E-32 +13.0 0.1072E-02 -.2119E-32 +13.5 0.3448E-03 0.3081E-32 +14.0 0.9421E-04 0.3852E-33 +14.5 0.2148E-04 -.1156E-32 +15.0 0.4006E-05 -.1733E-32 +15.5 0.5984E-06 0.2215E-32 +16.0 0.6994E-07 -.4430E-32 +16.5 0.6230E-08 -.3081E-32 +17.0 0.4105E-09 -.2889E-32 +17.5 0.1934E-10 -.1926E-33 +18.0 0.6266E-12 0.3852E-32 +18.5 0.1335E-13 -.1926E-33 +19.0 0.1777E-15 0.2119E-32 +19.5 0.1396E-17 0.1733E-32 +20.0 0.6076E-20 -.3852E-33 diff --git a/lib/ftrsd/ftrsd_paper/bodide.f90 b/lib/ftrsd/ftrsd_paper/bodide.f90 index 248cb890..72e0f137 100755 --- a/lib/ftrsd/ftrsd_paper/bodide.f90 +++ b/lib/ftrsd/ftrsd_paper/bodide.f90 @@ -1,54 +1,54 @@ -program bodide -! Compute probability of word error for a bounded distance decoder. -! Hardwired for non-coherent 64-FSK and the JT65 RS (63,12) code on GF(64). -! -! Let ps be symbol error probability. -! The probability of getting an error pattern with e symbol errors is: -! ps^e * (1-ps)*(n-e) -! The number of error patterns with e errors is binomial(63,e) -! Overall probability of getting a word with e errors is: -! P(e)= binomial(63,e)* ps^e * (1-ps)*(n-e) -! Probability that word is correct is P(0 to 25 errors) = sum{e=0}^{25} P(e) -! Probability that word is wrong is 1-P(0 to 25 errors) -! P_word_error=1-( sum_{e=0}^{t} P(e) ) -! - implicit real*16 (a-h,o-z) - - integer*8 binomial - integer x,s,XX,NN,M - character arg*8 - - nargs=iargc() - if(nargs.ne.1) then - print*,'Probability of word error for noncoherent 64-FSK with bounded distance decoding' - print*,'Usage: bounded_distance D' - print*,'Example: bounded_distance 25' - go to 999 - endif - call getarg(1,arg) - read(arg,*) nt - M=64 - write(*,1012) -1012 format('Es/No P(word error)'/ & - '----------------------') - do isnr=0,40 - esno=10**(isnr/2.0/10.0) - hsum=0.d0 - do k=1,M-1 - h=binomial(M-1,k) - h=h*((-1)**(k+1))/(k+1) - h=h*exp(-esno*k/(k+1)) - hsum=hsum + h - enddo - ps=hsum - hsum=0.d0 - do i=0,nt - h=binomial(63,i) - h=h*ps**i - h=h*(1-ps)**(63-i) - hsum=hsum+h - enddo - pw=1-hsum - write(*,'(f4.1,4x,e10.4,4x,e10.4)') isnr/2.0, ps, pw - enddo -999 end program bodide +program bodide +! Compute probability of word error for a bounded distance decoder. +! Hardwired for non-coherent 64-FSK and the JT65 RS (63,12) code on GF(64). +! +! Let ps be symbol error probability. +! The probability of getting an error pattern with e symbol errors is: +! ps^e * (1-ps)*(n-e) +! The number of error patterns with e errors is binomial(63,e) +! Overall probability of getting a word with e errors is: +! P(e)= binomial(63,e)* ps^e * (1-ps)*(n-e) +! Probability that word is correct is P(0 to 25 errors) = sum{e=0}^{25} P(e) +! Probability that word is wrong is 1-P(0 to 25 errors) +! P_word_error=1-( sum_{e=0}^{t} P(e) ) +! + implicit real*16 (a-h,o-z) + + integer*8 binomial + integer x,s,XX,NN,M + character arg*8 + + nargs=iargc() + if(nargs.ne.1) then + print*,'Probability of word error for noncoherent 64-FSK with bounded distance decoding' + print*,'Usage: bounded_distance D' + print*,'Example: bounded_distance 25' + go to 999 + endif + call getarg(1,arg) + read(arg,*) nt + M=64 + write(*,1012) +1012 format('Es/No P(word error)'/ & + '----------------------') + do isnr=0,40 + esno=10**(isnr/2.0/10.0) + hsum=0.d0 + do k=1,M-1 + h=binomial(M-1,k) + h=h*((-1)**(k+1))/(k+1) + h=h*exp(-esno*k/(k+1)) + hsum=hsum + h + enddo + ps=hsum + hsum=0.d0 + do i=0,nt + h=binomial(63,i) + h=h*ps**i + h=h*(1-ps)**(63-i) + hsum=hsum+h + enddo + pw=1-hsum + write(*,'(f4.1,4x,e10.4,4x,e10.4)') isnr/2.0, ps, pw + enddo +999 end program bodide diff --git a/lib/ftrsd/ftrsd_paper/bodide.lab b/lib/ftrsd/ftrsd_paper/bodide.lab index 2847dae9..6fa108e0 100755 --- a/lib/ftrsd/ftrsd_paper/bodide.lab +++ b/lib/ftrsd/ftrsd_paper/bodide.lab @@ -1,4 +1,4 @@ -7.5 0.05 BM -6.9 0.015 Theory -5.55 0.05 KV -5.3 0.005 FT +7.5 0.05 BM +6.9 0.015 Theory +5.55 0.05 KV +5.3 0.005 FT diff --git a/lib/ftrsd/ftrsd_paper/fig_bodide.gnuplot b/lib/ftrsd/ftrsd_paper/fig_bodide.gnuplot index 6c367d0c..b8bb0ada 100755 --- a/lib/ftrsd/ftrsd_paper/fig_bodide.gnuplot +++ b/lib/ftrsd/ftrsd_paper/fig_bodide.gnuplot @@ -1,24 +1,24 @@ -# gnuplot script for comparison to theoretical word error rate for -# bounded distance decoding - -# run: gnuplot fig_bodide.gnuplot -# then: pdflatex fig_bodide.tex - -set term epslatex standalone size 6in,2*6/3in -set output "fig_bodide.tex" -set xlabel "$E_b/N_0$ (dB)" -set ylabel "Word Error Rate" -set style func linespoints -set key off -set tics in -set mxtics 2 -set mytics 10 -set grid -set logscale y -plot [3:9] [1e-4:1] \ - "bmdata.dat" using ($1+29.1):(1-$2) with linespoints lt 2 lw 2 pt 2, \ - "ftdata-100000.dat" using ($1+29.1):(1-$3) with linespoints lt 1 lw 2 pt 7, \ - "bmtheory25.dat" using ($1-0.6):3 with linespoints lt 1 pt 5, \ - "kvasd-15.dat" using ($1+29.1):(1-$3) with linespoints lt 4 pt 6, \ - "bodide.lab" with labels - +# gnuplot script for comparison to theoretical word error rate for +# bounded distance decoding + +# run: gnuplot fig_bodide.gnuplot +# then: pdflatex fig_bodide.tex + +set term epslatex standalone size 6in,2*6/3in +set output "fig_bodide.tex" +set xlabel "$E_b/N_0$ (dB)" +set ylabel "Word Error Rate" +set style func linespoints +set key off +set tics in +set mxtics 2 +set mytics 10 +set grid +set logscale y +plot [3:9] [1e-4:1] \ + "bmdata.dat" using ($1+29.1):(1-$2) with linespoints lt 2 lw 2 pt 2, \ + "ftdata-100000.dat" using ($1+29.1):(1-$3) with linespoints lt 1 lw 2 pt 7, \ + "bmtheory25.dat" using ($1-0.6):3 with linespoints lt 1 pt 5, \ + "kvasd-15.dat" using ($1+29.1):(1-$3) with linespoints lt 4 pt 6, \ + "bodide.lab" with labels + diff --git a/lib/ftrsd/ftrsd_paper/fig_ntrials_vs_nhard.gnuplot b/lib/ftrsd/ftrsd_paper/fig_ntrials_vs_nhard.gnuplot index febcb993..9a6c9b08 100755 --- a/lib/ftrsd/ftrsd_paper/fig_ntrials_vs_nhard.gnuplot +++ b/lib/ftrsd/ftrsd_paper/fig_ntrials_vs_nhard.gnuplot @@ -1,14 +1,14 @@ -# gnuplot script for "ntrials_vs_nhard" figure -# run: gnuplot fig_ntrials_vs_nhard.gnuplot -# then: pdflatex fig_ntrials_vs_nhard.tex -# -set term epslatex standalone size 6in,2*6/3in -set output "fig_ntrials_vs_nhard.tex" -set xlabel "Errors in received word, $X$" -set ylabel "Number of trials" -set tics in -set mxtics 5 -set mytics 10 -#set grid -set logscale y -plot "stats-100000-24db-3.dat" using 1:4 pt 12 notitle +# gnuplot script for "ntrials_vs_nhard" figure +# run: gnuplot fig_ntrials_vs_nhard.gnuplot +# then: pdflatex fig_ntrials_vs_nhard.tex +# +set term epslatex standalone size 6in,2*6/3in +set output "fig_ntrials_vs_nhard.tex" +set xlabel "Errors in received word, $X$" +set ylabel "Number of trials" +set tics in +set mxtics 5 +set mytics 10 +#set grid +set logscale y +plot "stats-100000-24db-3.dat" using 1:4 pt 12 notitle diff --git a/lib/ftrsd/ftrsd_paper/fig_psuccess.gnuplot b/lib/ftrsd/ftrsd_paper/fig_psuccess.gnuplot index 785925c1..3718e29f 100755 --- a/lib/ftrsd/ftrsd_paper/fig_psuccess.gnuplot +++ b/lib/ftrsd/ftrsd_paper/fig_psuccess.gnuplot @@ -1,25 +1,25 @@ -# gnuplot script for "Percent copy" figure -# run: gnuplot fig_psuccess.gnuplot -# then: pdflatex fig_psuccess.tex -# -set term epslatex standalone size 6in,4in -set output "fig_psuccess.tex" -set xlabel "SNR in 2500 Hz Bandwidth (dB)" -set ylabel "Percent copy" -set style func linespoints -set key off -set tics in -set mxtics 2 -set mytics 2 -set grid -plot [-30:-18] [0:105] \ - "stats_0.0" using 1:($4)/10.0 with linespoints lt 2 lw 2 pt 2, \ - "stats_0.0" using 1:($5)/10.0 with linespoints lt 1 lw 2 pt 3, \ - "stats_0.0" using 1:($6)/10.0 with linespoints lt 3 lw 2 pt 4, \ - "stats_0.2" using 1:($4)/10.0 with linespoints lt 2 pt 2, \ - "stats_0.2" using 1:($5)/10.0 with linespoints lt 1 pt 3, \ - "stats_0.2" using 1:($6)/10.0 with linespoints lt 3 pt 4, \ - "stats_1.0" using 1:($4)/10.0 with linespoints lt 2 pt 2, \ - "stats_1.0" using 1:($5)/10.0 with linespoints lt 1 pt 3, \ - "stats_1.0" using 1:($6)/10.0 with linespoints lt 3 pt 4, \ - "psuccess.lab" with labels +# gnuplot script for "Percent copy" figure +# run: gnuplot fig_psuccess.gnuplot +# then: pdflatex fig_psuccess.tex +# +set term epslatex standalone size 6in,4in +set output "fig_psuccess.tex" +set xlabel "SNR in 2500 Hz Bandwidth (dB)" +set ylabel "Percent copy" +set style func linespoints +set key off +set tics in +set mxtics 2 +set mytics 2 +set grid +plot [-30:-18] [0:105] \ + "stats_0.0" using 1:($4)/10.0 with linespoints lt 2 lw 2 pt 2, \ + "stats_0.0" using 1:($5)/10.0 with linespoints lt 1 lw 2 pt 3, \ + "stats_0.0" using 1:($6)/10.0 with linespoints lt 3 lw 2 pt 4, \ + "stats_0.2" using 1:($4)/10.0 with linespoints lt 2 pt 2, \ + "stats_0.2" using 1:($5)/10.0 with linespoints lt 1 pt 3, \ + "stats_0.2" using 1:($6)/10.0 with linespoints lt 3 pt 4, \ + "stats_1.0" using 1:($4)/10.0 with linespoints lt 2 pt 2, \ + "stats_1.0" using 1:($5)/10.0 with linespoints lt 1 pt 3, \ + "stats_1.0" using 1:($6)/10.0 with linespoints lt 3 pt 4, \ + "psuccess.lab" with labels diff --git a/lib/ftrsd/ftrsd_paper/fig_wer.gnuplot b/lib/ftrsd/ftrsd_paper/fig_wer.gnuplot index 7a312743..bff05333 100755 --- a/lib/ftrsd/ftrsd_paper/fig_wer.gnuplot +++ b/lib/ftrsd/ftrsd_paper/fig_wer.gnuplot @@ -1,23 +1,23 @@ -# gnuplot script for "Percent copy" figure -# run: gnuplot fig_wer.gnuplot -# then: pdflatex fig_wer.tex -# -set term epslatex standalone size 6in,4in -set output "fig_wer.tex" -set xlabel "$E_b/N_0$ (dB)" -set ylabel "Word Error Rate" -set style func linespoints -set key off -set tics in -set mxtics 2 -set mytics 10 -set grid -set logscale y -plot [3:7] "ftdata-100000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-100K', \ - "ftdata-10000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-10K', \ - "ftdata-1000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-1K', \ - "kvasd-8.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-8', \ - "kvasd-12.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-12', \ - "kvasd-15.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-15', \ - "bmdata.dat" using ($1+29.1):(1-$2) with linespoints pt 7 title 'BM', \ - "wer.lab" with labels +# gnuplot script for "Percent copy" figure +# run: gnuplot fig_wer.gnuplot +# then: pdflatex fig_wer.tex +# +set term epslatex standalone size 6in,4in +set output "fig_wer.tex" +set xlabel "$E_b/N_0$ (dB)" +set ylabel "Word Error Rate" +set style func linespoints +set key off +set tics in +set mxtics 2 +set mytics 10 +set grid +set logscale y +plot [3:7] "ftdata-100000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-100K', \ + "ftdata-10000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-10K', \ + "ftdata-1000.dat" using ($1+29.1):(1-$2) with linespoints lt 1 pt 7 title 'FT-1K', \ + "kvasd-8.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-8', \ + "kvasd-12.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-12', \ + "kvasd-15.dat" using ($1+29.1):(1-$2) with linespoints lt 2 pt 8 title 'KV-15', \ + "bmdata.dat" using ($1+29.1):(1-$2) with linespoints pt 7 title 'BM', \ + "wer.lab" with labels diff --git a/lib/ftrsd/ftrsd_paper/fig_wer2.gnuplot b/lib/ftrsd/ftrsd_paper/fig_wer2.gnuplot index b79bf3a7..dc8edc98 100755 --- a/lib/ftrsd/ftrsd_paper/fig_wer2.gnuplot +++ b/lib/ftrsd/ftrsd_paper/fig_wer2.gnuplot @@ -1,23 +1,23 @@ -# gnuplot script for "Percent copy" figure -# run: gnuplot fig_wer2.gnuplot -# then: pdflatex fig_wer2.tex -# -set term epslatex standalone size 6in,6*2/3in -set output "fig_wer2.tex" -set xlabel "SNR in 2500 Hz Bandwidth (dB)" -set ylabel "Percent Copy" -set style func linespoints -set key off -set tics in -set mxtics 2 -set mytics 5 -set grid -plot [-27:-22] [0:110] \ - "ftdata-100000.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ - "ftdata-10000.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ - "ftdata-1000.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ - "ftdata-100.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ - "ftdata-10.dat" using 1:(100*$2) with linespoints lt 1 lw 2 pt 7, \ - "kvasd-15.dat" using 1:(100*$2) with linespoints lt 4 pt 6, \ - "bmdata.dat" using 1:(100*$2) with linespoints lt 2 lw 2 pt 2, \ - "wer2.lab" with labels +# gnuplot script for "Percent copy" figure +# run: gnuplot fig_wer2.gnuplot +# then: pdflatex fig_wer2.tex +# +set term epslatex standalone size 6in,6*2/3in +set output "fig_wer2.tex" +set xlabel "SNR in 2500 Hz Bandwidth (dB)" +set ylabel "Percent Copy" +set style func linespoints +set key off +set tics in +set mxtics 2 +set mytics 5 +set grid +plot [-27:-22] [0:110] \ + "ftdata-100000.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ + "ftdata-10000.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ + "ftdata-1000.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ + "ftdata-100.dat" using 1:(100*$3) with linespoints lt 1 lw 2 pt 7, \ + "ftdata-10.dat" using 1:(100*$2) with linespoints lt 1 lw 2 pt 7, \ + "kvasd-15.dat" using 1:(100*$2) with linespoints lt 4 pt 6, \ + "bmdata.dat" using 1:(100*$2) with linespoints lt 2 lw 2 pt 2, \ + "wer2.lab" with labels diff --git a/lib/ftrsd/ftrsd_paper/fig_wer3.gnuplot b/lib/ftrsd/ftrsd_paper/fig_wer3.gnuplot index 605ef777..f3c9d273 100755 --- a/lib/ftrsd/ftrsd_paper/fig_wer3.gnuplot +++ b/lib/ftrsd/ftrsd_paper/fig_wer3.gnuplot @@ -1,21 +1,21 @@ -# gnuplot script for "Percent copy" figure -# run: gnuplot fig_wer3.gnuplot -# then: pdflatex fig_wer3.tex -# -set term epslatex standalone size 6in,6*2/3in -set output "fig_wer3.tex" -set xlabel "SNR in 2500 Hz Bandwidth (dB)" -set ylabel "Percent Copy" -set style func linespoints -set key off -set tics in -set mxtics 2 -set mytics 10 -set grid -set label "r6315" at -25.25,30 -set label "r6330" at -26.0,30 -set label "$T=10^5$" at -22.8,15 -set label "$d=0.0$" at -22.8,10 -plot [-27:-22] [0:110] \ - "ftdata-100000.dat" using 1:(100*$3) with linespoints lt 1 pt 7 title 'FT-100K', \ - "ftdata-100000.dat" using 1:(100*$2) with linespoints lt 1 pt 7 title 'FT-100K' +# gnuplot script for "Percent copy" figure +# run: gnuplot fig_wer3.gnuplot +# then: pdflatex fig_wer3.tex +# +set term epslatex standalone size 6in,6*2/3in +set output "fig_wer3.tex" +set xlabel "SNR in 2500 Hz Bandwidth (dB)" +set ylabel "Percent Copy" +set style func linespoints +set key off +set tics in +set mxtics 2 +set mytics 10 +set grid +set label "r6315" at -25.25,30 +set label "r6330" at -26.0,30 +set label "$T=10^5$" at -22.8,15 +set label "$d=0.0$" at -22.8,10 +plot [-27:-22] [0:110] \ + "ftdata-100000.dat" using 1:(100*$3) with linespoints lt 1 pt 7 title 'FT-100K', \ + "ftdata-100000.dat" using 1:(100*$2) with linespoints lt 1 pt 7 title 'FT-100K' diff --git a/lib/ftrsd/ftrsd_paper/ftdata-10.dat b/lib/ftrsd/ftrsd_paper/ftdata-10.dat index cd72a7c7..467be382 100755 --- a/lib/ftrsd/ftrsd_paper/ftdata-10.dat +++ b/lib/ftrsd/ftrsd_paper/ftdata-10.dat @@ -1,10 +1,10 @@ - snr psuccess ntrials 10, r6321, r6333 --26.0 0.0 --25.5 0.007 --25.0 0.039 --24.5 0.157 0.14 --24.0 0.362 --23.5 0.701 0.681 --23.0 0.914 --22.5 0.985 0.988 --22.0 1.0 1.0 + snr psuccess ntrials 10, r6321, r6333 +-26.0 0.0 +-25.5 0.007 +-25.0 0.039 +-24.5 0.157 0.14 +-24.0 0.362 +-23.5 0.701 0.681 +-23.0 0.914 +-22.5 0.985 0.988 +-22.0 1.0 1.0 diff --git a/lib/ftrsd/ftrsd_paper/ftdata-100.dat b/lib/ftrsd/ftrsd_paper/ftdata-100.dat index 80365aed..a5d547c3 100755 --- a/lib/ftrsd/ftrsd_paper/ftdata-100.dat +++ b/lib/ftrsd/ftrsd_paper/ftdata-100.dat @@ -1,10 +1,10 @@ - snr psuccess ntrials 100, r6321, r6333 --26.0 0.003 0.003 --25.5 0.033 0.037 --25.0 0.113 0.113 --24.5 0.315 0.330 --24.0 0.635 0.670 --23.5 0.908 0.903 --23.0 0.977 0.984 --22.5 0.9986 0.999 --22.0 1.0 1.0 + snr psuccess ntrials 100, r6321, r6333 +-26.0 0.003 0.003 +-25.5 0.033 0.037 +-25.0 0.113 0.113 +-24.5 0.315 0.330 +-24.0 0.635 0.670 +-23.5 0.908 0.903 +-23.0 0.977 0.984 +-22.5 0.9986 0.999 +-22.0 1.0 1.0 diff --git a/lib/ftrsd/ftrsd_paper/ftdata-1000.dat b/lib/ftrsd/ftrsd_paper/ftdata-1000.dat index 2d1dd2b1..156a0b3b 100755 --- a/lib/ftrsd/ftrsd_paper/ftdata-1000.dat +++ b/lib/ftrsd/ftrsd_paper/ftdata-1000.dat @@ -1,9 +1,9 @@ - snr psuccess ntrials 1000, r6315, r6333 --26.0 0.010 0.022 --25.5 0.052 0.097 --25.0 0.22 0.262 --24.5 0.51 0.535 --24.0 0.80 0.844 --23.5 0.956 0.968 --23.0 0.9958 0.9963 --22.5 1.0 1.0 + snr psuccess ntrials 1000, r6315, r6333 +-26.0 0.010 0.022 +-25.5 0.052 0.097 +-25.0 0.22 0.262 +-24.5 0.51 0.535 +-24.0 0.80 0.844 +-23.5 0.956 0.968 +-23.0 0.9958 0.9963 +-22.5 1.0 1.0 diff --git a/lib/ftrsd/ftrsd_paper/ftdata-10000.dat b/lib/ftrsd/ftrsd_paper/ftdata-10000.dat index b6f15ca1..99d48597 100755 --- a/lib/ftrsd/ftrsd_paper/ftdata-10000.dat +++ b/lib/ftrsd/ftrsd_paper/ftdata-10000.dat @@ -1,11 +1,11 @@ - snr psuccess ntrials 10000 r6315, r6330 --27.0 0.000 0.001 --26.5 0.004 0.014 --26.0 0.03 0.066 --25.5 0.107 0.208 0.19 --25.0 0.353 0.424 0.40 (2) --24.5 0.653 0.725 --24.0 0.913 0.913 --23.5 0.983 0.988 --23.0 0.998 0.999 --22.0 1.0 1.0 + snr psuccess ntrials 10000 r6315, r6330 +-27.0 0.000 0.001 +-26.5 0.004 0.014 +-26.0 0.03 0.066 +-25.5 0.107 0.208 0.19 +-25.0 0.353 0.424 0.40 (2) +-24.5 0.653 0.725 +-24.0 0.913 0.913 +-23.5 0.983 0.988 +-23.0 0.998 0.999 +-22.0 1.0 1.0 diff --git a/lib/ftrsd/ftrsd_paper/ftdata-100000.dat b/lib/ftrsd/ftrsd_paper/ftdata-100000.dat index dffd774f..e2db520d 100755 --- a/lib/ftrsd/ftrsd_paper/ftdata-100000.dat +++ b/lib/ftrsd/ftrsd_paper/ftdata-100000.dat @@ -1,11 +1,11 @@ -snr psuccess 100000 trials r6315, r6330, --27.0 0.0 0.011 --26.5 0.007 0.035 --26.0 0.057 0.135 --25.5 0.207 0.326 --25.0 0.531 0.568 --24.5 0.822 0.836 --24.0 0.953 0.966 --23.5 0.99423 0.996 --23.0 0.99967 0.99974 302956/303056, 218991/219046 - +snr psuccess 100000 trials r6315, r6330, +-27.0 0.0 0.011 +-26.5 0.007 0.035 +-26.0 0.057 0.135 +-25.5 0.207 0.326 +-25.0 0.531 0.568 +-24.5 0.822 0.836 +-24.0 0.953 0.966 +-23.5 0.99423 0.996 +-23.0 0.99967 0.99974 302956/303056, 218991/219046 + diff --git a/lib/ftrsd/ftrsd_paper/ftrsd.lyx b/lib/ftrsd/ftrsd_paper/ftrsd.lyx index 8139ce1a..4549c768 100755 --- a/lib/ftrsd/ftrsd_paper/ftrsd.lyx +++ b/lib/ftrsd/ftrsd_paper/ftrsd.lyx @@ -1,3289 +1,3289 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass paper -\begin_preamble -\usepackage{ragged2e} -\exhyphenpenalty=10000\hyphenpenalty=10000 - -\fancyhf{} -\fancyhead[L]{Franke \& Taylor: {\it Open Source Soft-Decision Decoder \ldots}} -\fancyhead[R]{\thepage} -\makeatletter -\let\ps@plain\ps@fancy % Plain page style = fancy page style -\makeatother - -\usepackage{nomencl} -\usepackage{overcite} - -\renewcommand{\nomname}{Sidebar: Glossary of Specialized Terms} -\end_preamble -\use_default_options true -\begin_modules -boxedfloat -\end_modules -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding auto -\fontencoding global -\font_roman lmodern -\font_sans lmss -\font_typewriter lmtt -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\float_placement H -\paperfontsize 12 -\spacing onehalf -\use_hyperref false -\papersize default -\use_geometry true -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification false -\use_refstyle 1 -\index Index -\shortcut idx -\color #008000 -\end_index -\leftmargin 1in -\topmargin 1in -\rightmargin 1in -\bottommargin 1in -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation skip -\defskip bigskip -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle fancy -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Title -Open Source Soft-Decision Decoder for the JT65 (63,12) Reed-Solomon Code -\end_layout - -\begin_layout SubTitle - -\emph on -Under-the-hood description of the JT65 decoding procedure, including a wholly - new algorithm for its powerful error-correcting code. -\end_layout - -\begin_layout Author -Steven J. - Franke, K9AN and Joseph H. - Taylor, K1JT -\end_layout - -\begin_layout Section -\begin_inset CommandInset label -LatexCommand label -name "sec:Introduction-and-Motivation" - -\end_inset - -Background and Motivation -\end_layout - -\begin_layout Standard -\begin_inset ERT -status open - -\begin_layout Plain Layout - - -\backslash -RaggedRight -\end_layout - -\end_inset - - The JT65 protocol has revolutionized amateur-radio weak-signal communication - by enabling operators with small or compromise antennas and relatively - low-power transmitters to communicate over propagation paths not usable - with traditional technologies. - The protocol was developed in 2003 for Earth-Moon-Earth (EME, or -\begin_inset Quotes eld -\end_inset - -moonbounce -\begin_inset Quotes erd -\end_inset - -) communication -\begin_inset CommandInset citation -LatexCommand cite -key "jt65_protocol" - -\end_inset - -, where the scattered return signals are always weak. - It was soon found that JT65 also enables worldwide communication on the - HF bands with low power, modest antennas, and efficient spectral usage. - Thousands of amateurs now use JT65 on a regular basis, making contacts - on all bands from 160 meters through microwaves. -\end_layout - -\begin_layout Standard -JT65 uses timed transmitting and receiving sequences one minute long. - Messages are short and structured so as to streamline minimal exchanges - between two amateur operators over potentially difficult radio paths. - Most messages contain two callsigns and a grid locator, signal report, - acknowledgment, or sign-off; one of the tokens CQ, QRZ, or DE may be substitute -d for the first callsign. - Alternatively, a message may contain up to 13 Latin characters of arbitrary - text. - All messages are efficiently compressed into exactly 72 bits of digital - information. - It should be obvious that the JT65 protocol is intended for the basic purpose - of completing legitimate, documented two-way contacts, but not for extended - conversations. - Full details of the message structure and encoding procedure were presented - in an earlier publication -\begin_inset CommandInset citation -LatexCommand cite -key "jt65_protocol" - -\end_inset - -. - For a concise description of the overall process of transmitting and receiving - a JT65 message, see the accompanying sidebar -\series bold -JT65 Message Processing -\series default -. -\end_layout - -\begin_layout Standard -A major reason for the success and popularity of JT65 is its use of a strong - error-correction code. - Before transmission, each 72-bit message is divided into 12 six-bit -\emph on -symbols -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Symbol: }" -description "The information carried in one signalling interval, usually an integral number of bits. JT65 uses 6-bit symbols." - -\end_inset - - -\emph default - and augmented with 51 additional symbols of error-correcting information. - These 51 -\emph on -parity symbols -\emph default - are computed according to information-theory rules that maximize the probabilit -y of correctly decoding the message, even if many symbols are received incorrect -ly. - The JT65 code is properly described as a short block-length, low-rate Reed-Solo -mon code based on a 64-symbol -\emph on -alphabet. - -\emph default - -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Alphabet: }" -description "A sequence of possible symbol values used for signaling. JT65 uses a 64-character alphabet, values in the range 0 to 63." - -\end_inset - - Characters in this alphabet are mapped onto 64 different frequencies for - transmission. - -\end_layout - -\begin_layout Standard -Reed Solomon codes are widely used to ensure reliability in data transmission - and storage. - In hardware implementations, decoding is generally accomplished with a - procedure such as the Berlekamp-Massey (BM) algorithm, based on -\emph on -hard decisions -\emph default - -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Hard decision: }" -description "Received symbols are assigned definite values by the demodulator." - -\end_inset - - for each of the symbol values received. - -\emph on -Soft decisions -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Soft decision: }" -description "Received symbols are assigned tentative values (most probable, second most probable, etc.) and quality indicators." - -\end_inset - - -\emph default - are potentially more powerful, however. - For each received JT65 symbol we can estimate not only the value most likely - to be correct, but also the second, third, etc., most likely. - Most importantly, we can also estimate the probability that each of those - possible values is the correct one. - Decoders that make use of such information are called -\emph on -soft-decision decoders. -\end_layout - -\begin_layout Standard -Until now, nearly all programs implementing JT65 have used the patented - Kötter-Vardy (KV) algebraic soft-decision decoder -\begin_inset CommandInset citation -LatexCommand cite -key "kv2001" - -\end_inset - -, licensed to and implemented by K1JT as a closed-source executable for - use only in amateur radio applications. - Since 2001 the KV decoder has been considered the best available soft-decision - decoder for Reed Solomon codes. -\end_layout - -\begin_layout Standard -We describe here a new open-source alternative called the Franke-Taylor - (FT, or K9AN-K1JT) soft-decision decoding algorithm. - It is conceptually simple, built on top of the BM hard-decision decoder, - and in this application it performs even better than the KV decoder. - The FT algorithm is implemented in the popular programs -\emph on -WSJT -\emph default -, -\emph on -MAP65 -\emph default -, and -\emph on -WSJT-X -\emph default -, widely used for amateur weak-signal communication using JT65 and other - specialized digital protocols. - These programs are open-source, freely available -\begin_inset CommandInset citation -LatexCommand cite -key "wsjt" - -\end_inset - -, and licensed under the GNU General Public License. -\end_layout - -\begin_layout Standard -The JT65 protocol specifies transmissions that start one second into a UTC - minute and last for 46.8 seconds. - Receiving software therefore has as much as ten seconds to decode a message - before the start of the next minute, when the operator will send a reply. - With today's personal computers, this relatively long time encourages experimen -tation with decoders of high computational complexity. - With time to spare, the FT algorithm lowers the decoding threshold on a - typical fading channel by many dB over the hard-decision BM decoder, and - by a meaningful amount over the KV decoder. - In addition to its excellent performance, the new algorithm has other desirable - properties, not least of which is its conceptual simplicity. - Decoding performance and computational complexity scale in a convenient - way, providing steadily increasing soft-decision decoding gain as a tunable - parameter is increased over more than five orders of magnitude. - Appreciable gain is available from our decoder even on very simple (and - relatively slow) computers. - On the other hand, because the algorithm benefits from a large number of - independent decoding trials, further performance gains should be achievable - through parallelization on high-performance computers. -\end_layout - -\begin_layout Standard -The remainder of this paper is organized as follows. - Section 2 presents a brief overview of the nature of Reed Solomon codes - and their error-correcting capabilities. - Section 3 provides statistical motivation for the FT algorithm, and Section - 4 describes the algorithm in full detail. - Material in these two sections is important because it documents our approach - and underlines its fundamental technical contributions. - These sections are heavier in formal mathematics than common in -\emph on -QEX -\emph default -; for this reason, some readers may choose to skip or skim them and proceed - more quickly to the results. - Most readers will benefit by reviewing the original paper on the JT65 protocol - -\begin_inset CommandInset citation -LatexCommand cite -key "jt65_protocol" - -\end_inset - -. - A procedure for -\emph on -hinted decoding -\emph default ---- determining which one, if any, of a list of likely messages matches - the one that was received --- is outlined in Section 5. - Finally, in Section 6 we present performance measurements of the FT and - hinted decoding algorithms and make explicit comparisons to the BM and - KV decoders familiar to users of older versions of -\emph on -WSJT -\emph default -, -\emph on -MAP65 -\emph default - and -\emph on -WSJT-X -\emph default -. - Section 7 summarizes some on-the-air experiences with the new decoder. - Refer to the sidebar -\series bold -Glossary of Specialized Terms -\series default - for brief definitions of some potentially unfamiliar language. -\end_layout - -\begin_layout Section -\begin_inset CommandInset label -LatexCommand label -name "sec:JT65-messages-and" - -\end_inset - -JT65 Messages and Reed Solomon Codes -\end_layout - -\begin_layout Standard -The JT65 message frame consists of a short, compressed 72-bit message encoded - for transmission with a Reed-Solomon code. - Reed-Solomon codes are -\emph on -block codes -\emph default - -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Block code: }" -description "An error-correcting code that treats data in blocks of fixed size." - -\end_inset - - characterized by -\begin_inset Formula $n$ -\end_inset - -, the length of their -\emph on -codewords -\emph default -; -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Codeword:}" -description "For the JT65 code, a vector of 63 symbol values each in the range 0 to 63." - -\end_inset - - -\begin_inset Formula $k$ -\end_inset - -, the number of message symbols conveyed by the codeword; and the transmission - alphabet, or number of possible values for each symbol in a codeword. - The codeword length and the number of message symbols are specified with - the notation -\begin_inset Formula $(n,k)$ -\end_inset - -. - JT65 uses a (63,12) Reed-Solomon code with an alphabet of 64 possible values - for each symbol. - Each of the 12 message symbols represents -\begin_inset Formula $\log_{2}64=6$ -\end_inset - - message bits. - The source-encoded -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Source encoding: }" -description "Compression of a message to use a minimum number or bits. JT65 source-encodes all messages to 72 bits." - -\end_inset - - message conveyed by a 63-symbol JT65 frame thus consists of 72 information - bits. - The JT65 code is -\emph on -systematic -\emph default -, which means that the 12 message symbols are embedded in the codeword without - modification and another 51 parity symbols derived from the message symbols - are added to form a codeword of 63 symbols. - -\end_layout - -\begin_layout Standard -In coding theory the concept of -\emph on -Hamming distance -\emph default - -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Hamming distance: }" -description "The Hamming distance between two codewords, or between a received word and a codeword, is equal to the number of symbol positions in which they differ." - -\end_inset - - is used as a measure of disagreement between different codewords, or between - a received word -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Received word: }" -description "A vector of symbol values, possibly accompanied by soft information on individual reliabilities." - -\end_inset - - and a codeword. - Hamming distance is the number of code symbols that differ in two words - being compared. - Reed-Solomon codes have guaranteed minimum Hamming distance -\begin_inset Formula $d$ -\end_inset - -, where -\begin_inset Formula -\begin{equation} -d=n-k+1.\label{eq:minimum_distance} -\end{equation} - -\end_inset - -With -\begin_inset Formula $n=63$ -\end_inset - - and -\begin_inset Formula $k=12$ -\end_inset - - the minimum Hamming distance of the JT65 code is -\begin_inset Formula $d=52$ -\end_inset - -. - With 72 information bits in each message, JT65 can transmit any one of - -\begin_inset Formula $2^{72}\approx4.7\times10^{21}$ -\end_inset - - possible messages. - The codeword for any message differs from every other codeword in at least - 52 of the 63 symbol positions. -\end_layout - -\begin_layout Standard -A received word containing some -\emph on -errors -\emph default - (incorrect symbols) can be decoded into the correct codeword using a determinis -tic, -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Deterministic algorithm: }" -description "A series of computational steps that for the same input always produces the same output." - -\end_inset - - algebraic algorithm provided that no more than -\begin_inset Formula $t$ -\end_inset - - symbols were received incorrectly, where -\begin_inset Formula -\begin{equation} -t=\left\lfloor \frac{n-k}{2}\right\rfloor .\label{eq:t} -\end{equation} - -\end_inset - -For the JT65 code -\begin_inset Formula $t=25$ -\end_inset - -, so it is always possible to decode a received word having 25 or fewer - symbol errors. - Any one of several well-known algebraic algorithms, such as the BM algorithm, - can carry out this hard-decision decoding. - Two steps are necessarily involved in this process. - We must (1) determine which symbols were received incorrectly, and (2) - find the correct value of the incorrect symbols. - If we somehow know that certain symbols are incorrect, that information - can be used to reduce the work involved in step 1 and allow step 2 to correct - more than -\begin_inset Formula $t$ -\end_inset - - errors. - In the unlikely event that the location of every error is known, and if - no correct symbols are accidentally labeled as errors, the BM algorithm - can correct up to -\begin_inset Formula $d-1=n-k$ -\end_inset - - errors. - -\end_layout - -\begin_layout Standard -The FT algorithm creates lists of symbols suspected of being incorrect and - sends them to the BM decoder. - Symbols flagged in this way are called -\emph on -erasures -\emph default - -\begin_inset CommandInset nomenclature -LatexCommand nomenclature -symbol "{\\bf Erasure: }" -description "A received symbol may be ``erased'' when confidence in its value is so low that it is unlikely to provide useful information. " - -\end_inset - -. - With perfect erasure information up to -\begin_inset Formula $n-k=51$ -\end_inset - - incorrect symbols can be corrected for the JT65 code. - Imperfect erasure information means that some erased symbols may be correct, - and some other symbols in error. - If -\begin_inset Formula $s$ -\end_inset - - symbols are erased and the remaining -\begin_inset Formula $n-s$ -\end_inset - - symbols contain -\begin_inset Formula $e$ -\end_inset - - errors, the BM algorithm can find the correct codeword as long as -\begin_inset Formula -\begin{equation} -s+2e\le d-1.\label{eq:erasures_and_errors} -\end{equation} - -\end_inset - -If -\begin_inset Formula $s=0$ -\end_inset - -, the decoder is said to be an -\emph on -errors-only -\emph default - decoder. - If -\begin_inset Formula $0=x|N,X,s) '/ & - '-------------------------------') - - hsum=0.d0 - do ix=x,XX - h=hypergeo(ix,NN,XX,s) - hsum=hsum + h - write(*,1020) ix,h,hsum -1020 format(i3,2d13.4) - enddo - -999 end program prob +program prob + + implicit real*8 (a-h,o-z) + integer*8 binomial + integer x,s,XX,NN + real*8 hypergeo + character arg*8 + + nargs=iargc() + if(nargs.ne.4) then + print*,'Usage: prob x N X s' + print*,'Example: prob 35 63 40 40' + go to 999 + endif + call getarg(1,arg) + read(arg,*) x + call getarg(2,arg) + read(arg,*) NN + call getarg(3,arg) + read(arg,*) XX + call getarg(4,arg) + read(arg,*) s + +! print*,binomial(5, 3) ! 10 +! print*,binomial(40, 19) ! 131282408400 + + write(*,1010) x,NN,XX,s +1010 format(//' x=',i2,' N=',i2,' X=',i2,' s=',i2) + write(*,1012) +1012 format(/' x P(x|N,X,s) P(>=x|N,X,s) '/ & + '-------------------------------') + + hsum=0.d0 + do ix=x,XX + h=hypergeo(ix,NN,XX,s) + hsum=hsum + h + write(*,1020) ix,h,hsum +1020 format(i3,2d13.4) + enddo + +999 end program prob diff --git a/lib/ftrsd/ftrsd_paper/psuccess.lab b/lib/ftrsd/ftrsd_paper/psuccess.lab index 9959793f..21ed9734 100755 --- a/lib/ftrsd/ftrsd_paper/psuccess.lab +++ b/lib/ftrsd/ftrsd_paper/psuccess.lab @@ -1,14 +1,14 @@ --21.5 55 BM --24.5 50 FT --27.0 68 DS --25.2 25 0 --25.7 37 0.2 --24.6 16 1.0 --22.6 35 0 --20.9 29 0.2 --19.5 35 1.0 --28.5 25 1.0 --28.2 56 0.2 --28.5 72 0 - - +-21.5 55 BM +-24.5 50 FT +-27.0 68 DS +-25.2 25 0 +-25.7 37 0.2 +-24.6 16 1.0 +-22.6 35 0 +-20.9 29 0.2 +-19.5 35 1.0 +-28.5 25 1.0 +-28.2 56 0.2 +-28.5 72 0 + + diff --git a/lib/ftrsd/ftrsd_paper/stats-100000-24db-3.dat b/lib/ftrsd/ftrsd_paper/stats-100000-24db-3.dat index c7191960..bd2a10f4 100755 --- a/lib/ftrsd/ftrsd_paper/stats-100000-24db-3.dat +++ b/lib/ftrsd/ftrsd_paper/stats-100000-24db-3.dat @@ -1,930 +1,930 @@ - 35 19 45 12 - 34 20 46 6 - 35 27 43 4519 - 33 21 44 11 - 32 22 39 8 - 34 21 48 333 - 30 20 42 2 - 38 25 43 12 - 38 25 49 2958 - 28 20 43 10 - 41 29 44 4070 - 32 19 44 1 - 28 19 43 2 - 38 28 43 10421 - 25 0 0 0 - 36 24 42 8 - 38 25 42 243 - 39 25 45 81 - 33 17 39 2 - 38 25 39 157 - 37 27 45 1 - 31 18 39 8 - 35 22 41 2 - 31 20 45 32 - 40 30 45 11123 - 34 25 48 516 - 37 22 49 73 - 32 19 45 2 - 39 25 43 49 - 35 25 42 12 - 43 32 45 3645 - 35 21 45 124 - 39 26 48 31 - 40 26 48 23 - 36 25 43 169 - 33 21 41 8 - 31 21 49 3 - 37 23 46 2 - 32 27 41 8 - 36 23 43 2112 - 29 19 49 4 - 34 24 41 170 - 27 15 44 1 - 34 21 43 2 - 39 25 47 28 - 30 18 43 10 - 37 22 40 8 - 42 33 48 64709 - 36 25 43 10 - 35 20 51 17 - 37 28 45 301 - 34 18 40 9 - 34 25 47 23 - 39 28 43 4856 - 36 24 45 7057 - 35 25 47 769 - 38 28 47 208 - 39 27 47 52290 - 35 22 44 85 - 34 23 48 7 - 37 21 47 82 - 42 25 39 1677 - 29 17 41 8 - 41 24 46 656 - 35 24 43 2 - 38 22 45 10400 - 36 20 42 14 - 33 22 46 2 - 25 0 0 0 - 33 20 45 12 - 30 17 45 1 - 34 20 43 40 - 32 21 42 14 - 28 15 44 1 - 37 23 42 8 - 32 21 40 8 - 39 28 44 65 - 30 17 41 2 - 32 25 44 134 - 38 24 43 12 - 38 23 47 153 - 39 26 42 8 - 37 20 47 35 - 39 27 47 1003 - 36 23 45 215 - 38 28 49 46 - 34 24 47 200 - 35 23 40 8 - 30 19 44 1 - 38 25 43 32 - 32 22 39 103 - 33 23 42 2 - 34 24 47 6 - 33 22 43 13 - 42 28 43 2127 - 34 22 41 113 - 39 30 41 517 - 30 17 42 8 - 32 20 45 1 - 34 20 51 17 - 32 15 39 9 - 37 23 47 223 - 28 15 43 1 - 38 24 42 251 - 41 26 45 2 - 39 25 49 7 - 35 26 47 237 - 32 18 43 25 - 33 23 43 8 - 41 29 43 2667 - 28 17 45 1 - 34 23 47 53 - 32 19 39 9 - 34 24 42 59 - 36 22 44 8 - 34 20 45 59 - 37 24 45 12 - 28 17 44 1 - 41 29 43 24865 - 32 19 46 6 - 33 22 47 6 - 36 20 47 143 - 36 22 47 34 - 33 19 39 9 - 38 22 44 523 - 34 24 42 737 - 36 24 39 170 - 35 22 43 2 - 32 19 48 22 - 33 20 49 76 - 42 24 49 6910 - 37 22 47 94 - 40 24 43 6 - 35 25 45 33 - 29 22 41 2 - 40 24 46 2096 - 37 20 45 135 - 36 26 43 113 - 36 21 43 13 - 37 24 47 49 - 35 24 43 54 - 37 22 43 8 - 35 23 44 2 - 30 20 43 11 - 39 30 47 2870 - 42 33 44 585 - 26 17 45 2 - 41 29 47 79 - 40 24 46 836 - 33 19 45 201 - 34 21 39 13 - 33 21 49 60 - 35 24 44 248 - 33 24 43 24 - 39 29 44 151 - 31 23 46 1 - 36 23 46 1 - 41 27 47 5565 - 42 26 47 378 - 35 27 45 4571 - 40 30 47 6422 - 32 20 42 8 - 38 28 45 449 - 38 26 47 595 - 39 24 47 1555 - 41 25 49 645 - 32 19 40 8 - 35 25 45 97 - 25 0 0 0 - 30 19 44 25 - 31 18 45 1 - 41 24 51 6915 - 34 23 46 1917 - 30 19 43 2 - 35 22 47 20 - 38 23 43 882 - 30 20 48 5 - 37 25 44 919 - 34 20 45 74 - 38 25 46 394 - 39 21 49 738 - 35 20 47 22 - 40 30 47 190 - 41 27 45 1515 - 39 27 49 55 - 35 25 41 994 - 39 27 47 7117 - 37 22 46 19 - 33 21 41 2 - 34 18 47 19 - 30 20 46 6 - 31 21 46 1 - 36 24 47 98 - 40 24 43 39 - 38 25 45 138 - 41 27 47 33 - 40 29 49 2510 - 36 26 43 2 - 34 21 45 1 - 40 26 49 1924 - 36 17 43 2 - 38 27 45 68 - 34 22 45 61 - 32 22 40 8 - 37 19 43 4784 - 32 16 43 8 - 38 27 50 46 - 35 21 43 38 - 35 22 49 4 - 38 27 49 31 - 39 28 47 4677 - 30 18 45 2 - 43 28 47 8235 - 38 28 43 830 - 32 21 47 15 - 37 24 42 10 - 37 23 45 259 - 37 25 45 35 - 40 24 45 524 - 35 19 44 1 - 36 23 45 84 - 36 24 50 17 - 31 20 46 1 - 35 24 42 74 - 42 27 47 1445 - 40 28 48 31 - 36 23 45 151 - 34 22 46 6 - 33 24 49 16 - 30 20 45 2 - 38 22 43 125 - 40 25 49 64 - 35 23 49 86 - 38 24 46 613 - 42 25 47 4232 - 34 24 43 31 - 32 18 41 2 - 37 26 43 70 - 37 27 41 14 - 37 22 39 129 - 38 27 49 3 - 32 22 47 15 - 41 27 41 472 - 38 24 43 25 - 35 28 43 309 - 41 25 47 82 - 40 23 43 8 - 40 21 43 1716 - 38 22 48 5 - 37 20 47 22 - 42 28 43 315 - 32 23 43 79 - 25 0 0 0 - 42 23 47 2245 - 35 24 45 2 - 41 25 44 12 - 36 23 43 1 - 36 19 45 151 - 41 28 45 2207 - 40 27 45 76 - 34 20 47 6 - 41 28 46 370 - 38 20 45 12 - 32 20 43 8 - 39 24 45 8 - 41 27 47 26941 - 35 23 46 3 - 34 25 41 14 - 43 27 47 26905 - 35 25 45 2 - 32 20 50 3 - 31 17 41 2 - 38 26 47 4157 - 33 24 41 2 - 41 29 43 26513 - 35 22 45 297 - 37 26 44 99 - 33 19 43 10 - 39 23 45 138 - 39 26 47 1320 - 33 22 42 2 - 42 32 45 791 - 33 23 51 3 - 38 25 43 8 - 40 27 49 1210 - 43 27 45 32969 - 37 26 49 108 - 38 18 45 1268 - 40 28 49 7810 - 36 25 44 47 - 38 27 48 20 - 34 20 44 10 - 41 27 45 429 - 33 18 43 8 - 29 17 45 1 - 40 25 42 9 - 30 21 49 4 - 37 22 45 10 - 23 0 0 0 - 36 15 45 2509 - 29 21 45 18 - 33 23 45 53 - 43 27 49 7533 - 37 28 45 2652 - 36 24 49 31 - 32 20 43 25 - 42 27 49 1500 - 41 26 45 8 - 40 25 47 152 - 37 26 45 151 - 37 27 43 139 - 34 20 47 4 - 31 21 43 44 - 37 28 45 241 - 35 25 45 422 - 33 22 45 6 - 39 26 48 23 - 38 27 49 359 - 42 26 45 1430 - 36 28 47 116 - 33 23 41 232 - 38 25 47 73 - 35 24 43 16 - 42 29 47 398 - 38 27 49 2203 - 32 20 47 3 - 32 18 48 3 - 36 23 47 44 - 37 24 48 147 - 39 22 45 31 - 31 20 44 1 - 34 21 43 8 - 39 27 47 201 - 34 23 44 12 - 34 24 43 8 - 36 17 46 2 - 41 27 47 8709 - 41 26 45 112 - 37 23 47 216 - 38 24 45 93 - 32 19 45 44 - 34 22 45 8 - 33 24 41 14 - 34 22 41 9 - 35 23 42 136 - 36 26 43 3272 - 34 18 44 40 - 38 25 43 316 - 29 23 39 9 - 35 23 45 2 - 41 29 42 136 - 37 26 43 12 - 34 21 46 43 - 39 21 47 23 - 40 29 49 14666 - 36 19 45 400 - 37 24 43 8 - 35 19 44 2 - 36 26 45 14 - 36 22 43 103 - 33 19 45 6 - 35 24 43 1 - 31 22 43 80 - 35 23 46 22 - 28 18 41 2 - 35 24 45 31 - 34 24 47 46 - 37 24 42 2 - 37 27 43 525 - 31 16 41 9 - 30 18 45 2 - 39 25 47 1416 - 37 24 46 23 - 40 28 49 5 - 39 26 46 2071 - 28 13 42 8 - 31 17 47 3 - 34 22 49 3 - 42 23 47 61 - 30 21 41 2 - 40 23 47 208 - 38 22 48 6 - 35 17 40 8 - 36 20 45 32 - 37 22 47 1116 - 41 28 47 14145 - 43 28 49 96342 - 35 19 45 102 - 31 23 43 8 - 33 20 43 1 - 30 19 46 90 - 41 27 45 19090 - 35 26 45 2942 - 40 25 47 127 - 35 23 45 12 - 37 26 46 76 - 31 19 44 32 - 42 31 49 4951 - 43 30 44 38924 - 35 19 51 17 - 41 31 44 6637 - 33 22 42 2 - 33 25 46 12 - 31 24 44 10 - 27 16 49 4 - 39 24 45 16 - 33 20 40 8 - 39 31 48 5073 - 39 21 47 72 - 35 21 47 3 - 38 27 41 1168 - 35 22 43 8 - 28 18 45 1 - 38 28 40 776 - 33 22 51 3 - 34 22 41 370 - 37 25 43 3210 - 32 24 43 8 - 35 24 46 3 - 39 20 45 41 - 35 17 43 49 - 39 29 46 20 - 31 21 44 1 - 43 24 48 4400 - 36 23 48 350 - 38 29 47 520 - 36 24 45 49 - 39 27 43 493 - 34 15 45 6 - 41 31 43 59993 - 34 24 42 27 - 31 14 41 1 - 40 30 47 13295 - 35 23 47 202 - 36 22 47 35 - 38 26 45 18576 - 34 26 43 54 - 40 30 51 173 - 43 29 47 105 - 34 24 39 9 - 33 20 43 8 - 35 27 45 65 - 31 18 42 2 - 31 21 45 6 - 40 27 45 979 - 36 21 47 3 - 29 14 43 1 - 37 24 47 432 - 39 24 50 4778 - 33 20 44 2 - 40 27 44 7398 - 36 22 47 148 - 35 21 44 11 - 35 22 45 206 - 30 18 42 8 - 40 30 43 8 - 30 22 42 9 - 29 21 39 9 - 41 26 43 1248 - 39 24 43 14 - 38 24 49 605 - 35 20 42 155 - 33 22 47 53 - 34 20 43 10 - 35 26 49 21 - 31 18 45 1 - 32 19 39 9 - 31 20 43 19 - 41 23 41 157 - 36 23 42 9 - 28 19 45 1 - 33 19 43 10 - 38 22 44 25 - 29 19 41 2 - 34 19 42 8 - 35 21 39 9 - 34 23 45 2 - 41 30 47 71025 - 40 26 48 3059 - 36 24 45 1346 - 35 19 47 34 - 36 25 45 112 - 39 27 41 7065 - 38 24 47 4 - 29 18 42 1 - 30 20 41 2 - 32 22 49 3 - 40 29 45 4589 - 38 25 42 234 - 42 28 49 3171 - 35 22 45 34 - 39 24 41 5693 - 29 20 43 2 - 29 16 44 14 - 37 25 45 19 - 36 18 44 8 - 36 27 45 1224 - 38 28 47 8906 - 29 15 51 3 - 33 20 47 46 - 33 17 41 9 - 40 22 45 1775 - 32 22 45 8 - 35 21 43 8 - 38 24 41 9 - 41 22 47 10005 - 36 27 43 12 - 33 21 47 35 - 35 21 39 9 - 34 22 44 2 - 34 17 45 67 - 31 18 45 1 - 34 21 46 32 - 35 26 44 1 - 34 23 44 8 - 31 24 47 3 - 43 23 49 9210 - 40 20 48 114 - 36 25 42 8 - 37 24 46 336 - 37 23 43 138 - 38 26 47 89 - 38 24 47 6494 - 30 18 45 1 - 43 28 47 677 - 31 23 48 3 - 32 19 43 1 - 36 23 44 19 - 43 30 47 81276 - 37 22 48 106 - 37 24 45 12 - 37 22 45 68 - 28 17 43 24 - 43 28 45 1446 - 40 30 46 2753 - 35 23 44 1 - 28 16 43 2 - 29 19 42 2 - 31 21 42 2 - 39 26 48 98 - 41 30 47 21848 - 35 22 47 5 - 40 31 45 448 - 34 23 45 94 - 29 17 42 8 - 39 30 46 1231 - 41 22 47 49 - 30 15 51 7 - 35 26 41 9 - 29 17 49 7 - 33 22 43 12 - 33 19 46 5 - 35 24 45 12 - 33 22 42 9 - 34 18 43 13 - 36 21 43 63 - 37 27 45 32 - 37 23 49 474 - 31 17 46 19 - 38 24 41 2 - 40 28 47 1621 - 39 25 47 214 - 32 21 42 19 - 34 22 47 105 - 35 26 42 2 - 35 21 44 13 - 40 25 47 556 - 39 27 49 3 - 36 25 45 32 - 39 27 41 10 - 35 20 45 1 - 28 17 45 1 - 35 23 47 6 - 33 20 50 137 - 34 22 43 177 - 30 19 41 9 - 33 23 47 579 - 33 22 39 9 - 39 20 42 74 - 42 28 47 112 - 40 29 44 197 - 36 23 43 2 - 30 17 49 3 - 37 27 45 3815 - 35 24 43 74 - 35 22 47 24 - 40 27 46 82 - 36 25 41 366 - 33 23 44 1 - 37 21 40 131 - 34 22 45 16 - 36 24 45 306 - 39 26 47 82 - 29 17 45 1 - 36 23 48 3 - 35 20 44 63 - 35 23 46 5 - 39 25 43 792 - 32 22 49 5 - 35 23 41 9 - 37 24 41 12711 - 41 32 43 36575 - 34 23 42 8 - 31 21 43 2 - 35 24 41 2 - 35 24 39 8 - 37 23 48 75 - 35 19 43 12 - 40 25 49 914 - 38 22 49 60 - 34 19 42 10 - 42 33 44 9038 - 37 27 45 1849 - 29 20 42 138 - 37 27 43 332 - 36 26 45 36 - 32 18 45 6 - 37 25 46 4676 - 29 18 45 6 - 34 22 43 8 - 41 32 45 1966 - 30 18 42 12 - 33 20 45 1 - 31 23 45 6 - 30 21 46 1 - 36 21 43 14 - 34 18 45 37 - 42 32 47 3508 - 41 32 41 13 - 37 25 45 719 - 33 20 45 111 - 38 28 42 8 - 35 23 43 14 - 39 23 47 123 - 28 13 44 1 - 34 19 41 38 - 35 21 43 8 - 33 26 47 124 - 30 18 41 9 - 43 30 46 11935 - 40 28 48 2329 - 35 19 45 286 - 30 21 43 80 - 37 21 49 474 - 41 27 49 1560 - 42 24 46 1802 - 38 28 42 6807 - 38 24 43 63 - 33 24 49 35 - 41 27 41 9795 - 29 16 41 2 - 29 17 43 2 - 34 21 45 125 - 39 28 45 1008 - 34 21 42 8 - 36 23 45 2 - 34 22 41 8 - 34 21 41 74 - 37 21 43 262 - 30 18 41 8 - 33 22 49 3 - 33 21 42 1 - 35 28 49 21 - 31 19 43 1 - 36 24 44 10 - 40 23 49 583 - 33 19 37 9 - 32 21 45 6 - 38 24 47 15 - 42 27 47 2847 - 36 28 45 106 - 39 28 43 53 - 30 16 42 2 - 28 18 49 3 - 33 21 44 1 - 36 24 45 3050 - 37 27 40 8 - 35 19 43 12 - 41 29 43 19008 - 21 0 0 0 - 38 26 41 762 - 33 21 46 12 - 41 26 47 14517 - 33 24 49 3 - 41 31 47 287 - 35 24 51 17 - 37 27 42 38 - 34 22 43 24 - 39 26 46 135 - 38 26 41 493 - 35 22 42 8 - 38 24 41 1082 - 32 23 42 1 - 33 24 40 8 - 37 25 48 640 - 28 14 39 9 - 39 20 45 212 - 37 29 45 610 - 34 26 47 57 - 29 21 41 8 - 35 16 45 53 - 35 21 44 2 - 38 26 48 188 - 34 25 41 10 - 36 23 44 8 - 35 21 45 8 - 35 26 41 8 - 37 26 40 9 - 28 12 43 1 - 34 22 51 3 - 35 25 44 13 - 32 16 44 32 - 32 19 45 143 - 29 17 43 1 - 35 22 43 93 - 38 21 43 99 - 36 26 49 242 - 34 22 45 8 - 40 24 45 136 - 40 24 48 88 - 38 21 46 49 - 40 27 49 116 - 41 26 44 3696 - 35 23 42 8 - 28 15 45 104 - 33 21 43 106 - 35 25 45 31 - 33 24 40 113 - 36 24 46 23 - 37 25 45 334 - 32 21 46 12 - 35 21 41 2 - 36 22 45 8 - 37 18 43 13 - 37 26 47 48 - 39 25 46 400 - 37 27 43 174 - 37 23 47 41 - 40 21 47 1811 - 38 26 45 79 - 26 15 43 1 - 39 27 49 19 - 31 19 44 1 - 37 22 43 8 - 32 24 38 9 - 34 23 48 3 - 37 24 51 22 - 27 18 42 2 - 31 22 47 5 - 33 17 41 2 - 40 28 45 14534 - 37 21 47 5 - 27 15 43 2 - 43 26 47 46658 - 39 22 43 8 - 36 23 41 2 - 31 19 43 12 - 36 24 43 10 - 33 20 43 149 - 30 19 47 3 - 39 27 51 1236 - 41 26 45 4744 - 39 22 47 100 - 32 18 44 6 - 32 21 43 54 - 40 30 46 777 - 35 25 43 355 - 36 24 41 138 - 40 30 47 3056 - 39 28 46 19 - 34 21 46 6 - 34 18 46 52 - 36 27 41 232 - 35 25 51 3 - 36 28 44 110 - 33 23 45 1 - 37 22 46 64301 - 39 23 49 41 - 39 30 40 25 - 36 23 48 6 - 29 17 42 2 - 36 23 44 1 - 32 17 43 40 - 32 16 49 86 - 29 19 49 5 - 38 26 41 9 - 40 28 43 56710 - 41 29 45 1711 - 36 23 49 345 - 35 25 43 8 - 35 24 46 19 - 37 23 41 648 - 30 18 45 1 - 30 21 43 1 - 34 20 45 12 - 42 25 47 431 - 40 27 41 15878 - 34 22 43 8 - 41 29 48 49 - 32 21 43 2 - 37 22 43 2 - 39 28 49 86 - 43 28 45 8032 - 41 30 49 15674 - 34 22 48 17 - 36 24 48 107 - 28 20 44 1 - 43 28 48 1986 - 40 25 47 2585 - 38 21 43 59 - 38 28 41 167 - 34 22 39 9 - 43 27 48 4196 - 32 20 44 120 - 33 25 45 99 - 26 12 42 2 - 26 15 47 4 - 37 21 42 10 - 35 25 49 3 - 42 30 49 11151 - 33 20 44 2 - 39 26 45 65238 - 31 16 40 2 - 38 26 39 8 - 36 22 45 82 - 32 22 49 7 - 33 20 45 2 - 40 24 43 12 - 32 18 50 3 - 31 21 40 2 - 34 18 44 2 - 38 28 46 194 - 36 21 43 12 - 32 20 43 8 - 30 18 42 2 - 37 21 47 31 - 36 23 47 15 - 36 21 45 113 - 34 23 44 1 - 43 29 49 3889 - 37 24 47 32 - 41 22 43 243 - 38 25 47 707 - 35 22 43 18399 - 33 22 45 123 - 37 24 42 8 - 39 25 47 1087 - 34 23 47 107 - 32 21 42 2 - 42 25 47 106 - 39 24 42 13560 - 42 29 49 52387 - 38 27 43 59 - 31 18 39 9 - 40 28 48 41 - 37 25 45 11 - 30 23 45 242 - 38 23 47 1673 - 36 23 45 751 - 29 22 41 2 - 36 19 48 3 - 36 22 45 12 - 35 18 47 20 - 40 28 49 17369 - 29 19 46 2 - 36 26 42 25 - 42 30 49 4767 - 30 20 45 6 - 35 24 44 12 - 41 24 42 1537 - 38 25 47 629 - 31 21 44 2 - 34 22 43 1 - 33 20 47 3 - 34 20 43 8 - 40 26 49 4320 - 31 16 43 9 - 34 22 45 8 - 32 22 46 124 - 32 20 43 13 - 40 28 47 1185 - 41 24 45 30643 - 39 23 43 1658 - 33 23 44 8 - 36 22 46 23 - 41 25 47 114 - 36 21 42 12 - 33 19 48 31 - 42 28 48 76 - 29 22 39 9 - 36 21 47 3 - 37 27 45 282 - 42 29 46 24995 - 36 26 39 9 - 40 25 46 123 - 39 26 41 8 - 41 30 45 3143 - 34 20 41 27 - 38 31 42 17297 - 40 24 51 3052 - 36 28 45 190 - 31 23 42 8 - 42 26 42 68 - 39 31 45 37327 - 37 27 41 8 - 36 20 45 76 - 38 26 42 10 - 36 21 45 63 - 40 31 43 140 - 40 27 49 21 - 31 22 36 9 - 34 22 39 9 - 29 17 43 2 - 36 26 45 61 - 38 23 45 15 - 31 21 43 54 - 36 22 41 93 - 31 18 43 2 - 35 25 49 108 - 41 29 45 18292 - 37 25 45 104 - 28 20 41 2 - 35 26 46 35 - 34 20 46 19 - 38 22 51 183 - 34 14 43 8 - 32 23 43 16 - 27 17 44 1 - 29 15 42 2 - 37 26 41 129 + 35 19 45 12 + 34 20 46 6 + 35 27 43 4519 + 33 21 44 11 + 32 22 39 8 + 34 21 48 333 + 30 20 42 2 + 38 25 43 12 + 38 25 49 2958 + 28 20 43 10 + 41 29 44 4070 + 32 19 44 1 + 28 19 43 2 + 38 28 43 10421 + 25 0 0 0 + 36 24 42 8 + 38 25 42 243 + 39 25 45 81 + 33 17 39 2 + 38 25 39 157 + 37 27 45 1 + 31 18 39 8 + 35 22 41 2 + 31 20 45 32 + 40 30 45 11123 + 34 25 48 516 + 37 22 49 73 + 32 19 45 2 + 39 25 43 49 + 35 25 42 12 + 43 32 45 3645 + 35 21 45 124 + 39 26 48 31 + 40 26 48 23 + 36 25 43 169 + 33 21 41 8 + 31 21 49 3 + 37 23 46 2 + 32 27 41 8 + 36 23 43 2112 + 29 19 49 4 + 34 24 41 170 + 27 15 44 1 + 34 21 43 2 + 39 25 47 28 + 30 18 43 10 + 37 22 40 8 + 42 33 48 64709 + 36 25 43 10 + 35 20 51 17 + 37 28 45 301 + 34 18 40 9 + 34 25 47 23 + 39 28 43 4856 + 36 24 45 7057 + 35 25 47 769 + 38 28 47 208 + 39 27 47 52290 + 35 22 44 85 + 34 23 48 7 + 37 21 47 82 + 42 25 39 1677 + 29 17 41 8 + 41 24 46 656 + 35 24 43 2 + 38 22 45 10400 + 36 20 42 14 + 33 22 46 2 + 25 0 0 0 + 33 20 45 12 + 30 17 45 1 + 34 20 43 40 + 32 21 42 14 + 28 15 44 1 + 37 23 42 8 + 32 21 40 8 + 39 28 44 65 + 30 17 41 2 + 32 25 44 134 + 38 24 43 12 + 38 23 47 153 + 39 26 42 8 + 37 20 47 35 + 39 27 47 1003 + 36 23 45 215 + 38 28 49 46 + 34 24 47 200 + 35 23 40 8 + 30 19 44 1 + 38 25 43 32 + 32 22 39 103 + 33 23 42 2 + 34 24 47 6 + 33 22 43 13 + 42 28 43 2127 + 34 22 41 113 + 39 30 41 517 + 30 17 42 8 + 32 20 45 1 + 34 20 51 17 + 32 15 39 9 + 37 23 47 223 + 28 15 43 1 + 38 24 42 251 + 41 26 45 2 + 39 25 49 7 + 35 26 47 237 + 32 18 43 25 + 33 23 43 8 + 41 29 43 2667 + 28 17 45 1 + 34 23 47 53 + 32 19 39 9 + 34 24 42 59 + 36 22 44 8 + 34 20 45 59 + 37 24 45 12 + 28 17 44 1 + 41 29 43 24865 + 32 19 46 6 + 33 22 47 6 + 36 20 47 143 + 36 22 47 34 + 33 19 39 9 + 38 22 44 523 + 34 24 42 737 + 36 24 39 170 + 35 22 43 2 + 32 19 48 22 + 33 20 49 76 + 42 24 49 6910 + 37 22 47 94 + 40 24 43 6 + 35 25 45 33 + 29 22 41 2 + 40 24 46 2096 + 37 20 45 135 + 36 26 43 113 + 36 21 43 13 + 37 24 47 49 + 35 24 43 54 + 37 22 43 8 + 35 23 44 2 + 30 20 43 11 + 39 30 47 2870 + 42 33 44 585 + 26 17 45 2 + 41 29 47 79 + 40 24 46 836 + 33 19 45 201 + 34 21 39 13 + 33 21 49 60 + 35 24 44 248 + 33 24 43 24 + 39 29 44 151 + 31 23 46 1 + 36 23 46 1 + 41 27 47 5565 + 42 26 47 378 + 35 27 45 4571 + 40 30 47 6422 + 32 20 42 8 + 38 28 45 449 + 38 26 47 595 + 39 24 47 1555 + 41 25 49 645 + 32 19 40 8 + 35 25 45 97 + 25 0 0 0 + 30 19 44 25 + 31 18 45 1 + 41 24 51 6915 + 34 23 46 1917 + 30 19 43 2 + 35 22 47 20 + 38 23 43 882 + 30 20 48 5 + 37 25 44 919 + 34 20 45 74 + 38 25 46 394 + 39 21 49 738 + 35 20 47 22 + 40 30 47 190 + 41 27 45 1515 + 39 27 49 55 + 35 25 41 994 + 39 27 47 7117 + 37 22 46 19 + 33 21 41 2 + 34 18 47 19 + 30 20 46 6 + 31 21 46 1 + 36 24 47 98 + 40 24 43 39 + 38 25 45 138 + 41 27 47 33 + 40 29 49 2510 + 36 26 43 2 + 34 21 45 1 + 40 26 49 1924 + 36 17 43 2 + 38 27 45 68 + 34 22 45 61 + 32 22 40 8 + 37 19 43 4784 + 32 16 43 8 + 38 27 50 46 + 35 21 43 38 + 35 22 49 4 + 38 27 49 31 + 39 28 47 4677 + 30 18 45 2 + 43 28 47 8235 + 38 28 43 830 + 32 21 47 15 + 37 24 42 10 + 37 23 45 259 + 37 25 45 35 + 40 24 45 524 + 35 19 44 1 + 36 23 45 84 + 36 24 50 17 + 31 20 46 1 + 35 24 42 74 + 42 27 47 1445 + 40 28 48 31 + 36 23 45 151 + 34 22 46 6 + 33 24 49 16 + 30 20 45 2 + 38 22 43 125 + 40 25 49 64 + 35 23 49 86 + 38 24 46 613 + 42 25 47 4232 + 34 24 43 31 + 32 18 41 2 + 37 26 43 70 + 37 27 41 14 + 37 22 39 129 + 38 27 49 3 + 32 22 47 15 + 41 27 41 472 + 38 24 43 25 + 35 28 43 309 + 41 25 47 82 + 40 23 43 8 + 40 21 43 1716 + 38 22 48 5 + 37 20 47 22 + 42 28 43 315 + 32 23 43 79 + 25 0 0 0 + 42 23 47 2245 + 35 24 45 2 + 41 25 44 12 + 36 23 43 1 + 36 19 45 151 + 41 28 45 2207 + 40 27 45 76 + 34 20 47 6 + 41 28 46 370 + 38 20 45 12 + 32 20 43 8 + 39 24 45 8 + 41 27 47 26941 + 35 23 46 3 + 34 25 41 14 + 43 27 47 26905 + 35 25 45 2 + 32 20 50 3 + 31 17 41 2 + 38 26 47 4157 + 33 24 41 2 + 41 29 43 26513 + 35 22 45 297 + 37 26 44 99 + 33 19 43 10 + 39 23 45 138 + 39 26 47 1320 + 33 22 42 2 + 42 32 45 791 + 33 23 51 3 + 38 25 43 8 + 40 27 49 1210 + 43 27 45 32969 + 37 26 49 108 + 38 18 45 1268 + 40 28 49 7810 + 36 25 44 47 + 38 27 48 20 + 34 20 44 10 + 41 27 45 429 + 33 18 43 8 + 29 17 45 1 + 40 25 42 9 + 30 21 49 4 + 37 22 45 10 + 23 0 0 0 + 36 15 45 2509 + 29 21 45 18 + 33 23 45 53 + 43 27 49 7533 + 37 28 45 2652 + 36 24 49 31 + 32 20 43 25 + 42 27 49 1500 + 41 26 45 8 + 40 25 47 152 + 37 26 45 151 + 37 27 43 139 + 34 20 47 4 + 31 21 43 44 + 37 28 45 241 + 35 25 45 422 + 33 22 45 6 + 39 26 48 23 + 38 27 49 359 + 42 26 45 1430 + 36 28 47 116 + 33 23 41 232 + 38 25 47 73 + 35 24 43 16 + 42 29 47 398 + 38 27 49 2203 + 32 20 47 3 + 32 18 48 3 + 36 23 47 44 + 37 24 48 147 + 39 22 45 31 + 31 20 44 1 + 34 21 43 8 + 39 27 47 201 + 34 23 44 12 + 34 24 43 8 + 36 17 46 2 + 41 27 47 8709 + 41 26 45 112 + 37 23 47 216 + 38 24 45 93 + 32 19 45 44 + 34 22 45 8 + 33 24 41 14 + 34 22 41 9 + 35 23 42 136 + 36 26 43 3272 + 34 18 44 40 + 38 25 43 316 + 29 23 39 9 + 35 23 45 2 + 41 29 42 136 + 37 26 43 12 + 34 21 46 43 + 39 21 47 23 + 40 29 49 14666 + 36 19 45 400 + 37 24 43 8 + 35 19 44 2 + 36 26 45 14 + 36 22 43 103 + 33 19 45 6 + 35 24 43 1 + 31 22 43 80 + 35 23 46 22 + 28 18 41 2 + 35 24 45 31 + 34 24 47 46 + 37 24 42 2 + 37 27 43 525 + 31 16 41 9 + 30 18 45 2 + 39 25 47 1416 + 37 24 46 23 + 40 28 49 5 + 39 26 46 2071 + 28 13 42 8 + 31 17 47 3 + 34 22 49 3 + 42 23 47 61 + 30 21 41 2 + 40 23 47 208 + 38 22 48 6 + 35 17 40 8 + 36 20 45 32 + 37 22 47 1116 + 41 28 47 14145 + 43 28 49 96342 + 35 19 45 102 + 31 23 43 8 + 33 20 43 1 + 30 19 46 90 + 41 27 45 19090 + 35 26 45 2942 + 40 25 47 127 + 35 23 45 12 + 37 26 46 76 + 31 19 44 32 + 42 31 49 4951 + 43 30 44 38924 + 35 19 51 17 + 41 31 44 6637 + 33 22 42 2 + 33 25 46 12 + 31 24 44 10 + 27 16 49 4 + 39 24 45 16 + 33 20 40 8 + 39 31 48 5073 + 39 21 47 72 + 35 21 47 3 + 38 27 41 1168 + 35 22 43 8 + 28 18 45 1 + 38 28 40 776 + 33 22 51 3 + 34 22 41 370 + 37 25 43 3210 + 32 24 43 8 + 35 24 46 3 + 39 20 45 41 + 35 17 43 49 + 39 29 46 20 + 31 21 44 1 + 43 24 48 4400 + 36 23 48 350 + 38 29 47 520 + 36 24 45 49 + 39 27 43 493 + 34 15 45 6 + 41 31 43 59993 + 34 24 42 27 + 31 14 41 1 + 40 30 47 13295 + 35 23 47 202 + 36 22 47 35 + 38 26 45 18576 + 34 26 43 54 + 40 30 51 173 + 43 29 47 105 + 34 24 39 9 + 33 20 43 8 + 35 27 45 65 + 31 18 42 2 + 31 21 45 6 + 40 27 45 979 + 36 21 47 3 + 29 14 43 1 + 37 24 47 432 + 39 24 50 4778 + 33 20 44 2 + 40 27 44 7398 + 36 22 47 148 + 35 21 44 11 + 35 22 45 206 + 30 18 42 8 + 40 30 43 8 + 30 22 42 9 + 29 21 39 9 + 41 26 43 1248 + 39 24 43 14 + 38 24 49 605 + 35 20 42 155 + 33 22 47 53 + 34 20 43 10 + 35 26 49 21 + 31 18 45 1 + 32 19 39 9 + 31 20 43 19 + 41 23 41 157 + 36 23 42 9 + 28 19 45 1 + 33 19 43 10 + 38 22 44 25 + 29 19 41 2 + 34 19 42 8 + 35 21 39 9 + 34 23 45 2 + 41 30 47 71025 + 40 26 48 3059 + 36 24 45 1346 + 35 19 47 34 + 36 25 45 112 + 39 27 41 7065 + 38 24 47 4 + 29 18 42 1 + 30 20 41 2 + 32 22 49 3 + 40 29 45 4589 + 38 25 42 234 + 42 28 49 3171 + 35 22 45 34 + 39 24 41 5693 + 29 20 43 2 + 29 16 44 14 + 37 25 45 19 + 36 18 44 8 + 36 27 45 1224 + 38 28 47 8906 + 29 15 51 3 + 33 20 47 46 + 33 17 41 9 + 40 22 45 1775 + 32 22 45 8 + 35 21 43 8 + 38 24 41 9 + 41 22 47 10005 + 36 27 43 12 + 33 21 47 35 + 35 21 39 9 + 34 22 44 2 + 34 17 45 67 + 31 18 45 1 + 34 21 46 32 + 35 26 44 1 + 34 23 44 8 + 31 24 47 3 + 43 23 49 9210 + 40 20 48 114 + 36 25 42 8 + 37 24 46 336 + 37 23 43 138 + 38 26 47 89 + 38 24 47 6494 + 30 18 45 1 + 43 28 47 677 + 31 23 48 3 + 32 19 43 1 + 36 23 44 19 + 43 30 47 81276 + 37 22 48 106 + 37 24 45 12 + 37 22 45 68 + 28 17 43 24 + 43 28 45 1446 + 40 30 46 2753 + 35 23 44 1 + 28 16 43 2 + 29 19 42 2 + 31 21 42 2 + 39 26 48 98 + 41 30 47 21848 + 35 22 47 5 + 40 31 45 448 + 34 23 45 94 + 29 17 42 8 + 39 30 46 1231 + 41 22 47 49 + 30 15 51 7 + 35 26 41 9 + 29 17 49 7 + 33 22 43 12 + 33 19 46 5 + 35 24 45 12 + 33 22 42 9 + 34 18 43 13 + 36 21 43 63 + 37 27 45 32 + 37 23 49 474 + 31 17 46 19 + 38 24 41 2 + 40 28 47 1621 + 39 25 47 214 + 32 21 42 19 + 34 22 47 105 + 35 26 42 2 + 35 21 44 13 + 40 25 47 556 + 39 27 49 3 + 36 25 45 32 + 39 27 41 10 + 35 20 45 1 + 28 17 45 1 + 35 23 47 6 + 33 20 50 137 + 34 22 43 177 + 30 19 41 9 + 33 23 47 579 + 33 22 39 9 + 39 20 42 74 + 42 28 47 112 + 40 29 44 197 + 36 23 43 2 + 30 17 49 3 + 37 27 45 3815 + 35 24 43 74 + 35 22 47 24 + 40 27 46 82 + 36 25 41 366 + 33 23 44 1 + 37 21 40 131 + 34 22 45 16 + 36 24 45 306 + 39 26 47 82 + 29 17 45 1 + 36 23 48 3 + 35 20 44 63 + 35 23 46 5 + 39 25 43 792 + 32 22 49 5 + 35 23 41 9 + 37 24 41 12711 + 41 32 43 36575 + 34 23 42 8 + 31 21 43 2 + 35 24 41 2 + 35 24 39 8 + 37 23 48 75 + 35 19 43 12 + 40 25 49 914 + 38 22 49 60 + 34 19 42 10 + 42 33 44 9038 + 37 27 45 1849 + 29 20 42 138 + 37 27 43 332 + 36 26 45 36 + 32 18 45 6 + 37 25 46 4676 + 29 18 45 6 + 34 22 43 8 + 41 32 45 1966 + 30 18 42 12 + 33 20 45 1 + 31 23 45 6 + 30 21 46 1 + 36 21 43 14 + 34 18 45 37 + 42 32 47 3508 + 41 32 41 13 + 37 25 45 719 + 33 20 45 111 + 38 28 42 8 + 35 23 43 14 + 39 23 47 123 + 28 13 44 1 + 34 19 41 38 + 35 21 43 8 + 33 26 47 124 + 30 18 41 9 + 43 30 46 11935 + 40 28 48 2329 + 35 19 45 286 + 30 21 43 80 + 37 21 49 474 + 41 27 49 1560 + 42 24 46 1802 + 38 28 42 6807 + 38 24 43 63 + 33 24 49 35 + 41 27 41 9795 + 29 16 41 2 + 29 17 43 2 + 34 21 45 125 + 39 28 45 1008 + 34 21 42 8 + 36 23 45 2 + 34 22 41 8 + 34 21 41 74 + 37 21 43 262 + 30 18 41 8 + 33 22 49 3 + 33 21 42 1 + 35 28 49 21 + 31 19 43 1 + 36 24 44 10 + 40 23 49 583 + 33 19 37 9 + 32 21 45 6 + 38 24 47 15 + 42 27 47 2847 + 36 28 45 106 + 39 28 43 53 + 30 16 42 2 + 28 18 49 3 + 33 21 44 1 + 36 24 45 3050 + 37 27 40 8 + 35 19 43 12 + 41 29 43 19008 + 21 0 0 0 + 38 26 41 762 + 33 21 46 12 + 41 26 47 14517 + 33 24 49 3 + 41 31 47 287 + 35 24 51 17 + 37 27 42 38 + 34 22 43 24 + 39 26 46 135 + 38 26 41 493 + 35 22 42 8 + 38 24 41 1082 + 32 23 42 1 + 33 24 40 8 + 37 25 48 640 + 28 14 39 9 + 39 20 45 212 + 37 29 45 610 + 34 26 47 57 + 29 21 41 8 + 35 16 45 53 + 35 21 44 2 + 38 26 48 188 + 34 25 41 10 + 36 23 44 8 + 35 21 45 8 + 35 26 41 8 + 37 26 40 9 + 28 12 43 1 + 34 22 51 3 + 35 25 44 13 + 32 16 44 32 + 32 19 45 143 + 29 17 43 1 + 35 22 43 93 + 38 21 43 99 + 36 26 49 242 + 34 22 45 8 + 40 24 45 136 + 40 24 48 88 + 38 21 46 49 + 40 27 49 116 + 41 26 44 3696 + 35 23 42 8 + 28 15 45 104 + 33 21 43 106 + 35 25 45 31 + 33 24 40 113 + 36 24 46 23 + 37 25 45 334 + 32 21 46 12 + 35 21 41 2 + 36 22 45 8 + 37 18 43 13 + 37 26 47 48 + 39 25 46 400 + 37 27 43 174 + 37 23 47 41 + 40 21 47 1811 + 38 26 45 79 + 26 15 43 1 + 39 27 49 19 + 31 19 44 1 + 37 22 43 8 + 32 24 38 9 + 34 23 48 3 + 37 24 51 22 + 27 18 42 2 + 31 22 47 5 + 33 17 41 2 + 40 28 45 14534 + 37 21 47 5 + 27 15 43 2 + 43 26 47 46658 + 39 22 43 8 + 36 23 41 2 + 31 19 43 12 + 36 24 43 10 + 33 20 43 149 + 30 19 47 3 + 39 27 51 1236 + 41 26 45 4744 + 39 22 47 100 + 32 18 44 6 + 32 21 43 54 + 40 30 46 777 + 35 25 43 355 + 36 24 41 138 + 40 30 47 3056 + 39 28 46 19 + 34 21 46 6 + 34 18 46 52 + 36 27 41 232 + 35 25 51 3 + 36 28 44 110 + 33 23 45 1 + 37 22 46 64301 + 39 23 49 41 + 39 30 40 25 + 36 23 48 6 + 29 17 42 2 + 36 23 44 1 + 32 17 43 40 + 32 16 49 86 + 29 19 49 5 + 38 26 41 9 + 40 28 43 56710 + 41 29 45 1711 + 36 23 49 345 + 35 25 43 8 + 35 24 46 19 + 37 23 41 648 + 30 18 45 1 + 30 21 43 1 + 34 20 45 12 + 42 25 47 431 + 40 27 41 15878 + 34 22 43 8 + 41 29 48 49 + 32 21 43 2 + 37 22 43 2 + 39 28 49 86 + 43 28 45 8032 + 41 30 49 15674 + 34 22 48 17 + 36 24 48 107 + 28 20 44 1 + 43 28 48 1986 + 40 25 47 2585 + 38 21 43 59 + 38 28 41 167 + 34 22 39 9 + 43 27 48 4196 + 32 20 44 120 + 33 25 45 99 + 26 12 42 2 + 26 15 47 4 + 37 21 42 10 + 35 25 49 3 + 42 30 49 11151 + 33 20 44 2 + 39 26 45 65238 + 31 16 40 2 + 38 26 39 8 + 36 22 45 82 + 32 22 49 7 + 33 20 45 2 + 40 24 43 12 + 32 18 50 3 + 31 21 40 2 + 34 18 44 2 + 38 28 46 194 + 36 21 43 12 + 32 20 43 8 + 30 18 42 2 + 37 21 47 31 + 36 23 47 15 + 36 21 45 113 + 34 23 44 1 + 43 29 49 3889 + 37 24 47 32 + 41 22 43 243 + 38 25 47 707 + 35 22 43 18399 + 33 22 45 123 + 37 24 42 8 + 39 25 47 1087 + 34 23 47 107 + 32 21 42 2 + 42 25 47 106 + 39 24 42 13560 + 42 29 49 52387 + 38 27 43 59 + 31 18 39 9 + 40 28 48 41 + 37 25 45 11 + 30 23 45 242 + 38 23 47 1673 + 36 23 45 751 + 29 22 41 2 + 36 19 48 3 + 36 22 45 12 + 35 18 47 20 + 40 28 49 17369 + 29 19 46 2 + 36 26 42 25 + 42 30 49 4767 + 30 20 45 6 + 35 24 44 12 + 41 24 42 1537 + 38 25 47 629 + 31 21 44 2 + 34 22 43 1 + 33 20 47 3 + 34 20 43 8 + 40 26 49 4320 + 31 16 43 9 + 34 22 45 8 + 32 22 46 124 + 32 20 43 13 + 40 28 47 1185 + 41 24 45 30643 + 39 23 43 1658 + 33 23 44 8 + 36 22 46 23 + 41 25 47 114 + 36 21 42 12 + 33 19 48 31 + 42 28 48 76 + 29 22 39 9 + 36 21 47 3 + 37 27 45 282 + 42 29 46 24995 + 36 26 39 9 + 40 25 46 123 + 39 26 41 8 + 41 30 45 3143 + 34 20 41 27 + 38 31 42 17297 + 40 24 51 3052 + 36 28 45 190 + 31 23 42 8 + 42 26 42 68 + 39 31 45 37327 + 37 27 41 8 + 36 20 45 76 + 38 26 42 10 + 36 21 45 63 + 40 31 43 140 + 40 27 49 21 + 31 22 36 9 + 34 22 39 9 + 29 17 43 2 + 36 26 45 61 + 38 23 45 15 + 31 21 43 54 + 36 22 41 93 + 31 18 43 2 + 35 25 49 108 + 41 29 45 18292 + 37 25 45 104 + 28 20 41 2 + 35 26 46 35 + 34 20 46 19 + 38 22 51 183 + 34 14 43 8 + 32 23 43 16 + 27 17 44 1 + 29 15 42 2 + 37 26 41 129 diff --git a/lib/ftrsd/ftrsd_paper/stats_0.0 b/lib/ftrsd/ftrsd_paper/stats_0.0 index f051da94..75c97780 100755 --- a/lib/ftrsd/ftrsd_paper/stats_0.0 +++ b/lib/ftrsd/ftrsd_paper/stats_0.0 @@ -1,27 +1,27 @@ - SNR Files Sync BM FT Hint Total False BadSync --------------------------------------------------------- --18.0 1000 1000 1000 1000 1000 1000 0 0 --18.5 1000 1000 1000 1000 1000 1000 0 0 --19.0 1000 1000 1000 1000 1000 1000 0 0 --19.5 1000 1000 1000 1000 1000 1000 0 0 --20.0 1000 1000 1000 1000 1000 1000 0 0 --20.5 1000 1000 1000 1000 1000 1000 0 0 --21.0 1000 1000 1000 1000 1000 1000 0 0 --21.5 1000 1000 991 1000 1000 1000 0 0 --22.0 1000 1000 918 1000 1000 1000 0 0 --22.5 1000 1000 631 1000 1000 1000 0 0 --23.0 1000 1000 261 1000 1000 1000 0 0 --23.5 1000 1000 57 990 1000 1000 0 0 --24.0 1000 1000 0 925 1000 1000 0 0 --24.5 1000 1000 0 737 1000 1000 0 0 --25.0 1000 999 0 445 999 999 1 ? --25.5 1000 996 0 191 996 996 2 ? --26.0 1000 980 0 68 985 985 3 ? --26.5 1000 953 0 18 975 975 3 ? --27.0 1000 904 0 3 926 926 4 ? --27.5 1000 816 0 2 874 874 3 ? --28.0 1000 722 0 0 786 786 7 ? --28.5 1000 590 0 0 616 616 12 ? --29.0 1000 451 0 0 479 479 15 ? --29.5 1000 355 0 0 303 303 27 ? --30.0 1000 277 0 0 173 173 28 ? + SNR Files Sync BM FT Hint Total False BadSync +-------------------------------------------------------- +-18.0 1000 1000 1000 1000 1000 1000 0 0 +-18.5 1000 1000 1000 1000 1000 1000 0 0 +-19.0 1000 1000 1000 1000 1000 1000 0 0 +-19.5 1000 1000 1000 1000 1000 1000 0 0 +-20.0 1000 1000 1000 1000 1000 1000 0 0 +-20.5 1000 1000 1000 1000 1000 1000 0 0 +-21.0 1000 1000 1000 1000 1000 1000 0 0 +-21.5 1000 1000 991 1000 1000 1000 0 0 +-22.0 1000 1000 918 1000 1000 1000 0 0 +-22.5 1000 1000 631 1000 1000 1000 0 0 +-23.0 1000 1000 261 1000 1000 1000 0 0 +-23.5 1000 1000 57 990 1000 1000 0 0 +-24.0 1000 1000 0 925 1000 1000 0 0 +-24.5 1000 1000 0 737 1000 1000 0 0 +-25.0 1000 999 0 445 999 999 1 ? +-25.5 1000 996 0 191 996 996 2 ? +-26.0 1000 980 0 68 985 985 3 ? +-26.5 1000 953 0 18 975 975 3 ? +-27.0 1000 904 0 3 926 926 4 ? +-27.5 1000 816 0 2 874 874 3 ? +-28.0 1000 722 0 0 786 786 7 ? +-28.5 1000 590 0 0 616 616 12 ? +-29.0 1000 451 0 0 479 479 15 ? +-29.5 1000 355 0 0 303 303 27 ? +-30.0 1000 277 0 0 173 173 28 ? diff --git a/lib/ftrsd/ftrsd_paper/stats_0.2 b/lib/ftrsd/ftrsd_paper/stats_0.2 index 7a26d992..1e0cb00c 100755 --- a/lib/ftrsd/ftrsd_paper/stats_0.2 +++ b/lib/ftrsd/ftrsd_paper/stats_0.2 @@ -1,27 +1,27 @@ - SNR Files Sync BM FT Hint Total False BadSync --------------------------------------------------------- --18.0 1000 998 973 998 998 998 0 2 --18.5 1000 1000 960 1000 1000 1000 0 0 --19.0 1000 1000 917 1000 1000 1000 0 0 --19.5 1000 1000 849 1000 1000 1000 0 0 --20.0 1000 1000 725 1000 1000 1000 0 0 --20.5 1000 1000 549 1000 1000 1000 0 0 --21.0 1000 1000 373 1000 1000 1000 0 0 --21.5 1000 1000 216 1000 1000 1000 0 0 --22.0 1000 1000 100 998 1000 1000 0 0 --22.5 1000 1000 32 998 1000 1000 0 0 --23.0 1000 1000 12 991 1000 1000 0 0 --23.5 1000 998 2 958 1000 1000 0 2 --24.0 1000 992 0 878 998 998 1 8 --24.5 1000 986 0 739 995 995 0 14 --25.0 1000 977 0 533 991 991 0 23 --25.5 1000 959 0 324 975 975 3 41 --26.0 1000 930 0 153 953 953 1 70 --26.5 1000 874 0 51 924 924 8 126 --27.0 1000 808 0 14 866 866 6 192 --27.5 1000 716 0 3 799 799 10 284 --28.0 1000 610 0 1 689 689 14 390 --28.5 1000 497 0 0 596 596 19 503 --29.0 1000 399 0 0 451 451 21 601 --29.5 1000 300 0 0 270 270 27 700 --30.0 1000 243 0 0 172 172 26 757 + SNR Files Sync BM FT Hint Total False BadSync +-------------------------------------------------------- +-18.0 1000 998 973 998 998 998 0 2 +-18.5 1000 1000 960 1000 1000 1000 0 0 +-19.0 1000 1000 917 1000 1000 1000 0 0 +-19.5 1000 1000 849 1000 1000 1000 0 0 +-20.0 1000 1000 725 1000 1000 1000 0 0 +-20.5 1000 1000 549 1000 1000 1000 0 0 +-21.0 1000 1000 373 1000 1000 1000 0 0 +-21.5 1000 1000 216 1000 1000 1000 0 0 +-22.0 1000 1000 100 998 1000 1000 0 0 +-22.5 1000 1000 32 998 1000 1000 0 0 +-23.0 1000 1000 12 991 1000 1000 0 0 +-23.5 1000 998 2 958 1000 1000 0 2 +-24.0 1000 992 0 878 998 998 1 8 +-24.5 1000 986 0 739 995 995 0 14 +-25.0 1000 977 0 533 991 991 0 23 +-25.5 1000 959 0 324 975 975 3 41 +-26.0 1000 930 0 153 953 953 1 70 +-26.5 1000 874 0 51 924 924 8 126 +-27.0 1000 808 0 14 866 866 6 192 +-27.5 1000 716 0 3 799 799 10 284 +-28.0 1000 610 0 1 689 689 14 390 +-28.5 1000 497 0 0 596 596 19 503 +-29.0 1000 399 0 0 451 451 21 601 +-29.5 1000 300 0 0 270 270 27 700 +-30.0 1000 243 0 0 172 172 26 757 diff --git a/lib/ftrsd/ftrsd_paper/stats_1.0 b/lib/ftrsd/ftrsd_paper/stats_1.0 index df5e789e..34f94c62 100755 --- a/lib/ftrsd/ftrsd_paper/stats_1.0 +++ b/lib/ftrsd/ftrsd_paper/stats_1.0 @@ -1,27 +1,27 @@ - SNR Files Sync BM FT Hint Total False BadSync --------------------------------------------------------- --18.0 1000 998 917 998 998 998 1 2 --18.5 1000 998 824 998 998 998 0 2 --19.0 1000 999 695 999 999 999 0 1 --19.5 1000 999 504 999 999 999 0 1 --20.0 1000 1000 300 1000 1000 1000 0 0 --20.5 1000 1000 148 1000 1000 1000 0 0 --21.0 1000 1000 56 1000 1000 1000 0 0 --21.5 1000 1000 10 1000 1000 1000 0 0 --22.0 1000 999 3 995 1000 1000 0 1 --22.5 1000 998 0 972 1000 1000 0 2 --23.0 1000 997 0 899 999 999 0 3 --23.5 1000 996 0 758 999 999 0 4 --24.0 1000 990 0 545 999 999 0 10 --24.5 1000 981 0 305 988 988 2 19 --25.0 1000 964 0 128 987 987 0 36 --25.5 1000 930 0 43 956 956 4 70 --26.0 1000 870 0 15 932 932 4 130 --26.5 1000 810 0 4 889 889 8 190 --27.0 1000 737 0 0 798 798 9 263 --27.5 1000 632 0 0 650 650 10 368 --28.0 1000 522 0 0 526 526 15 478 --28.5 1000 426 0 0 383 383 19 574 --29.0 1000 332 0 0 226 226 34 668 --29.5 1000 260 0 0 136 136 32 740 --30.0 1000 209 0 0 64 64 47 791 + SNR Files Sync BM FT Hint Total False BadSync +-------------------------------------------------------- +-18.0 1000 998 917 998 998 998 1 2 +-18.5 1000 998 824 998 998 998 0 2 +-19.0 1000 999 695 999 999 999 0 1 +-19.5 1000 999 504 999 999 999 0 1 +-20.0 1000 1000 300 1000 1000 1000 0 0 +-20.5 1000 1000 148 1000 1000 1000 0 0 +-21.0 1000 1000 56 1000 1000 1000 0 0 +-21.5 1000 1000 10 1000 1000 1000 0 0 +-22.0 1000 999 3 995 1000 1000 0 1 +-22.5 1000 998 0 972 1000 1000 0 2 +-23.0 1000 997 0 899 999 999 0 3 +-23.5 1000 996 0 758 999 999 0 4 +-24.0 1000 990 0 545 999 999 0 10 +-24.5 1000 981 0 305 988 988 2 19 +-25.0 1000 964 0 128 987 987 0 36 +-25.5 1000 930 0 43 956 956 4 70 +-26.0 1000 870 0 15 932 932 4 130 +-26.5 1000 810 0 4 889 889 8 190 +-27.0 1000 737 0 0 798 798 9 263 +-27.5 1000 632 0 0 650 650 10 368 +-28.0 1000 522 0 0 526 526 15 478 +-28.5 1000 426 0 0 383 383 19 574 +-29.0 1000 332 0 0 226 226 34 668 +-29.5 1000 260 0 0 136 136 32 740 +-30.0 1000 209 0 0 64 64 47 791 diff --git a/lib/ftrsd/ftrsd_paper/wer2.lab b/lib/ftrsd/ftrsd_paper/wer2.lab index e0ce7e49..b3440f83 100755 --- a/lib/ftrsd/ftrsd_paper/wer2.lab +++ b/lib/ftrsd/ftrsd_paper/wer2.lab @@ -1,7 +1,7 @@ --25.7 30 $10^5$ --25.25 36 $10^4$ --24.5 44 $10^3$ --24.15 48 $10^2$ --23.7 44 10 --22.5 48 BM +-25.7 30 $10^5$ +-25.25 36 $10^4$ +-24.5 44 $10^3$ +-24.15 48 $10^2$ +-23.7 44 10 +-22.5 48 BM -25.2 24 KV \ No newline at end of file diff --git a/lib/ftrsd/ftrsdap.c b/lib/ftrsd/ftrsdap.c index bb9d2f17..b2b85ddd 100755 --- a/lib/ftrsd/ftrsdap.c +++ b/lib/ftrsd/ftrsdap.c @@ -1,227 +1,227 @@ -/* - ftrsdap.c - - A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. - - This decoding scheme is built around Phil Karn's Berlekamp-Massey - errors and erasures decoder. The approach is inspired by a number of - publications, including the stochastic Chase decoder described - in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., - IEEE Communications Letters, Vol. 14, No. 9, September 2010 and - "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- - and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. - - Steve Franke K9AN and Joe Taylor K1JT - */ - -#include -#include -#include -#include -#include -#include "../ftrsd/rs2.h" - -static void *rs; -void getpp_(int workdat[], float *pp); - -void ftrsdap_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], - int ap[], int* ntrials0, int correct[], int param[], int ntry[]) -{ - int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63]; - int workdat[63]; - int indexes[63]; - int era_pos[51]; - int i, j, numera, nerr, nn=63; - int ntrials = *ntrials0; - int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768; - int ntotal=0,ntotal_min=32768,ncandidates; - int nera_best=0; - float pp,pp1,pp2; - static unsigned int nseed; - -// Power-percentage symbol metrics - composite gnnf/hf - int perr[8][8] = { - { 4, 9, 11, 13, 14, 14, 15, 15}, - { 2, 20, 20, 30, 40, 50, 50, 50}, - { 7, 24, 27, 40, 50, 50, 50, 50}, - {13, 25, 35, 46, 52, 70, 50, 50}, - {17, 30, 42, 54, 55, 64, 71, 70}, - {25, 39, 48, 57, 64, 66, 77, 77}, - {32, 45, 54, 63, 66, 75, 78, 83}, - {51, 58, 57, 66, 72, 77, 82, 86}}; - - -// Initialize the KA9Q Reed-Solomon encoder/decoder - unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51; - rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0); - -// Reverse the received symbol vectors for BM decoder - for (i=0; i<63; i++) { - rxdat[i]=mrsym[62-i]; - rxprob[i]=mrprob[62-i]; - rxdat2[i]=mr2sym[62-i]; - rxprob2[i]=mr2prob[62-i]; - } - -// Set ap symbols and ap mask - for (i=0; i<12; i++) { - if(ap[i]>=0) { - rxdat[11-i]=ap[i]; - rxprob2[11-i]=-1; - } - } - -// Sort rxprob to find indexes of the least reliable symbols - int k, pass, tmp, nsym=63; - int probs[63]; - for (i=0; i<63; i++) { - indexes[i]=i; - probs[i]=rxprob[i]; - } - for (pass = 1; pass <= nsym-1; pass++) { - for (k = 0; k < nsym - pass; k++) { - if( probs[k] < probs[k+1] ) { - tmp = probs[k]; - probs[k] = probs[k+1]; - probs[k+1] = tmp; - tmp = indexes[k]; - indexes[k] = indexes[k+1]; - indexes[k+1] = tmp; - } - } - } - -// See if we can decode using BM HDD, and calculate the syndrome vector. - memset(era_pos,0,51*sizeof(int)); - numera=0; - memcpy(workdat,rxdat,sizeof(rxdat)); - nerr=decode_rs_int(rs,workdat,era_pos,numera,1); - if( nerr >= 0 ) { - // Hard-decision decoding succeeded. Save codeword and some parameters. - nhard=0; - for (i=0; i<63; i++) { - if( workdat[i] != rxdat[i] ) nhard=nhard+1; - } - memcpy(correct,workdat,63*sizeof(int)); - param[0]=0; - param[1]=nhard; - param[2]=0; - param[3]=0; - param[4]=0; - param[5]=0; - param[7]=1000*1000; - ntry[0]=0; - return; - } - -/* -Hard-decision decoding failed. Try the FT soft-decision method. -Generate random erasure-locator vectors and see if any of them -decode. This will generate a list of "candidate" codewords. The -soft distance between each candidate codeword and the received -word is estimated by finding the largest (pp1) and second-largest -(pp2) outputs from a synchronized filter-bank operating on the -symbol spectra, and using these to decide which candidate -codeword is "best". -*/ - - nseed=1; //Seed for random numbers - float ratio; - int thresh, nsum; - int thresh0[63]; - ncandidates=0; - nsum=0; - int ii,jj; - for (i=0; i=0 ) { - ratio = (float)rxprob2[j]/((float)rxprob[j]+0.01); - ii = 7.999*ratio; - jj = (62-i)/8; - thresh0[i] = 1.3*perr[ii][jj]; - } else { - thresh0[i] = 0.0; - } -//printf("%d %d %d\n",i,j,rxdat[i]); - } - - if(nsum<=0) return; - - pp1=0.0; - pp2=0.0; - for (k=1; k<=ntrials; k++) { - memset(era_pos,0,51*sizeof(int)); - memcpy(workdat,rxdat,sizeof(rxdat)); - -/* -Mark a subset of the symbols as erasures. -Run through the ranked symbols, starting with the worst, i=0. -NB: j is the symbol-vector index of the symbol with rank i. -*/ - numera=0; - for (i=0; i= 0 ) { - // We have a candidate codeword. Find its hard and soft distance from - // the received word. Also find pp1 and pp2 from the full array - // s3(64,63) of synchronized symbol spectra. - ncandidates=ncandidates+1; - nhard=0; - nsoft=0; - for (i=0; i<63; i++) { - if(workdat[i] != rxdat[i]) { - nhard=nhard+1; - if(workdat[i] != rxdat2[i]) { - nsoft=nsoft+rxprob[i]; - } - } - } - nsoft=63*nsoft/nsum; - ntotal=nsoft+nhard; - - getpp_(workdat,&pp); - if(pp>pp1) { - pp2=pp1; - pp1=pp; - nsoft_min=nsoft; - nhard_min=nhard; - ntotal_min=ntotal; - memcpy(correct,workdat,63*sizeof(int)); - nera_best=numera; - ntry[0]=k; - } else { - if(pp>pp2 && pp!=pp1) pp2=pp; - } - if(nhard_min <= 41 && ntotal_min <= 71) break; - } - if(k == ntrials) ntry[0]=k; - } - - param[0]=ncandidates; - param[1]=nhard_min; - param[2]=nsoft_min; - param[3]=nera_best; - param[4]=1000.0*pp2/pp1; - param[5]=ntotal_min; - param[6]=ntry[0]; - param[7]=1000.0*pp2; - param[8]=1000.0*pp1; - if(param[0]==0) param[2]=-1; - return; -} +/* + ftrsdap.c + + A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. + + This decoding scheme is built around Phil Karn's Berlekamp-Massey + errors and erasures decoder. The approach is inspired by a number of + publications, including the stochastic Chase decoder described + in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., + IEEE Communications Letters, Vol. 14, No. 9, September 2010 and + "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- + and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. + + Steve Franke K9AN and Joe Taylor K1JT + */ + +#include +#include +#include +#include +#include +#include "../ftrsd/rs2.h" + +static void *rs; +void getpp_(int workdat[], float *pp); + +void ftrsdap_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], + int ap[], int* ntrials0, int correct[], int param[], int ntry[]) +{ + int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63]; + int workdat[63]; + int indexes[63]; + int era_pos[51]; + int i, j, numera, nerr, nn=63; + int ntrials = *ntrials0; + int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768; + int ntotal=0,ntotal_min=32768,ncandidates; + int nera_best=0; + float pp,pp1,pp2; + static unsigned int nseed; + +// Power-percentage symbol metrics - composite gnnf/hf + int perr[8][8] = { + { 4, 9, 11, 13, 14, 14, 15, 15}, + { 2, 20, 20, 30, 40, 50, 50, 50}, + { 7, 24, 27, 40, 50, 50, 50, 50}, + {13, 25, 35, 46, 52, 70, 50, 50}, + {17, 30, 42, 54, 55, 64, 71, 70}, + {25, 39, 48, 57, 64, 66, 77, 77}, + {32, 45, 54, 63, 66, 75, 78, 83}, + {51, 58, 57, 66, 72, 77, 82, 86}}; + + +// Initialize the KA9Q Reed-Solomon encoder/decoder + unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51; + rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0); + +// Reverse the received symbol vectors for BM decoder + for (i=0; i<63; i++) { + rxdat[i]=mrsym[62-i]; + rxprob[i]=mrprob[62-i]; + rxdat2[i]=mr2sym[62-i]; + rxprob2[i]=mr2prob[62-i]; + } + +// Set ap symbols and ap mask + for (i=0; i<12; i++) { + if(ap[i]>=0) { + rxdat[11-i]=ap[i]; + rxprob2[11-i]=-1; + } + } + +// Sort rxprob to find indexes of the least reliable symbols + int k, pass, tmp, nsym=63; + int probs[63]; + for (i=0; i<63; i++) { + indexes[i]=i; + probs[i]=rxprob[i]; + } + for (pass = 1; pass <= nsym-1; pass++) { + for (k = 0; k < nsym - pass; k++) { + if( probs[k] < probs[k+1] ) { + tmp = probs[k]; + probs[k] = probs[k+1]; + probs[k+1] = tmp; + tmp = indexes[k]; + indexes[k] = indexes[k+1]; + indexes[k+1] = tmp; + } + } + } + +// See if we can decode using BM HDD, and calculate the syndrome vector. + memset(era_pos,0,51*sizeof(int)); + numera=0; + memcpy(workdat,rxdat,sizeof(rxdat)); + nerr=decode_rs_int(rs,workdat,era_pos,numera,1); + if( nerr >= 0 ) { + // Hard-decision decoding succeeded. Save codeword and some parameters. + nhard=0; + for (i=0; i<63; i++) { + if( workdat[i] != rxdat[i] ) nhard=nhard+1; + } + memcpy(correct,workdat,63*sizeof(int)); + param[0]=0; + param[1]=nhard; + param[2]=0; + param[3]=0; + param[4]=0; + param[5]=0; + param[7]=1000*1000; + ntry[0]=0; + return; + } + +/* +Hard-decision decoding failed. Try the FT soft-decision method. +Generate random erasure-locator vectors and see if any of them +decode. This will generate a list of "candidate" codewords. The +soft distance between each candidate codeword and the received +word is estimated by finding the largest (pp1) and second-largest +(pp2) outputs from a synchronized filter-bank operating on the +symbol spectra, and using these to decide which candidate +codeword is "best". +*/ + + nseed=1; //Seed for random numbers + float ratio; + int thresh, nsum; + int thresh0[63]; + ncandidates=0; + nsum=0; + int ii,jj; + for (i=0; i=0 ) { + ratio = (float)rxprob2[j]/((float)rxprob[j]+0.01); + ii = 7.999*ratio; + jj = (62-i)/8; + thresh0[i] = 1.3*perr[ii][jj]; + } else { + thresh0[i] = 0.0; + } +//printf("%d %d %d\n",i,j,rxdat[i]); + } + + if(nsum<=0) return; + + pp1=0.0; + pp2=0.0; + for (k=1; k<=ntrials; k++) { + memset(era_pos,0,51*sizeof(int)); + memcpy(workdat,rxdat,sizeof(rxdat)); + +/* +Mark a subset of the symbols as erasures. +Run through the ranked symbols, starting with the worst, i=0. +NB: j is the symbol-vector index of the symbol with rank i. +*/ + numera=0; + for (i=0; i= 0 ) { + // We have a candidate codeword. Find its hard and soft distance from + // the received word. Also find pp1 and pp2 from the full array + // s3(64,63) of synchronized symbol spectra. + ncandidates=ncandidates+1; + nhard=0; + nsoft=0; + for (i=0; i<63; i++) { + if(workdat[i] != rxdat[i]) { + nhard=nhard+1; + if(workdat[i] != rxdat2[i]) { + nsoft=nsoft+rxprob[i]; + } + } + } + nsoft=63*nsoft/nsum; + ntotal=nsoft+nhard; + + getpp_(workdat,&pp); + if(pp>pp1) { + pp2=pp1; + pp1=pp; + nsoft_min=nsoft; + nhard_min=nhard; + ntotal_min=ntotal; + memcpy(correct,workdat,63*sizeof(int)); + nera_best=numera; + ntry[0]=k; + } else { + if(pp>pp2 && pp!=pp1) pp2=pp; + } + if(nhard_min <= 41 && ntotal_min <= 71) break; + } + if(k == ntrials) ntry[0]=k; + } + + param[0]=ncandidates; + param[1]=nhard_min; + param[2]=nsoft_min; + param[3]=nera_best; + param[4]=1000.0*pp2/pp1; + param[5]=ntotal_min; + param[6]=ntry[0]; + param[7]=1000.0*pp2; + param[8]=1000.0*pp1; + if(param[0]==0) param[2]=-1; + return; +} diff --git a/lib/ftrsd/init_rs.c b/lib/ftrsd/init_rs.c index 528b8db3..4b1d1edb 100755 --- a/lib/ftrsd/init_rs.c +++ b/lib/ftrsd/init_rs.c @@ -1,119 +1,119 @@ -/* Initialize a RS codec - * - * Copyright 2002 Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#include - -#ifdef CCSDS -#include "ccsds.h" -#elif defined(BIGSYM) -#include "int.h" -#else -#include "char.h" -#endif - -void FREE_RS(void *p){ - struct rs *rs = (struct rs *)p; - - free(rs->alpha_to); - free(rs->index_of); - free(rs->genpoly); - free(rs); -} - -/* Initialize a Reed-Solomon codec - * symsize = symbol size, bits (1-8) - * gfpoly = Field generator polynomial coefficients - * fcr = first root of RS code generator polynomial, index form - * prim = primitive element to generate polynomial roots - * nroots = RS code generator polynomial degree (number of roots) - */ -void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned prim, - unsigned int nroots){ - struct rs *rs; - int i, j, sr,root,iprim; - - if(symsize > 8*sizeof(DTYPE)) - return NULL; /* Need version with ints rather than chars */ - - if(fcr >= (1<= (1<= (1<mm = symsize; - rs->nn = (1<alpha_to = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); - if(rs->alpha_to == NULL){ - free(rs); - return NULL; - } - rs->index_of = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); - if(rs->index_of == NULL){ - free(rs->alpha_to); - free(rs); - return NULL; - } - - /* Generate Galois field lookup tables */ - rs->index_of[0] = A0; /* log(zero) = -inf */ - rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */ - sr = 1; - for(i=0;inn;i++){ - rs->index_of[sr] = i; - rs->alpha_to[i] = sr; - sr <<= 1; - if(sr & (1<nn; - } - if(sr != 1){ - /* field generator polynomial is not primitive! */ - free(rs->alpha_to); - free(rs->index_of); - free(rs); - return NULL; - } - - /* Form RS code generator polynomial from its roots */ - rs->genpoly = (DTYPE *)malloc(sizeof(DTYPE)*(nroots+1)); - if(rs->genpoly == NULL){ - free(rs->alpha_to); - free(rs->index_of); - free(rs); - return NULL; - } - rs->fcr = fcr; - rs->prim = prim; - rs->nroots = nroots; - - /* Find prim-th root of 1, used in decoding */ - for(iprim=1;(iprim % prim) != 0;iprim += rs->nn) - ; - rs->iprim = iprim / prim; - - rs->genpoly[0] = 1; - for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) { - rs->genpoly[i+1] = 1; - - /* Multiply rs->genpoly[] by @**(root + x) */ - for (j = i; j > 0; j--){ - if (rs->genpoly[j] != 0) - rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)]; - else - rs->genpoly[j] = rs->genpoly[j-1]; - } - /* rs->genpoly[0] can never be zero */ - rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)]; - } - /* convert rs->genpoly[] to index form for quicker encoding */ - for (i = 0; i <= nroots; i++) - rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; - - return rs; -} +/* Initialize a RS codec + * + * Copyright 2002 Phil Karn, KA9Q + * May be used under the terms of the GNU General Public License (GPL) + */ +#include + +#ifdef CCSDS +#include "ccsds.h" +#elif defined(BIGSYM) +#include "int.h" +#else +#include "char.h" +#endif + +void FREE_RS(void *p){ + struct rs *rs = (struct rs *)p; + + free(rs->alpha_to); + free(rs->index_of); + free(rs->genpoly); + free(rs); +} + +/* Initialize a Reed-Solomon codec + * symsize = symbol size, bits (1-8) + * gfpoly = Field generator polynomial coefficients + * fcr = first root of RS code generator polynomial, index form + * prim = primitive element to generate polynomial roots + * nroots = RS code generator polynomial degree (number of roots) + */ +void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned prim, + unsigned int nroots){ + struct rs *rs; + int i, j, sr,root,iprim; + + if(symsize > 8*sizeof(DTYPE)) + return NULL; /* Need version with ints rather than chars */ + + if(fcr >= (1<= (1<= (1<mm = symsize; + rs->nn = (1<alpha_to = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); + if(rs->alpha_to == NULL){ + free(rs); + return NULL; + } + rs->index_of = (DTYPE *)malloc(sizeof(DTYPE)*(rs->nn+1)); + if(rs->index_of == NULL){ + free(rs->alpha_to); + free(rs); + return NULL; + } + + /* Generate Galois field lookup tables */ + rs->index_of[0] = A0; /* log(zero) = -inf */ + rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */ + sr = 1; + for(i=0;inn;i++){ + rs->index_of[sr] = i; + rs->alpha_to[i] = sr; + sr <<= 1; + if(sr & (1<nn; + } + if(sr != 1){ + /* field generator polynomial is not primitive! */ + free(rs->alpha_to); + free(rs->index_of); + free(rs); + return NULL; + } + + /* Form RS code generator polynomial from its roots */ + rs->genpoly = (DTYPE *)malloc(sizeof(DTYPE)*(nroots+1)); + if(rs->genpoly == NULL){ + free(rs->alpha_to); + free(rs->index_of); + free(rs); + return NULL; + } + rs->fcr = fcr; + rs->prim = prim; + rs->nroots = nroots; + + /* Find prim-th root of 1, used in decoding */ + for(iprim=1;(iprim % prim) != 0;iprim += rs->nn) + ; + rs->iprim = iprim / prim; + + rs->genpoly[0] = 1; + for (i = 0,root=fcr*prim; i < nroots; i++,root += prim) { + rs->genpoly[i+1] = 1; + + /* Multiply rs->genpoly[] by @**(root + x) */ + for (j = i; j > 0; j--){ + if (rs->genpoly[j] != 0) + rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)]; + else + rs->genpoly[j] = rs->genpoly[j-1]; + } + /* rs->genpoly[0] can never be zero */ + rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)]; + } + /* convert rs->genpoly[] to index form for quicker encoding */ + for (i = 0; i <= nroots; i++) + rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; + + return rs; +} diff --git a/lib/ftrsd/int.h b/lib/ftrsd/int.h index 3c4f26a6..ada5bfd4 100755 --- a/lib/ftrsd/int.h +++ b/lib/ftrsd/int.h @@ -1,54 +1,54 @@ -/* Include file to configure the RS codec for integer symbols - * - * Copyright 2002, Phil Karn, KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ -#define DTYPE int - -/* Reed-Solomon codec control block */ -struct rs { - unsigned int mm; /* Bits per symbol */ - unsigned int nn; /* Symbols per block (= (1<= rs->nn) { - x -= rs->nn; - x = (x >> rs->mm) + (x & rs->nn); - } - return x; -} -#define MODNN(x) modnn(rs,x) - -#define MM (rs->mm) -#define NN (rs->nn) -#define ALPHA_TO (rs->alpha_to) -#define INDEX_OF (rs->index_of) -#define GENPOLY (rs->genpoly) -#define NROOTS (rs->nroots) -#define FCR (rs->fcr) -#define PRIM (rs->prim) -#define IPRIM (rs->iprim) -#define A0 (NN) - -#define ENCODE_RS encode_rs_int -#define DECODE_RS decode_rs_int -#define INIT_RS init_rs_int -#define FREE_RS free_rs_int - -void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); -int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras, int calc_syn); -void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, - unsigned int prim,unsigned int nroots); -void FREE_RS(void *p); - - - - +/* Include file to configure the RS codec for integer symbols + * + * Copyright 2002, Phil Karn, KA9Q + * May be used under the terms of the GNU General Public License (GPL) + */ +#define DTYPE int + +/* Reed-Solomon codec control block */ +struct rs { + unsigned int mm; /* Bits per symbol */ + unsigned int nn; /* Symbols per block (= (1<= rs->nn) { + x -= rs->nn; + x = (x >> rs->mm) + (x & rs->nn); + } + return x; +} +#define MODNN(x) modnn(rs,x) + +#define MM (rs->mm) +#define NN (rs->nn) +#define ALPHA_TO (rs->alpha_to) +#define INDEX_OF (rs->index_of) +#define GENPOLY (rs->genpoly) +#define NROOTS (rs->nroots) +#define FCR (rs->fcr) +#define PRIM (rs->prim) +#define IPRIM (rs->iprim) +#define A0 (NN) + +#define ENCODE_RS encode_rs_int +#define DECODE_RS decode_rs_int +#define INIT_RS init_rs_int +#define FREE_RS free_rs_int + +void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity); +int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras, int calc_syn); +void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr, + unsigned int prim,unsigned int nroots); +void FREE_RS(void *p); + + + + diff --git a/lib/ftrsd/rs2.h b/lib/ftrsd/rs2.h index ab65fb01..c2b807d1 100755 --- a/lib/ftrsd/rs2.h +++ b/lib/ftrsd/rs2.h @@ -1,16 +1,16 @@ -/* User include file for the Reed-Solomon codec - * Copyright 2002, Phil Karn KA9Q - * May be used under the terms of the GNU General Public License (GPL) - */ - -/* General purpose RS codec, integer symbols */ -void encode_rs_int(void *rs,int *data,int *parity); -int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras, int calc_syn); -void *init_rs_int(int symsize,int gfpoly,int fcr, - int prim,int nroots,int pad); -void free_rs_int(void *rs); - -/* Tables to map from conventional->dual (Taltab) and - * dual->conventional (Tal1tab) bases - */ -extern unsigned char Taltab[],Tal1tab[]; +/* User include file for the Reed-Solomon codec + * Copyright 2002, Phil Karn KA9Q + * May be used under the terms of the GNU General Public License (GPL) + */ + +/* General purpose RS codec, integer symbols */ +void encode_rs_int(void *rs,int *data,int *parity); +int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras, int calc_syn); +void *init_rs_int(int symsize,int gfpoly,int fcr, + int prim,int nroots,int pad); +void free_rs_int(void *rs); + +/* Tables to map from conventional->dual (Taltab) and + * dual->conventional (Tal1tab) bases + */ +extern unsigned char Taltab[],Tal1tab[]; diff --git a/lib/ftrsd/rsdtest.f90 b/lib/ftrsd/rsdtest.f90 index 1de8aadb..2c862e5a 100755 --- a/lib/ftrsd/rsdtest.f90 +++ b/lib/ftrsd/rsdtest.f90 @@ -1,34 +1,34 @@ -program rsdtest - - real s3(64,63) - character msg*22,arg*12 - integer param(0:7) - - nargs=iargc() - if(nargs.ne.2) then - print*,'Usage: rsdtest ntrials nfiles' - go to 999 - endif - call getarg(1,arg) - read(arg,*) ntrials - call getarg(2,arg) - read(arg,*) nfiles - - open(10,file='s3_1000.bin',access='stream', status='old') - open(22,file='kvasd.dat',access='direct',recl=1024,status='unknown') - - nadd=1 - ifile0=0 - if(nfiles.lt.0) then - ifile0=-nfiles - nfiles=99999 - endif - - do ifile=1,nfiles - read(10,end=999) s3 - if(ifile.lt.ifile0) cycle - call extract2(s3,nadd,ntrials,param,msg) - if(ifile.eq.ifile0) exit - enddo - -999 end program rsdtest +program rsdtest + + real s3(64,63) + character msg*22,arg*12 + integer param(0:7) + + nargs=iargc() + if(nargs.ne.2) then + print*,'Usage: rsdtest ntrials nfiles' + go to 999 + endif + call getarg(1,arg) + read(arg,*) ntrials + call getarg(2,arg) + read(arg,*) nfiles + + open(10,file='s3_1000.bin',access='stream', status='old') + open(22,file='kvasd.dat',access='direct',recl=1024,status='unknown') + + nadd=1 + ifile0=0 + if(nfiles.lt.0) then + ifile0=-nfiles + nfiles=99999 + endif + + do ifile=1,nfiles + read(10,end=999) s3 + if(ifile.lt.ifile0) cycle + call extract2(s3,nadd,ntrials,param,msg) + if(ifile.eq.ifile0) exit + enddo + +999 end program rsdtest diff --git a/lib/ftrsd/sfrsd.c b/lib/ftrsd/sfrsd.c index e6b80181..e64dfc96 100755 --- a/lib/ftrsd/sfrsd.c +++ b/lib/ftrsd/sfrsd.c @@ -1,137 +1,137 @@ -/* - sfrsd.c - - A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. - - This decoding scheme is built around Phil Karn's Berlekamp-Massey - errors and erasures decoder. The approach is inspired by a number of - publications, including the stochastic Chase decoder described - in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., - IEEE Communications Letters, Vol. 14, No. 9, September 2010 and - "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- - and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. - - Steve Franke K9AN, Urbana IL, September 2015 - */ - -#include -#include -#include -#include -#include -#include "sfrsd2.h" - -//*************************************************************************** -void usage(void) -{ - printf("Usage: sfrsd [options...] \n"); - printf(" input file should be in kvasd format\n"); - printf("\n"); - printf("Options:\n"); - printf(" -n number of random erasure vectors to try\n"); - printf(" -v verbose\n"); -} - -int main(int argc, char *argv[]){ - - extern char *optarg; - extern int optind; - - int correct[63], indx[63], param[8]; - int c,i; - char *infile; - - FILE *datfile, *logfile; - int nsec, maxe, nads; - float xlambda; - int mrsym[63],mrprob[63],mr2sym[63],mr2prob[63]; - int nsec2,ncount,dat4[12]; - int ntrials, nverbose, ntry; - int nhard; - double tt; - - ntrials=10000; - nverbose=1; - - while ( (c = getopt(argc, argv, "n:qv")) !=-1 ) { - switch (c) { - case 'n': - ntrials=(int)strtof(optarg,NULL); - printf("ntrials set to %d\n",ntrials); - break; - case 'v': - nverbose=1; - break; - case 'q': //accept (and ignore) -q option for WSJT10 compatibility - break; - case '?': - usage(); - exit(1); - } - } - - if( optind+1 > argc) { - // usage(); - // exit(1); - infile="kvasd.dat"; - } else { - infile=argv[optind]; - } - - logfile=fopen("/tmp/sfrsd.log","a"); - if( !logfile ) { - printf("Unable to open sfrsd.log\n"); - exit(1); - } - - datfile=fopen(infile,"rb"); - if( !datfile ) { - printf("Unable to open kvasd.dat\n"); - exit(1); - } else { - fread(&nsec,sizeof(int),1,datfile); - fread(&xlambda,sizeof(float),1,datfile); - fread(&maxe,sizeof(int),1,datfile); - fread(&nads,sizeof(int),1,datfile); - fread(&mrsym,sizeof(int),63,datfile); - fread(&mrprob,sizeof(int),63,datfile); - fread(&mr2sym,sizeof(int),63,datfile); - fread(&mr2prob,sizeof(int),63,datfile); - fread(&nsec2,sizeof(int),1,datfile); - fread(&ncount,sizeof(int),1,datfile); - fread(&dat4,sizeof(int),12,datfile); - fclose(datfile); - } - - sfrsd2_(mrsym,mrprob,mr2sym,mr2prob,&ntrials,&nverbose,correct,param,indx,&tt,&ntry); - nhard=param[1]; - if( nhard>=0 ) { - for (i=0; i<12; i++) { - dat4[i]=correct[11-i]; - } - } else { - nhard=-1; - memset(dat4,0,12*sizeof(int)); - } - datfile=fopen(infile,"wb"); - if( !datfile ) { - printf("Unable to open kvasd.dat\n"); - return 1; - } else { - fwrite(&nsec,sizeof(int),1,datfile); - fwrite(&xlambda,sizeof(float),1,datfile); - fwrite(&maxe,sizeof(int),1,datfile); - fwrite(&nads,sizeof(int),1,datfile); - fwrite(&mrsym,sizeof(int),63,datfile); - fwrite(&mrprob,sizeof(int),63,datfile); - fwrite(&mr2sym,sizeof(int),63,datfile); - fwrite(&mr2prob,sizeof(int),63,datfile); - fwrite(&nsec2,sizeof(int),1,datfile); - fwrite(&nhard,sizeof(int),1,datfile); - fwrite(&dat4,sizeof(int),12,datfile); - fclose(datfile); - } - exit(0); -} - - +/* + sfrsd.c + + A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. + + This decoding scheme is built around Phil Karn's Berlekamp-Massey + errors and erasures decoder. The approach is inspired by a number of + publications, including the stochastic Chase decoder described + in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., + IEEE Communications Letters, Vol. 14, No. 9, September 2010 and + "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- + and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. + + Steve Franke K9AN, Urbana IL, September 2015 + */ + +#include +#include +#include +#include +#include +#include "sfrsd2.h" + +//*************************************************************************** +void usage(void) +{ + printf("Usage: sfrsd [options...] \n"); + printf(" input file should be in kvasd format\n"); + printf("\n"); + printf("Options:\n"); + printf(" -n number of random erasure vectors to try\n"); + printf(" -v verbose\n"); +} + +int main(int argc, char *argv[]){ + + extern char *optarg; + extern int optind; + + int correct[63], indx[63], param[8]; + int c,i; + char *infile; + + FILE *datfile, *logfile; + int nsec, maxe, nads; + float xlambda; + int mrsym[63],mrprob[63],mr2sym[63],mr2prob[63]; + int nsec2,ncount,dat4[12]; + int ntrials, nverbose, ntry; + int nhard; + double tt; + + ntrials=10000; + nverbose=1; + + while ( (c = getopt(argc, argv, "n:qv")) !=-1 ) { + switch (c) { + case 'n': + ntrials=(int)strtof(optarg,NULL); + printf("ntrials set to %d\n",ntrials); + break; + case 'v': + nverbose=1; + break; + case 'q': //accept (and ignore) -q option for WSJT10 compatibility + break; + case '?': + usage(); + exit(1); + } + } + + if( optind+1 > argc) { + // usage(); + // exit(1); + infile="kvasd.dat"; + } else { + infile=argv[optind]; + } + + logfile=fopen("/tmp/sfrsd.log","a"); + if( !logfile ) { + printf("Unable to open sfrsd.log\n"); + exit(1); + } + + datfile=fopen(infile,"rb"); + if( !datfile ) { + printf("Unable to open kvasd.dat\n"); + exit(1); + } else { + fread(&nsec,sizeof(int),1,datfile); + fread(&xlambda,sizeof(float),1,datfile); + fread(&maxe,sizeof(int),1,datfile); + fread(&nads,sizeof(int),1,datfile); + fread(&mrsym,sizeof(int),63,datfile); + fread(&mrprob,sizeof(int),63,datfile); + fread(&mr2sym,sizeof(int),63,datfile); + fread(&mr2prob,sizeof(int),63,datfile); + fread(&nsec2,sizeof(int),1,datfile); + fread(&ncount,sizeof(int),1,datfile); + fread(&dat4,sizeof(int),12,datfile); + fclose(datfile); + } + + sfrsd2_(mrsym,mrprob,mr2sym,mr2prob,&ntrials,&nverbose,correct,param,indx,&tt,&ntry); + nhard=param[1]; + if( nhard>=0 ) { + for (i=0; i<12; i++) { + dat4[i]=correct[11-i]; + } + } else { + nhard=-1; + memset(dat4,0,12*sizeof(int)); + } + datfile=fopen(infile,"wb"); + if( !datfile ) { + printf("Unable to open kvasd.dat\n"); + return 1; + } else { + fwrite(&nsec,sizeof(int),1,datfile); + fwrite(&xlambda,sizeof(float),1,datfile); + fwrite(&maxe,sizeof(int),1,datfile); + fwrite(&nads,sizeof(int),1,datfile); + fwrite(&mrsym,sizeof(int),63,datfile); + fwrite(&mrprob,sizeof(int),63,datfile); + fwrite(&mr2sym,sizeof(int),63,datfile); + fwrite(&mr2prob,sizeof(int),63,datfile); + fwrite(&nsec2,sizeof(int),1,datfile); + fwrite(&nhard,sizeof(int),1,datfile); + fwrite(&dat4,sizeof(int),12,datfile); + fclose(datfile); + } + exit(0); +} + + diff --git a/lib/ftrsd/sfrsd2.h b/lib/ftrsd/sfrsd2.h index 39eb4877..4ef7ab47 100755 --- a/lib/ftrsd/sfrsd2.h +++ b/lib/ftrsd/sfrsd2.h @@ -1,3 +1,3 @@ -void ftrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], - int* ntrials0, int* verbose0, int correct[], int param[], - int indexes[], double tt[], int ntry[]); +void ftrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], + int* ntrials0, int* verbose0, int correct[], int param[], + int indexes[], double tt[], int ntry[]); diff --git a/lib/ftrsd/sfrsd3.c b/lib/ftrsd/sfrsd3.c index 164389d4..f117dcca 100755 --- a/lib/ftrsd/sfrsd3.c +++ b/lib/ftrsd/sfrsd3.c @@ -1,243 +1,243 @@ -/* - sfrsd2.c - - A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. - - This decoding scheme is built around Phil Karn's Berlekamp-Massey - errors and erasures decoder. The approach is inspired by a number of - publications, including the stochastic Chase decoder described - in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., - IEEE Communications Letters, Vol. 14, No. 9, September 2010 and - "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- - and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. - - Steve Franke K9AN and Joe Taylor K1JT - */ - -#include -#include -#include -#include -#include -#include "rs2.h" - -static void *rs; - -void sfrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], - int* ntrials0, int* verbose0, int correct[], int param[], - int indexes[], double tt[], int ntry[]) -{ - int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63]; - int workdat[63],workdat2[63]; - int era_pos[51]; - int c, i, j, numera, nmr2, nerr, nn=63, kk=12; - FILE *datfile, *logfile; - int ntrials = *ntrials0; - int verbose = *verbose0; - int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768, ncandidates; - int ngmd,nera_best; - clock_t t0=0,t1=0; - int perr[8][8] = { - 12, 31, 44, 52, 60, 57, 50, 50, - 28, 38, 49, 58, 65, 69, 64, 80, - 40, 41, 53, 62, 66, 73, 76, 81, - 50, 53, 53, 64, 70, 76, 77, 81, - 50, 50, 52, 60, 71, 72, 77, 84, - 50, 50, 56, 62, 67, 73, 81, 85, - 50, 50, 71, 62, 70, 77, 80, 85, - 50, 50, 62, 64, 71, 75, 82, 87}; - - int pmr2[8][8] = { - 4, 8, 9, 7, 6, 0, 0, 0, - 13, 18, 15, 11, 9, 7, 5, 0, - 0, 23, 21, 15, 12, 10, 7, 4, - 0, 34, 28, 20, 16, 14, 11, 7, - 0, 20, 26, 25, 19, 14, 12, 9, - 0, 0, 28, 27, 22, 19, 14, 11, - 0, 0, 40, 29, 29, 23, 18, 12, - 0, 0, 40, 35, 31, 21, 20, 13}; - - if(verbose) { - logfile=fopen("sfrsd.log","a"); - if( !logfile ) { - printf("Unable to open sfrsd.log\n"); - exit(1); - } - } - -// Initialize the KA9Q Reed-Solomon encoder/decoder - unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51; - rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0); - -// Reverse the received symbol vector for BM decoder - for (i=0; i<63; i++) { - rxdat[i]=mrsym[62-i]; - rxprob[i]=mrprob[62-i]; - rxdat2[i]=mr2sym[62-i]; - rxprob2[i]=mr2prob[62-i]; - } - -// Sort the mrsym probabilities to find the least reliable symbols - int k, pass, tmp, nsym=63; - int probs[63]; - for (i=0; i<63; i++) { - indexes[i]=i; - probs[i]=rxprob[i]; - } - for (pass = 1; pass <= nsym-1; pass++) { - for (k = 0; k < nsym - pass; k++) { - if( probs[k] < probs[k+1] ) { - tmp = probs[k]; - probs[k] = probs[k+1]; - probs[k+1] = tmp; - tmp = indexes[k]; - indexes[k] = indexes[k+1]; - indexes[k+1] = tmp; - } - } - } - -// See if we can decode using BM HDD, and calculate the syndrome vector. - memset(era_pos,0,51*sizeof(int)); - numera=0; - memcpy(workdat,rxdat,sizeof(rxdat)); - nerr=decode_rs_int(rs,workdat,era_pos,numera,1); - if( nerr >= 0 ) { - if(verbose) fprintf(logfile," BM decode nerrors= %3d : ",nerr); - memcpy(correct,workdat,63*sizeof(int)); - ngmd=-1; - param[0]=0; - param[1]=0; - param[2]=0; - param[3]=0; - param[4]=0; - return; - } - -/* -Generate random erasure-locator vectors and see if any of them -decode. This will generate a list of potential codewords. The -"soft" distance between each codeword and the received word is -used to decide which codeword is "best". -*/ - -#ifdef WIN32 - srand(0xdeadbeef); -#else - srandom(0xdeadbeef); -#endif - - float ratio, ratio0[63]; - int threshe, thresh2, nsum; - int thresh0[63],thresh1[63], mr2flag; - ncandidates=0; - nsum=0; - int ii,jj; - for (i=0; i= 0 ) { - ncandidates=ncandidates+1; - nhard=0; - nsoft=0; - for (i=0; i<63; i++) { - if(workdat[i] != rxdat[i]) { - nhard=nhard+1; - if(workdat[i] != rxdat2[i]) { - nsoft=nsoft+rxprob[i]; - } - } - } - nsoft=63*nsoft/nsum; - if((nsoft < 33) && (nhard < 43) && (nhard+nsoft) < 74) { //??? - if( (nsoft < nsoft_min) ) { - nsoft_min=nsoft; - nhard_min=nhard; - memcpy(correct,workdat,63*sizeof(int)); - ngmd=0; - nera_best=numera; - ntry[0]=k; - } - } - if(nsoft_min < 27) break; - if((nsoft_min < 32) && (nhard_min < 43) && - (nhard_min+nsoft_min) < 74) break; - } - if(k == ntrials-1) ntry[0]=k+1; - } - - if(verbose) fprintf(logfile, - "%d trials and %d candidates after stochastic loop\n",k,ncandidates); - - if( (ncandidates >= 0) && (nsoft_min < 36) && (nhard_min < 44) ) { - if(verbose) { - for (i=0; i<63; i++) { - fprintf(logfile,"%3d %3d %3d %3d %3d %3d\n",i,correct[i], - rxdat[i],rxprob[i],rxdat2[i],rxprob2[i]); - } - fprintf(logfile,"**** ncandidates %d nhard %d nsoft %d nsum %d\n", - ncandidates,nhard_min,nsoft_min,nsum); - } - } else { - nhard_min=-1; - } - - if(verbose) { - fprintf(logfile,"exiting sfrsd\n"); - fclose(logfile); - } - param[0]=ncandidates; - param[1]=nhard_min; - param[2]=nsoft_min; - param[3]=nera_best; - param[4]=ngmd; - if(param[0]==0) param[2]=-1; - return; -} +/* + sfrsd2.c + + A soft-decision decoder for the JT65 (63,12) Reed-Solomon code. + + This decoding scheme is built around Phil Karn's Berlekamp-Massey + errors and erasures decoder. The approach is inspired by a number of + publications, including the stochastic Chase decoder described + in "Stochastic Chase Decoding of Reed-Solomon Codes", by Leroux et al., + IEEE Communications Letters, Vol. 14, No. 9, September 2010 and + "Soft-Decision Decoding of Reed-Solomon Codes Using Successive Error- + and-Erasure Decoding," by Soo-Woong Lee and B. V. K. Vijaya Kumar. + + Steve Franke K9AN and Joe Taylor K1JT + */ + +#include +#include +#include +#include +#include +#include "rs2.h" + +static void *rs; + +void sfrsd2_(int mrsym[], int mrprob[], int mr2sym[], int mr2prob[], + int* ntrials0, int* verbose0, int correct[], int param[], + int indexes[], double tt[], int ntry[]) +{ + int rxdat[63], rxprob[63], rxdat2[63], rxprob2[63]; + int workdat[63],workdat2[63]; + int era_pos[51]; + int c, i, j, numera, nmr2, nerr, nn=63, kk=12; + FILE *datfile, *logfile; + int ntrials = *ntrials0; + int verbose = *verbose0; + int nhard=0,nhard_min=32768,nsoft=0,nsoft_min=32768, ncandidates; + int ngmd,nera_best; + clock_t t0=0,t1=0; + int perr[8][8] = { + 12, 31, 44, 52, 60, 57, 50, 50, + 28, 38, 49, 58, 65, 69, 64, 80, + 40, 41, 53, 62, 66, 73, 76, 81, + 50, 53, 53, 64, 70, 76, 77, 81, + 50, 50, 52, 60, 71, 72, 77, 84, + 50, 50, 56, 62, 67, 73, 81, 85, + 50, 50, 71, 62, 70, 77, 80, 85, + 50, 50, 62, 64, 71, 75, 82, 87}; + + int pmr2[8][8] = { + 4, 8, 9, 7, 6, 0, 0, 0, + 13, 18, 15, 11, 9, 7, 5, 0, + 0, 23, 21, 15, 12, 10, 7, 4, + 0, 34, 28, 20, 16, 14, 11, 7, + 0, 20, 26, 25, 19, 14, 12, 9, + 0, 0, 28, 27, 22, 19, 14, 11, + 0, 0, 40, 29, 29, 23, 18, 12, + 0, 0, 40, 35, 31, 21, 20, 13}; + + if(verbose) { + logfile=fopen("sfrsd.log","a"); + if( !logfile ) { + printf("Unable to open sfrsd.log\n"); + exit(1); + } + } + +// Initialize the KA9Q Reed-Solomon encoder/decoder + unsigned int symsize=6, gfpoly=0x43, fcr=3, prim=1, nroots=51; + rs=init_rs_int(symsize, gfpoly, fcr, prim, nroots, 0); + +// Reverse the received symbol vector for BM decoder + for (i=0; i<63; i++) { + rxdat[i]=mrsym[62-i]; + rxprob[i]=mrprob[62-i]; + rxdat2[i]=mr2sym[62-i]; + rxprob2[i]=mr2prob[62-i]; + } + +// Sort the mrsym probabilities to find the least reliable symbols + int k, pass, tmp, nsym=63; + int probs[63]; + for (i=0; i<63; i++) { + indexes[i]=i; + probs[i]=rxprob[i]; + } + for (pass = 1; pass <= nsym-1; pass++) { + for (k = 0; k < nsym - pass; k++) { + if( probs[k] < probs[k+1] ) { + tmp = probs[k]; + probs[k] = probs[k+1]; + probs[k+1] = tmp; + tmp = indexes[k]; + indexes[k] = indexes[k+1]; + indexes[k+1] = tmp; + } + } + } + +// See if we can decode using BM HDD, and calculate the syndrome vector. + memset(era_pos,0,51*sizeof(int)); + numera=0; + memcpy(workdat,rxdat,sizeof(rxdat)); + nerr=decode_rs_int(rs,workdat,era_pos,numera,1); + if( nerr >= 0 ) { + if(verbose) fprintf(logfile," BM decode nerrors= %3d : ",nerr); + memcpy(correct,workdat,63*sizeof(int)); + ngmd=-1; + param[0]=0; + param[1]=0; + param[2]=0; + param[3]=0; + param[4]=0; + return; + } + +/* +Generate random erasure-locator vectors and see if any of them +decode. This will generate a list of potential codewords. The +"soft" distance between each codeword and the received word is +used to decide which codeword is "best". +*/ + +#ifdef WIN32 + srand(0xdeadbeef); +#else + srandom(0xdeadbeef); +#endif + + float ratio, ratio0[63]; + int threshe, thresh2, nsum; + int thresh0[63],thresh1[63], mr2flag; + ncandidates=0; + nsum=0; + int ii,jj; + for (i=0; i= 0 ) { + ncandidates=ncandidates+1; + nhard=0; + nsoft=0; + for (i=0; i<63; i++) { + if(workdat[i] != rxdat[i]) { + nhard=nhard+1; + if(workdat[i] != rxdat2[i]) { + nsoft=nsoft+rxprob[i]; + } + } + } + nsoft=63*nsoft/nsum; + if((nsoft < 33) && (nhard < 43) && (nhard+nsoft) < 74) { //??? + if( (nsoft < nsoft_min) ) { + nsoft_min=nsoft; + nhard_min=nhard; + memcpy(correct,workdat,63*sizeof(int)); + ngmd=0; + nera_best=numera; + ntry[0]=k; + } + } + if(nsoft_min < 27) break; + if((nsoft_min < 32) && (nhard_min < 43) && + (nhard_min+nsoft_min) < 74) break; + } + if(k == ntrials-1) ntry[0]=k+1; + } + + if(verbose) fprintf(logfile, + "%d trials and %d candidates after stochastic loop\n",k,ncandidates); + + if( (ncandidates >= 0) && (nsoft_min < 36) && (nhard_min < 44) ) { + if(verbose) { + for (i=0; i<63; i++) { + fprintf(logfile,"%3d %3d %3d %3d %3d %3d\n",i,correct[i], + rxdat[i],rxprob[i],rxdat2[i],rxprob2[i]); + } + fprintf(logfile,"**** ncandidates %d nhard %d nsoft %d nsum %d\n", + ncandidates,nhard_min,nsoft_min,nsum); + } + } else { + nhard_min=-1; + } + + if(verbose) { + fprintf(logfile,"exiting sfrsd\n"); + fclose(logfile); + } + param[0]=ncandidates; + param[1]=nhard_min; + param[2]=nsoft_min; + param[3]=nera_best; + param[4]=ngmd; + if(param[0]==0) param[2]=-1; + return; +} -- cgit v1.2.3