14 fOrder(16), fPolynom(0x8005), fCRCXor(0x0000), fRefIn(0), fRefOut(0), fCRCInit_direct(0)
34 ULong64_t hamming_code=0;
36 if(dataword_length > 63)
38 std::cout <<
"Error: maximum length of datastream is 63" << std::endl;
43 for (
int i = 0; pow(2,
i) < dataword_length; ++
i)
46 int stepwidth=2*start;
48 for (
int j = start; j < dataword_length+1; j+=stepwidth)
50 for (
int k = j; k < j+stepwidth/2 && k < dataword_length+1; ++k)
52 parity_bit ^= ((dataword & (shift <<(k-1)))>> (k-1));
55 hamming_code += (parity_bit <<
i);
62 std::vector<char> topix_data;
63 for (
unsigned int i = 1;
i < topixFrame.size() - 1;
i++) {
64 for (
int j = 0; j < 8; j++) {
65 if (j == 0 or j == 1 or j == 2) {
66 topix_data.push_back(0x00);
68 topix_data.push_back((topixFrame[
i] >> (7 - j) * 2 * 4) & 0xff);
82 std::vector<char>::iterator it=p.begin();
93 crc = (crc << 8) ^ fCRCTab[ ((crc >> (
fOrder-8)) & 0xff) ^ (*it & 0xff)];
101 crc = (crc >> 8) ^
fCRCTab[ (crc & 0xff) ^ (*it & 0xff)];
118 for (
int i=0;
i<256;
i++) {
126 for (
int j=0; j<8; j++)
148 ULong64_t
i, j=1, crcout=0;
150 for (i=(ULong64_t)1<<(bitnum-1);
i; i>>=1)
virtual ~PndHammingDecoder()
std::vector< char > ConvertData(std::vector< ULong64_t > topixFrame)
ULong64_t fCRCInit_direct
ULong64_t CalculateCRCTableFast(std::vector< char > p, ULong64_t len)
ULong64_t ReflectBitsStream(ULong64_t crc, int bitnum)
UShort_t CheckHammingCode(ULong64_t dataword, int dataword_length)