From 3fa480b04745d175d102a4897b4897acf0f0f81c Mon Sep 17 00:00:00 2001 From: Mathias Weyland Date: Wed, 20 Apr 2016 13:03:54 +0200 Subject: [PATCH] Adding V/D type 2 VCH reconstruction (currently disabled). I didn't have the chance to test this yet, hence the WRITE_BIT line is commented out still. It's only a matter of getting the inter- leaving right now, though. --- YSFPayload.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/YSFPayload.cpp b/YSFPayload.cpp index aaecdd9..c49a43c 100644 --- a/YSFPayload.cpp +++ b/YSFPayload.cpp @@ -405,6 +405,22 @@ void CYSFPayload::decodeVDMode2(unsigned char fn) errors++; } } + + // Reconstruct only if we have bit errors. Technically we could even + // constrain it individually to the 5 VCH sections. + if(errors) + { + // Scramble + for (unsigned int i = 0U; i < 13U; i++) + vch[i] ^= WHITENING_DATA[i]; + + // Interleave + for(unsigned int i = 0U; i < 104U; i++) { + unsigned int n = INTERLEAVE_TABLE_26_4[i]; + bool s = READ_BIT1(m_data, i); + //WRITE_BIT1(m_data, offset+n, s); + } + } } LogMessage("YSF, V/D Mode 2, Repetition FEC %u/270 (%.1f%%)", errors, float(errors) / 270.0F);