Finish the System Fusion AMBE regeneration.

This commit is contained in:
Jonathan Naylor
2016-04-28 18:01:02 +01:00
parent d517a1de0d
commit a41cd74c94
3 changed files with 15 additions and 19 deletions

View File

@@ -651,16 +651,19 @@ unsigned int CAMBEFEC::regenerateYSF3(unsigned char* bytes) const
}
bit += 23U;
// De-whiten some bits
unsigned int prn = 0x00U;
for (unsigned int i = 0U; i < 12U; i++)
prn = (prn << 1) | (temp[i] ? 0x01U : 0x00U);
prn <<= 4;
for (unsigned int i = 23U; i < 137U; i++) {
prn = ((173U * prn) + 13849U) & 0xFFFFU;
temp[i] ^= (prn & 0x80U) == 0x80U;
bool prn[114U];
// Create the whitening vector and save it for future use
unsigned int p = 16U * c0data;
for (unsigned int i = 0U; i < 114U; i++) {
p = (173U * p + 13849U) % 65536U;
prn[i] = p >= 32768U;
}
// De-whiten some bits
for (unsigned int i = 0U; i < 114U; i++)
temp[i + 23U] ^= prn[i];
// c1
g1 = 0U;
for (unsigned int i = 0U; i < 23U; i++)
@@ -709,14 +712,8 @@ unsigned int CAMBEFEC::regenerateYSF3(unsigned char* bytes) const
CHamming::decode15113_1(bit);
// Whiten some bits
prn = 0x00U;
for (unsigned int i = 0U; i < 12U; i++)
prn = (prn << 1) | (temp[i] ? 0x01U : 0x00U);
prn <<= 4;
for (unsigned int i = 23U; i < 137U; i++) {
prn = ((173U * prn) + 13849U) & 0xFFFFU;
temp[i] ^= (prn & 0x80U) == 0x80U;
}
for (unsigned int i = 0U; i < 114U; i++)
temp[i + 23U] ^= prn[i];
unsigned int errors = 0U;
for (unsigned int i = 0U; i < 144U; i++) {

View File

@@ -17,5 +17,4 @@ Split transmit and mode hang times.
System Fusion
-------------
Finish the VW (Voice FR Mode) AMBE FEC.
Finish the callsign extraction from the header and trailer.

View File

@@ -245,8 +245,8 @@ bool CYSFControl::writeModem(unsigned char *data)
default: // YSF_DT_VOICE_FR_MODE
if (fn != 0U || ft != 1U) {
// The first packet after the header is odd, don't try and regenerate it
// m_errs += m_payload.processVoiceFRModeAudio(data + 2U);
// m_bits += 720U;
m_errs += m_payload.processVoiceFRModeAudio(data + 2U);
m_bits += 720U;
}
valid = false;
break;