diff options
Diffstat (limited to 'gr-fec/lib/viterbi/decode.cc')
-rw-r--r-- | gr-fec/lib/viterbi/decode.cc | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/gr-fec/lib/viterbi/decode.cc b/gr-fec/lib/viterbi/decode.cc index 3b948818fe..98d2644f89 100644 --- a/gr-fec/lib/viterbi/decode.cc +++ b/gr-fec/lib/viterbi/decode.cc @@ -33,54 +33,54 @@ #include <cmath> #define MAXCHUNKSIZE 4096 -#define MAXENCSIZE MAXCHUNKSIZE*16 +#define MAXENCSIZE MAXCHUNKSIZE * 16 int main() { - unsigned char data[MAXCHUNKSIZE]; - signed char syms[MAXENCSIZE]; - int count = 0; + unsigned char data[MAXCHUNKSIZE]; + signed char syms[MAXENCSIZE]; + int count = 0; - // Initialize metric table - int mettab[2][256]; - int amp = 100; - float RATE=0.5; - float ebn0 = 12.0; - float esn0 = RATE*pow(10.0, ebn0/10); - gen_met(mettab, amp, esn0, 0.0, 4); + // Initialize metric table + int mettab[2][256]; + int amp = 100; + float RATE = 0.5; + float ebn0 = 12.0; + float esn0 = RATE * pow(10.0, ebn0 / 10); + gen_met(mettab, amp, esn0, 0.0, 4); - // Initialize decoder state - struct gr::fec::viterbi_state state0[64]; - struct gr::fec::viterbi_state state1[64]; - unsigned char viterbi_in[16]; - gr::fec::viterbi_chunks_init(state0); + // Initialize decoder state + struct gr::fec::viterbi_state state0[64]; + struct gr::fec::viterbi_state state1[64]; + unsigned char viterbi_in[16]; + gr::fec::viterbi_chunks_init(state0); - while (!feof(stdin)) { - unsigned int n = fread(syms, 1, MAXENCSIZE, stdin); - unsigned char *out = data; + while (!feof(stdin)) { + unsigned int n = fread(syms, 1, MAXENCSIZE, stdin); + unsigned char* out = data; - for (unsigned int i = 0; i < n; i++) { + for (unsigned int i = 0; i < n; i++) { - // FIXME: This implements hard decoding by slicing the input stream - unsigned char sym = syms[i] > 0 ? -amp : amp; + // FIXME: This implements hard decoding by slicing the input stream + unsigned char sym = syms[i] > 0 ? -amp : amp; - // Write the symbol to the decoder input - viterbi_in[count % 4] = sym; + // Write the symbol to the decoder input + viterbi_in[count % 4] = sym; - // Every four symbols, perform the butterfly2 operation - if ((count % 4) == 3) { - gr::fec::viterbi_butterfly2(viterbi_in, mettab, state0, state1); + // Every four symbols, perform the butterfly2 operation + if ((count % 4) == 3) { + gr::fec::viterbi_butterfly2(viterbi_in, mettab, state0, state1); - // Every sixteen symbols, perform the readback operation - if ((count > 64) && (count % 16) == 11) { - gr::fec::viterbi_get_output(state0, out); - fwrite(out++, 1, 1, stdout); - } - } + // Every sixteen symbols, perform the readback operation + if ((count > 64) && (count % 16) == 11) { + gr::fec::viterbi_get_output(state0, out); + fwrite(out++, 1, 1, stdout); + } + } - count++; + count++; + } } - } - return 0; + return 0; } |