mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-29 07:39:43 -05:00
Use a table lookup for exp(i*phi) in gen_ft8wave.f90.
This commit is contained in:
parent
761ee1cd85
commit
02eb4fe90b
@ -2,15 +2,15 @@ subroutine gen_ft8wave(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave)
|
|||||||
!
|
!
|
||||||
! generate ft8 waveform using Gaussian-filtered frequency pulses.
|
! generate ft8 waveform using Gaussian-filtered frequency pulses.
|
||||||
!
|
!
|
||||||
|
use timer_module, only: timer
|
||||||
parameter(MAX_SECONDS=20)
|
parameter(MAX_SECONDS=20,NTAB=65536)
|
||||||
real wave(nwave)
|
real wave(nwave)
|
||||||
complex cwave(nwave)
|
complex cwave(nwave),ctab(0:NTAB-1)
|
||||||
real pulse(23040)
|
real pulse(23040)
|
||||||
real dphi(0:(nsym+2)*nsps-1)
|
real dphi(0:(nsym+2)*nsps-1)
|
||||||
integer itone(nsym)
|
integer itone(nsym)
|
||||||
data ibt0/0/
|
data ibt0/0/
|
||||||
save pulse,twopi,dt,hmod,ibt0
|
save pulse,twopi,dt,hmod,ibt0,ctab
|
||||||
|
|
||||||
ibt=nint(10*bt)
|
ibt=nint(10*bt)
|
||||||
if(ibt0.ne.ibt) then
|
if(ibt0.ne.ibt) then
|
||||||
@ -23,6 +23,10 @@ subroutine gen_ft8wave(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave)
|
|||||||
pulse(i)=gfsk_pulse(bt,tt)
|
pulse(i)=gfsk_pulse(bt,tt)
|
||||||
enddo
|
enddo
|
||||||
ibt0=nint(10*bt)
|
ibt0=nint(10*bt)
|
||||||
|
do i=0,NTAB-1
|
||||||
|
phi=i*twopi/NTAB
|
||||||
|
ctab(i)=cmplx(cos(phi),sin(phi))
|
||||||
|
enddo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! Compute the smoothed frequency waveform.
|
! Compute the smoothed frequency waveform.
|
||||||
@ -40,19 +44,23 @@ subroutine gen_ft8wave(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave)
|
|||||||
|
|
||||||
! Calculate and insert the audio waveform
|
! Calculate and insert the audio waveform
|
||||||
phi=0.0
|
phi=0.0
|
||||||
dphi = dphi + twopi*f0*dt !Shift frequency up by f0
|
dphi = dphi + twopi*f0*dt !Shift frequency up by f0
|
||||||
wave=0.
|
wave=0.
|
||||||
if (icmplx .ne. 0) cwave=0. ! avoid writing to memory we may not have access to
|
if(icmplx .ne. 0) cwave=0. !Avoid writing to memory we may not have access to
|
||||||
|
|
||||||
|
call timer('gen_loop',0)
|
||||||
k=0
|
k=0
|
||||||
do j=nsps,nsps+nwave-1 !Don't include dummy symbols
|
do j=nsps,nsps+nwave-1 !Don't include dummy symbols
|
||||||
k=k+1
|
k=k+1
|
||||||
if(icmplx.eq.0) then
|
if(icmplx.eq.0) then
|
||||||
wave(k)=sin(phi)
|
wave(k)=sin(phi)
|
||||||
else
|
else
|
||||||
cwave(k)=cmplx(cos(phi),sin(phi))
|
i=phi*float(NTAB)/twopi
|
||||||
|
cwave(k)=ctab(i)
|
||||||
endif
|
endif
|
||||||
phi=mod(phi+dphi(j),twopi)
|
phi=mod(phi+dphi(j),twopi)
|
||||||
enddo
|
enddo
|
||||||
|
call timer('gen_loop',1)
|
||||||
|
|
||||||
! Apply envelope shaping to the first and last symbols
|
! Apply envelope shaping to the first and last symbols
|
||||||
nramp=nint(nsps/8.0)
|
nramp=nint(nsps/8.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user