Commit 47436139 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Convolution code test: support printing generators as binary.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent b8e582a4
......@@ -208,3 +208,22 @@ conv_decode_hard (ConvBlockType block_type, const vector<int>& coded_bits)
return conv_decode_soft (block_type, soft_bits);
}
void
conv_print_table (ConvBlockType block_type)
{
vector<int> bits (100);
bits[0] = 1;
vector<int> out_bits = conv_encode (block_type, bits);
auto generators = get_block_type_generators (block_type);
unsigned int rate = generators.size();
for (unsigned int r = 0; r < rate; r++)
{
for (unsigned int i = 0; i < order; i++)
printf ("%s%d", i == 0 ? "" : " ", out_bits[i * rate + r]);
printf ("\n");
}
}
......@@ -11,4 +11,6 @@ std::vector<int> conv_encode (ConvBlockType block_type, const std::vector<int>&
std::vector<int> conv_decode_hard (ConvBlockType block_type, const std::vector<int>& coded_bits);
std::vector<int> conv_decode_soft (ConvBlockType block_type, const std::vector<float>& coded_bits, float *error_out = nullptr);
void conv_print_table (ConvBlockType block_type);
#endif /* AUDIOWMARK_CONV_CODE_HH */
......@@ -202,4 +202,6 @@ main (int argc, char **argv)
}
printf ("%.1f ms/block\n", (gettime() - start_t) / runs * 1000.0);
}
if (argc == 3 && string (argv[2]) == "table")
conv_print_table (block_type);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment