Merge in recent ldpc decoder interface updates.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6627 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2016-04-20 00:44:47 +00:00
parent bb1cac4bce
commit a08515a725
9 changed files with 68 additions and 55 deletions

View File

@ -25,7 +25,7 @@
#include "mod2sparse.h" #include "mod2sparse.h"
#include "mod2dense.h" #include "mod2dense.h"
#include "mod2convert.h" #include "mod2convert.h"
#include "rand.h" /*#include "rand.h"*/
#include "rcode.h" #include "rcode.h"
#include "check.h" #include "check.h"
#include "dec.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]; char dblk[N],pchk[M];
double bprb[N]; double bprb[N],lr[N];
float fac;
max_iter=*max_iterations; max_iter=*max_iterations;
*niterations = prprp_decode ( H, lratio, dblk, pchk, bprb ); for (itry=0; itry< *max_dither; itry++) {
valid = check( H, dblk, pchk )==0; for (i=0; i<N; i++) {
if( !valid ) { if( itry == 0 ) {
*niterations=-1; fac=1.0;
}; } else {
fac=1.0+0.8*(rand()%1024-512)/512.0;
j=0; }
for( i=M; i<N; i++ ) { lr[i]=lratio[i]*fac;
decoded[j]=dblk[cols[i]]; }
j=j+1; *niterations = prprp_decode ( H, lr, dblk, pchk, bprb );
valid = check( H, dblk, pchk )==0;
if( !valid ) {
*niterations=-1;
} else {
j=0;
for( i=M; i<N; i++ ) {
decoded[j]=dblk[cols[i]];
j=j+1;
}
*ndither=itry;
// printf("ldpc_decode %d %d \n",*niterations, *ndither);
return;
}
} }
} }

View File

@ -17,7 +17,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "rand.h" /*#include "rand.h"*/
#include "alloc.h" #include "alloc.h"
#include "mod2sparse.h" #include "mod2sparse.h"
#include "mod2dense.h" #include "mod2dense.h"

View File

@ -16,3 +16,4 @@
void sparse_encode (char *, char *); void sparse_encode (char *, char *);
void dense_encode (char *, char *, mod2dense *, mod2dense *); void dense_encode (char *, char *, mod2dense *, mod2dense *);
void mixed_encode (char *, char *, mod2dense *, mod2dense *); void mixed_encode (char *, char *, mod2dense *, mod2dense *);
void ldpc_encode_ (char *, char *);

View File

@ -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 Eb/N0 ngood nundetected
-0.5 35222 2 -0.5 35222 2 815 0
0.0 97638 3 0.0 97638 3 1899 0
0.5 220445 4 0.5 220445 4 3824 0
1.0 415823 1 1.0 415823 1 5980 0
1.5 642153 2 1.5 642153 2 8056 0
2.0 832670 0 2.0 832670 0 9283 0
2.5 942661 0 2.5 942661 0 9832 0
3.0 986548 0 3.0 986548 0 9966 0
3.5 997810 0 3.5 997810 0 9996 0
4.0 999759 0 4.0 999759 0 10000 0
4.5 999980 0 4.5 999980 0
5.0 999997 0 5.0 999997 0

View File

@ -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 Eb/N0 ngood nundetected
-0.5 50475 26 -0.5 50475 26 105000
0.0 128150 15 0.0 128150 15 237000
0.5 271242 16 0.5 271242 16 430000
1.0 477112 18 1.0 477112 18 636000
1.5 694045 14 1.5 694045 14 847000
2.0 864410 4 2.0 864410 4 943000
2.5 955647 1 2.5 955647 1 988000
3.0 989346 0 3.0 989346 0 1000000
3.5 998132 0 3.5 998132 0
4.0 999764 0 4.0 999764 0
4.5 999968 0 4.5 999968 0
5.0 999998 0 5.0 999998 0

View File

@ -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-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:(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-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 "compare.lab" with labels
exit exit

View File

@ -14,9 +14,9 @@ set grid
#set logscale y #set logscale y
set format y "%2.1f" set format y "%2.1f"
plot [-1:6] [1e-6:1] \ 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-irreg-8x3-2x4.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:($4/10000) 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, \ "128-80-peg-reg4.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, \ "128-80-peg-reg4.results" using 1:($4/1000) with linespoints lt 4 lw 2 pt 4, \
"success.lab" with labels "success.lab" with labels
exit exit

View File

@ -1,2 +1,2 @@
0.9 0.75 "(198,72) reg3" 0.9 0.75 "(198,72)"
2.9 0.65 "(198,72) reg4" 3.5 0.75 "(128,80)"

View File

@ -4,14 +4,14 @@ use, intrinsic :: iso_c_binding
! To change to a new code, edit the following line and the filenames ! To change to a new code, edit the following line and the filenames
! that contain the parity check and generator matrices. ! 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) integer(1) codeword(1:N), decoded(1:K), message(1:K)
real*8 lratio(N), rxdata(N) real*8 lratio(N), rxdata(N)
pchk_file="./jtmode_codes/peg-198-72-reg4.pchk" pchk_file="./jtmode_codes/peg-128-80-reg4.pchk"
gen_file="./jtmode_codes/peg-198-72-reg4.gen" gen_file="./jtmode_codes/peg-128-80-reg4.gen"
rate=real(K)/real(N) rate=real(K)/real(N)
@ -21,8 +21,9 @@ message(1:K/2)=1
message((K/2+1):K)=0 message((K/2+1):K)=0
call ldpc_encode(message,codeword) call ldpc_encode(message,codeword)
max_iterations=50 max_iterations=10
ntrials=1000000 max_dither=5
ntrials=10000
write(*,*) "Eb/N0 ngood nundetected" write(*,*) "Eb/N0 ngood nundetected"
do idb = 0, 11 do idb = 0, 11
@ -51,7 +52,7 @@ do idb = 0, 11
lratio(i)=exp(2.0*rxdata(i)/(s*s)) lratio(i)=exp(2.0*rxdata(i)/(s*s))
enddo 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 if( niterations .ge. 0 ) then
nueflag=0 nueflag=0