mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-07-31 05:02:26 -04:00
Starting to implement accumulation of reference spectrum.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6598 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
db29c04d70
commit
8d519b7b9f
@ -7,7 +7,7 @@
|
|||||||
#include "moc_Detector.cpp"
|
#include "moc_Detector.cpp"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void fil4_(qint16*, qint32*, qint16*, qint32*);
|
void fil4_(qint16*, qint32*, qint16*, qint32*, qint32*);
|
||||||
}
|
}
|
||||||
|
|
||||||
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds,
|
Detector::Detector (unsigned frameRate, unsigned periodLengthInSeconds,
|
||||||
@ -85,8 +85,10 @@ 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);
|
&framesAfterDownSample, &nrefspec);
|
||||||
dec_data.params.kin += framesAfterDownSample;
|
dec_data.params.kin += framesAfterDownSample;
|
||||||
} else {
|
} else {
|
||||||
// qDebug() << "framesToProcess = " << framesToProcess;
|
// qDebug() << "framesToProcess = " << framesToProcess;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef DETECTOR_HPP__
|
#ifndef DETECTOR_HPP__
|
||||||
#define DETECTOR_HPP__
|
#define DETECTOR_HPP__
|
||||||
|
|
||||||
#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)
|
subroutine fil4(id1,n1,id2,n2,nrefspec)
|
||||||
|
|
||||||
! FIR lowpass filter designed using ScopeFIR
|
! FIR lowpass filter designed using ScopeFIR
|
||||||
|
|
||||||
@ -12,10 +12,15 @@ subroutine fil4(id1,n1,id2,n2)
|
|||||||
|
|
||||||
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)
|
||||||
data t/NTAPS*0.0/
|
real x(NFFT)
|
||||||
|
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)
|
||||||
@ -33,7 +38,13 @@ subroutine fil4(id1,n1,id2,n2)
|
|||||||
-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
|
save w,t,nsave,s,nrefspec0
|
||||||
|
|
||||||
|
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'
|
||||||
@ -45,5 +56,34 @@ subroutine fil4(id1,n1,id2,n2)
|
|||||||
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
|
||||||
|
@ -118,6 +118,7 @@ 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
|
||||||
{
|
{
|
||||||
@ -676,6 +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;
|
||||||
|
|
||||||
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
|
||||||
@ -1472,7 +1474,11 @@ void MainWindow::closeEvent(QCloseEvent * e)
|
|||||||
void MainWindow::on_stopButton_clicked() //stopButton
|
void MainWindow::on_stopButton_clicked() //stopButton
|
||||||
{
|
{
|
||||||
monitor (false);
|
monitor (false);
|
||||||
m_loopall=false;
|
m_loopall=false;
|
||||||
|
if(g_bRefSpec) {
|
||||||
|
// msgBox("Reference spectrum saved.");
|
||||||
|
g_bRefSpec=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::msgBox(QString t) //msgBox
|
void MainWindow::msgBox(QString t) //msgBox
|
||||||
@ -5336,7 +5342,7 @@ void MainWindow::fastPick(int x0, int x1, int y)
|
|||||||
|
|
||||||
void MainWindow::on_actionSave_reference_spectrum_triggered()
|
void MainWindow::on_actionSave_reference_spectrum_triggered()
|
||||||
{
|
{
|
||||||
msgBox("Reference spectrum not presently implemented");
|
g_bRefSpec=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_sbCQRxFreq_valueChanged(int n)
|
void MainWindow::on_sbCQRxFreq_valueChanged(int n)
|
||||||
|
@ -2810,7 +2810,7 @@ QPushButton[state="ok"] {
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionSave_reference_spectrum">
|
<action name="actionSave_reference_spectrum">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save reference spectrum</string>
|
<string>Measure reference spectrum</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionJTMSK">
|
<action name="actionJTMSK">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user