mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-01 13:42:39 -04:00
Code cleanup.
This commit is contained in:
parent
347e32548c
commit
5cc29df68f
@ -24,54 +24,31 @@ void rs_encode_sf_(int *dgen, int *sent)
|
|||||||
int b[256];
|
int b[256];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Reverse data order for the Karn codec.
|
for(i=0; i<kk; i++) { //Copy data into dat1
|
||||||
for(i=0; i<kk; i++) {
|
dat1[i]=dgen[i];
|
||||||
// dat1[i]=dgen[kk-1-i];
|
|
||||||
dat1[i]=dgen[i]; //### Temporary, no reversal ###
|
|
||||||
}
|
}
|
||||||
// Compute the parity symbols
|
|
||||||
encode_rs_sf(rs_sf,dat1,b);
|
|
||||||
|
|
||||||
// Move parity symbols and data into sent[] array, in reverse order.
|
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++) {
|
for (i = 0; i < nroots; i++) {
|
||||||
// sent[nroots-1-i] = b[i];
|
sent[i] = b[i];
|
||||||
sent[i] = b[i]; //### Temporary, no reversal ###
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < kk; i++) {
|
for (i = 0; i < kk; i++) {
|
||||||
// sent[i+nroots] = dat1[kk-1-i];
|
sent[i+nroots] = dat1[i];
|
||||||
sent[i+nroots] = dat1[i]; //### Temporary, no reversal ###
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rs_decode_sf_(int *recd0, int *era0, int *numera0, int *decoded, int *nerr)
|
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *decoded, int *nerr)
|
||||||
// Decode JT65 received data recd0[63], producing decoded[12].
|
// Decode JT65 received data recd0[63], producing decoded[12].
|
||||||
// Erasures are indicated in era0[numera]. The number of corrected
|
// Erasures are indicated in era0[numera]. The number of corrected
|
||||||
// errors is *nerr. If the data are uncorrectable, *nerr=-1 is
|
// errors is *nerr. If the data are uncorrectable, *nerr=-1 is
|
||||||
// returned.
|
// returned.
|
||||||
{
|
{
|
||||||
int numera;
|
|
||||||
int i;
|
int i;
|
||||||
int era_pos[200];
|
*nerr=decode_rs_sf(rs_sf,recd,era_pos,*numera);
|
||||||
int recd[255];
|
|
||||||
|
|
||||||
numera=*numera0;
|
|
||||||
for(i=0; i<kk; i++) {
|
for(i=0; i<kk; i++) {
|
||||||
// recd[i]=recd0[nn-1-i];
|
|
||||||
recd[i]=recd0[i];
|
|
||||||
}
|
|
||||||
for(i=0; i<nroots; i++) {
|
|
||||||
// recd[kk+i]=recd0[nroots-1-i];
|
|
||||||
recd[kk+i]=recd0[kk+i];
|
|
||||||
}
|
|
||||||
if(numera) {
|
|
||||||
for(i=0; i<numera; i++) {
|
|
||||||
era_pos[i]=era0[i];
|
|
||||||
// printf("erased %d %d\n",i,era_pos[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*nerr=decode_rs_sf(rs_sf,recd,era_pos,numera);
|
|
||||||
for(i=0; i<kk; i++) {
|
|
||||||
// decoded[i]=recd[kk-1-i];
|
|
||||||
decoded[i]=recd[nroots+i];
|
decoded[i]=recd[nroots+i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,9 @@ program rstest
|
|||||||
write(*,1008)
|
write(*,1008)
|
||||||
1008 format(/'Decoded result:')
|
1008 format(/'Decoded result:')
|
||||||
write(*,1002) dat(1:kk)
|
write(*,1002) dat(1:kk)
|
||||||
write(*,1100) nerr,nera,nfixed
|
maxfix=(nn-kk)/2 + nera/2
|
||||||
1100 format(/'nerr:',i3,' nera:',i3,' nfixed:',i3)
|
write(*,1100) nerr,nera,nfixed,maxfix
|
||||||
|
1100 format(/'nerr:',i3,' nera:',i3,' nfixed:',i3,' maxfix:',i3)
|
||||||
|
|
||||||
999 end program rstest
|
999 end program rstest
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user