mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-06-27 15:35:20 -04:00
WIP on superfox test progs.
This commit is contained in:
parent
84e5fbe6d5
commit
8c61d303bf
@ -15,7 +15,7 @@ CFLAGS= -O9 -Wall
|
|||||||
%.o: %.F90
|
%.o: %.F90
|
||||||
${FC} ${FFLAGS} -c $<
|
${FC} ${FFLAGS} -c $<
|
||||||
|
|
||||||
all: rs_sf.a rstest rs_125_49 rst8
|
all: rs_sf.a rstest
|
||||||
|
|
||||||
OBJS1 = rstest.o ran1.o rs_sf.a
|
OBJS1 = rstest.o ran1.o rs_sf.a
|
||||||
rstest: $(OBJS1)
|
rstest: $(OBJS1)
|
||||||
|
Binary file not shown.
@ -37,17 +37,7 @@ void rs_encode_sf_(int *dgen, int *sent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *decoded,
|
void rs_decode_sf_(int *recd, int *era_pos, int *numera, int *nerr)
|
||||||
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.
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
*nerr=decode_rs_sf(rs_sf,recd,era_pos,*numera);
|
*nerr=decode_rs_sf(rs_sf,recd,era_pos,*numera);
|
||||||
for(int i=0; i<kk; i++) {
|
|
||||||
decoded[i]=recd[nroots+i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ program rst8
|
|||||||
|
|
||||||
character arg*8
|
character arg*8
|
||||||
integer*1 dat0(223) !Generated data
|
integer*1 dat0(223) !Generated data
|
||||||
integer*1 parity(32) !Parity symbols
|
integer*1 parsym(32) !Parity symbols
|
||||||
integer*1 cword0(255) !Generated codeword
|
integer*1 cword0(255) !Generated codeword
|
||||||
integer*1 cword(255) !Rcvd codeword with errors; will be corrected in place
|
integer*1 cword(255) !Rcvd codeword with errors; will be corrected in place
|
||||||
integer iera(0:200) !Positions of additional erasures
|
integer iera(0:200) !Positions of additional erasures
|
||||||
|
integer decode_rs_8
|
||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.3) then
|
if(nargs.ne.3) then
|
||||||
@ -37,12 +38,12 @@ program rst8
|
|||||||
write(*,1004) dat0(1:kk)
|
write(*,1004) dat0(1:kk)
|
||||||
1004 format(20i4)
|
1004 format(20i4)
|
||||||
|
|
||||||
call encode_rs_8(dat0,parity) !Get parity symbols
|
call encode_rs_8(dat0,parsym,npad) !Get parity symbols
|
||||||
cword0(1:kk)=dat0(1:kk) !Genetated codeword
|
cword0(1:kk)=dat0(1:kk) !Genetated codeword
|
||||||
cword0(kk+1:nn)=parity(1:nn-kk)
|
cword0(kk+1:nn)=parsym(1:nn-kk)
|
||||||
write(*,1006)
|
write(*,1006)
|
||||||
1006 format(/'Encoded channel symbols')
|
1006 format(/'Encoded channel symbols')
|
||||||
write(*,1002) cword0(1:nn)
|
write(*,1004) cword0(1:nn)
|
||||||
|
|
||||||
cword=cword0
|
cword=cword0
|
||||||
do i=1,nerr !Introduce errors
|
do i=1,nerr !Introduce errors
|
||||||
@ -51,18 +52,18 @@ program rst8
|
|||||||
enddo
|
enddo
|
||||||
write(*,1008) nera
|
write(*,1008) nera
|
||||||
1008 format(/'Received channel symbols, with',i4,' errors at the end:')
|
1008 format(/'Received channel symbols, with',i4,' errors at the end:')
|
||||||
write(*,1002) cword(1:nn)
|
write(*,1004) cword(1:nn)
|
||||||
|
|
||||||
do i=0,nera-1
|
do i=0,nera-1
|
||||||
iera(i)=i
|
iera(i)=i
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
call decode_rs_8(cword,iera,nera,npad)
|
nfixed=decode_rs_8(cword,iera,nera,npad)
|
||||||
ibad=count(cword(1:kk).ne.cword0(1:kk))
|
ibad=count(cword(1:kk).ne.cword0(1:kk))
|
||||||
|
|
||||||
write(*,1010)
|
write(*,1010)
|
||||||
1010 format(/'Decoded result:')
|
1010 format(/'Decoded result:')
|
||||||
write(*,1002) cword(1:kk)
|
write(*,1004) cword(1:kk)
|
||||||
maxfix=(nn-kk)/2 + nera/2
|
maxfix=(nn-kk)/2 + nera/2
|
||||||
write(*,1100) nerr,nera,nfixed,maxfix
|
write(*,1100) nerr,nera,nfixed,maxfix
|
||||||
1100 format(/'nerr:',i3,' nera:',i3,' nfixed:',i3,' maxfix:',i3)
|
1100 format(/'nerr:',i3,' nera:',i3,' nfixed:',i3,' maxfix:',i3)
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
program rstest
|
program rstest
|
||||||
|
|
||||||
character arg*8
|
character arg*8
|
||||||
integer dgen(235) !Generated data, i*4
|
integer dat0(255) !Message symbols
|
||||||
integer gsym0(255) !Encoded data, Karn
|
integer parsym(255) !Parity symbols
|
||||||
integer gsym(255) !Encoded data with errors
|
integer chansym0(255) !Encoded data, Karn
|
||||||
|
integer chansym(255) !Encoded data with errors
|
||||||
integer dat(235) !Decoded data, i*4
|
integer dat(235) !Decoded data, i*4
|
||||||
|
! integer, target :: parsym(255)
|
||||||
integer iera(0:200) !Positions of erasures
|
integer iera(0:200) !Positions of erasures
|
||||||
|
integer gfpoly
|
||||||
|
! type(c_ptr) :: rs
|
||||||
|
|
||||||
|
data gfpoly/z'11d'/
|
||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.5) then
|
if(nargs.ne.5) then
|
||||||
@ -27,41 +33,46 @@ program rstest
|
|||||||
read(arg,*) nera
|
read(arg,*) nera
|
||||||
call getarg(5,arg)
|
call getarg(5,arg)
|
||||||
read(arg,*) nerr
|
read(arg,*) nerr
|
||||||
|
|
||||||
! Initialize the Karn codec
|
! Initialize the Karn codec
|
||||||
nq=2**mm
|
nq=2**mm
|
||||||
nfz=3
|
nfz=3
|
||||||
call rs_init_sf(mm,nq,nn,kk,nfz) !Initialize the Karn RS codec
|
call rs_init_sf(mm,nq,nn,kk,nfz) !Initialize the Karn RS codec
|
||||||
|
|
||||||
! Generate random message, kk symbols with values 0 to nq-1
|
! Generate kk message symbols. (Values must be in range 0 to nq-1.)
|
||||||
do i=1,kk
|
do i=1,kk
|
||||||
dgen(i)=i
|
dat0(i)=i
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
write(*,1000)
|
write(*,1000) mm,nn,kk,nera,nerr
|
||||||
1000 format('Generated data symbols, values 0-127:')
|
1000 format('M:',i2,' N:',i4,' K:',i4,' nera:',i4,' nerr:',i4/ &
|
||||||
write(*,1002) dgen(1:kk)
|
'Generated data symbols')
|
||||||
|
write(*,1002) dat0(1:kk)
|
||||||
1002 format(20i4)
|
1002 format(20i4)
|
||||||
|
|
||||||
call rs_encode_sf(dgen,gsym0) !Encode dgen into gsym0
|
call rs_encode_sf(dat0,parsym) !Compute parity symbols
|
||||||
|
chansym0(1:kk)=dat0(1:kk)
|
||||||
|
chansym0(kk+1:nn)=parsym(1:nn-kk)
|
||||||
|
|
||||||
write(*,1004)
|
write(*,1004)
|
||||||
1004 format(/'Encoded channel symbols')
|
1004 format(/'Encoded channel symbols')
|
||||||
write(*,1002) gsym0(1:nn)
|
write(*,1002) chansym0(1:nn)
|
||||||
|
|
||||||
gsym=gsym0
|
chansym=chansym0
|
||||||
do i=1,nerr !Introduce errors
|
do i=1,nerr !Introduce errors
|
||||||
gsym(i)=mod(gsym(i)+1,nq)
|
chansym(i)=mod(chansym(i)+1,nq)
|
||||||
enddo
|
enddo
|
||||||
write(*,1006) nera
|
write(*,1006) nera
|
||||||
1006 format(/'Recovered channel symbols, with',i4,' errors at the start:')
|
1006 format(/'Recovered channel symbols, with',i4,' errors at the start:')
|
||||||
write(*,1002) gsym(1:nn)
|
write(*,1002) chansym(1:nn)
|
||||||
|
|
||||||
do i=0,nera-1
|
do i=0,nera-1
|
||||||
iera(i)=i
|
iera(i)=i
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
call rs_decode_sf(gsym,iera,nera,dat,nfixed)
|
call rs_decode_sf(chansym,iera,nera,nfixed)
|
||||||
ibad=count(dat(1:kk).ne.dgen(1:kk))
|
dat(1:kk)=chansym(1:kk)
|
||||||
|
ibad=count(dat(1:kk).ne.dat0(1:kk))
|
||||||
write(*,1008)
|
write(*,1008)
|
||||||
1008 format(/'Decoded result:')
|
1008 format(/'Decoded result:')
|
||||||
write(*,1002) dat(1:kk)
|
write(*,1002) dat(1:kk)
|
||||||
|
@ -13,7 +13,7 @@ program sfoxtest
|
|||||||
complex cnoise(NMAX) !Complex noise
|
complex cnoise(NMAX) !Complex noise
|
||||||
complex crcvd(NMAX) !Signal as received
|
complex crcvd(NMAX) !Signal as received
|
||||||
integer imsg(KK) !Information symbols
|
integer imsg(KK) !Information symbols
|
||||||
integer jmsg(KK) !Decoded information
|
integer jmsg(KK) !Decoded information
|
||||||
integer*1 imsg1(7*KK) !Copy of imsg in 1-bit i*1 format
|
integer*1 imsg1(7*KK) !Copy of imsg in 1-bit i*1 format
|
||||||
integer idat(NN) !Encoded data, 7-bit integers
|
integer idat(NN) !Encoded data, 7-bit integers
|
||||||
integer jdat(NN) !Recovered hard-decision symbols
|
integer jdat(NN) !Recovered hard-decision symbols
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void encode_rs_8(unsigned char *data, unsigned char *parity, int pad);
|
||||||
|
|
||||||
|
int decode_rs_8(unsigned char *data, int *eras_pos, int no_eras, int pad);
|
||||||
|
|
||||||
void encode_rs_8_(unsigned char data[], unsigned char parity[], int *npad)
|
void encode_rs_8_(unsigned char data[], unsigned char parity[], int *npad)
|
||||||
{
|
{
|
||||||
encode_rs_8(data,parity,*npad); //Compute the parity symbols
|
encode_rs_8(data,parity,*npad); //Compute the parity symbols
|
||||||
|
Loading…
x
Reference in New Issue
Block a user