mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-02 13:17:49 -04:00
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:
parent
bb1cac4bce
commit
a08515a725
@ -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 );
|
||||
for (itry=0; itry< *max_dither; itry++) {
|
||||
for (i=0; i<N; i++) {
|
||||
if( itry == 0 ) {
|
||||
fac=1.0;
|
||||
} else {
|
||||
fac=1.0+0.8*(rand()%1024-512)/512.0;
|
||||
}
|
||||
lr[i]=lratio[i]*fac;
|
||||
}
|
||||
*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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "rand.h"
|
||||
/*#include "rand.h"*/
|
||||
#include "alloc.h"
|
||||
#include "mod2sparse.h"
|
||||
#include "mod2dense.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 *);
|
||||
|
@ -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
|
||||
-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
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
(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
|
||||
-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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)"
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user