mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-04-04 10:28:33 -04:00
WIP: sfoxtest and rstest both working at this point.
This commit is contained in:
parent
ca44347507
commit
a382fbfe7b
@ -1,23 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include "rs_sf.h"
|
||||
|
||||
void *rs;
|
||||
void *rs_sf;
|
||||
static int first=1;
|
||||
static int nn,kk,nroots,npad;
|
||||
|
||||
void rs_init_(int *mm, int *nq, int *nn0, int *kk0, int *nfz)
|
||||
void rs_init_sf_(int *mm, int *nq, int *nn0, int *kk0, int *nfz)
|
||||
{
|
||||
nn=*nn0;
|
||||
kk=*kk0;
|
||||
nroots=nn-kk;
|
||||
npad=*nq-1-nn;
|
||||
if(*mm==6) rs=init_rs_sf(*mm,0x43,*nfz,1,nroots,npad); //M=6
|
||||
if(*mm==7) rs=init_rs_sf(*mm,0x89,*nfz,1,nroots,npad); //M=7
|
||||
if(*mm==8) rs=init_rs_sf(*mm,0x11d,*nfz,1,nroots,npad); //M=8
|
||||
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
|
||||
first=0;
|
||||
}
|
||||
|
||||
void rs_encode_(int *dgen, int *sent)
|
||||
void rs_encode_sf_(int *dgen, int *sent)
|
||||
// Encode JT65 data dgen[...], producing sent[...].
|
||||
{
|
||||
int dat1[256];
|
||||
@ -29,14 +29,14 @@ void rs_encode_(int *dgen, int *sent)
|
||||
dat1[i]=dgen[kk-1-i];
|
||||
}
|
||||
// Compute the parity symbols
|
||||
encode_rs_sf(rs,dat1,b);
|
||||
encode_rs_sf(rs_sf,dat1,b);
|
||||
|
||||
// Move parity symbols and data into sent[] array, in reverse order.
|
||||
for (i = 0; i < nroots; i++) sent[nroots-1-i] = b[i];
|
||||
for (i = 0; i < kk; i++) sent[i+nroots] = dat1[kk-1-i];
|
||||
}
|
||||
|
||||
void rs_decode_(int *recd0, int *era0, int *numera0, int *decoded, int *nerr)
|
||||
void rs_decode_sf_(int *recd0, int *era0, int *numera0, 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
|
||||
@ -52,6 +52,6 @@ void rs_decode_(int *recd0, int *era0, int *numera0, int *decoded, int *nerr)
|
||||
for(i=0; i<nroots; i++) recd[kk+i]=recd0[nroots-1-i];
|
||||
if(numera)
|
||||
for(i=0; i<numera; i++) era_pos[i]=era0[i];
|
||||
*nerr=decode_rs_sf(rs,recd,era_pos,numera);
|
||||
*nerr=decode_rs_sf(rs_sf,recd,era_pos,numera);
|
||||
for(i=0; i<kk; i++) decoded[i]=recd[kk-1-i];
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ program rstest
|
||||
! Initialize the Karn codec
|
||||
nq=2**mm
|
||||
nfz=3
|
||||
call rs_init(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 and random symbols wuth values 0 to nq-1
|
||||
do i=1,kk
|
||||
@ -37,7 +37,7 @@ program rstest
|
||||
write(*,1002) dgen(1:kk)
|
||||
1002 format(20i4)
|
||||
|
||||
call rs_encode(dgen,gsym0) !Encode dgen into gsym0
|
||||
call rs_encode_sf(dgen,gsym0) !Encode dgen into gsym0
|
||||
write(*,1004)
|
||||
1004 format(/'Encoded channel symbols')
|
||||
write(*,1002) gsym0(1:nn)
|
||||
@ -50,7 +50,7 @@ program rstest
|
||||
1006 format(/'Recovered channel symbols, with errors:')
|
||||
write(*,1002) gsym(1:nn)
|
||||
|
||||
call rs_decode(gsym,era,0,dat,nfixed)
|
||||
call rs_decode_sf(gsym,era,0,dat,nfixed)
|
||||
ibad=0
|
||||
do i=1,kk
|
||||
if(dat(i).ne.dgen(i)) ibad=ibad+1
|
||||
|
@ -3,10 +3,13 @@
|
||||
parameter (ND2=63) !Data symbols after sync waveform
|
||||
parameter (ND=ND1+ND2) !Total data symbols (125)
|
||||
parameter (NS=23) !Sync symbols (for length)
|
||||
parameter (NN=NS+ND) !Total channel symbols (148)
|
||||
parameter (NSPS=1024) !Samples per symbol at 12000 S/s
|
||||
parameter (NSYNC=NS*NSPS) !Samples in sync waveform (23,552)
|
||||
parameter (NZ=NSPS*NN) !Samples in full Tx waveform (151,552)
|
||||
parameter (NZ=NSPS*(ND+NS)) !Samples in full Tx waveform (151,552)
|
||||
parameter (NMAX=15*12000) !Samples in iwave (180,000)
|
||||
parameter (NFFT=32768) !Length of FFT for sync waveform
|
||||
parameter (NFFT1=2*NSPS) !Length of FFTs for symbol spectra
|
||||
parameter (MM=7) !Bits per symbol
|
||||
parameter (NQ=2**MM) !Q, number of MFSK tones
|
||||
parameter (NN=127) !Our code is (127,51)
|
||||
parameter (NFZ=3) !First zero
|
||||
|
@ -1,4 +1,4 @@
|
||||
program synctest
|
||||
program sfoxtest
|
||||
|
||||
! Generate and test sync waveforms for possible use in SuperFox signal.
|
||||
|
||||
@ -12,7 +12,6 @@ program synctest
|
||||
complex clo(NMAX) !Complex Local Oscillator
|
||||
complex cnoise(NMAX) !Complex noise
|
||||
complex crcvd(NMAX) !Signal as received
|
||||
! real xdat(ND) !Temporary: for generating idat
|
||||
integer*1 idat(ND) !Encoded data, 7-bit integers
|
||||
integer*1 jdat(ND) !Recovered hard-decision symbols
|
||||
character fname*17,arg*12
|
||||
@ -135,4 +134,4 @@ program synctest
|
||||
! if(fgood.eq.0.0) exit
|
||||
enddo ! isnr
|
||||
|
||||
999 end program synctest
|
||||
999 end program sfoxtest
|
Loading…
Reference in New Issue
Block a user