1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

DATV demod: TV screen graticule optimization

This commit is contained in:
f4exb 2018-03-15 00:58:18 +01:00
parent 8d984c2f09
commit 09905c362a
2 changed files with 37 additions and 16 deletions

View File

@ -20,6 +20,7 @@
#define DATVCONSTELLATION_H #define DATVCONSTELLATION_H
#include <sys/time.h> #include <sys/time.h>
#include <vector>
#include "leansdr/framework.h" #include "leansdr/framework.h"
#include "gui/tvscreen.h" #include "gui/tvscreen.h"
@ -38,6 +39,8 @@ template<typename T> struct datvconstellation: runnable
TVScreen *m_objDATVScreen; TVScreen *m_objDATVScreen;
pipereader<complex<T> > in; pipereader<complex<T> > in;
unsigned long phase; unsigned long phase;
std::vector<int> cstln_rows;
std::vector<int> cstln_cols;
datvconstellation(scheduler *sch, pipebuf<complex<T> > &_in, T _xymin, T _xymax, const char *_name = 0, TVScreen *objDATVScreen = 0) : datvconstellation(scheduler *sch, pipebuf<complex<T> > &_in, T _xymin, T _xymax, const char *_name = 0, TVScreen *objDATVScreen = 0) :
runnable(sch, _name ? _name : _in.name), runnable(sch, _name ? _name : _in.name),
@ -45,7 +48,7 @@ template<typename T> struct datvconstellation: runnable
xymax(_xymax), xymax(_xymax),
decimation(DEFAULT_GUI_DECIMATION), decimation(DEFAULT_GUI_DECIMATION),
pixels_per_frame(1024), pixels_per_frame(1024),
cstln(NULL), cstln(0),
m_objDATVScreen(objDATVScreen), m_objDATVScreen(objDATVScreen),
in(_in), in(_in),
phase(0) phase(0)
@ -66,9 +69,8 @@ template<typename T> struct datvconstellation: runnable
for (; p < pend; ++p) for (; p < pend; ++p)
{ {
if (m_objDATVScreen != NULL) if (m_objDATVScreen != 0)
{ {
m_objDATVScreen->selectRow(256 * (p->re - xymin) / (xymax - xymin)); m_objDATVScreen->selectRow(256 * (p->re - xymin) / (xymax - xymin));
m_objDATVScreen->setDataColor(256 - 256 * ((p->im - xymin) / (xymax - xymin)), 255, 0, 255); m_objDATVScreen->setDataColor(256 - 256 * ((p->im - xymin) / (xymax - xymin)), 255, 0, 255);
} }
@ -79,23 +81,17 @@ template<typename T> struct datvconstellation: runnable
{ {
// Plot constellation points // Plot constellation points
for (int i = 0; i < (*cstln)->nsymbols; ++i) std::vector<int>::const_iterator row_it = cstln_rows.begin();
{ std::vector<int>::const_iterator col_it = cstln_cols.begin();
complex<signed char> *p = &(*cstln)->symbols[i];
int x = 256 * (p->re - xymin) / (xymax - xymin);
int y = 256 - 256 * (p->im - xymin) / (xymax - xymin);
for (int d = -4; d <= 4; ++d) for (; (row_it != cstln_rows.end()) && (col_it != cstln_cols.end()); ++row_it, ++col_it)
{ {
m_objDATVScreen->selectRow(x + d); m_objDATVScreen->selectRow(*row_it);
m_objDATVScreen->setDataColor(y, 5, 250, 250); m_objDATVScreen->setDataColor(*col_it, 250, 250, 5);
m_objDATVScreen->selectRow(x);
m_objDATVScreen->setDataColor(y + d, 5, 250, 250);
}
} }
} }
m_objDATVScreen->renderImage(NULL); m_objDATVScreen->renderImage(0);
} }
in.read(pixels_per_frame); in.read(pixels_per_frame);
@ -111,6 +107,30 @@ template<typename T> struct datvconstellation: runnable
{ {
} }
void calculate_cstln_points()
{
if (!(*cstln)) {
return;
}
cstln_rows.clear();
cstln_cols.clear();
for (int i = 0; i < (*cstln)->nsymbols; ++i)
{
complex<signed char> *p = &(*cstln)->symbols[i];
int x = 256 * (p->re - xymin) / (xymax - xymin);
int y = 256 - 256 * (p->im - xymin) / (xymax - xymin);
for (int d = -4; d <= 4; ++d)
{
cstln_rows.push_back(x + d);
cstln_cols.push_back(y);
cstln_rows.push_back(x);
cstln_cols.push_back(y + d);
}
}
}
}; };
} }

View File

@ -701,6 +701,7 @@ void DATVDemod::InitDATVFramework()
r_scope_symbols = new leansdr::datvconstellation<leansdr::f32>(m_objScheduler, *p_sampled, -128,128, NULL, m_objRegisteredTVScreen); r_scope_symbols = new leansdr::datvconstellation<leansdr::f32>(m_objScheduler, *p_sampled, -128,128, NULL, m_objRegisteredTVScreen);
r_scope_symbols->decimation = 1; r_scope_symbols->decimation = 1;
r_scope_symbols->cstln = &m_objDemodulator->cstln; r_scope_symbols->cstln = &m_objDemodulator->cstln;
r_scope_symbols->calculate_cstln_points();
} }
// DECONVOLUTION AND SYNCHRONIZATION // DECONVOLUTION AND SYNCHRONIZATION