Revert "Rework YSF AMBE repetition FEC."
This reverts commit 17b9e7e287
.
This commit is contained in:
parent
f364eda0a4
commit
fee3cf561c
|
@ -393,31 +393,16 @@ unsigned int CYSFPayload::processVDMode2Audio(unsigned char* data)
|
||||||
data += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES;
|
data += YSF_SYNC_LENGTH_BYTES + YSF_FICH_LENGTH_BYTES;
|
||||||
|
|
||||||
unsigned int errors = 0U;
|
unsigned int errors = 0U;
|
||||||
errors += processVDMode2AudioBlock(data + 5U);
|
unsigned int offset = 40U; // DCH(0)
|
||||||
errors += processVDMode2AudioBlock(data + 23U);
|
|
||||||
errors += processVDMode2AudioBlock(data + 41U);
|
|
||||||
errors += processVDMode2AudioBlock(data + 59U);
|
|
||||||
errors += processVDMode2AudioBlock(data + 77U);
|
|
||||||
|
|
||||||
// "errors" is the number of triplets that were recognized to be corrupted
|
// We have a total of 5 VCH sections, iterate through each
|
||||||
// and that were corrected. There are 27 of those per VCH and 5 VCH per CC,
|
for (unsigned int j = 0U; j < 5U; j++, offset += 144U) {
|
||||||
// yielding a total of 27*5 = 135. I believe the expected value of this
|
|
||||||
// error distribution to be Bin(1;3,BER)+Bin(2;3,BER) which entails 75% for
|
|
||||||
// BER = 0.5.
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int CYSFPayload::processVDMode2AudioBlock(unsigned char* data)
|
|
||||||
{
|
|
||||||
assert(data != NULL);
|
|
||||||
|
|
||||||
unsigned int errors = 0U;
|
|
||||||
unsigned char vch[13U];
|
unsigned char vch[13U];
|
||||||
|
|
||||||
// Deinterleave
|
// Deinterleave
|
||||||
for (unsigned int i = 0U; i < 104U; i++) {
|
for (unsigned int i = 0U; i < 104U; i++) {
|
||||||
unsigned int n = INTERLEAVE_TABLE_26_4[i];
|
unsigned int n = INTERLEAVE_TABLE_26_4[i];
|
||||||
bool s = READ_BIT1(data, n);
|
bool s = READ_BIT1(data, offset + n) != 0x00U;
|
||||||
WRITE_BIT1(vch, i, s);
|
WRITE_BIT1(vch, i, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,33 +410,22 @@ unsigned int CYSFPayload::processVDMode2AudioBlock(unsigned char* data)
|
||||||
for (unsigned int i = 0U; i < 13U; i++)
|
for (unsigned int i = 0U; i < 13U; i++)
|
||||||
vch[i] ^= WHITENING_DATA[i];
|
vch[i] ^= WHITENING_DATA[i];
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < 81U; i += 3U) {
|
// errors += READ_BIT1(vch, 103); // Padding bit must be zero but apparently it is not...
|
||||||
unsigned int n = i;
|
|
||||||
bool bit1 = READ_BIT1(vch, n);
|
|
||||||
n++;
|
|
||||||
bool bit2 = READ_BIT1(vch, n);
|
|
||||||
n++;
|
|
||||||
bool bit3 = READ_BIT1(vch, n);
|
|
||||||
|
|
||||||
if ((bit1 && bit2 && !bit3) || (bit1 && !bit2 && bit3) || (!bit1 && bit2 && bit3)) {
|
for (unsigned int i = 0U; i < 81U; i += 3) {
|
||||||
unsigned int n = i;
|
uint8_t vote = bool(READ_BIT1(vch, i)) + bool(READ_BIT1(vch, i + 1)) + bool(READ_BIT1(vch, i + 2));
|
||||||
WRITE_BIT1(vch, n, true);
|
if (vote == 1 || vote == 2) {
|
||||||
n++;
|
bool decision = vote / 2; // exploit integer division: 1/2 == 0, 2/2 == 1.
|
||||||
WRITE_BIT1(vch, n, true);
|
WRITE_BIT1(vch, i, decision);
|
||||||
n++;
|
WRITE_BIT1(vch, i + 1, decision);
|
||||||
WRITE_BIT1(vch, n, true);
|
WRITE_BIT1(vch, i + 2, decision);
|
||||||
errors++;
|
|
||||||
} else if ((!bit1 && !bit2 && bit3) || (!bit1 && bit2 && !bit3) || (bit1 && !bit2 && !bit3)) {
|
|
||||||
unsigned int n = i;
|
|
||||||
WRITE_BIT1(vch, n, false);
|
|
||||||
n++;
|
|
||||||
WRITE_BIT1(vch, n, false);
|
|
||||||
n++;
|
|
||||||
WRITE_BIT1(vch, n, false);
|
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reconstruct only if we have bit errors. Technically we could even
|
||||||
|
// constrain it individually to the 5 VCH sections.
|
||||||
|
if (errors > 0U) {
|
||||||
// Scramble
|
// Scramble
|
||||||
for (unsigned int i = 0U; i < 13U; i++)
|
for (unsigned int i = 0U; i < 13U; i++)
|
||||||
vch[i] ^= WHITENING_DATA[i];
|
vch[i] ^= WHITENING_DATA[i];
|
||||||
|
@ -460,9 +434,16 @@ unsigned int CYSFPayload::processVDMode2AudioBlock(unsigned char* data)
|
||||||
for (unsigned int i = 0U; i < 104U; i++) {
|
for (unsigned int i = 0U; i < 104U; i++) {
|
||||||
unsigned int n = INTERLEAVE_TABLE_26_4[i];
|
unsigned int n = INTERLEAVE_TABLE_26_4[i];
|
||||||
bool s = READ_BIT1(vch, i);
|
bool s = READ_BIT1(vch, i);
|
||||||
WRITE_BIT1(data, n, s);
|
WRITE_BIT1(data, offset + n, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "errors" is the number of triplets that were recognized to be corrupted
|
||||||
|
// and that were corrected. There are 27 of those per VCH and 5 VCH per CC,
|
||||||
|
// yielding a total of 27*5 = 135. I believe the expected value of this
|
||||||
|
// error distribution to be Bin(1;3,BER)+Bin(2;3,BER) which entails 75% for
|
||||||
|
// BER = 0.5.
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ private:
|
||||||
unsigned char* m_source;
|
unsigned char* m_source;
|
||||||
unsigned char* m_dest;
|
unsigned char* m_dest;
|
||||||
CAMBEFEC m_fec;
|
CAMBEFEC m_fec;
|
||||||
|
|
||||||
unsigned int processVDMode2AudioBlock(unsigned char* data);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue