Skip to content

Commit

Permalink
Re-add the audio blanking for too corrupt audio in DMR, NXDN and YSFDN
Browse files Browse the repository at this point in the history
modes.
  • Loading branch information
g4klx committed Mar 7, 2018
1 parent 25bd10f commit 06ccaf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions AMBEFEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion AMBEFEC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 06ccaf6

Please sign in to comment.