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

View File

@@ -17,5 +17,4 @@ Split transmit and mode hang times.
System Fusion System Fusion
------------- -------------
Finish the VW (Voice FR Mode) AMBE FEC.
Finish the callsign extraction from the header and trailer. 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 default: // YSF_DT_VOICE_FR_MODE
if (fn != 0U || ft != 1U) { if (fn != 0U || ft != 1U) {
// The first packet after the header is odd, don't try and regenerate it // The first packet after the header is odd, don't try and regenerate it
// m_errs += m_payload.processVoiceFRModeAudio(data + 2U); m_errs += m_payload.processVoiceFRModeAudio(data + 2U);
// m_bits += 720U; m_bits += 720U;
} }
valid = false; valid = false;
break; break;