mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-04-10 13:29:02 -04:00
More code cleanup.
This commit is contained in:
parent
5cc29df68f
commit
ae462a9cb8
@ -6,49 +6,48 @@ static int first=1;
|
||||
static int nn,kk,nroots,npad;
|
||||
|
||||
void rs_init_sf_(int *mm, int *nq, int *nn0, int *kk0, int *nfz)
|
||||
// Initialize the RS decoder.
|
||||
{
|
||||
// Save parameters nn, kk, nroots, npad for global access
|
||||
nn=*nn0;
|
||||
kk=*kk0;
|
||||
nroots=nn-kk;
|
||||
npad=*nq-1-nn;
|
||||
if(*mm==6) rs_sf=init_rs_sf(*mm,0x43,*nfz,1,nroots,npad); //M=6
|
||||
if(*mm==7) rs_sf=init_rs_sf(*mm,0x89,*nfz,1,nroots,npad); //M=7
|
||||
if(*mm==8) rs_sf=init_rs_sf(*mm,0x11d,*nfz,1,nroots,npad); //M=8
|
||||
|
||||
int gfpoly=0x43; //For *mm=6
|
||||
if(*mm==7) gfpoly=0x89;
|
||||
if(*mm==8) gfpoly=0x11d;
|
||||
rs_sf=init_rs_sf(*mm,gfpoly,*nfz,1,nroots,npad);
|
||||
first=0;
|
||||
}
|
||||
|
||||
void rs_encode_sf_(int *dgen, int *sent)
|
||||
// Encode JT65 data dgen[...], producing sent[...].
|
||||
// Encode the information symbols dgen[KK], producing channel symbols sent[NN].
|
||||
{
|
||||
int dat1[256];
|
||||
int b[256];
|
||||
int i;
|
||||
int b[256]; //These are the parity symbols
|
||||
encode_rs_sf(rs_sf,dgen,b); //Compute the parity symbols
|
||||
|
||||
for(i=0; i<kk; i++) { //Copy data into dat1
|
||||
dat1[i]=dgen[i];
|
||||
}
|
||||
|
||||
encode_rs_sf(rs_sf,dat1,b); // Compute the parity symbols
|
||||
|
||||
// Copy parity symbols into sent[] array, followed by data
|
||||
for (i = 0; i < nroots; i++) {
|
||||
sent[i] = b[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < kk; i++) {
|
||||
sent[i+nroots] = dat1[i];
|
||||
// Copy parity symbols into sent[] array, followed by information symbols
|
||||
for (int i=0; i< nn; i++) {
|
||||
if(i<nroots) {
|
||||
sent[i]=b[i];
|
||||
} else {
|
||||
sent[i]=dgen[i-nroots];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *decoded, int *nerr)
|
||||
// Decode JT65 received data recd0[63], producing decoded[12].
|
||||
// Erasures are indicated in era0[numera]. The number of corrected
|
||||
// errors is *nerr. If the data are uncorrectable, *nerr=-1 is
|
||||
// returned.
|
||||
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *decoded,
|
||||
int *nerr)
|
||||
/*
|
||||
Decode received data recd[NN], producing decoded[KK]. Positiions of
|
||||
erased symbols are specified in array era_pos[numera]. The number of
|
||||
corrected errors is *nerr; if the data are uncorrectable, *nerr=-1
|
||||
is returned.
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
*nerr=decode_rs_sf(rs_sf,recd,era_pos,*numera);
|
||||
for(i=0; i<kk; i++) {
|
||||
for(int i=0; i<kk; i++) {
|
||||
decoded[i]=recd[nroots+i];
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,10 @@ program rstest
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.5) then
|
||||
print*,'Usage: rstest M N K nera nerr'
|
||||
print*,'Example: rstest 7 127 51 0 38'
|
||||
print*,'Usage: rstest M N K nera nerr'
|
||||
print*,'Examples: rstest 6 63 12 0 25'
|
||||
print*,' rstest 7 127 51 0 38'
|
||||
print*,' rstest 8 255 51 0 102'
|
||||
go to 999
|
||||
endif
|
||||
nkv=0
|
||||
|
Loading…
Reference in New Issue
Block a user