1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

DATV demod: fixed FP handling in leansdr/sdr.h. Fixed call to cstln_lut constructor

This commit is contained in:
f4exb 2019-07-16 01:05:53 +02:00
parent bb92048dcc
commit fbbc9a19b7
4 changed files with 26 additions and 21 deletions

View File

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

View File

@ -1242,8 +1242,8 @@ void DATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
lngWritable = p_rawiq_writer->writable(); lngWritable = p_rawiq_writer->writable();
//Leave +1 by safety //Leave +1 by safety
if(((m_lngReadIQ+1)>=lngWritable) || (m_lngReadIQ>=768)) //if(((m_lngReadIQ+1)>=lngWritable) || (m_lngReadIQ>=768))
//if((m_lngReadIQ+1)>=lngWritable) if((m_lngReadIQ+1)>=lngWritable)
{ {
m_objScheduler->step(); m_objScheduler->step();

View File

@ -33,13 +33,11 @@ static inline cstln_lut<llr_ss, 256> * make_dvbs2_constellation(cstln_lut<llr_ss
code_rate r) code_rate r)
{ {
float gamma1 = 1, gamma2 = 1, gamma3 = 1; float gamma1 = 1, gamma2 = 1, gamma3 = 1;
switch (c) switch (c)
{ {
case cstln_lut<llr_ss, 256>::APSK16: case cstln_lut<llr_ss, 256>::APSK16:
// EN 302 307, section 5.4.3, Table 9 // EN 302 307, section 5.4.3, Table 9
switch (r) switch (r)
{ {
case FEC23: case FEC23:
@ -104,8 +102,8 @@ static inline cstln_lut<llr_ss, 256> * make_dvbs2_constellation(cstln_lut<llr_ss
default: default:
break; break;
} }
return new cstln_lut<llr_ss, 256>(c, gamma1, gamma2, gamma3); return new cstln_lut<llr_ss, 256>(c, 10, gamma1, gamma2, gamma3);
} }
template<typename T> struct datvdvbs2constellation: runnable template<typename T> struct datvdvbs2constellation: runnable
@ -140,12 +138,12 @@ template<typename T> struct datvdvbs2constellation: runnable
} }
void run() void run()
{ {
phase=0; phase=0;
//Symbols //Symbols
while (in.readable() >= pixels_per_frame) while (in.readable() >= pixels_per_frame)
{ {
if ((!phase) && m_objDATVScreen) if ((!phase) && m_objDATVScreen)
{ {
m_objDATVScreen->resetImage(); m_objDATVScreen->resetImage();

View File

@ -500,9 +500,11 @@ struct cstln_lut : cstln_base
#if 0 // BPSK at 0° #if 0 // BPSK at 0°
symbols[0] = polar(1, 2, 0); symbols[0] = polar(1, 2, 0);
symbols[1] = polar(1, 2, 1); symbols[1] = polar(1, 2, 1);
printf("cstln_lut::cstln_lut: BPSK at 0 degrees\n");
#else // BPSK at 45° #else // BPSK at 45°
symbols[0] = polar(1, 8, 1); symbols[0] = polar(1, 8, 1);
symbols[1] = polar(1, 8, 5); symbols[1] = polar(1, 8, 5);
printf("cstln_lut::cstln_lut: BPSK at 45 degrees\n");
#endif #endif
make_lut_from_symbols(mer); make_lut_from_symbols(mer);
break; break;
@ -518,6 +520,7 @@ struct cstln_lut : cstln_base
symbols[2] = polar(1, 4, 1.5); symbols[2] = polar(1, 4, 1.5);
symbols[3] = polar(1, 4, 2.5); symbols[3] = polar(1, 4, 2.5);
make_lut_from_symbols(mer); make_lut_from_symbols(mer);
printf("cstln_lut::cstln_lut: QPSK\n");
break; break;
case PSK8: case PSK8:
amp_max = 1; amp_max = 1;
@ -534,14 +537,15 @@ struct cstln_lut : cstln_base
symbols[6] = polar(1, 8, 3); symbols[6] = polar(1, 8, 3);
symbols[7] = polar(1, 8, 6); symbols[7] = polar(1, 8, 6);
make_lut_from_symbols(mer); make_lut_from_symbols(mer);
printf("cstln_lut::cstln_lut: PSK8\n");
break; break;
case APSK16: case APSK16:
{ {
// Default gamma for non-DVB-S2 applications. // Default gamma for non-DVB-S2 applications.
if (!gamma1) if (gamma1 == 0)
gamma1 = 2.57; gamma1 = 2.57;
// EN 302 307, section 5.4.3 // EN 302 307, section 5.4.3
float r1 = sqrtf(4 / (1 + 3 * gamma1 * gamma1)); float r1 = sqrtf(4.0f / (1.0f + 3.0f * gamma1 * gamma1));
float r2 = gamma1 * r1; float r2 = gamma1 * r1;
amp_max = r2; amp_max = r2;
nrotations = 4; nrotations = 4;
@ -564,18 +568,19 @@ struct cstln_lut : cstln_base
symbols[14] = polar(r1, 4, 1.5); symbols[14] = polar(r1, 4, 1.5);
symbols[15] = polar(r1, 4, 2.5); symbols[15] = polar(r1, 4, 2.5);
make_lut_from_symbols(mer); make_lut_from_symbols(mer);
printf("cstln_lut::cstln_lut: APSK16: gamma1=%f r1=%f r2=%f\n", gamma1, r1, r2);
break; break;
} }
case APSK32: case APSK32:
{ {
// Default gammas for non-DVB-S2 applications. // Default gammas for non-DVB-S2 applications.
if (!gamma1) if (gamma1 == 0)
gamma1 = 2.53; gamma1 = 2.53;
if (!gamma2) if (gamma2 == 0)
gamma2 = 4.30; gamma2 = 4.30;
// EN 302 307, section 5.4.3 // EN 302 307, section 5.4.3
float r1 = sqrtf( float r1 = sqrtf(
8 / (1 + 3 * gamma1 * gamma1 + 4 * gamma2 * gamma2)); 8.0f / (1.0f + 3.0f * gamma1 * gamma1 + 4 * gamma2 * gamma2));
float r2 = gamma1 * r1; float r2 = gamma1 * r1;
float r3 = gamma2 * r1; float r3 = gamma2 * r1;
amp_max = r3; amp_max = r3;
@ -615,20 +620,21 @@ struct cstln_lut : cstln_base
symbols[30] = polar(r3, 16, 8); symbols[30] = polar(r3, 16, 8);
symbols[31] = polar(r3, 16, 10); symbols[31] = polar(r3, 16, 10);
make_lut_from_symbols(mer); make_lut_from_symbols(mer);
printf("cstln_lut::cstln_lut: APSK32: gamma1=%f gamma2=%f, r1=%f r2=%f r3=%f\n", gamma1, gamma2, r1, r2, r3);
break; break;
} }
case APSK64E: case APSK64E:
{ {
// Default gammas for non-DVB-S2 applications. // Default gammas for non-DVB-S2 applications.
if (!gamma1) if (gamma1 == 0)
gamma1 = 2.4; gamma1 = 2.4;
if (!gamma2) if (gamma2 == 0)
gamma2 = 4.3; gamma2 = 4.3;
if (!gamma3) if (gamma3 == 0)
gamma3 = 7.0; gamma3 = 7.0;
// EN 302 307-2, section 5.4.5, Table 13e // EN 302 307-2, section 5.4.5, Table 13e
float r1 = sqrtf( float r1 = sqrtf(
64 / (4 + 12 * gamma1 * gamma1 + 20 * gamma2 * gamma2 + 28 * gamma3 * gamma3)); 64.0f / (4.0f + 12.0f * gamma1 * gamma1 + 20.0f * gamma2 * gamma2 + 28.0f * gamma3 * gamma3));
float r2 = gamma1 * r1; float r2 = gamma1 * r1;
float r3 = gamma2 * r1; float r3 = gamma2 * r1;
float r4 = gamma3 * r1; float r4 = gamma3 * r1;
@ -653,6 +659,7 @@ struct cstln_lut : cstln_base
polar2(56, r3, 3.0 / 20, 37.0 / 20, 17.0 / 20, 23.0 / 20); polar2(56, r3, 3.0 / 20, 37.0 / 20, 17.0 / 20, 23.0 / 20);
polar2(60, r2, 1.0 / 4, 7.0 / 4, 3.0 / 4, 5.0 / 4); polar2(60, r2, 1.0 / 4, 7.0 / 4, 3.0 / 4, 5.0 / 4);
make_lut_from_symbols(mer); make_lut_from_symbols(mer);
printf("cstln_lut::cstln_lut: APSK64E: gamma1=%f gamma2=%f, gamm3=%f r1=%f r2=%f r3=%f r4=%f\n", gamma1, gamma2, gamma3, r1, r2, r3, r4);
break; break;
} }
case QAM16: case QAM16: