1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

DATV demod: detect MODCOD induced change in constellation and update screen points (DVB-S2)

This commit is contained in:
f4exb 2019-07-16 18:19:29 +02:00
parent 8cb4ed57ed
commit 354b59c793
7 changed files with 114 additions and 3 deletions

View File

@ -101,7 +101,11 @@ static inline cstln_lut<eucl_ss, 256> * make_dvbs_constellation(cstln_lut<eucl_s
default:
break;
}
return new cstln_lut<eucl_ss, 256>(c, 10, gamma1, gamma2, gamma3);
cstln_lut<eucl_ss, 256> *newCstln = new cstln_lut<eucl_ss, 256>(c, 10, gamma1, gamma2, gamma3);
newCstln->m_rateCode = (int) r;
newCstln->m_typeCode = (int) c;
newCstln->m_setByModcod = false;
return newCstln;
}
template<typename T> struct datvconstellation: runnable

View File

@ -49,6 +49,7 @@ DATVDemod::DATVDemod(DeviceAPI *deviceAPI) :
m_audioFifo(48000),
m_blnRenderingVideo(false),
m_blnStartStopVideo(false),
m_cstlnSetByModcod(false),
m_enmModulation(DATVDemodSettings::BPSK /*DATV_FM1*/),
m_sampleRate(1024000),
m_objSettingsMutex(QMutex::NonRecursive)
@ -1080,7 +1081,7 @@ void DATVDemod::InitDATVS2Framework()
objDemodulatorDVBS2->cstln = make_dvbs2_constellation(m_objCfg.constellation, m_objCfg.fec);
m_cstlnSetByModcod = false;
//constellation
@ -1254,6 +1255,23 @@ void DATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
}
}
} // Samples for loop
// DVBS2: Track change of constellation via MODCOD
if (m_settings.m_standard==DATVDemodSettings::DVB_S2)
{
leansdr::s2_frame_receiver<leansdr::f32, leansdr::llr_ss> * objDemodulatorDVBS2 = (leansdr::s2_frame_receiver<leansdr::f32, leansdr::llr_ss> *) m_objDemodulatorDVBS2;
if (objDemodulatorDVBS2->cstln->m_setByModcod && !m_cstlnSetByModcod)
{
qDebug("DATVDemod::feed: change by MODCOD detected");
if (r_scope_symbols_dvbs2) {
r_scope_symbols_dvbs2->calculate_cstln_points();
}
}
m_cstlnSetByModcod = objDemodulatorDVBS2->cstln->m_setByModcod;
}
}
@ -1425,3 +1443,61 @@ int DATVDemod::GetSampleRate()
{
return m_sampleRate;
}
DATVDemodSettings::DATVCodeRates getCodeRateFromLeanDVBCode(int leanDVBCodeRate)
{
if (leanDVBCodeRate == leansdr::code_rate::FEC12) {
return DATVDemodSettings::DATVCodeRates::FEC12;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC13) {
return DATVDemodSettings::DATVCodeRates::FEC13;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC14) {
return DATVDemodSettings::DATVCodeRates::FEC14;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC23) {
return DATVDemodSettings::DATVCodeRates::FEC23;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC25) {
return DATVDemodSettings::DATVCodeRates::FEC25;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC34) {
return DATVDemodSettings::DATVCodeRates::FEC34;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC35) {
return DATVDemodSettings::DATVCodeRates::FEC35;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC45) {
return DATVDemodSettings::DATVCodeRates::FEC45;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC46) {
return DATVDemodSettings::DATVCodeRates::FEC46;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC56) {
return DATVDemodSettings::DATVCodeRates::FEC56;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC78) {
return DATVDemodSettings::DATVCodeRates::FEC78;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC89) {
return DATVDemodSettings::DATVCodeRates::FEC89;
} else if (leanDVBCodeRate == leansdr::code_rate::FEC910) {
return DATVDemodSettings::DATVCodeRates::FEC910;
} else {
return DATVDemodSettings::DATVCodeRates::FEC12;
}
}
DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModulation)
{
if (leanDVBModulation == leansdr::cstln_base::predef::APSK16) {
return DATVDemodSettings::DATVModulation::APSK16;
} else if (leanDVBModulation == leansdr::cstln_base::predef::APSK32) {
return DATVDemodSettings::DATVModulation::APSK32;
} else if (leanDVBModulation == leansdr::cstln_base::predef::APSK64E) {
return DATVDemodSettings::DATVModulation::APSK64E;
} else if (leanDVBModulation == leansdr::cstln_base::predef::BPSK) {
return DATVDemodSettings::DATVModulation::BPSK;
} else if (leanDVBModulation == leansdr::cstln_base::predef::PSK8) {
return DATVDemodSettings::DATVModulation::PSK8;
} else if (leanDVBModulation == leansdr::cstln_base::predef::QAM16) {
return DATVDemodSettings::DATVModulation::QAM16;
} else if (leanDVBModulation == leansdr::cstln_base::predef::QAM64) {
return DATVDemodSettings::DATVModulation::QAM64;
} else if (leanDVBModulation == leansdr::cstln_base::predef::QAM256) {
return DATVDemodSettings::DATVModulation::QAM256;
} else if (leanDVBModulation == leansdr::cstln_base::predef::QPSK) {
return DATVDemodSettings::DATVModulation::QPSK;
} else {
return DATVDemodSettings::DATVModulation::BPSK;
}
}

View File

@ -185,6 +185,8 @@ public:
void InitDATVFramework();
void InitDATVS2Framework();
double getMagSq() const { return m_objMagSqAverage; } //!< Beware this is scaled to 2^30
static DATVDemodSettings::DATVCodeRates getCodeRateFromLeanDVBCode(int leanDVBCodeRate);
static DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModulation);
static const QString m_channelIdURI;
static const QString m_channelId;
@ -381,6 +383,7 @@ private:
bool m_blnInitialized;
bool m_blnRenderingVideo;
bool m_blnStartStopVideo;
bool m_cstlnSetByModcod;
DATVDemodSettings::DATVModulation m_enmModulation;

View File

@ -47,6 +47,23 @@ struct DATVDemodSettings
QAM256
};
enum DATVCodeRates
{
FEC12,
FEC23,
FEC46,
FEC34,
FEC56,
FEC78, // DVB-S
FEC45,
FEC89,
FEC910, // DVB-S2
FEC14,
FEC13,
FEC25,
FEC35
};
enum dvb_sampler
{
SAMP_NEAREST,

View File

@ -103,7 +103,11 @@ static inline cstln_lut<llr_ss, 256> * make_dvbs2_constellation(cstln_lut<llr_ss
break;
}
return new cstln_lut<llr_ss, 256>(c, 10, gamma1, gamma2, gamma3);
cstln_lut<llr_ss, 256> *newCstln = new cstln_lut<llr_ss, 256>(c, 10, gamma1, gamma2, gamma3);
newCstln->m_rateCode = (int) r;
newCstln->m_typeCode = (int) c;
newCstln->m_setByModcod = false;
return newCstln;
}
template<typename T> struct datvdvbs2constellation: runnable

View File

@ -808,6 +808,9 @@ struct s2_frame_receiver : runnable
cstln_base::names[mcinfo->c], mcinfo->rate);
cstln = new cstln_lut<SOFTSYMB, 256>(mcinfo->c, mcinfo->esn0_nf,
mcinfo->g1, mcinfo->g2, mcinfo->g3);
cstln->m_rateCode = (int) mcinfo->rate;
cstln->m_typeCode = (int) mcinfo->c;
cstln->m_setByModcod = true;
#if 0
fprintf(stderr, "Dumping constellation LUT to stdout.\n");
cstln->dump(stdout);

View File

@ -875,6 +875,10 @@ struct cstln_lut : cstln_base
softsymb_harden(&lut[i][q].ss);
}
}
int m_typeCode;
int m_rateCode;
bool m_setByModcod;
};
// cstln_lut