1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

Corrected channel analyzer decimation and incorrect workarounds

This commit is contained in:
f4exb 2015-07-16 22:31:12 +02:00
parent 93aa852897
commit 7ee44dfd27
5 changed files with 22 additions and 20 deletions

View File

@ -63,7 +63,7 @@ void ChannelAnalyzer::feed(SampleVector::const_iterator begin, SampleVector::con
{ {
fftfilt::cmplx *sideband, sum; fftfilt::cmplx *sideband, sum;
int n_out; int n_out;
int decim = 1<<(m_spanLog2 - 1); int decim = 1<<m_spanLog2;
unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1) unsigned char decim_mask = decim - 1; // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
for(SampleVector::const_iterator it = begin; it < end; ++it) { for(SampleVector::const_iterator it = begin; it < end; ++it) {

View File

@ -208,8 +208,8 @@ void ChannelAnalyzerGUI::on_ssb_toggled(bool checked)
m_channelMarker->setSidebands(ChannelMarker::usb); m_channelMarker->setSidebands(ChannelMarker::usb);
} }
ui->glSpectrum->setCenterFrequency(m_rate/2); ui->glSpectrum->setCenterFrequency(m_rate/4);
ui->glSpectrum->setSampleRate(m_rate); ui->glSpectrum->setSampleRate(m_rate/2);
ui->glSpectrum->setSsbSpectrum(true); ui->glSpectrum->setSsbSpectrum(true);
on_lowCut_valueChanged(m_channelMarker->getLowCutoff()/100); on_lowCut_valueChanged(m_channelMarker->getLowCutoff()/100);
@ -219,7 +219,7 @@ void ChannelAnalyzerGUI::on_ssb_toggled(bool checked)
m_channelMarker->setSidebands(ChannelMarker::dsb); m_channelMarker->setSidebands(ChannelMarker::dsb);
ui->glSpectrum->setCenterFrequency(0); ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(2*m_rate); ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setSsbSpectrum(false); ui->glSpectrum->setSsbSpectrum(false);
applySettings(); applySettings();
@ -342,21 +342,22 @@ bool ChannelAnalyzerGUI::setNewRate(int spanLog2)
m_channelMarker->setSidebands(ChannelMarker::usb); m_channelMarker->setSidebands(ChannelMarker::usb);
} }
ui->glSpectrum->setCenterFrequency(m_rate/2); ui->glSpectrum->setCenterFrequency(m_rate/4);
ui->glSpectrum->setSampleRate(m_rate); ui->glSpectrum->setSampleRate(m_rate/2);
ui->glSpectrum->setSsbSpectrum(true); ui->glSpectrum->setSsbSpectrum(true);
ui->glScope->setSampleRate(m_rate); }
m_scopeVis->setSampleRate(m_rate); else
} else { {
m_channelMarker->setSidebands(ChannelMarker::dsb); m_channelMarker->setSidebands(ChannelMarker::dsb);
ui->glSpectrum->setCenterFrequency(0); ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(2*m_rate); ui->glSpectrum->setSampleRate(m_rate);
ui->glSpectrum->setSsbSpectrum(false); ui->glSpectrum->setSsbSpectrum(false);
ui->glScope->setSampleRate(2*m_rate);
m_scopeVis->setSampleRate(2*m_rate);
} }
ui->glScope->setSampleRate(m_rate);
m_scopeVis->setSampleRate(m_rate);
return true; return true;
} }

View File

@ -125,8 +125,11 @@ bool ScopeVis::handleMessageKeep(Message* message)
{ {
if(DSPSignalNotification::match(message)) { if(DSPSignalNotification::match(message)) {
DSPSignalNotification* signal = (DSPSignalNotification*)message; DSPSignalNotification* signal = (DSPSignalNotification*)message;
//fprintf(stderr, "ScopeVis::handleMessage @%x : %d samples/sec, %lld Hz offset\n", this, signal->getSampleRate(), signal->getFrequencyOffset());
m_sampleRate = signal->getSampleRate(); m_sampleRate = signal->getSampleRate();
/*fprintf(stderr, "ScopeVis::handleMessage : %d samples/sec, %lld Hz offset, traceSize: \n",
m_sampleRate,
signal->getFrequencyOffset(),
m_trace.size());*/
return true; return true;
} else if(MsgConfigureScopeVis::match(message)) { } else if(MsgConfigureScopeVis::match(message)) {
MsgConfigureScopeVis* conf = (MsgConfigureScopeVis*)message; MsgConfigureScopeVis* conf = (MsgConfigureScopeVis*)message;

View File

@ -338,7 +338,7 @@ void GLScope::paintGL()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
glLineWidth(1.0f); glLineWidth(1.0f);
glColor4f(1, 1, 0, 0.4f); glColor4f(1, 1, 0.25f, 0.4f);
int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2) if(end - start < 2)
@ -510,7 +510,7 @@ void GLScope::paintGL()
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
glLineWidth(1.0f); glLineWidth(1.0f);
glColor4f(1, 1, 0, 0.4f); glColor4f(1, 1, 0.25f, 0.4f);
int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size();
int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size());
if(end - start < 2) if(end - start < 2)

View File

@ -243,13 +243,11 @@ void GLScopeGUI::setTimeScaleDisplay()
{ {
m_sampleRate = m_glScope->getSampleRate(); m_sampleRate = m_glScope->getSampleRate();
qreal t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate) / (qreal)m_timeBase; qreal t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate) / (qreal)m_timeBase;
/* /*std::cerr << "GLScopeGUI::setTimeScaleDisplay: sample rate: "
std::cerr << "GLScopeGUI::setTimeScaleDisplay: sample rate: " << m_sampleRate
<< m_glScope->getSampleRate()
<< " traceSize: " << m_glScope->getTraceSize() << " traceSize: " << m_glScope->getTraceSize()
<< " timeBase: " << m_timeBase << " timeBase: " << m_timeBase
<< " glScope @" << m_glScope << std::endl; << " t: " << t << std::endl;*/
*/
if(t < 0.000001) if(t < 0.000001)
ui->timeText->setText(tr("%1\nns").arg(t * 1000000000.0)); ui->timeText->setText(tr("%1\nns").arg(t * 1000000000.0));
else if(t < 0.001) else if(t < 0.001)