mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Working on implementing reference spectra.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6600 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
700cc37c88
commit
88e47a5941
@ -387,6 +387,7 @@ set (wsjt_FSRCS
|
|||||||
lib/ps4.f90
|
lib/ps4.f90
|
||||||
lib/readwav.f90
|
lib/readwav.f90
|
||||||
lib/rectify_msk.f90
|
lib/rectify_msk.f90
|
||||||
|
lib/refspec.f90
|
||||||
lib/savec2.f90
|
lib/savec2.f90
|
||||||
lib/sec_midn.f90
|
lib/sec_midn.f90
|
||||||
lib/setup65.f90
|
lib/setup65.f90
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "moc_Detector.cpp"
|
#include "moc_Detector.cpp"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void fil4_(qint16*, qint32*, qint16*, qint32*, qint32*);
|
void fil4_(qint16*, qint32*, qint16*, qint32*);
|
||||||
}
|
}
|
||||||
|
|
||||||
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds,
|
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds,
|
||||||
@ -85,10 +85,8 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
|
|||||||
qint32 framesAfterDownSample (m_samplesPerFFT);
|
qint32 framesAfterDownSample (m_samplesPerFFT);
|
||||||
if(framesToProcess==13824 and dec_data.params.kin>=0 and
|
if(framesToProcess==13824 and dec_data.params.kin>=0 and
|
||||||
dec_data.params.kin < (NTMAX*12000 - framesAfterDownSample)) {
|
dec_data.params.kin < (NTMAX*12000 - framesAfterDownSample)) {
|
||||||
int nrefspec=0;
|
|
||||||
if(g_bRefSpec) nrefspec=1;
|
|
||||||
fil4_(&m_buffer[0], &framesToProcess, &dec_data.d2[dec_data.params.kin],
|
fil4_(&m_buffer[0], &framesToProcess, &dec_data.d2[dec_data.params.kin],
|
||||||
&framesAfterDownSample, &nrefspec);
|
&framesAfterDownSample);
|
||||||
dec_data.params.kin += framesAfterDownSample;
|
dec_data.params.kin += framesAfterDownSample;
|
||||||
} else {
|
} else {
|
||||||
// qDebug() << "framesToProcess = " << framesToProcess;
|
// qDebug() << "framesToProcess = " << framesToProcess;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
#include "AudioDevice.hpp"
|
#include "AudioDevice.hpp"
|
||||||
#include <QScopedArrayPointer>
|
#include <QScopedArrayPointer>
|
||||||
|
|
||||||
extern bool g_bRefSpec;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// output device that distributes data in predefined chunks via a signal
|
// output device that distributes data in predefined chunks via a signal
|
||||||
//
|
//
|
||||||
|
46
lib/fil4.f90
46
lib/fil4.f90
@ -1,4 +1,4 @@
|
|||||||
subroutine fil4(id1,n1,id2,n2,nrefspec)
|
subroutine fil4(id1,n1,id2,n2)
|
||||||
|
|
||||||
! FIR lowpass filter designed using ScopeFIR
|
! FIR lowpass filter designed using ScopeFIR
|
||||||
|
|
||||||
@ -12,15 +12,10 @@ subroutine fil4(id1,n1,id2,n2,nrefspec)
|
|||||||
|
|
||||||
parameter (NTAPS=49)
|
parameter (NTAPS=49)
|
||||||
parameter (NDOWN=4) !Downsample ratio
|
parameter (NDOWN=4) !Downsample ratio
|
||||||
parameter (NFFT=13824,NH=NFFT/2)
|
|
||||||
integer*2 id1(n1)
|
integer*2 id1(n1)
|
||||||
integer*2 id2(*)
|
integer*2 id2(*)
|
||||||
real t(NTAPS)
|
real t(NTAPS)
|
||||||
real x(NFFT)
|
data t/NTAPS*0.0/
|
||||||
real s(0:NH)
|
|
||||||
complex cx(0:NH)
|
|
||||||
equivalence(x,cx)
|
|
||||||
data t/NTAPS*0.0/,nrefspec0/-999/
|
|
||||||
|
|
||||||
! Filter coefficients:
|
! Filter coefficients:
|
||||||
real w(NTAPS)
|
real w(NTAPS)
|
||||||
@ -38,13 +33,7 @@ subroutine fil4(id1,n1,id2,n2,nrefspec)
|
|||||||
-0.013752163325,-0.011720748164,-0.005202883094, 0.002613872664, &
|
-0.013752163325,-0.011720748164,-0.005202883094, 0.002613872664, &
|
||||||
0.008706594219, 0.011363155076, 0.010161983649, 0.010051920210, &
|
0.008706594219, 0.011363155076, 0.010161983649, 0.010051920210, &
|
||||||
0.000861074040/
|
0.000861074040/
|
||||||
save w,t,nsave,s,nrefspec0
|
save w,t
|
||||||
|
|
||||||
if(nrefspec.ne.nrefspec0) then
|
|
||||||
s=0.
|
|
||||||
nsave=0
|
|
||||||
nrefspec0=nrefspec
|
|
||||||
endif
|
|
||||||
|
|
||||||
n2=n1/NDOWN
|
n2=n1/NDOWN
|
||||||
if(n2*NDOWN.ne.n1) stop 'Error in fil4'
|
if(n2*NDOWN.ne.n1) stop 'Error in fil4'
|
||||||
@ -56,34 +45,5 @@ subroutine fil4(id1,n1,id2,n2,nrefspec)
|
|||||||
id2(i)=nint(dot_product(w,t))
|
id2(i)=nint(dot_product(w,t))
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
if(nrefspec.eq.1) then
|
|
||||||
nsave=nsave+1
|
|
||||||
x=0.001*id1
|
|
||||||
call four2a(x,NFFT,1,-1,0) !r2c FFT
|
|
||||||
|
|
||||||
do i=1,NH
|
|
||||||
s(i)=s(i) + real(cx(i))**2 + aimag(cx(i))**2
|
|
||||||
enddo
|
|
||||||
|
|
||||||
if(mod(nsave,34).eq.0) then !About 9.8 sec
|
|
||||||
df=48000.0/NFFT
|
|
||||||
ia=nint(500.0/df)
|
|
||||||
ib=nint(2500.0/df)
|
|
||||||
call pctile(s(ia),ib-ia+1,50,xmed)
|
|
||||||
db0=db(xmed)
|
|
||||||
nhadd=10
|
|
||||||
open(16,file='refspec.dat',status='unknown')
|
|
||||||
do i=1,NH
|
|
||||||
freq=i*df
|
|
||||||
ia=max(1,i-nhadd)
|
|
||||||
ib=min(NH,i+nhadd)
|
|
||||||
smo=sum(s(ia:ib))/(ib-ia+1)
|
|
||||||
write(16,1000) freq,db(smo)-db0
|
|
||||||
1000 format(2f10.3)
|
|
||||||
enddo
|
|
||||||
close(16)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine fil4
|
end subroutine fil4
|
||||||
|
17
lib/refspec.f90
Normal file
17
lib/refspec.f90
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
subroutine refspec(id2,k)
|
||||||
|
|
||||||
|
! Input:
|
||||||
|
! id2 raw 16-bit integer data, 12000 Hz sample rate
|
||||||
|
! k pointer to the most recent new data
|
||||||
|
|
||||||
|
! Output (in common/c0com)
|
||||||
|
! c0 complex data downsampled to 1500 Hz
|
||||||
|
|
||||||
|
parameter (NMAX=120*12000) !Total sample intervals per 30 minutes
|
||||||
|
integer*2 id2(0:NMAX-1)
|
||||||
|
|
||||||
|
! write(*,3001) id2(k-3456:k-3456+9),k
|
||||||
|
!3001 format(10i5,i10)
|
||||||
|
|
||||||
|
return
|
||||||
|
end subroutine refspec
|
@ -99,6 +99,7 @@ extern "C" {
|
|||||||
void hash_calls_(char calls[], int* ih9, int len);
|
void hash_calls_(char calls[], int* ih9, int len);
|
||||||
void degrade_snr_(short d2[], int* n, float* db, float* bandwidth);
|
void degrade_snr_(short d2[], int* n, float* db, float* bandwidth);
|
||||||
void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2);
|
void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2);
|
||||||
|
void refspec_(short int d2[], int* k);
|
||||||
}
|
}
|
||||||
|
|
||||||
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
|
int volatile itone[NUM_ISCAT_SYMBOLS]; //Audio tones for all Tx symbols
|
||||||
@ -118,7 +119,6 @@ int fast_jh2;
|
|||||||
int narg[15];
|
int narg[15];
|
||||||
QVector<QColor> g_ColorTbl;
|
QVector<QColor> g_ColorTbl;
|
||||||
bool g_single_decode;
|
bool g_single_decode;
|
||||||
bool g_bRefSpec;
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -677,7 +677,7 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
|
|||||||
}
|
}
|
||||||
VHF_features_enabled(m_config.enable_VHF_features());
|
VHF_features_enabled(m_config.enable_VHF_features());
|
||||||
g_single_decode=m_config.single_decode();
|
g_single_decode=m_config.single_decode();
|
||||||
g_bRefSpec=false;
|
m_bRefSpec=false;
|
||||||
|
|
||||||
progressBar->setMaximum(m_TRperiod);
|
progressBar->setMaximum(m_TRperiod);
|
||||||
m_modulator->setPeriod(m_TRperiod); // TODO - not thread safe
|
m_modulator->setPeriod(m_TRperiod); // TODO - not thread safe
|
||||||
@ -873,6 +873,10 @@ void MainWindow::dataSink(qint64 frames)
|
|||||||
static float px=0.0;
|
static float px=0.0;
|
||||||
static float df3;
|
static float df3;
|
||||||
|
|
||||||
|
int k (frames);
|
||||||
|
refspec_(dec_data.d2,&k);
|
||||||
|
// wspr_downsample_(dec_data.d2,&k);
|
||||||
|
|
||||||
if(m_diskData) {
|
if(m_diskData) {
|
||||||
dec_data.params.ndiskdat=1;
|
dec_data.params.ndiskdat=1;
|
||||||
} else {
|
} else {
|
||||||
@ -887,7 +891,6 @@ void MainWindow::dataSink(qint64 frames)
|
|||||||
// Get power, spectrum, and ihsym
|
// Get power, spectrum, and ihsym
|
||||||
trmin=m_TRperiod/60;
|
trmin=m_TRperiod/60;
|
||||||
// int k (frames - 1);
|
// int k (frames - 1);
|
||||||
int k (frames);
|
|
||||||
dec_data.params.nfa=m_wideGraph->nStartFreq();
|
dec_data.params.nfa=m_wideGraph->nStartFreq();
|
||||||
dec_data.params.nfb=m_wideGraph->Fmax();
|
dec_data.params.nfb=m_wideGraph->Fmax();
|
||||||
int nsps=m_nsps;
|
int nsps=m_nsps;
|
||||||
@ -1475,9 +1478,9 @@ void MainWindow::on_stopButton_clicked() //stopButton
|
|||||||
{
|
{
|
||||||
monitor (false);
|
monitor (false);
|
||||||
m_loopall=false;
|
m_loopall=false;
|
||||||
if(g_bRefSpec) {
|
if(m_bRefSpec) {
|
||||||
// msgBox("Reference spectrum saved.");
|
// msgBox("Reference spectrum saved.");
|
||||||
g_bRefSpec=false;
|
m_bRefSpec=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5342,7 +5345,7 @@ void MainWindow::fastPick(int x0, int x1, int y)
|
|||||||
|
|
||||||
void MainWindow::on_actionSave_reference_spectrum_triggered()
|
void MainWindow::on_actionSave_reference_spectrum_triggered()
|
||||||
{
|
{
|
||||||
g_bRefSpec=true;
|
m_bRefSpec=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_sbCQRxFreq_valueChanged(int n)
|
void MainWindow::on_sbCQRxFreq_valueChanged(int n)
|
||||||
|
@ -425,6 +425,7 @@ private:
|
|||||||
bool m_bFast9;
|
bool m_bFast9;
|
||||||
bool m_bFastDecodeCalled;
|
bool m_bFastDecodeCalled;
|
||||||
bool m_bDoubleClickAfterCQnnn;
|
bool m_bDoubleClickAfterCQnnn;
|
||||||
|
bool m_bRefSpec;
|
||||||
float m_pctZap;
|
float m_pctZap;
|
||||||
|
|
||||||
char m_msg[100][80];
|
char m_msg[100][80];
|
||||||
|
Loading…
Reference in New Issue
Block a user