From 06ccaf603225b04c9bb76631a633b3c0ef4f1319 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 7 Mar 2018 20:14:07 +0000 Subject: [PATCH] Re-add the audio blanking for too corrupt audio in DMR, NXDN and YSFDN modes. --- AMBEFEC.cpp | 16 +++++++++++----- AMBEFEC.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/AMBEFEC.cpp b/AMBEFEC.cpp index 0ca60ad59..864c35d65 100644 --- a/AMBEFEC.cpp +++ b/AMBEFEC.cpp @@ -527,9 +527,9 @@ unsigned int CAMBEFEC::regenerateDMR(unsigned char* bytes) const c3 |= MASK; } - unsigned int errors = regenerateDMR(a1, b1); - errors += regenerateDMR(a2, b2); - errors += regenerateDMR(a3, b3); + unsigned int errors = regenerateDMR(a1, b1, c1); + errors += regenerateDMR(a2, b2, c2); + errors += regenerateDMR(a3, b3, c3); MASK = 0x800000U; for (unsigned int i = 0U; i < 24U; i++, MASK >>= 1) { @@ -633,7 +633,7 @@ unsigned int CAMBEFEC::regenerateYSFDN(unsigned char* bytes) const c |= MASK; } - unsigned int errors = regenerateDMR(a, b); + unsigned int errors = regenerateDMR(a, b, c); MASK = 0x800000U; for (unsigned int i = 0U; i < 24U; i++, MASK >>= 1) { @@ -827,7 +827,7 @@ unsigned int CAMBEFEC::regenerateDStar(unsigned int& a, unsigned int& b) const return errsA + errsB; } -unsigned int CAMBEFEC::regenerateDMR(unsigned int& a, unsigned int& b) const +unsigned int CAMBEFEC::regenerateDMR(unsigned int& a, unsigned int& b, unsigned int& c) const { unsigned int orig_a = a; unsigned int orig_b = b; @@ -861,5 +861,11 @@ unsigned int CAMBEFEC::regenerateDMR(unsigned int& a, unsigned int& b) const errsB++; } + if (errsA >= 4U || ((errsA + errsB) >= 6U && errsA >= 2U)) { + a = 0xF00292U; + b = 0x0E0B20U; + c = 0x000000U; + } + return errsA + errsB; } diff --git a/AMBEFEC.h b/AMBEFEC.h index 615ae26c2..7e242d4de 100644 --- a/AMBEFEC.h +++ b/AMBEFEC.h @@ -34,7 +34,7 @@ class CAMBEFEC { private: unsigned int regenerateDStar(unsigned int& a, unsigned int& b) const; - unsigned int regenerateDMR(unsigned int& a, unsigned int& b) const; + unsigned int regenerateDMR(unsigned int& a, unsigned int& b,unsigned int& c) const; }; #endif