diff options
author | Keith Packard <keithp@keithp.com> | 2012-07-10 15:13:55 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-10 15:13:55 -0700 |
commit | b89d37d357273b97050c00d7fe12022e32799fa8 (patch) | |
tree | 3e84fa88d41cae57123337b004a2eb388618873f | |
parent | 6694cedd560a7ea9520ef11472c2770b489187c0 (diff) |
altos: add some (unused) test code for different soft-decision sizes
This lets us experiment with hard-decision and other possible
soft_decision bit depths.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/test/ao_fec_test.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ao_fec_test.c b/src/test/ao_fec_test.c index b94b16dc..216a4b79 100644 --- a/src/test/ao_fec_test.c +++ b/src/test/ao_fec_test.c @@ -100,6 +100,7 @@ ao_fuzz (uint8_t *in, int in_len, uint8_t *out, double dev) { int i; int errors = 0; + int s; for (i = 0; i < in_len; i++) { double error = gaussian_random(0, dev); @@ -115,6 +116,24 @@ ao_fuzz (uint8_t *in, int in_len, uint8_t *out, double dev) else byte -= error; } + + /* abcd efgh 8 + * abcd efga 7 + * abcd efab 6 + * abcd eabc 5 + * abcd abcd 4 + * abca bcab 3 + * abab abab 2 + * aaaa aaaa 1 + */ + +#define SAVE 8 +#define SAVE_MASK (((1 << SAVE) - 1) << (8 - SAVE)) + + byte &= SAVE_MASK; + for (s = SAVE; s < 8; s += SAVE) + byte |= byte >> s; + out[i] = byte; } return errors; |