Skip to content

Commit

Permalink
Minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Apr 19, 2016
1 parent 38dc134 commit 929877f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions AMBEFEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "Hamming.h"
#include "AMBEFEC.h"

#include "Log.h"

#include <cstdio>
#include <cassert>

Expand Down Expand Up @@ -630,14 +632,14 @@ unsigned int CAMBEFEC::regenerateYSF3(unsigned char* bytes) const
//
// 7 voice bits 137

// De-Whiten some bits
// De-whiten some bits
unsigned int prn = 0x00U;
for (int i = 0U; i < 12U; i++)
prn = (prn << 1) | (temp[i] & 1);
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 = (unsigned short)((173 * prn) + 13849);
temp[i] ^= (prn >> 15) & 1;
prn = (unsigned short)((173U * prn) + 13849U);
temp[i] ^= (prn & 0x80U) == 0x80U;
}

// Check/Fix FEC
Expand Down Expand Up @@ -705,11 +707,11 @@ unsigned int CAMBEFEC::regenerateYSF3(unsigned char* bytes) const
// Whiten some bits
prn = 0x00U;
for (unsigned int i = 0U; i < 12U; i++)
prn = (prn << 1) | (temp[i] & 1);
prn = (prn << 1) | (temp[i] ? 0x01U : 0x00U);
prn <<= 4;
for (unsigned int i = 23U; i < 137U; i++) {
prn = (unsigned short)((173 * prn) + 13849);
temp[i] ^= (prn >> 15) & 1;
prn = (unsigned short)((173U * prn) + 13849U);
temp[i] ^= (prn & 0x80U) == 0x80U;
}

// Interleave
Expand Down

0 comments on commit 929877f

Please sign in to comment.