mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-25 21:49:20 -04:00
More code cleanup; possible scheme for more frequency diversity in sync.
This commit is contained in:
parent
f896df064d
commit
0393d7bd7c
@ -1,76 +0,0 @@
|
||||
program rs_125_49
|
||||
|
||||
include 'sfox_params.f90'
|
||||
character arg*8
|
||||
integer dgen(256) !Generated data, i*4
|
||||
integer*1 dgen1(7*KK) !Copy of dgen in 1-bit i*1 format
|
||||
integer gsym0(NN) !Encoded data, Karn
|
||||
integer gsym(NN) !Encoded data with errors
|
||||
integer dat(256) !Decoded data, i*4
|
||||
integer iera(0:100) !Positions of erasures
|
||||
character c357*357,c14*14,chkmsg*15
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.2) then
|
||||
print*,'Usage: rs_125_49 nera nerr'
|
||||
print*,'Example: rs_125_49 0 38'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
read(arg,*) nera
|
||||
call getarg(2,arg)
|
||||
read(arg,*) nerr
|
||||
|
||||
! Initialize the Karn codec
|
||||
call rs_init_sf(MM,NQ,NN,KK,NFZ)
|
||||
|
||||
! Generate a message with sequential values in the range 0 to NQ-1
|
||||
dgen=0
|
||||
do i=1,KK-2
|
||||
dgen(i)=i
|
||||
enddo
|
||||
write(c357,'(51b7.7)') dgen(1:KK)
|
||||
read(c357,'(357i1)') dgen1
|
||||
call get_crc14(dgen1,7*KK,ncrc0)
|
||||
write(c14,'(b14.14)') ncrc0
|
||||
read(c14,'(2b7.7)') dgen(50:51)
|
||||
|
||||
write(*,1000)
|
||||
1000 format('Generated data symbols, values 0-127:')
|
||||
write(*,1002) dgen(1:KK)
|
||||
1002 format(20i4)
|
||||
|
||||
call rs_encode_sf(dgen,gsym0) !Encode dgen into gsym0
|
||||
write(*,1004)
|
||||
1004 format(/'Encoded channel symbols')
|
||||
write(*,1002) gsym0(1:NN)
|
||||
|
||||
gsym0(KK-1:KK)=0 !Puncture by removing the CRC
|
||||
gsym=gsym0
|
||||
do i=1,nerr !Introduce errors in the first nerr positions
|
||||
gsym(i)=mod(gsym(i)+1,NQ)
|
||||
enddo
|
||||
write(*,1006)
|
||||
1006 format(/'Recovered channel symbols, punctured and with additional errors:')
|
||||
write(*,1002) gsym(1:NN)
|
||||
|
||||
do i=0,nera-1 !Specify locations of symbols to be erased
|
||||
iera(i)=i
|
||||
enddo
|
||||
|
||||
call rs_decode_sf(gsym,iera,nera,dat,nfixed) !Call the decoder
|
||||
write(c357,'(51b7.7)') dat(1:KK)
|
||||
read(c357,'(357i1)') dgen1
|
||||
call get_crc14(dgen1,7*KK,ncrc)
|
||||
|
||||
write(*,1008)
|
||||
1008 format(/'Decoded result:')
|
||||
chkmsg='Decode failed'
|
||||
if(nfixed.ge.0 .and. ncrc.eq.0) chkmsg='CRC OK'
|
||||
write(*,1002) dat(1:KK)
|
||||
maxfix=(nn-kk)/2 + nera/2
|
||||
write(*,1100) nerr,nera,nfixed,maxfix,trim(chkmsg)
|
||||
1100 format(/'punctured: 2',' nerr:',i3,' nera:',i3,' nfixed:',i3, &
|
||||
' maxfix:',i3,3x,a)
|
||||
|
||||
999 end program rs_125_49
|
@ -28,6 +28,8 @@ subroutine sweep(f0,syncwidth,fsample,w,c,iz)
|
||||
if(i.eq.iz/2+1) a2=-a2 !Reverse sign of drift at midpoint
|
||||
x=s*(i-x0)
|
||||
dphi=(a0 + x*a2)*(twopi/fsample)
|
||||
! j=i/(4*1024)
|
||||
! dphi=(a0 + (j-1.5)*200.0 + x*a2)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
w=w*wstep
|
||||
c(i)=w
|
||||
|
@ -1,7 +1,6 @@
|
||||
subroutine sfox_gen(idat,f0,fsample,syncwidth,cdat)
|
||||
|
||||
use sfox_mod
|
||||
! include "sfox_params.f90"
|
||||
complex cdat(NMAX) !Generated complex waveform
|
||||
complex ctmp(NSYNC)
|
||||
complex w,wstep
|
||||
|
@ -1,16 +0,0 @@
|
||||
! Our code is RS(127,51). We puncture two symbols to give (125,49)
|
||||
parameter (NN=127) !Channel symbols, before puncture
|
||||
parameter (KK=51) !Information symbols, before puncture
|
||||
parameter (ND1=25) !Data symbols before sync
|
||||
parameter (ND2=100) !Data symbols after sync
|
||||
parameter (ND=ND1+ND2) !Total data symbols (125)
|
||||
parameter (NS=24) !Sync symbols (for length)
|
||||
parameter (NSPS=1024) !Samples per symbol at 12000 S/s
|
||||
parameter (NSYNC=NS*NSPS) !Samples in sync waveform (24,576)
|
||||
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 (NFZ=3) !First zero
|
@ -171,7 +171,6 @@ program sfoxtest
|
||||
call timer('watterso',1)
|
||||
|
||||
dat=aimag(sigr*cdat(1:NMAX)) + xnoise !Add generated AWGN noise
|
||||
! call plotspec(dat) !### TEMPORARY, for SNR calibration ###
|
||||
fac=32767.0
|
||||
if(snr.ge.90.0) iwave(1:NMAX)=nint(fac*dat(1:NMAX))
|
||||
if(snr.lt.90.0) iwave(1:NMAX)=nint(rms*dat(1:NMAX))
|
||||
@ -188,7 +187,7 @@ program sfoxtest
|
||||
ferr=f-f1
|
||||
terr=t-xdt
|
||||
igoodsync=0
|
||||
if(abs(ferr).lt.baud/2.0 .and. abs(terr).lt.tsym/8.0) then
|
||||
if(abs(ferr).lt.baud/2.0 .and. abs(terr).lt.tsym/4.0) then
|
||||
igoodsync=1
|
||||
ngoodsync=ngoodsync+1
|
||||
sqt=sqt + terr*terr
|
||||
@ -249,7 +248,7 @@ program sfoxtest
|
||||
endif
|
||||
fgood0=fgood
|
||||
if(snrdb.ne.0.0) exit
|
||||
! if(fgood.eq.0.0) exit
|
||||
if(fgood.eq.0.0) exit
|
||||
if(fgoodsync.lt.0.5) exit
|
||||
enddo ! isnr
|
||||
if(snrdb.eq.0.0) write(*,1320) threshold
|
||||
@ -259,4 +258,3 @@ program sfoxtest
|
||||
999 call timer('sfoxtest',101)
|
||||
end program sfoxtest
|
||||
|
||||
! include 'plotspec.f90' !### TEMPORARY, for SNR calibration ###
|
||||
|
Loading…
Reference in New Issue
Block a user