mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-07 00:12:32 -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;
|
static int nn,kk,nroots,npad;
|
||||||
|
|
||||||
void rs_init_sf_(int *mm, int *nq, int *nn0, int *kk0, int *nfz)
|
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;
|
nn=*nn0;
|
||||||
kk=*kk0;
|
kk=*kk0;
|
||||||
nroots=nn-kk;
|
nroots=nn-kk;
|
||||||
npad=*nq-1-nn;
|
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
|
int gfpoly=0x43; //For *mm=6
|
||||||
if(*mm==8) rs_sf=init_rs_sf(*mm,0x11d,*nfz,1,nroots,npad); //M=8
|
if(*mm==7) gfpoly=0x89;
|
||||||
|
if(*mm==8) gfpoly=0x11d;
|
||||||
|
rs_sf=init_rs_sf(*mm,gfpoly,*nfz,1,nroots,npad);
|
||||||
first=0;
|
first=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rs_encode_sf_(int *dgen, int *sent)
|
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]; //These are the parity symbols
|
||||||
int b[256];
|
encode_rs_sf(rs_sf,dgen,b); //Compute the parity symbols
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0; i<kk; i++) { //Copy data into dat1
|
// Copy parity symbols into sent[] array, followed by information symbols
|
||||||
dat1[i]=dgen[i];
|
for (int i=0; i< nn; i++) {
|
||||||
}
|
if(i<nroots) {
|
||||||
|
sent[i]=b[i];
|
||||||
encode_rs_sf(rs_sf,dat1,b); // Compute the parity symbols
|
} else {
|
||||||
|
sent[i]=dgen[i-nroots];
|
||||||
// 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];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *decoded, int *nerr)
|
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *decoded,
|
||||||
// Decode JT65 received data recd0[63], producing decoded[12].
|
int *nerr)
|
||||||
// Erasures are indicated in era0[numera]. The number of corrected
|
/*
|
||||||
// errors is *nerr. If the data are uncorrectable, *nerr=-1 is
|
Decode received data recd[NN], producing decoded[KK]. Positiions of
|
||||||
// returned.
|
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);
|
*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];
|
decoded[i]=recd[nroots+i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,10 @@ program rstest
|
|||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.5) then
|
if(nargs.ne.5) then
|
||||||
print*,'Usage: rstest M N K nera nerr'
|
print*,'Usage: rstest M N K nera nerr'
|
||||||
print*,'Example: rstest 7 127 51 0 38'
|
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
|
go to 999
|
||||||
endif
|
endif
|
||||||
nkv=0
|
nkv=0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user