mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-29 21:42:26 -04:00
DATV demod: fixes for MSVC compilation
This commit is contained in:
parent
f8843e243d
commit
0219f119a8
@ -108,6 +108,7 @@ bool DATVDemodGUI::handleMessage(const Message& message)
|
|||||||
m_settings.m_modulation = notif.getModulation();
|
m_settings.m_modulation = notif.getModulation();
|
||||||
m_settings.validateSystemConfiguration();
|
m_settings.validateSystemConfiguration();
|
||||||
displaySystemConfiguration();
|
displaySystemConfiguration();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -88,13 +88,13 @@ struct bch_engine : bch_interface
|
|||||||
bool corrupted = false;
|
bool corrupted = false;
|
||||||
// Divide by individual polynomials.
|
// Divide by individual polynomials.
|
||||||
// TBD Maybe do in parallel, scanning cw only once.
|
// TBD Maybe do in parallel, scanning cw only once.
|
||||||
bitvect<T, DP> rem[npolys];
|
bitvect<T, DP> *rem = new bitvect<T, DP>[npolys]; // npolys is not static hence 'bitvect<T, DP> rem[npolys]' does not compile in all compilers
|
||||||
for (int j = 0; j < npolys; ++j)
|
for (int j = 0; j < npolys; ++j)
|
||||||
{
|
{
|
||||||
rem[j] = divmod(cw, cwbytes, truncpolys[j]);
|
rem[j] = divmod(cw, cwbytes, truncpolys[j]);
|
||||||
}
|
}
|
||||||
// Compute syndromes.
|
// Compute syndromes.
|
||||||
TGF S[2 * npolys];
|
TGF *S = new TGF[2 * npolys]; // npolys is not static hence 'TGF S[2 * npolys]' does not compile in all compilers
|
||||||
for (int i = 0; i < 2 * npolys; ++i)
|
for (int i = 0; i < 2 * npolys; ++i)
|
||||||
{
|
{
|
||||||
// Compute R(alpha^(1+i)), exploiting the fact that
|
// Compute R(alpha^(1+i)), exploiting the fact that
|
||||||
@ -105,6 +105,7 @@ struct bch_engine : bch_interface
|
|||||||
if (S[i])
|
if (S[i])
|
||||||
corrupted = true;
|
corrupted = true;
|
||||||
}
|
}
|
||||||
|
delete[] rem;
|
||||||
if (!corrupted)
|
if (!corrupted)
|
||||||
return 0;
|
return 0;
|
||||||
#if 0
|
#if 0
|
||||||
@ -122,12 +123,16 @@ struct bch_engine : bch_interface
|
|||||||
// TBD More efficient to work with logs of syndromes ?
|
// TBD More efficient to work with logs of syndromes ?
|
||||||
|
|
||||||
int NN = 2 * npolys;
|
int NN = 2 * npolys;
|
||||||
TGF C[NN] = {
|
TGF *C = new TGF[NN];
|
||||||
1,
|
std::fill(C, C+NN, 1);
|
||||||
},
|
TGF *B = new TGF[NN];
|
||||||
B[NN] = {
|
std::fill(C, C+NN, 1);
|
||||||
1,
|
// TGF C[NN] = { crap code
|
||||||
};
|
// 1,
|
||||||
|
// },
|
||||||
|
// B[NN] = {
|
||||||
|
// 1,
|
||||||
|
// };
|
||||||
int L = 0, m = 1;
|
int L = 0, m = 1;
|
||||||
TGF b = 1;
|
TGF b = 1;
|
||||||
for (int n = 0; n < NN; ++n)
|
for (int n = 0; n < NN; ++n)
|
||||||
@ -142,7 +147,7 @@ struct bch_engine : bch_interface
|
|||||||
TGF d_div_b = GF.mul(d, GF.inv(b));
|
TGF d_div_b = GF.mul(d, GF.inv(b));
|
||||||
if (2 * L <= n)
|
if (2 * L <= n)
|
||||||
{
|
{
|
||||||
TGF tmp[NN];
|
TGF *tmp = new TGF[NN]; // replaced crap code
|
||||||
memcpy(tmp, C, sizeof(tmp));
|
memcpy(tmp, C, sizeof(tmp));
|
||||||
for (int i = 0; i < NN - m; ++i)
|
for (int i = 0; i < NN - m; ++i)
|
||||||
C[m + i] = GF.sub(C[m + i], GF.mul(d_div_b, B[i]));
|
C[m + i] = GF.sub(C[m + i], GF.mul(d_div_b, B[i]));
|
||||||
@ -150,6 +155,7 @@ struct bch_engine : bch_interface
|
|||||||
memcpy(B, tmp, sizeof(B));
|
memcpy(B, tmp, sizeof(B));
|
||||||
b = d;
|
b = d;
|
||||||
m = 1;
|
m = 1;
|
||||||
|
delete[] tmp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -159,6 +165,7 @@ struct bch_engine : bch_interface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete[] S;
|
||||||
// L is the number of errors.
|
// L is the number of errors.
|
||||||
// C of degree L is the error locator polynomial (Lambda).
|
// C of degree L is the error locator polynomial (Lambda).
|
||||||
// C(X) = sum(l=1..L)(1-X_l*X).
|
// C(X) = sum(l=1..L)(1-X_l*X).
|
||||||
@ -188,6 +195,8 @@ struct bch_engine : bch_interface
|
|||||||
if (rloc < 0)
|
if (rloc < 0)
|
||||||
{
|
{
|
||||||
// This may happen if the code is used truncated.
|
// This may happen if the code is used truncated.
|
||||||
|
delete[] C;
|
||||||
|
delete[] B;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cw[rloc / 8] ^= 128 >> (rloc & 7);
|
cw[rloc / 8] ^= 128 >> (rloc & 7);
|
||||||
@ -196,6 +205,10 @@ struct bch_engine : bch_interface
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] C;
|
||||||
|
delete[] B;
|
||||||
|
|
||||||
if (roots_found != L)
|
if (roots_found != L)
|
||||||
return -1;
|
return -1;
|
||||||
return L;
|
return L;
|
||||||
|
@ -1878,36 +1878,36 @@ static const struct fec_info
|
|||||||
const s2_ldpc_table *ldpc;
|
const s2_ldpc_table *ldpc;
|
||||||
} fec_infos[2][FEC_COUNT] = {
|
} fec_infos[2][FEC_COUNT] = {
|
||||||
{
|
{
|
||||||
// Normal frames
|
// Normal frames - must respect enum code_rate order
|
||||||
[FEC12] = {32208, 32400, 12, &ldpc_nf_fec12},
|
{32208, 32400, 12, &ldpc_nf_fec12}, // FEC12 (was [FEC12] = {...} and so on. Does not compile with MSVC)
|
||||||
[FEC23] = {43040, 43200, 10, &ldpc_nf_fec23},
|
{43040, 43200, 10, &ldpc_nf_fec23}, // FEC23
|
||||||
[FEC46] = {0},
|
{0}, // FEC46
|
||||||
[FEC34] = {48408, 48600, 12, &ldpc_nf_fec34},
|
{48408, 48600, 12, &ldpc_nf_fec34}, // FEC34
|
||||||
[FEC56] = {53840, 54000, 10, &ldpc_nf_fec56},
|
{53840, 54000, 10, &ldpc_nf_fec56}, // FEC56
|
||||||
[FEC78] = {0},
|
{0}, // FEC78
|
||||||
[FEC45] = {51648, 51840, 12, &ldpc_nf_fec45},
|
{51648, 51840, 12, &ldpc_nf_fec45}, // FEC45
|
||||||
[FEC89] = {57472, 57600, 8, &ldpc_nf_fec89},
|
{57472, 57600, 8, &ldpc_nf_fec89}, // FEC89
|
||||||
[FEC910] = {58192, 58320, 8, &ldpc_nf_fec910},
|
{58192, 58320, 8, &ldpc_nf_fec910}, // FEC910
|
||||||
[FEC14] = {16008, 16200, 12, &ldpc_nf_fec14},
|
{16008, 16200, 12, &ldpc_nf_fec14}, // FEC14
|
||||||
[FEC13] = {21408, 21600, 12, &ldpc_nf_fec13},
|
{21408, 21600, 12, &ldpc_nf_fec13}, // FEC13
|
||||||
[FEC25] = {25728, 25920, 12, &ldpc_nf_fec25},
|
{25728, 25920, 12, &ldpc_nf_fec25}, // FEC25
|
||||||
[FEC35] = {38688, 38880, 12, &ldpc_nf_fec35},
|
{38688, 38880, 12, &ldpc_nf_fec35}, // FEC35
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Short frames
|
// Short frames - must respect enum code_rate order
|
||||||
[FEC12] = {7032, 7200, 12, &ldpc_sf_fec12},
|
{7032, 7200, 12, &ldpc_sf_fec12}, // FEC12 (was [FEC12] = {...} and so on. Does not compile with MSVC)
|
||||||
[FEC23] = {10632, 10800, 12, &ldpc_sf_fec23},
|
{10632, 10800, 12, &ldpc_sf_fec23}, // FEC23
|
||||||
[FEC46] = {},
|
{}, // FEC46
|
||||||
[FEC34] = {11712, 11880, 12, &ldpc_sf_fec34},
|
{11712, 11880, 12, &ldpc_sf_fec34}, // FEC34
|
||||||
[FEC56] = {13152, 13320, 12, &ldpc_sf_fec56},
|
{13152, 13320, 12, &ldpc_sf_fec56}, // FEC56
|
||||||
[FEC78] = {},
|
{}, // FEC78
|
||||||
[FEC45] = {12432, 12600, 12, &ldpc_sf_fec45},
|
{12432, 12600, 12, &ldpc_sf_fec45}, // FEC45
|
||||||
[FEC89] = {14232, 14400, 12, &ldpc_sf_fec89},
|
{14232, 14400, 12, &ldpc_sf_fec89}, // FEC89
|
||||||
[FEC910] = {},
|
{}, // FEC910
|
||||||
[FEC14] = {3072, 3240, 12, &ldpc_sf_fec14},
|
{3072, 3240, 12, &ldpc_sf_fec14}, // FEC14
|
||||||
[FEC13] = {5232, 5400, 12, &ldpc_sf_fec13},
|
{5232, 5400, 12, &ldpc_sf_fec13}, // FEC13
|
||||||
[FEC25] = {6312, 6480, 12, &ldpc_sf_fec25},
|
{6312, 6480, 12, &ldpc_sf_fec25}, // FEC25
|
||||||
[FEC35] = {9552, 9720, 12, &ldpc_sf_fec35},
|
{9552, 9720, 12, &ldpc_sf_fec35}, // FEC35
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -291,14 +291,14 @@ struct ldpc_engine
|
|||||||
int n_k = n - k;
|
int n_k = n - k;
|
||||||
|
|
||||||
// Compute the expected check bits (without the final mixing)
|
// Compute the expected check bits (without the final mixing)
|
||||||
SOFTWORD expected[n_k / SWSIZE];
|
SOFTWORD *expected = new SOFTWORD[n_k / SWSIZE]; // Forbidden to statically allocate with non constant size
|
||||||
encode(table, cw, k, n, expected, false);
|
encode(table, cw, k, n, expected, false);
|
||||||
// Reverse the integrator mixing from the received check bits
|
// Reverse the integrator mixing from the received check bits
|
||||||
SOFTWORD received[n_k / SWSIZE];
|
SOFTWORD *received = new SOFTWORD[n_k / SWSIZE]; // Forbidden to statically allocate with non constant size
|
||||||
diff_bits(cw + k / SWSIZE, received, n_k / SWSIZE);
|
diff_bits(cw + k / SWSIZE, received, n_k / SWSIZE);
|
||||||
|
|
||||||
// Compute initial scores
|
// Compute initial scores
|
||||||
score_t score[k];
|
score_t *score = new score_t[k]; // Forbidden to statically allocate with non constant size
|
||||||
score_t tots = compute_scores(cw, expected, received, n_k, score, k);
|
score_t tots = compute_scores(cw, expected, received, n_k, score, k);
|
||||||
lfprintf(stderr, "Initial score %d\n", (int)tots);
|
lfprintf(stderr, "Initial score %d\n", (int)tots);
|
||||||
|
|
||||||
@ -438,6 +438,11 @@ struct ldpc_engine
|
|||||||
if ( tots2 != tots ) fail("bad tots update");
|
if ( tots2 != tots ) fail("bad tots update");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] score;
|
||||||
|
delete[] received;
|
||||||
|
delete[] expected;
|
||||||
|
|
||||||
return nflipped;
|
return nflipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user