1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-02-20 20:48:46 -05:00

DSD demod: TV screen graticule optimization

This commit is contained in:
f4exb 2018-03-15 00:16:50 +01:00
parent d1bb70a32c
commit 8d984c2f09
6 changed files with 52 additions and 18 deletions

View File

@ -317,6 +317,8 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
} }
} }
m_scopeVisXY->calculateGraticule(200,200);
m_dsdDemod = (DSDDemod*) rxChannel; //new DSDDemod(m_deviceUISet->m_deviceSourceAPI); m_dsdDemod = (DSDDemod*) rxChannel; //new DSDDemod(m_deviceUISet->m_deviceSourceAPI);
m_dsdDemod->setScopeXYSink(m_scopeVisXY); m_dsdDemod->setScopeXYSink(m_scopeVisXY);
m_dsdDemod->setMessageQueueToGUI(getInputMessageQueue()); m_dsdDemod->setMessageQueueToGUI(getInputMessageQueue());

View File

@ -71,14 +71,22 @@ void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVe
if (m_pixelCount == m_pixelsPerFrame) if (m_pixelCount == m_pixelsPerFrame)
{ {
int rows, cols;
m_tvScreen->getSize(rows, cols);
if ((rows != m_rows) || (cols != m_cols))
{
calculateGraticule(rows, cols);
m_rows = rows;
m_cols = cols;
}
drawGraticule(); drawGraticule();
m_tvScreen->renderImage(0); m_tvScreen->renderImage(0);
usleep(5000); usleep(5000);
m_tvScreen->getSize(m_cols, m_rows);
m_tvScreen->resetImage(m_alphaReset); m_tvScreen->resetImage(m_alphaReset);
m_pixelCount = 0; m_pixelCount = 0;
} }
} }
} }
@ -103,22 +111,37 @@ void ScopeVisXY::clearGraticule() {
m_graticule.clear(); m_graticule.clear();
} }
void ScopeVisXY::drawGraticule() void ScopeVisXY::calculateGraticule(int rows, int cols)
{ {
m_graticuleRows.clear();
m_graticuleCols.clear();
std::vector<std::complex<float> >::const_iterator grIt = m_graticule.begin(); std::vector<std::complex<float> >::const_iterator grIt = m_graticule.begin();
for (; grIt != m_graticule.end(); ++grIt) for (; grIt != m_graticule.end(); ++grIt)
{ {
int y = m_rows * ((1.0 - grIt->imag()) / 2.0); int y = rows * ((1.0 - grIt->imag()) / 2.0);
int x = m_cols * ((1.0 + grIt->real()) / 2.0); int x = cols * ((1.0 + grIt->real()) / 2.0);
for (int d = -4; d <= 4; ++d) for (int d = -4; d <= 4; ++d)
{ {
m_tvScreen->selectRow(y + d); m_graticuleRows.push_back(y+d);
m_tvScreen->setDataColor(x, qRed(m_gridRGB), qGreen(m_gridRGB), qBlue(m_gridRGB)); m_graticuleCols.push_back(x);
m_tvScreen->selectRow(y); m_graticuleRows.push_back(y);
m_tvScreen->setDataColor(x + d, qRed(m_gridRGB), qGreen(m_gridRGB), qBlue(m_gridRGB)); m_graticuleCols.push_back(x+d);
} }
} }
} }
void ScopeVisXY::drawGraticule()
{
std::vector<int>::const_iterator rowIt = m_graticuleRows.begin();
std::vector<int>::const_iterator colIt = m_graticuleCols.begin();
for(; (rowIt != m_graticuleRows.end()) && (colIt != m_graticuleCols.end()); ++rowIt, ++colIt)
{
m_tvScreen->selectRow(*rowIt);
m_tvScreen->setDataColor(*colIt, qRed(m_gridRGB), qGreen(m_gridRGB), qBlue(m_gridRGB));
}
}

View File

@ -47,6 +47,7 @@ public:
void setGridRGB(const QRgb& gridRGB) { m_gridRGB = gridRGB; } void setGridRGB(const QRgb& gridRGB) { m_gridRGB = gridRGB; }
void addGraticulePoint(const std::complex<float>& z); void addGraticulePoint(const std::complex<float>& z);
void calculateGraticule(int rows, int cols);
void clearGraticule(); void clearGraticule();
private: private:
@ -63,6 +64,8 @@ private:
QRgb m_plotRGB; QRgb m_plotRGB;
QRgb m_gridRGB; QRgb m_gridRGB;
std::vector<std::complex<float> > m_graticule; std::vector<std::complex<float> > m_graticule;
std::vector<int> m_graticuleRows;
std::vector<int> m_graticuleCols;
}; };

View File

@ -46,8 +46,6 @@ public:
void setAlphaBlend(bool blnAlphaBlend) { m_blnAlphaBlend = blnAlphaBlend; } void setAlphaBlend(bool blnAlphaBlend) { m_blnAlphaBlend = blnAlphaBlend; }
void setAlphaReset() { m_blnAlphaReset = true; } void setAlphaReset() { m_blnAlphaReset = true; }
void InitializeGL(int intCols, int intRows); void InitializeGL(int intCols, int intRows);
void ResizeContainer(int intCols, int intRows);
void getSize(int& intCols, int& intRows) const { intCols = m_intCols, intRows = m_intRows; }
void Cleanup(); void Cleanup();
QRgb *GetRowBuffer(int intRow); QRgb *GetRowBuffer(int intRow);
void RenderPixels(unsigned char *chrData); void RenderPixels(unsigned char *chrData);

View File

@ -43,7 +43,8 @@ TVScreen::TVScreen(bool blnColor, QWidget* parent) :
//Par défaut //Par défaut
m_intAskedCols = TV_COLS; m_intAskedCols = TV_COLS;
m_intAskedRows = TV_ROWS; m_intAskedRows = TV_ROWS;
m_cols = TV_COLS;
m_rows = TV_ROWS;
} }
TVScreen::~TVScreen() TVScreen::~TVScreen()
@ -88,13 +89,17 @@ void TVScreen::resetImage(int alpha)
void TVScreen::resizeTVScreen(int intCols, int intRows) void TVScreen::resizeTVScreen(int intCols, int intRows)
{ {
qDebug("TVScreen::resizeTVScreen: cols: %d, rows: %d", intCols, intRows);
m_intAskedCols = intCols; m_intAskedCols = intCols;
m_intAskedRows = intRows; m_intAskedRows = intRows;
m_cols = intCols;
m_rows = intRows;
} }
void TVScreen::getSize(int& intCols, int& intRows) const void TVScreen::getSize(int& intCols, int& intRows) const
{ {
m_objGLShaderArray.getSize(intCols, intRows); intCols = m_cols;
intRows = m_rows;
} }
void TVScreen::initializeGL() void TVScreen::initializeGL()

View File

@ -84,6 +84,9 @@ private:
GLShaderTVArray m_objGLShaderArray; GLShaderTVArray m_objGLShaderArray;
int m_cols;
int m_rows;
void initializeGL(); void initializeGL();
void resizeGL(int width, int height); void resizeGL(int width, int height);
void paintGL(); void paintGL();