diff --git a/lib/decoder_impl.cc b/lib/decoder_impl.cc index 80a6864..a987dbe 100644 --- a/lib/decoder_impl.cc +++ b/lib/decoder_impl.cc @@ -333,6 +333,8 @@ namespace gr { float instantaneous_freq[d_samples_per_symbol]; float bins[d_number_of_bins]; + samples_to_file("/tmp/data", &samples[0], d_samples_per_symbol, sizeof(gr_complex)); + // Determine instant phase for(unsigned int i = 0; i < d_samples_per_symbol; i++) { instantaneous_phase[i] = arg(samples[i]); @@ -417,7 +419,7 @@ namespace gr { for(unsigned int j = 0; j < bits_per_word; j++) { uint8_t power = pow(2, j); - unsigned int power_check = pow(2, offset_diag); // TODO: Here we are actually reversing endianess. This needs to be fixed in the future by implementing the interleaving similarly to how it is done in the Python based decoder. + unsigned int power_check = pow(2, offset_diag); if((d_words[j] & power_check) > 0) { // Mask triggers d += power; } @@ -433,7 +435,7 @@ namespace gr { } std::reverse(words_deinterleaved.begin(),words_deinterleaved.end()); - //print_vector(words_deinterleaved, "D", sizeof(uint8_t)*8); + print_vector(d_debug, words_deinterleaved, "D", sizeof(uint8_t)*8); // Add to demodulated data for(int i = 0; i < words_deinterleaved.size(); i++) { @@ -451,24 +453,29 @@ namespace gr { if(is_header) { prng = prng_header; } else { - if(d_cr == 4) - prng = prng_payload_cr8; - else if(d_cr == 3) - prng = prng_payload_cr7; - else if(d_cr == 2) - prng = prng_payload_cr6; - else if(d_cr == 1) - prng = prng_payload_cr5; + if(d_sf == 7) + prng = prng_payload_sf7; + else if(d_sf == 8) + prng = prng_payload_sf8; + else if(d_sf == 9) + prng = prng_payload_sf9; + else if(d_sf == 10) + prng = prng_payload_sf10; + else if(d_sf == 11) + prng = prng_payload_sf11; + else if(d_sf == 12) + prng = prng_payload_sf12; else - prng = prng_payload_cr8; + prng = prng_payload_sf7; } - deshuffle(shuffle_pattern); + deshuffle(shuffle_pattern, is_header); dewhiten(prng); hamming_decode(out_data); - // Nibbles are reversed - nibble_reverse(out_data, d_payload_length); + // Nibbles are reversed for uneven spreading factors TODO why is this? + if(d_sf % 2 == 1) + nibble_reverse(out_data, d_payload_length); // Print result std::stringstream result; @@ -484,8 +491,10 @@ namespace gr { return 0; } - void decoder_impl::deshuffle(const uint8_t* shuffle_pattern) { - for(int i = 0; i < d_demodulated.size(); i++) { + void decoder_impl::deshuffle(const uint8_t* shuffle_pattern, bool is_header) { + uint32_t to_decode = d_demodulated.size(); + + for(uint32_t i = 0; i < to_decode; i++) { uint8_t original = d_demodulated[i]; uint8_t result = 0; @@ -499,8 +508,9 @@ namespace gr { d_words_deshuffled.push_back(result); } - //print_vector(d_words_deshuffled, "S", sizeof(uint8_t)*8); - //print_vector_raw(d_words_deshuffled, sizeof(uint8_t)*8); + //print_vector(d_debug, d_words_deshuffled, "S", sizeof(uint8_t)*8); + print_vector_raw(d_debug, d_words_deshuffled, sizeof(uint8_t)*8); + d_debug << std::endl; // We're done with these words d_demodulated.clear(); @@ -509,13 +519,13 @@ namespace gr { void decoder_impl::dewhiten(const uint8_t* prng) { for(int i = 0; i < d_words_deshuffled.size(); i++) { uint8_t xor_b = d_words_deshuffled[i] ^ prng[i]; - xor_b = (xor_b & 0xF0) >> 4 | (xor_b & 0x0F) << 4; // TODO: reverse bit order is performed here, but is probably due to mistake in interleaving + xor_b = (xor_b & 0xF0) >> 4 | (xor_b & 0x0F) << 4; // TODO: reverse bit order is performed here, but is probably due to mistake in whitening or interleaving xor_b = (xor_b & 0xCC) >> 2 | (xor_b & 0x33) << 2; xor_b = (xor_b & 0xAA) >> 1 | (xor_b & 0x55) << 1; d_words_dewhitened.push_back(xor_b); } - //print_vector(d_words_dewhitened, "W", sizeof(uint8_t)*8); + print_vector(d_debug, d_words_dewhitened, "W", sizeof(uint8_t)*8); d_words_deshuffled.clear(); } @@ -526,9 +536,13 @@ namespace gr { fec_scheme fs = LIQUID_FEC_HAMMING84; if(d_cr == 4) { - fs = LIQUID_FEC_HAMMING84; + hamming_decode_soft(&d_words_dewhitened[0], d_words_dewhitened.size(), out_data); + d_words_dewhitened.clear(); + return; } else if(d_cr == 3) { - fs = LIQUID_FEC_HAMMING84; + hamming_decode_soft(&d_words_dewhitened[0], d_words_dewhitened.size(), out_data); + d_words_dewhitened.clear(); + return; } else if(d_cr == 2) { fec_extract_data_only(&d_words_dewhitened[0], d_words_dewhitened.size(), data_indices, 4, out_data); d_words_dewhitened.clear(); @@ -539,13 +553,15 @@ namespace gr { return; } + /*fs = LIQUID_FEC_HAMMING84; + unsigned int k = fec_get_enc_msg_length(fs, n); fec hamming = fec_create(fs, NULL); fec_decode(hamming, n, &d_words_dewhitened[0], out_data); d_words_dewhitened.clear(); - fec_destroy(hamming); + fec_destroy(hamming);*/ } void decoder_impl::nibble_reverse(uint8_t* out_data, int len) { @@ -685,7 +701,7 @@ namespace gr { double c = detect_downchirp(&input[0], d_samples_per_symbol); d_debug << "Cd: " << c << std::endl; - if(c > 0.96f) { + if(c > 0.98f) { d_debug << "SYNC: " << c << std::endl; // Debug stuff samples_to_file("/tmp/sync", &input[0], d_samples_per_symbol, sizeof(gr_complex)); @@ -716,7 +732,8 @@ namespace gr { d_payload_length = 3; // TODO: A bit messy. I think it's better to make an internal decoded std::vector decode(decoded, true); - nibble_reverse(decoded, 1); // TODO: Why? Is the radio chip CPU 16-bit? + if(d_sf % 2 == 1) // TODO: Why? + nibble_reverse(decoded, 1); d_payload_length = decoded[0]; d_cr = lookup_cr(decoded[1]); diff --git a/lib/decoder_impl.h b/lib/decoder_impl.h index 27330ed..01719bc 100644 --- a/lib/decoder_impl.h +++ b/lib/decoder_impl.h @@ -100,7 +100,7 @@ namespace gr { bool demodulate(gr_complex* samples, bool is_header); void deinterleave(int ppm); int decode(uint8_t* out_data, bool is_header); - void deshuffle(const uint8_t* shuffle_pattern); + void deshuffle(const uint8_t* shuffle_pattern, bool is_header); void dewhiten(const uint8_t* prng); void hamming_decode(uint8_t* out_data); void nibble_reverse(uint8_t* out_data, int len); diff --git a/lib/tables.h b/lib/tables.h index 21a297e..cafb37a 100644 --- a/lib/tables.h +++ b/lib/tables.h @@ -7,20 +7,28 @@ namespace gr { 0x22, 0x11, 0x01, 0x00, 0x00 }; - const uint8_t prng_payload_cr8[] = { - 0xdf, 0xef, 0xb0, 0xf7, 0x9e, 0xfd, 0xc6, 0xdf, 0x10, 0xfb, 0x43, 0x34, 0xa8, 0x5f, 0xf2, 0x97, 0x62, 0x8, 0xf8, 0x49, 0xbe, 0x8a, 0xa4, 0xd6, 0x16, 0xe6, 0x85, 0x39, 0x6b, 0xef, 0xe5, 0xbc, 0xb3, 0x1c, 0x14, 0xa7, 0x3d, 0x4f, 0x91, 0x61, 0x85, 0x72, 0x20, 0x45, 0x4, 0x25, 0x80, 0x1b, 0x41, 0xa7, 0x5b, 0x4, 0xa2, 0x80, 0x9b, 0x41, 0xa7, 0x10, 0x4f, 0x43, 0x61, 0xa8, 0x39, 0xb9, 0xa4, 0x83, 0x16, 0xcb, 0x85, 0xa0, 0x6b, 0x68, 0xae, 0xbc, 0x19, 0x1c, 0x8d, 0xa7, 0xba, 0x4f, 0xda, 0x2a, 0x64, 0xd8, 0x58, 0xdc, 0xb0, 0xa2, 0x9e, 0xd0, 0xc6, 0x46, 0x10, 0x7c, 0x8, 0x34, 0x2, 0x5f, 0x6b, 0x97, 0xe5, 0x8, 0xb3, 0x2, 0x5f, 0x20, 0xdc, 0x4f, 0xa2, 0x61, 0x9b, 0x72, 0xec, 0xe, 0xae, 0xc4, 0x19, 0xa8, 0x8d, 0xb9, 0xf1, 0xc8, 0x3b, 0x2a, 0x57, 0xd8, 0x46, 0xdc, 0x7c, 0xe9, 0x34, 0x31, 0x5f, 0x75, 0xdc, 0x62, 0xa2, 0xf8, 0x9b, 0xf5, 0xa7, 0xe, 0x4, 0xc0, 0x80, 0xa8, 0xa, 0xb9, 0xba, 0xa3, 0xda, 0x80, 0x2f, 0x43, 0xf2, 0x79, 0x62, 0xa2, 0xb3, 0xd0, 0x14, 0xd, 0x76, 0x96, 0x2b, 0xee, 0xd7, 0x72, 0xd, 0x44,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 0xbe, 0x6a, 0xa4, 0xe4, 0x5c, 0xf8, 0x64, 0xbe, 0x12, 0xee, 0x50, 0xbc, 0xe6, 0x56, 0x38, 0x46, 0xee, 0x36, 0xbc, 0xd4, 0x56, 0x26, 0xc, 0x68, 0xd6, 0xf6, 0xe6, 0xb6, 0x38, 0x74, 0xa4, 0x28, 0x5c, 0x52, 0x2e, 0x26, 0xb8, 0x68, 0x82, 0xbc, 0xca, 0x56, 0xea, 0x4c, 0x88, 0x9c, 0x8e, 0x6, 0x2, 0xa, 0x6a, 0xba, 0xe4, 0x90, 0xb2, 0x84, 0x14, 0x20, 0x76, 0x4e, 0x3a, 0x60, 0x9c, 0x72, 0xa6, 0x44, 0x4e, 0x6e, 0x60, 0x30, 0x38, 0xbe, 0xee, 0x82, 0xb8, 0xca, 0x1c, 0xa2, 0xec, 0x68, 0xd4, 0xf6, 0xfc, 0x3e, 0xf6, 0x7e, 0x2c, 0xd8, 0xc4, 0x6c, 0xe2, 0xb8 - }; - - const uint8_t prng_payload_cr6[] = { + const uint8_t prng_payload_sf7[] = { 0xdc, 0xec, 0xb0, 0xf4, 0x9c, 0xfc, 0xc4, 0xdc, 0x10, 0xf8, 0x40, 0x34, 0xa8, 0x5c, 0xf0, 0x94, 0x60, 0x8, 0xf8, 0x48, 0xbc, 0x88, 0xa4, 0xd4, 0x14, 0xe4, 0x84, 0x38, 0x68, 0xec, 0xe4, 0xbc, 0xb0, 0x1c, 0x14, 0xa4, 0x3c, 0x4c, 0x90, 0x60, 0x84, 0x70, 0x20, 0x44, 0x4, 0x24, 0x80, 0x98, 0x40, 0xa4, 0x58, 0x4, 0xa0, 0x80, 0x98, 0x40, 0xa4, 0x10, 0x4c, 0x40, 0x60, 0xa8, 0x38, 0xb8, 0xa4, 0x80, 0x14, 0xc8, 0x84, 0xa0, 0x68, 0x68, 0xac, 0xbc, 0x18, 0x1c, 0x8c, 0xa4, 0xb8, 0x4c, 0xd8, 0x28, 0x64, 0xd8, 0x58, 0xdc, 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0x3c, 0xec, 0x80, 0xbc, 0xc8, 0x1c, 0xa0, 0xec, 0x68, 0xe4, 0xf4, 0xf8, 0xb4, 0xf4, 0x3c, 0xc, 0xc8, 0xc4, 0x60, 0xe0, 0x38, 0x10, 0xa4, 0x18, 0x14, 0x4, 0xcc, 0x8, 0xc0, 0xb8, 0x34, 0xd8, 0x9c, 0x64, 0xc4, 0x10, 0x58, 0x50, 0xa0, 0xac, 0xd0, 0xd8, 0x44, 0xdc, 0x34, 0xa0, 0xd4, 0x98, 0x6c, 0xa4, 0x88, 0x4c, 0xc4, 0x28, 0xa8, 0x90, 0xb8, 0x3c, 0x80, 0x90, 0xc8, 0xcc, 0xe8, 0x88, 0xc0, 0xd4, 0x24, 0xac, 0x98, 0x90 }; - const uint8_t prng_payload_cr5[] = { - 0x54, 0x64, 0x38, 0x7c, 0x14, 0x74, 0x4c, 0x54, 0x10, 0x70, 0x40, 0x3c, 0x28, 0x54, 0x70, 0x1c, 0x68, 0x8, 0x78, 0x48, 0x34, 0x8, 0x2c, 0x54, 0x1c, 0x6c, 0xc, 0x38, 0x68, 0x64, 0x64, 0x34, 0x30, 0x14, 0x1c, 0x2c, 0x34, 0x4c, 0x10, 0x60, 0xc, 0x70, 0x20, 0x4c, 0x4, 0x2c, 0x0, 0x18, 0x40, 0x2c, 0x58, 0x4, 0x20, 0x0, 0x18, 0x40, 0x2c, 0x10, 0x4c, 0x40, 0x60, 0x28, 0x38, 0x38, 0x2c, 0x8, 0x1c, 0x48, 0xc, 0x20, 0x68, 0x68, 0x2c, 0x34, 0x18, 0x14, 0x4, 0x2c, 0x38, 0x4c, 0x58, 0x28, 0x6c, 0x58, 0x58, 0x54, 0x38, 0x20, 0x14, 0x50, 0x4c, 0x4c, 0x10, 0x7c, 0x8, 0x3c, 0x0, 0x54, 0x68, 0x1c, 0x64, 0x8, 0x30, 0x0, 0x54, 0x20, 0x54, 0x4c, 0x20, 0x60, 0x18, 0x70, 0x64, 0x4, 0x2c, 0x4c, 0x18, 0x28, 0x4, 0x38, 0x70, 0x40, 0x38, 0x28, 0x5c, 0x58, 0x4c, 0x54, 0x7c, 0x68, 0x3c, 0x30, 0x54, 0x7c, 0x54, 0x68, 0x20, 0x78, 0x18, 0x7c, 0x2c, 0x14, 0x4, 0x4c, 0x0, 0x28, 0x8, 0x38, 0x38, 0x8, 0x58, 0x0, 0x24, 0x40, 0x70, 0x58, 0x68, 0x20, 0x30, 0x50, 0x1c, 0x4, 0x7c, 0x54, 0x38, 0x6c, 0x5c, 0x70, 0x4, 0x4c, 0x54, 0x64, 0x6c, 0x30, 0x70, 0x7c, 0x4, 0x20, 0x4c, 0x50, 0x28, 0x2c, 0x70, 0x20, 0x68, 0x1c, 0x30, 0x44, 0x54, 0x8, 0x1c, 0x54, 0x8, 0x6c, 0x48, 0x70, 0x40, 0x4, 0x7c, 0x4, 0x74, 0x0, 0x34, 0x68, 0x2c, 0x64, 0x54, 0x78, 0x6c, 0x34, 0x10, 0x64, 0x58, 0x34, 0x6c, 0x5c, 0x38, 0x4c, 0x64, 0x34, 0x34, 0x5c, 0x5c, 0x2c, 0x4, 0x68, 0x54, 0x7c, 0x6c, 0x3c, 0x38, 0x7c, 0x2c, 0x20, 0x54, 0x50, 0x24, 0x2c, 0x38, 0x68, 0x8, 0x34, 0x48, 0x5c, 0x68, 0x4, 0x8, 0x1c, 0x4, 0xc, 0x0, 0x8, 0x68, 0x38, 0x64, 0x10, 0x30, 0xc, 0x1c, 0x20, 0x7c, 0x4c, 0x38, 0x60, 0x14, 0x70, 0x2c, 0x4c, 0x4c, 0x64, 0x60, 0x30, 0x38, 0x34, 0x64, 0x8, 0x34, 0x48, 0x14, 0x20, 0x64, 0x68, 0x64, 0x7c, 0x78, 0x3c, 0x7c, 0x34, 0x4, 0x40, 0x4c, 0x60, 0x60, 0x38, 0x10, 0x2c, 0x10, 0x1c, 0xc, 0x44, 0x8, 0x40, 0x38, 0x34, 0x58, 0x14, 0x6c, 0x4c, 0x10, 0x58, 0x58, 0x20, 0x24, 0x50, 0x58, 0x4c, 0x54, 0x34, 0x20, 0x5c, 0x18, 0x64, 0x2c, 0x8, 0x4c, 0x4c, 0x28, 0x28, 0x10, 0x38, 0x34, 0x8, 0x10, 0x48, 0x44, 0x68, 0x8, 0x40, 0x54, 0x2c, 0x24, 0x18, 0x10, 0x64, 0x34, 0x2c, 0x10, 0x50, 0x44, 0x64, 0x40, 0x40, 0x7c, 0x2c, 0x3c, 0x18, 0x1c, 0x64, 0x7c, 0x64, 0x70, 0x78, 0x3c, 0x7c, 0x3c, 0x4c, 0x68, 0x44, 0x38, 0x78, 0x54, 0x5c, 0x74, 0x58, 0x78, 0x6c, 0x74, 0x70, 0x14, 0x4, 0x38, 0x7c, 0x50, 0x60, 0x2c, 0x58, 0x28, 0x40, 0x78, 0x3c, 0x7c, 0x1c, 0x14, 0x7c, 0x8, 0x70, 0x5c, 0x78, 0x64, 0x14, 0x8, 0x60, 0x68, 0x34, 0x60, 0x1c, 0x50, 0x14, 0x0, 0x10, 0x4c, 0x40, 0x20 + const uint8_t prng_payload_sf8[] = { + 0xdf, 0xa4, 0xfb, 0x16, 0x7f, 0x85, 0xfe, 0x40, 0xdf, 0x5b, 0xb0, 0xa2, 0x9e, 0xd0, 0x86, 0x26, 0x20, 0x68, 0x4f, 0xf7, 0x2a, 0xb6, 0xd3, 0x5e, 0x46, 0x97, 0x7c, 0x43, 0x7f, 0xe3, 0xb5, 0x73, 0x3e, 0x45, 0x83, 0x25, 0xcb, 0x9b, 0xe0, 0xc7, 0x13, 0x10, 0x51, 0x8, 0xad, 0x2, 0x98, 0x40, 0xa7, 0x5b, 0x4, 0xa2, 0x80, 0x9b, 0x1, 0xc7, 0x20, 0x5b, 0x4f, 0xe9, 0x2a, 0x7a, 0x98, 0xf4, 0xa7, 0xe, 0x4f, 0x8f, 0x61, 0x49, 0x79, 0xea, 0x94, 0x89, 0x1a, 0xc4, 0x7, 0xa8, 0x4a, 0x92, 0x8a, 0x76, 0x9d, 0x70, 0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 0x26, 0x64, 0x85, 0x16 + }; + + const uint8_t prng_payload_sf11[] = { + 0x3e, 0x8f, 0xa3, 0xd3, 0x90, 0x75, 0x4, 0xfe, 0xc1, 0xb5, 0xea, 0x3e, 0xc2, 0xc3, 0x4a, 0x80, 0x6e, 0x2c, 0x7a, 0x59, 0xfe, 0x6a, 0x94, 0x82, 0x2a, 0x7a, 0x47, 0x62, 0x84, 0xf8, 0x42, 0xfd, 0xa0, 0x94, 0x43, 0x4a, 0x39, 0x27, 0x53, 0x4, 0x2c, 0x43, 0x9a, 0x21, 0xe7, 0x61, 0x54, 0x3d, 0xbc, 0xd3, 0x3, 0x2d, 0x9, 0x98, 0xc0, 0xe7, 0x7b, 0x74, 0xf6, 0x98, 0xab, 0xb, 0x99, 0x80, 0x87, 0x47, 0x6b, 0x3b, 0xd5, 0x86, 0xec, 0x87, 0xfb, 0x3, 0xb7, 0x86, 0x5e, 0x6b, 0xb7, 0xd5, 0x47, 0xec, 0xe4, 0xfb, 0x33, 0xb7, 0x98, 0x5e, 0xec, 0xb7, 0xbe, 0x7, 0x3a, 0xec, 0xd3, 0xab, 0xee, 0x9a, 0x38, 0xe4, 0xe4, 0xfe, 0x76, 0xa, 0x99, 0x43, 0x5, 0x64, 0x1, 0x38, 0x63, 0xe4, 0x14, 0x6, 0x9b, 0x99, 0x4a, 0x4f, 0xe1, 0x0, 0x73, 0x62, 0x2e, 0x54, 0xa4, 0x9f, 0xc4, 0xc6, 0xaa, 0x61, 0x99, 0x72, 0xac, 0x4e, 0xce, 0xe0, 0x35, 0x4c, 0x9d, 0xa0, 0x4e, 0x98, 0xa1, 0xad, 0x43, 0xce, 0x59, 0x25, 0x54, 0x5, 0xe4, 0xcf, 0x78, 0xa1, 0x94, 0x43, 0xa, 0x19, 0x10, 0x40, 0x85, 0x66, 0xaa, 0xfb, 0xd9, 0x95, 0xd7, 0x2a, 0x8, 0x4, 0x2, 0x45, 0xc6, 0xa8, 0x68, 0xd9, 0x8a, 0xd7, 0xc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8, 0xb6, 0xce, 0xb9, 0x93, 0x22, 0x81, 0x13, 0xc0, 0x4d, 0x68, 0xcb, 0xab, 0xf6, 0xc4, 0xad, 0xff, 0x2f, 0x41, 0x59, 0xea, 0x2c, 0xf1, 0xf8, 0x2d, 0xf8, 0xe, 0x75, 0x1e, 0x51, 0xf4, 0xf3, 0x36, 0xb7, 0x14, 0x35, 0x17, 0x20, 0x3b, 0xa0, 0x24, 0x45, 0x92, 0x2d, 0xce, 0xd6, 0xa0, 0x6, 0x8, 0x7, 0x92, 0xd2, 0x5a, 0x91, 0x20, 0xc7, 0x50, 0xe3, 0xa6, 0x18, 0x48, 0x8b, 0xc2, 0x44, 0x9, 0xac, 0x54, 0x4a, 0x76, 0x67, 0xf7, 0x18, 0x5, 0x8b, 0x27, 0x2b, 0xb3, 0x42, 0x45, 0x70, 0x4f, 0xbe, 0x20, 0x75, 0x22, 0x19, 0x4e, 0x59, 0xb2, 0x37, 0x51, 0x2, 0x60, 0xe2, 0xf2, 0xd3, 0x64, 0x5a, 0x25, 0x4c, 0xc8, 0x52, 0x5d, 0xef, 0x2e, 0x38, 0xda, 0x77, 0xb6, 0x19, 0x37, 0x5e, 0xef, 0x6a, 0x67, 0x26, 0xb2, 0x99, 0x5e }; } } diff --git a/lib/utilities.h b/lib/utilities.h index 9972c1d..7aad72d 100644 --- a/lib/utilities.h +++ b/lib/utilities.h @@ -25,20 +25,20 @@ namespace gr { } template - inline void print_vector(std::vector& v, std::string prefix, int element_len_bits) { - std::cout << prefix << ": "; + inline void print_vector(std::ostream& out, std::vector& v, std::string prefix, int element_len_bits) { + out << prefix << ": "; for(int i = 0; i < v.size(); i++) { - std::cout << to_bin(v[i], element_len_bits) << ", "; + out << to_bin(v[i], element_len_bits) << ", "; } - std::cout << std::endl << std::flush; + out << std::endl << std::flush; } template - inline void print_vector_raw(std::vector& v, int element_len_bits) { + inline void print_vector_raw(std::ostream& out, std::vector& v, int element_len_bits) { for(int i = 0; i < v.size(); i++) { - std::cout << to_bin(v[i], element_len_bits); + out << to_bin(v[i], element_len_bits); } - std::cout << std::flush; + out << std::flush; } bool check_parity(std::string word, bool even) { @@ -118,7 +118,7 @@ namespace gr { return pack_byte(p1, bit(v, 0), bit(v, 1), bit(v, 2), p2, bit(v, 3), p3, p4); } - uint8_t hamming_decode_soft(uint8_t v) { + uint8_t hamming_decode_soft_byte(uint8_t v) { // Precalculation // Which bits are covered (including self)? // p1 10110100 @@ -177,6 +177,22 @@ namespace gr { return pack_nibble(d1, d2, d3, d4); } + // Manual Hamming + void hamming_decode_soft(uint8_t* words, uint32_t len, uint8_t* out_data) { + uint32_t out_index = 0; + for(int i = 0; i < len; i+=2) { + uint8_t d1 = 0; + d1 = hamming_decode_soft_byte(words[i]); + + uint8_t d2 = 0; + if(i+1 < len) + d2 = hamming_decode_soft_byte(words[i+1]); + + out_data[out_index] = (d1 << 4) | d2; + out_index++; + } + } + } }