diff --git a/lib/ldpc/dec.c b/lib/ldpc/dec.c index 431518d8f..7f8faa250 100755 --- a/lib/ldpc/dec.c +++ b/lib/ldpc/dec.c @@ -25,7 +25,7 @@ #include "mod2sparse.h" #include "mod2dense.h" #include "mod2convert.h" -#include "rand.h" +/*#include "rand.h"*/ #include "rcode.h" #include "check.h" #include "dec.h" @@ -384,23 +384,36 @@ void iterprp } } -void ldpc_decode_ ( double lratio[], char decoded[], int *max_iterations, int *niterations) +void ldpc_decode_ ( double lratio[], char decoded[], int *max_iterations, int *niterations, int *max_dither, int *ndither) { - int i, j, valid; + int i, j, itry, valid; char dblk[N],pchk[M]; - double bprb[N]; - + double bprb[N],lr[N]; + float fac; + max_iter=*max_iterations; - *niterations = prprp_decode ( H, lratio, dblk, pchk, bprb ); - valid = check( H, dblk, pchk )==0; - if( !valid ) { - *niterations=-1; - }; - - j=0; - for( i=M; i #include -#include "rand.h" +/*#include "rand.h"*/ #include "alloc.h" #include "mod2sparse.h" #include "mod2dense.h" diff --git a/lib/ldpc/enc.h b/lib/ldpc/enc.h index c36e92927..083b5f52f 100755 --- a/lib/ldpc/enc.h +++ b/lib/ldpc/enc.h @@ -16,3 +16,4 @@ void sparse_encode (char *, char *); void dense_encode (char *, char *, mod2dense *, mod2dense *); void mixed_encode (char *, char *, mod2dense *, mod2dense *); +void ldpc_encode_ (char *, char *); diff --git a/lib/ldpc/jtmode_codes/198-72-peg-irreg-8x3-2x4.results b/lib/ldpc/jtmode_codes/198-72-peg-irreg-8x3-2x4.results index 7c3b50d5f..06c4c1731 100644 --- a/lib/ldpc/jtmode_codes/198-72-peg-irreg-8x3-2x4.results +++ b/lib/ldpc/jtmode_codes/198-72-peg-irreg-8x3-2x4.results @@ -1,15 +1,15 @@ -peg (198,72), irregular, 80% 3, 20% 4, s=0.75, 50 iterations +peg (198,72), irregular, 80% 3, 20% 4, s=0.75, 50 iterations; max_dither=200, out of 10000 Eb/N0 ngood nundetected --0.5 35222 2 - 0.0 97638 3 - 0.5 220445 4 - 1.0 415823 1 - 1.5 642153 2 - 2.0 832670 0 - 2.5 942661 0 - 3.0 986548 0 - 3.5 997810 0 - 4.0 999759 0 - 4.5 999980 0 - 5.0 999997 0 +-0.5 35222 2 815 0 + 0.0 97638 3 1899 0 + 0.5 220445 4 3824 0 + 1.0 415823 1 5980 0 + 1.5 642153 2 8056 0 + 2.0 832670 0 9283 0 + 2.5 942661 0 9832 0 + 3.0 986548 0 9966 0 + 3.5 997810 0 9996 0 + 4.0 999759 0 10000 0 + 4.5 999980 0 + 5.0 999997 0 diff --git a/lib/ldpc/jtmode_codes/198-72-peg-reg3.results b/lib/ldpc/jtmode_codes/198-72-peg-reg3.results index 3c57f2abd..b98e197a9 100644 --- a/lib/ldpc/jtmode_codes/198-72-peg-reg3.results +++ b/lib/ldpc/jtmode_codes/198-72-peg-reg3.results @@ -1,14 +1,14 @@ -(198,72) peg, regular, j=3, 50 iterations, s=0.75 +(198,72) peg, regular, j=3, 50 iterations, s=0.75; max_dither=200 (out of 1000) Eb/N0 ngood nundetected --0.5 50475 26 - 0.0 128150 15 - 0.5 271242 16 - 1.0 477112 18 - 1.5 694045 14 - 2.0 864410 4 - 2.5 955647 1 - 3.0 989346 0 - 3.5 998132 0 +-0.5 50475 26 105000 + 0.0 128150 15 237000 + 0.5 271242 16 430000 + 1.0 477112 18 636000 + 1.5 694045 14 847000 + 2.0 864410 4 943000 + 2.5 955647 1 988000 + 3.0 989346 0 1000000 + 3.5 998132 0 4.0 999764 0 4.5 999968 0 5.0 999998 0 diff --git a/lib/ldpc/jtmode_codes/fig_compare.gnuplot b/lib/ldpc/jtmode_codes/fig_compare.gnuplot index 6e027ae83..04e04707d 100644 --- a/lib/ldpc/jtmode_codes/fig_compare.gnuplot +++ b/lib/ldpc/jtmode_codes/fig_compare.gnuplot @@ -20,7 +20,5 @@ plot [-1:6] [1e-6:1] \ "198-72-peg-reg4.results" using 1:($3/1000000) with linespoints lt 2 lw 2 pt 2, \ "198-72-peg-irreg-8x3-2x4.results" using 1:(1-$2/1000000) with linespoints lt 3 lw 2 pt 3, \ "198-72-peg-irreg-8x3-2x4.results" using 1:($3/1000000) with linespoints lt 3 lw 2 pt 3, \ - "198-72-sf9.results" using 1:(1-$2/1000000) with linespoints lt 4 lw 2 pt 4, \ - "198-72-sf9.results" using 1:($3/1000000) with linespoints lt 4 lw 2 pt 4, \ "compare.lab" with labels exit diff --git a/lib/ldpc/jtmode_codes/fig_success.gnuplot b/lib/ldpc/jtmode_codes/fig_success.gnuplot index 5252cace7..09abd84f2 100644 --- a/lib/ldpc/jtmode_codes/fig_success.gnuplot +++ b/lib/ldpc/jtmode_codes/fig_success.gnuplot @@ -14,9 +14,9 @@ set grid #set logscale y set format y "%2.1f" plot [-1:6] [1e-6:1] \ - "198-72-peg-reg3.results" using 1:($2/1000000) with linespoints lt 1 lw 2 pt 1, \ - "198-72-peg-reg4.results" using 1:($2/1000000) with linespoints lt 2 lw 2 pt 2, \ - "198-72-peg-irreg-8x3-2x4.results" using 1:($2/1000000) with linespoints lt 3 lw 2 pt 3, \ - "198-72-sf9.results" using 1:($2/1000000) with linespoints lt 4 lw 2 pt 4, \ + "198-72-peg-irreg-8x3-2x4.results" using 1:($2/1000000) with linespoints lt 1 lw 2 pt 1, \ + "198-72-peg-irreg-8x3-2x4.results" using 1:($4/10000) with linespoints lt 2 lw 2 pt 2, \ + "128-80-peg-reg4.results" using 1:($2/1000000) with linespoints lt 3 lw 2 pt 3, \ + "128-80-peg-reg4.results" using 1:($4/1000) with linespoints lt 4 lw 2 pt 4, \ "success.lab" with labels exit diff --git a/lib/ldpc/jtmode_codes/success.lab b/lib/ldpc/jtmode_codes/success.lab index 63d47adfe..9379cad1a 100644 --- a/lib/ldpc/jtmode_codes/success.lab +++ b/lib/ldpc/jtmode_codes/success.lab @@ -1,2 +1,2 @@ -0.9 0.75 "(198,72) reg3" -2.9 0.65 "(198,72) reg4" +0.9 0.75 "(198,72)" +3.5 0.75 "(128,80)" diff --git a/lib/ldpc/ldpcsim.f90 b/lib/ldpc/ldpcsim.f90 index 6b9e599be..849538ac4 100644 --- a/lib/ldpc/ldpcsim.f90 +++ b/lib/ldpc/ldpcsim.f90 @@ -4,14 +4,14 @@ use, intrinsic :: iso_c_binding ! To change to a new code, edit the following line and the filenames ! that contain the parity check and generator matrices. -parameter (N=198, M=126, K=72) ! M and N are global variables on the C side. +parameter (N=128, M=48, K=80) ! M and N are global variables on the C side. -character(50) pchk_file,gen_file +character(80) pchk_file,gen_file integer(1) codeword(1:N), decoded(1:K), message(1:K) real*8 lratio(N), rxdata(N) -pchk_file="./jtmode_codes/peg-198-72-reg4.pchk" -gen_file="./jtmode_codes/peg-198-72-reg4.gen" +pchk_file="./jtmode_codes/peg-128-80-reg4.pchk" +gen_file="./jtmode_codes/peg-128-80-reg4.gen" rate=real(K)/real(N) @@ -21,8 +21,9 @@ message(1:K/2)=1 message((K/2+1):K)=0 call ldpc_encode(message,codeword) -max_iterations=50 -ntrials=1000000 +max_iterations=10 +max_dither=5 +ntrials=10000 write(*,*) "Eb/N0 ngood nundetected" do idb = 0, 11 @@ -51,7 +52,7 @@ do idb = 0, 11 lratio(i)=exp(2.0*rxdata(i)/(s*s)) enddo - call ldpc_decode(lratio, decoded, max_iterations, niterations) + call ldpc_decode(lratio, decoded, max_iterations, niterations, max_dither, ndither) if( niterations .ge. 0 ) then nueflag=0