mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
DSD demod: TV screen graticule optimization
This commit is contained in:
parent
d1bb70a32c
commit
8d984c2f09
@ -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->setScopeXYSink(m_scopeVisXY);
|
||||
m_dsdDemod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
@ -71,14 +71,22 @@ void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVe
|
||||
|
||||
if (m_pixelCount == m_pixelsPerFrame)
|
||||
{
|
||||
drawGraticule();
|
||||
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();
|
||||
m_tvScreen->renderImage(0);
|
||||
usleep(5000);
|
||||
m_tvScreen->getSize(m_cols, m_rows);
|
||||
m_tvScreen->resetImage(m_alphaReset);
|
||||
m_pixelCount = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,22 +111,37 @@ void ScopeVisXY::clearGraticule() {
|
||||
m_graticule.clear();
|
||||
}
|
||||
|
||||
void ScopeVisXY::drawGraticule()
|
||||
void ScopeVisXY::calculateGraticule(int rows, int cols)
|
||||
{
|
||||
std::vector<std::complex<float> >::const_iterator grIt = m_graticule.begin();
|
||||
m_graticuleRows.clear();
|
||||
m_graticuleCols.clear();
|
||||
|
||||
for (; grIt != m_graticule.end(); ++grIt)
|
||||
{
|
||||
int y = m_rows * ((1.0 - grIt->imag()) / 2.0);
|
||||
int x = m_cols * ((1.0 + grIt->real()) / 2.0);
|
||||
std::vector<std::complex<float> >::const_iterator grIt = m_graticule.begin();
|
||||
|
||||
for (; grIt != m_graticule.end(); ++grIt)
|
||||
{
|
||||
int y = rows * ((1.0 - grIt->imag()) / 2.0);
|
||||
int x = cols * ((1.0 + grIt->real()) / 2.0);
|
||||
|
||||
for (int d = -4; d <= 4; ++d)
|
||||
{
|
||||
m_tvScreen->selectRow(y + d);
|
||||
m_tvScreen->setDataColor(x, qRed(m_gridRGB), qGreen(m_gridRGB), qBlue(m_gridRGB));
|
||||
m_tvScreen->selectRow(y);
|
||||
m_tvScreen->setDataColor(x + d, qRed(m_gridRGB), qGreen(m_gridRGB), qBlue(m_gridRGB));
|
||||
m_graticuleRows.push_back(y+d);
|
||||
m_graticuleCols.push_back(x);
|
||||
m_graticuleRows.push_back(y);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
void setGridRGB(const QRgb& gridRGB) { m_gridRGB = gridRGB; }
|
||||
|
||||
void addGraticulePoint(const std::complex<float>& z);
|
||||
void calculateGraticule(int rows, int cols);
|
||||
void clearGraticule();
|
||||
|
||||
private:
|
||||
@ -63,6 +64,8 @@ private:
|
||||
QRgb m_plotRGB;
|
||||
QRgb m_gridRGB;
|
||||
std::vector<std::complex<float> > m_graticule;
|
||||
std::vector<int> m_graticuleRows;
|
||||
std::vector<int> m_graticuleCols;
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,8 +46,6 @@ public:
|
||||
void setAlphaBlend(bool blnAlphaBlend) { m_blnAlphaBlend = blnAlphaBlend; }
|
||||
void setAlphaReset() { m_blnAlphaReset = true; }
|
||||
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();
|
||||
QRgb *GetRowBuffer(int intRow);
|
||||
void RenderPixels(unsigned char *chrData);
|
||||
|
@ -43,7 +43,8 @@ TVScreen::TVScreen(bool blnColor, QWidget* parent) :
|
||||
//Par défaut
|
||||
m_intAskedCols = TV_COLS;
|
||||
m_intAskedRows = TV_ROWS;
|
||||
|
||||
m_cols = TV_COLS;
|
||||
m_rows = TV_ROWS;
|
||||
}
|
||||
|
||||
TVScreen::~TVScreen()
|
||||
@ -88,13 +89,17 @@ void TVScreen::resetImage(int alpha)
|
||||
|
||||
void TVScreen::resizeTVScreen(int intCols, int intRows)
|
||||
{
|
||||
qDebug("TVScreen::resizeTVScreen: cols: %d, rows: %d", intCols, intRows);
|
||||
m_intAskedCols = intCols;
|
||||
m_intAskedRows = intRows;
|
||||
m_cols = intCols;
|
||||
m_rows = intRows;
|
||||
}
|
||||
|
||||
void TVScreen::getSize(int& intCols, int& intRows) const
|
||||
{
|
||||
m_objGLShaderArray.getSize(intCols, intRows);
|
||||
intCols = m_cols;
|
||||
intRows = m_rows;
|
||||
}
|
||||
|
||||
void TVScreen::initializeGL()
|
||||
|
@ -84,6 +84,9 @@ private:
|
||||
|
||||
GLShaderTVArray m_objGLShaderArray;
|
||||
|
||||
int m_cols;
|
||||
int m_rows;
|
||||
|
||||
void initializeGL();
|
||||
void resizeGL(int width, int height);
|
||||
void paintGL();
|
||||
|
Loading…
Reference in New Issue
Block a user