From a52f9a19581901beabc9111917965b9817231014 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Tue, 15 Apr 2008 21:31:29 +0000 Subject: Merged r8195:8205 from jcorgan/ecc into trunk. Adds convolutional encoder and decoder corresponding to the R=1/2, K=7 CCSDS standard ("Voyager"). This code is a GNU Radio wrapper around a 1995-era KA9Q portable-C implementation, and is designed for continuous streaming data, not packets. The encoder takes MSB packed bytes and outputs channel symbols 0 or 1. The decoder uses soft-decision Viterbi decoding on a floating point stream of (possibly noise corrupted) [1.0, 1.0] symbols, and outputs MSB packed decoded bytes. Benchmarking on a 2.16 GHz Intel Core 2 Duo shows 4.7 Mbps decoding rate at 100% CPU usage (single core). (There is a newer KA9Q library that implements SIMD speed ups with correspondingly faster performance.) The KA9Q library is placed into src/lib/viterbi. It could use some cleanup, file/function renaming, and refactoring, or even replacement with the newer libfec code that is available. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8206 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/Makefile.am | 41 ++++ gnuradio-core/src/lib/viterbi/decode.cc | 88 ++++++++ gnuradio-core/src/lib/viterbi/encode.cc | 54 +++++ gnuradio-core/src/lib/viterbi/metrics.c | 119 ++++++++++ gnuradio-core/src/lib/viterbi/tab.c | 57 +++++ gnuradio-core/src/lib/viterbi/viterbi.c | 355 ++++++++++++++++++++++++++++++ gnuradio-core/src/lib/viterbi/viterbi.h | 49 +++++ 7 files changed, 763 insertions(+) create mode 100644 gnuradio-core/src/lib/viterbi/Makefile.am create mode 100644 gnuradio-core/src/lib/viterbi/decode.cc create mode 100644 gnuradio-core/src/lib/viterbi/encode.cc create mode 100644 gnuradio-core/src/lib/viterbi/metrics.c create mode 100644 gnuradio-core/src/lib/viterbi/tab.c create mode 100644 gnuradio-core/src/lib/viterbi/viterbi.c create mode 100644 gnuradio-core/src/lib/viterbi/viterbi.h (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am new file mode 100644 index 000000000..3eb1502ba --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -0,0 +1,41 @@ +# +# Copyright 2008 Free Software Foundation, Inc. +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +INCLUDES = -Wall -Werror +LIBS = -lm + +noinst_LTLIBRARIES = libviterbi.la + +libviterbi_la_SOURCES = \ + metrics.c \ + tab.c \ + viterbi.c + +noinst_HEADERS = \ + viterbi.h + +noinst_PROGRAMS = encode decode + +encode_SOURCES = encode.cc + +encode_LDADD = libviterbi.la + +decode_SOURCES = decode.cc + +decode_LDADD = libviterbi.la diff --git a/gnuradio-core/src/lib/viterbi/decode.cc b/gnuradio-core/src/lib/viterbi/decode.cc new file mode 100644 index 000000000..6580e4d66 --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/decode.cc @@ -0,0 +1,88 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * This is a minimal example demonstrating how to call the Viterbi decoder + * in continuous streaming mode. It accepts data on stdin and writes to + * stdout. + * + */ + +extern "C" { +#include "viterbi.h" +} + +#include +#include + +#define MAXCHUNKSIZE 4096 +#define MAXENCSIZE MAXCHUNKSIZE*16 + +int main() +{ + 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 decoder state + struct viterbi_state state0[64]; + struct viterbi_state state1[64]; + unsigned char viterbi_in[16]; + viterbi_chunks_init(state0); + + while (!feof(stdin)) { + unsigned int n = fread(syms, 1, MAXENCSIZE, stdin); + unsigned char *out = data; + + 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; + + // Write the symbol to the decoder input + viterbi_in[count % 4] = sym; + + // Every four symbols, perform the butterfly2 operation + if ((count % 4) == 3) { + viterbi_butterfly2(viterbi_in, mettab, state0, state1); + + // Every sixteen symbols, perform the readback operation + if ((count > 64) && (count % 16) == 11) { + viterbi_get_output(state0, out); + fwrite(out++, 1, 1, stdout); + } + } + + count++; + } + } + + return 0; +} diff --git a/gnuradio-core/src/lib/viterbi/encode.cc b/gnuradio-core/src/lib/viterbi/encode.cc new file mode 100644 index 000000000..01acb3987 --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/encode.cc @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * This is a minimal example demonstrating how to call the ECC encoder + * in continuous streaming mode. It accepts data on stdin and writes to + * stdout. + * + * FIXME: This does not flush the final bits out of the encoder. + * + */ + +extern "C" { +#include "viterbi.h" +} + +#include + +#define MAXCHUNKSIZE 4096 +#define MAXENCSIZE MAXCHUNKSIZE*16 + +int main() +{ + unsigned char encoder_state = 0; + unsigned char data[MAXCHUNKSIZE]; + unsigned char syms[MAXENCSIZE]; + + while (!feof(stdin)) { + unsigned int n = fread(data, 1, MAXCHUNKSIZE, stdin); + encoder_state = encode(syms, data, n, encoder_state); + fwrite(syms, 1, n*16, stdout); + } + + return 0; +} diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c new file mode 100644 index 000000000..74f8ce09d --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -0,0 +1,119 @@ +/* + * Copyright 1995 Phil Karn, KA9Q + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * Generate metric tables for a soft-decision convolutional decoder + * assuming gaussian noise on a PSK channel. + * + * Works from "first principles" by evaluating the normal probability + * function and then computing the log-likelihood function + * for every possible received symbol value + * + */ + +/* Symbols are offset-binary, with 128 corresponding to an erased (no + * information) symbol + */ +#define OFFSET 128 + +#include +#include + +/* Normal function integrated from -Inf to x. Range: 0-1 */ +#define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) + +/* Logarithm base 2 */ +#define log2(x) (log(x)*M_LOG2E) + +/* Generate log-likelihood metrics for 8-bit soft quantized channel + * assuming AWGN and BPSK + */ +void +gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ + int amp, /* Signal amplitude, units */ + double esn0, /* Es/N0 ratio in dB */ + double bias, /* Metric bias; 0 for viterbi, rate for sequential */ + int scale) /* Scale factor */ +{ + double noise; + int s,bit; + double metrics[2][256]; + double p0,p1; + + /* Es/N0 as power ratio */ + esn0 = pow(10.,esn0/10); + + noise = 0.5/esn0; /* only half the noise for BPSK */ + noise = sqrt(noise); /* noise/signal Voltage ratio */ + + /* Zero is a special value, since this sample includes all + * lower samples that were clipped to this value, i.e., it + * takes the whole lower tail of the curve + */ + p1 = normal(((0-OFFSET+0.5)/amp - 1)/noise); /* P(s|1) */ + + /* Prob of this value occurring for a 0-bit */ /* P(s|0) */ + p0 = normal(((0-OFFSET+0.5)/amp + 1)/noise); + metrics[0][0] = log2(2*p0/(p1+p0)) - bias; + metrics[1][0] = log2(2*p1/(p1+p0)) - bias; + + for(s=1;s<255;s++){ + /* P(s|1), prob of receiving s given 1 transmitted */ + p1 = normal(((s-OFFSET+0.5)/amp - 1)/noise) - + normal(((s-OFFSET-0.5)/amp - 1)/noise); + + /* P(s|0), prob of receiving s given 0 transmitted */ + p0 = normal(((s-OFFSET+0.5)/amp + 1)/noise) - + normal(((s-OFFSET-0.5)/amp + 1)/noise); + +#ifdef notdef + printf("P(%d|1) = %lg, P(%d|0) = %lg\n",s,p1,s,p0); +#endif + metrics[0][s] = log2(2*p0/(p1+p0)) - bias; + metrics[1][s] = log2(2*p1/(p1+p0)) - bias; + } + /* 255 is also a special value */ + /* P(s|1) */ + p1 = 1 - normal(((255-OFFSET-0.5)/amp - 1)/noise); + /* P(s|0) */ + p0 = 1 - normal(((255-OFFSET-0.5)/amp + 1)/noise); + + metrics[0][255] = log2(2*p0/(p1+p0)) - bias; + metrics[1][255] = log2(2*p1/(p1+p0)) - bias; +#ifdef notdef + /* The probability of a raw symbol error is the probability + * that a 1-bit would be received as a sample with value + * 0-128. This is the offset normal curve integrated from -Inf to 0. + */ + printf("symbol Pe = %lg\n",normal(-1/noise)); +#endif + for(bit=0;bit<2;bit++){ + for(s=0;s<256;s++){ + /* Scale and round to nearest integer */ + mettab[bit][s] = floor(metrics[bit][s] * scale + 0.5); +#ifdef notdef + printf("metrics[%d][%d] = %lg, mettab = %d\n", + bit,s,metrics[bit][s],mettab[bit][s]); +#endif + } + } +} diff --git a/gnuradio-core/src/lib/viterbi/tab.c b/gnuradio-core/src/lib/viterbi/tab.c new file mode 100644 index 000000000..1133c6308 --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/tab.c @@ -0,0 +1,57 @@ +/* + * Copyright 1995 Phil Karn, KA9Q + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* 8-bit parity lookup table, generated by partab.c */ +unsigned char Partab[] = { + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, +}; diff --git a/gnuradio-core/src/lib/viterbi/viterbi.c b/gnuradio-core/src/lib/viterbi/viterbi.c new file mode 100644 index 000000000..9f5c1e72a --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/viterbi.c @@ -0,0 +1,355 @@ +/* + * Copyright 1995 Phil Karn, KA9Q + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * Viterbi decoder for K=7 rate=1/2 convolutional code + * Some modifications from original Karn code by Matt Ettus + */ + +#include "viterbi.h" + +/* The two generator polynomials for the NASA Standard K=7 code. + * Since these polynomials are known to be optimal for this constraint + * length there is not much point in changing them. But if you do, you + * will have to regenerate the BUTTERFLY macro calls in viterbi() + */ +#define POLYA 0x6d +#define POLYB 0x4f + +/* The basic Viterbi decoder operation, called a "butterfly" + * operation because of the way it looks on a trellis diagram. Each + * butterfly involves an Add-Compare-Select (ACS) operation on the two nodes + * where the 0 and 1 paths from the current node merge at the next step of + * the trellis. + * + * The code polynomials are assumed to have 1's on both ends. Given a + * function encode_state() that returns the two symbols for a given + * encoder state in the low two bits, such a code will have the following + * identities for even 'n' < 64: + * + * encode_state(n) = encode_state(n+65) + * encode_state(n+1) = encode_state(n+64) = (3 ^ encode_state(n)) + * + * Any convolutional code you would actually want to use will have + * these properties, so these assumptions aren't too limiting. + * + * Doing this as a macro lets the compiler evaluate at compile time the + * many expressions that depend on the loop index and encoder state and + * emit them as immediate arguments. + * This makes an enormous difference on register-starved machines such + * as the Intel x86 family where evaluating these expressions at runtime + * would spill over into memory. + */ +#define BUTTERFLY(i,sym) { \ + int m0,m1;\ +\ + /* ACS for 0 branch */\ + m0 = state[i].metric + mets[sym]; /* 2*i */\ + m1 = state[i+32].metric + mets[3^sym]; /* 2*i + 64 */\ + if(m0 > m1){\ + next[2*i].metric = m0;\ + next[2*i].path = state[i].path << 1;\ + } else {\ + next[2*i].metric = m1;\ + next[2*i].path = (state[i+32].path << 1)|1;\ + }\ + /* ACS for 1 branch */\ + m0 = state[i].metric + mets[3^sym]; /* 2*i + 1 */\ + m1 = state[i+32].metric + mets[sym]; /* 2*i + 65 */\ + if(m0 > m1){\ + next[2*i+1].metric = m0;\ + next[2*i+1].path = state[i].path << 1;\ + } else {\ + next[2*i+1].metric = m1;\ + next[2*i+1].path = (state[i+32].path << 1)|1;\ + }\ +} + +extern unsigned char Partab[]; /* Parity lookup table */ + +/* Convolutionally encode data into binary symbols */ +unsigned char +encode(unsigned char *symbols, + unsigned char *data, + unsigned int nbytes, + unsigned char encstate) +{ + int i; + + while(nbytes-- != 0){ + for(i=7;i>=0;i--){ + encstate = (encstate << 1) | ((*data >> i) & 1); + *symbols++ = Partab[encstate & POLYA]; + *symbols++ = Partab[encstate & POLYB]; + } + data++; + } + + return encstate; +} + +/* Viterbi decoder */ +int +viterbi(unsigned long *metric, /* Final path metric (returned value) */ + unsigned char *data, /* Decoded output data */ + unsigned char *symbols, /* Raw deinterleaved input symbols */ + unsigned int nbits, /* Number of output bits */ + int mettab[2][256] /* Metric table, [sent sym][rx symbol] */ + ){ + unsigned int bitcnt = 0; + int mets[4]; + long bestmetric; + int beststate,i; + struct viterbi_state state0[64],state1[64],*state,*next; + + state = state0; + next = state1; + + /* Initialize starting metrics to prefer 0 state */ + state[0].metric = 0; + for(i=1;i<64;i++) + state[i].metric = -999999; + state[0].path = 0; + + for(bitcnt = 0;bitcnt < nbits;bitcnt++){ + /* Read input symbol pair and compute all possible branch + * metrics + */ + mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; + mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; + mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; + mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; + symbols += 2; + + /* These macro calls were generated by genbut.c */ + BUTTERFLY(0,0); + BUTTERFLY(1,1); + BUTTERFLY(2,3); + BUTTERFLY(3,2); + BUTTERFLY(4,3); + BUTTERFLY(5,2); + BUTTERFLY(6,0); + BUTTERFLY(7,1); + BUTTERFLY(8,0); + BUTTERFLY(9,1); + BUTTERFLY(10,3); + BUTTERFLY(11,2); + BUTTERFLY(12,3); + BUTTERFLY(13,2); + BUTTERFLY(14,0); + BUTTERFLY(15,1); + BUTTERFLY(16,2); + BUTTERFLY(17,3); + BUTTERFLY(18,1); + BUTTERFLY(19,0); + BUTTERFLY(20,1); + BUTTERFLY(21,0); + BUTTERFLY(22,2); + BUTTERFLY(23,3); + BUTTERFLY(24,2); + BUTTERFLY(25,3); + BUTTERFLY(26,1); + BUTTERFLY(27,0); + BUTTERFLY(28,1); + BUTTERFLY(29,0); + BUTTERFLY(30,2); + BUTTERFLY(31,3); + + /* Swap current and next states */ + if(bitcnt & 1){ + state = state0; + next = state1; + } else { + state = state1; + next = state0; + } + // ETTUS + //if(bitcnt > nbits-7){ + /* In tail, poison non-zero nodes */ + //for(i=1;i<64;i += 2) + // state[i].metric = -9999999; + //} + /* Produce output every 8 bits once path memory is full */ + if((bitcnt % 8) == 5 && bitcnt > 32){ + /* Find current best path */ + bestmetric = state[0].metric; + beststate = 0; + for(i=1;i<64;i++){ + if(state[i].metric > bestmetric){ + bestmetric = state[i].metric; + beststate = i; + } + } +#ifdef notdef + printf("metrics[%d] = %d state = %lx\n",beststate, + state[beststate].metric,state[beststate].path); +#endif + *data++ = state[beststate].path >> 24; + } + + } + /* Output remaining bits from 0 state */ + // ETTUS Find best state instead + bestmetric = state[0].metric; + beststate = 0; + for(i=1;i<64;i++){ + if(state[i].metric > bestmetric){ + bestmetric = state[i].metric; + beststate = i; + } + } + if((i = bitcnt % 8) != 6) + state[beststate].path <<= 6-i; + + *data++ = state[beststate].path >> 24; + *data++ = state[beststate].path >> 16; + *data++ = state[beststate].path >> 8; + *data = state[beststate].path; + //printf ("BS = %d\tBSM = %d\tM0 = %d\n",beststate,state[beststate].metric,state[0].metric); + *metric = state[beststate].metric; + return 0; +} + + +void +viterbi_chunks_init(struct viterbi_state* state) { + // Initialize starting metrics to prefer 0 state + int i; + state[0].metric = 0; + state[0].path = 0; + for(i=1;i<64;i++) + state[i].metric = -999999; +} + +void +viterbi_butterfly8(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1) +{ + unsigned int bitcnt; + int mets[4]; + + struct viterbi_state *state, *next; + state = state0; + next = state1; + // Operate on 16 symbols (8 bits) at a time + for(bitcnt = 0;bitcnt < 8;bitcnt++){ + // Read input symbol pair and compute all possible branch metrics + mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; + mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; + mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; + mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; + symbols += 2; + + // These macro calls were generated by genbut.c + BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); + BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); + BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); + BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1); + BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0); + BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); + BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); + BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); + + // Swap current and next states + if(bitcnt & 1){ + state = state0; + next = state1; + } else { + state = state1; + next = state0; + } + } +} + +void +viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1) +{ + //unsigned int bitcnt; + int mets[4]; + + struct viterbi_state *state, *next; + state = state0; + next = state1; + // Operate on 4 symbols (2 bits) at a time + + // Read input symbol pair and compute all possible branch metrics + mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; + mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; + mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; + mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; + + // These macro calls were generated by genbut.c + BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); + BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); + BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); + BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1); + BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0); + BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); + BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); + BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); + + state = state1; + next = state0; + + // Read input symbol pair and compute all possible branch metrics + mets[0] = mettab[0][symbols[2]] + mettab[0][symbols[3]]; + mets[1] = mettab[0][symbols[2]] + mettab[1][symbols[3]]; + mets[2] = mettab[1][symbols[2]] + mettab[0][symbols[3]]; + mets[3] = mettab[1][symbols[2]] + mettab[1][symbols[3]]; + + // These macro calls were generated by genbut.c + BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); + BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); + BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); + BUTTERFLY(12,3);BUTTERFLY(13,2);BUTTERFLY(14,0);BUTTERFLY(15,1); + BUTTERFLY(16,2);BUTTERFLY(17,3);BUTTERFLY(18,1);BUTTERFLY(19,0); + BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); + BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); + BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); +} + +unsigned char +viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf) { + // Produce output every 8 bits once path memory is full + // if((bitcnt % 8) == 5 && bitcnt > 32) { + + // Find current best path + unsigned int i,beststate; + int bestmetric; + + bestmetric = state[0].metric; + beststate = 0; + for(i=1;i<64;i++) + if(state[i].metric > bestmetric) { + bestmetric = state[i].metric; + beststate = i; + } + *outbuf = state[beststate].path >> 24; + return bestmetric; +} + + +//printf ("BS = %d\tBSM = %d\tM0 = %d\n",beststate,state[beststate].metric,state[0].metric); +// In tail, poison non-zero nodes +//if(bits_out > packet_size-7) +// for(i=1;i<64;i += 2) +// state[i].metric = -9999999; + diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h new file mode 100644 index 000000000..155b0d93a --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/viterbi.h @@ -0,0 +1,49 @@ +/* + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* The path memory for each state is 32 bits. This is slightly shorter + * than we'd like for K=7, especially since we chain back every 8 bits. + * But it fits so nicely into a 32-bit machine word... + */ +struct viterbi_state { + unsigned long path; /* Decoded path to this state */ + long metric; /* Cumulative metric to this state */ +}; + +int gen_met(int mettab[2][256], /* Metric table */ + int amp, /* Signal amplitude */ + double esn0, /* Es/N0 ratio in dB */ + double bias, /* Metric bias */ + int scale); /* Scale factor */ + +unsigned char +encode(unsigned char *symbols, unsigned char *data, + unsigned int nbytes,unsigned char encstate); + +void +viterbi_chunks_init(struct viterbi_state* state); + +void +viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], + struct viterbi_state *state0, struct viterbi_state *state1); + +unsigned char +viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf); -- cgit From 07383f3191c80c2d59535d72d5dc1c92075b0f49 Mon Sep 17 00:00:00 2001 From: eb Date: Thu, 8 May 2008 03:57:47 +0000 Subject: fix for ticket:243 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8318 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/metrics.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c index 74f8ce09d..3351ff403 100644 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -41,9 +41,6 @@ /* Normal function integrated from -Inf to x. Range: 0-1 */ #define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) -/* Logarithm base 2 */ -#define log2(x) (log(x)*M_LOG2E) - /* Generate log-likelihood metrics for 8-bit soft quantized channel * assuming AWGN and BPSK */ -- cgit From 593a87ce2254a7966d33fa88e2efa9cbbdb4f7f0 Mon Sep 17 00:00:00 2001 From: eb Date: Thu, 8 May 2008 06:17:55 +0000 Subject: better fix for ticket:243 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8324 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/metrics.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c index 3351ff403..2dd4279aa 100644 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -30,6 +30,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + /* Symbols are offset-binary, with 128 corresponding to an erased (no * information) symbol */ @@ -41,6 +45,12 @@ /* Normal function integrated from -Inf to x. Range: 0-1 */ #define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) +/* Logarithm base 2 */ +double log2(double); /* declaration seems to be missing from some math.h's */ +#if !defined(HAVE_LOG2) +#define log2(x) (log(x)*M_LOG2E) +#endif + /* Generate log-likelihood metrics for 8-bit soft quantized channel * assuming AWGN and BPSK */ -- cgit From 0da73b85fc0a8bf49e84c46e29b045d76defa984 Mon Sep 17 00:00:00 2001 From: eb Date: Sat, 23 Aug 2008 18:46:04 +0000 Subject: fix for ticket:243 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9381 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/metrics.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c index 2dd4279aa..9f958cab7 100644 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -46,10 +46,7 @@ #define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) /* Logarithm base 2 */ -double log2(double); /* declaration seems to be missing from some math.h's */ -#if !defined(HAVE_LOG2) -#define log2(x) (log(x)*M_LOG2E) -#endif +#define gr_log2(x) (log(x)*M_LOG2E) /* Generate log-likelihood metrics for 8-bit soft quantized channel * assuming AWGN and BPSK @@ -80,8 +77,8 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ /* Prob of this value occurring for a 0-bit */ /* P(s|0) */ p0 = normal(((0-OFFSET+0.5)/amp + 1)/noise); - metrics[0][0] = log2(2*p0/(p1+p0)) - bias; - metrics[1][0] = log2(2*p1/(p1+p0)) - bias; + metrics[0][0] = gr_log2(2*p0/(p1+p0)) - bias; + metrics[1][0] = gr_log2(2*p1/(p1+p0)) - bias; for(s=1;s<255;s++){ /* P(s|1), prob of receiving s given 1 transmitted */ @@ -95,8 +92,8 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ #ifdef notdef printf("P(%d|1) = %lg, P(%d|0) = %lg\n",s,p1,s,p0); #endif - metrics[0][s] = log2(2*p0/(p1+p0)) - bias; - metrics[1][s] = log2(2*p1/(p1+p0)) - bias; + metrics[0][s] = gr_log2(2*p0/(p1+p0)) - bias; + metrics[1][s] = gr_log2(2*p1/(p1+p0)) - bias; } /* 255 is also a special value */ /* P(s|1) */ @@ -104,8 +101,8 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ /* P(s|0) */ p0 = 1 - normal(((255-OFFSET-0.5)/amp + 1)/noise); - metrics[0][255] = log2(2*p0/(p1+p0)) - bias; - metrics[1][255] = log2(2*p1/(p1+p0)) - bias; + metrics[0][255] = gr_log2(2*p0/(p1+p0)) - bias; + metrics[1][255] = gr_log2(2*p1/(p1+p0)) - bias; #ifdef notdef /* The probability of a raw symbol error is the probability * that a 1-bit would be received as a sample with value -- cgit From 48ce0c39329017f236d148bb067d15026f6d5ce9 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Thu, 2 Oct 2008 23:11:10 +0000 Subject: Removed extraneous flags git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9703 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/Makefile.am | 1 - 1 file changed, 1 deletion(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am index 3eb1502ba..4b434cb4b 100644 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -17,7 +17,6 @@ # Boston, MA 02110-1301, USA. # -INCLUDES = -Wall -Werror LIBS = -lm noinst_LTLIBRARIES = libviterbi.la -- cgit From 18f685853b2bf1914148cb07a9c6df76f5063ff3 Mon Sep 17 00:00:00 2001 From: eb Date: Wed, 13 May 2009 05:29:11 +0000 Subject: Fixes ticket:364, ticket:365. Merged eb/t364 -r11015:11017 to trunk. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11018 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am index 4b434cb4b..8384c52f0 100644 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -17,6 +17,8 @@ # Boston, MA 02110-1301, USA. # +include $(top_srcdir)/Makefile.common + LIBS = -lm noinst_LTLIBRARIES = libviterbi.la @@ -25,7 +27,7 @@ libviterbi_la_SOURCES = \ metrics.c \ tab.c \ viterbi.c - + noinst_HEADERS = \ viterbi.h -- cgit From 253018c6cdb114f5662a2d7ba8ed748c6e68e3a7 Mon Sep 17 00:00:00 2001 From: git Date: Fri, 14 Aug 2009 18:10:11 +0000 Subject: Added git ignore files auto created from svn:ignore properties. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11592 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/viterbi/.gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 gnuradio-core/src/lib/viterbi/.gitignore (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/.gitignore b/gnuradio-core/src/lib/viterbi/.gitignore new file mode 100644 index 000000000..85bb5cc04 --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/.gitignore @@ -0,0 +1,6 @@ +/Makefile +/Makefile.in +/.libs +/.deps +/encode +/decode -- cgit From 1e1798393381fe7472a7cdb5b2c3c90d7ae753fb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jul 2011 18:06:44 -0700 Subject: core: declare erf in case it was missing in math.h and provided for by the build system --- gnuradio-core/src/lib/viterbi/metrics.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c index 9f958cab7..77c6a63c8 100644 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -42,6 +42,9 @@ #include #include +//declare erf in case it was missing in math.h and provided for by the build system +extern double erf(double x); + /* Normal function integrated from -Inf to x. Range: 0-1 */ #define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) -- cgit From f914499f4a96fe69ab9cd8dba48f8e3bfc7a54e5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jul 2011 18:38:36 -0700 Subject: core: API declaration macros for core class and function symbols --- gnuradio-core/src/lib/viterbi/Makefile.am | 2 ++ gnuradio-core/src/lib/viterbi/viterbi.h | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am index 8384c52f0..1b86a86f8 100644 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -21,6 +21,8 @@ include $(top_srcdir)/Makefile.common LIBS = -lm +AM_CPPFLAGS = -I$(top_srcdir)/gnuradio-core/src/lib/general + noinst_LTLIBRARIES = libviterbi.la libviterbi_la_SOURCES = \ diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h index 155b0d93a..5bb8b357a 100644 --- a/gnuradio-core/src/lib/viterbi/viterbi.h +++ b/gnuradio-core/src/lib/viterbi/viterbi.h @@ -23,27 +23,31 @@ * than we'd like for K=7, especially since we chain back every 8 bits. * But it fits so nicely into a 32-bit machine word... */ -struct viterbi_state { + +#include + +struct GR_CORE_API viterbi_state { unsigned long path; /* Decoded path to this state */ long metric; /* Cumulative metric to this state */ }; +GR_CORE_API int gen_met(int mettab[2][256], /* Metric table */ int amp, /* Signal amplitude */ double esn0, /* Es/N0 ratio in dB */ double bias, /* Metric bias */ int scale); /* Scale factor */ -unsigned char +GR_CORE_API unsigned char encode(unsigned char *symbols, unsigned char *data, unsigned int nbytes,unsigned char encstate); -void +GR_CORE_API void viterbi_chunks_init(struct viterbi_state* state); -void + GR_CORE_API void viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1); -unsigned char +GR_CORE_API unsigned char viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf); -- cgit From accb9f2fe8fd8f6a1e114adac5b15304b0e0012d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jul 2011 19:04:32 -0700 Subject: gr: squashed cmakelists.txt into one commit --- gnuradio-core/src/lib/viterbi/CMakeLists.txt | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 gnuradio-core/src/lib/viterbi/CMakeLists.txt (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/CMakeLists.txt b/gnuradio-core/src/lib/viterbi/CMakeLists.txt new file mode 100644 index 000000000..aeb8a012d --- /dev/null +++ b/gnuradio-core/src/lib/viterbi/CMakeLists.txt @@ -0,0 +1,63 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +SET(viterbi_sources + ${CMAKE_CURRENT_SOURCE_DIR}/metrics.c + ${CMAKE_CURRENT_SOURCE_DIR}/tab.c + ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.c +) + +######################################################################## +# define missing erf function with C linkage (hack for metrics.c) +######################################################################## +IF(MSVC) +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc " +#include +extern \"C\" double erf(double x){ + return boost::math::erf(x); +} +") +LIST(APPEND viterbi_sources ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc) +ENDIF(MSVC) + +######################################################################## +# Append gnuradio-core library sources +######################################################################## +LIST(APPEND gnuradio_core_sources ${viterbi_sources}) + +######################################################################## +# Install runtime headers +######################################################################## +INSTALL( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio + COMPONENT "core_devel" +) + +######################################################################## +# Create some text executables (not registered tests) +# Its not much to build so the sources are just re-listed, +# rather than create a new library just for these two apps. +######################################################################## +#ADD_EXECUTABLE(viterbi_encode ${CMAKE_CURRENT_SOURCE_DIR}/encode.cc ${viterbi_sources}) +#ADD_EXECUTABLE(viterbi_decode ${CMAKE_CURRENT_SOURCE_DIR}/decode.cc ${viterbi_sources}) -- cgit From 71c0f14a46f85027b95f2f5f6d3d219cc9e3783e Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 8 Oct 2011 17:11:12 -0700 Subject: gr: the CMakeLists.txt took a chill pill --- gnuradio-core/src/lib/viterbi/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/CMakeLists.txt b/gnuradio-core/src/lib/viterbi/CMakeLists.txt index aeb8a012d..add5c77e8 100644 --- a/gnuradio-core/src/lib/viterbi/CMakeLists.txt +++ b/gnuradio-core/src/lib/viterbi/CMakeLists.txt @@ -21,7 +21,7 @@ # This file included, use CMake directory variables ######################################################################## -SET(viterbi_sources +set(viterbi_sources ${CMAKE_CURRENT_SOURCE_DIR}/metrics.c ${CMAKE_CURRENT_SOURCE_DIR}/tab.c ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.c @@ -30,25 +30,25 @@ SET(viterbi_sources ######################################################################## # define missing erf function with C linkage (hack for metrics.c) ######################################################################## -IF(MSVC) -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc " +if(MSVC) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc " #include extern \"C\" double erf(double x){ return boost::math::erf(x); } ") -LIST(APPEND viterbi_sources ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc) -ENDIF(MSVC) +list(APPEND viterbi_sources ${CMAKE_CURRENT_BINARY_DIR}/boost_math_erf.cc) +endif(MSVC) ######################################################################## # Append gnuradio-core library sources ######################################################################## -LIST(APPEND gnuradio_core_sources ${viterbi_sources}) +list(APPEND gnuradio_core_sources ${viterbi_sources}) ######################################################################## # Install runtime headers ######################################################################## -INSTALL( +install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" -- cgit From 8dec45ada7e92f425a876494d5daf85fd3825e98 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 20 Oct 2011 11:19:33 -0700 Subject: core: fixing AM_CPPFLAGS in viterbi/Makefile.am --- gnuradio-core/src/lib/viterbi/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am index 1b86a86f8..7e65880b3 100644 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -21,7 +21,9 @@ include $(top_srcdir)/Makefile.common LIBS = -lm -AM_CPPFLAGS = -I$(top_srcdir)/gnuradio-core/src/lib/general +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(GRUEL_INCLUDES) \ + -I$(top_srcdir)/gnuradio-core/src/lib/general \ + $(WITH_INCLUDES) noinst_LTLIBRARIES = libviterbi.la -- cgit From ab6f8142da17ee70effd469f20a41821b4bc4513 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 20 Oct 2011 14:00:14 -0700 Subject: removes gcc warning, dont need symbol export on plain c structs --- gnuradio-core/src/lib/viterbi/viterbi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h index 5bb8b357a..3a3ea5615 100644 --- a/gnuradio-core/src/lib/viterbi/viterbi.h +++ b/gnuradio-core/src/lib/viterbi/viterbi.h @@ -26,7 +26,7 @@ #include -struct GR_CORE_API viterbi_state { +struct viterbi_state { unsigned long path; /* Decoded path to this state */ long metric; /* Cumulative metric to this state */ }; -- cgit From 00420d32081d8252bb37142b2be19a8a7c4dc4c4 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Thu, 8 Dec 2011 13:48:48 -0800 Subject: Removed autotools, gr-waveform, some cleanup Nick Foster owes Nick Corgan a six-pack of beer! --- gnuradio-core/src/lib/viterbi/.gitignore | 6 ---- gnuradio-core/src/lib/viterbi/Makefile.am | 46 ------------------------------- 2 files changed, 52 deletions(-) delete mode 100644 gnuradio-core/src/lib/viterbi/.gitignore delete mode 100644 gnuradio-core/src/lib/viterbi/Makefile.am (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/.gitignore b/gnuradio-core/src/lib/viterbi/.gitignore deleted file mode 100644 index 85bb5cc04..000000000 --- a/gnuradio-core/src/lib/viterbi/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/Makefile -/Makefile.in -/.libs -/.deps -/encode -/decode diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am deleted file mode 100644 index 7e65880b3..000000000 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -LIBS = -lm - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(GRUEL_INCLUDES) \ - -I$(top_srcdir)/gnuradio-core/src/lib/general \ - $(WITH_INCLUDES) - -noinst_LTLIBRARIES = libviterbi.la - -libviterbi_la_SOURCES = \ - metrics.c \ - tab.c \ - viterbi.c - -noinst_HEADERS = \ - viterbi.h - -noinst_PROGRAMS = encode decode - -encode_SOURCES = encode.cc - -encode_LDADD = libviterbi.la - -decode_SOURCES = decode.cc - -decode_LDADD = libviterbi.la -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- gnuradio-core/src/lib/viterbi/decode.cc | 20 ++++++------ gnuradio-core/src/lib/viterbi/encode.cc | 14 ++++----- gnuradio-core/src/lib/viterbi/metrics.c | 30 +++++++++--------- gnuradio-core/src/lib/viterbi/tab.c | 8 ++--- gnuradio-core/src/lib/viterbi/viterbi.c | 56 ++++++++++++++++----------------- gnuradio-core/src/lib/viterbi/viterbi.h | 10 +++--- 6 files changed, 69 insertions(+), 69 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi') diff --git a/gnuradio-core/src/lib/viterbi/decode.cc b/gnuradio-core/src/lib/viterbi/decode.cc index 6580e4d66..368e69713 100644 --- a/gnuradio-core/src/lib/viterbi/decode.cc +++ b/gnuradio-core/src/lib/viterbi/decode.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2008 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -22,7 +22,7 @@ /* * This is a minimal example demonstrating how to call the Viterbi decoder - * in continuous streaming mode. It accepts data on stdin and writes to + * in continuous streaming mode. It accepts data on stdin and writes to * stdout. * */ @@ -55,12 +55,12 @@ int main() struct viterbi_state state0[64]; struct viterbi_state state1[64]; unsigned char viterbi_in[16]; - viterbi_chunks_init(state0); + viterbi_chunks_init(state0); while (!feof(stdin)) { unsigned int n = fread(syms, 1, MAXENCSIZE, stdin); unsigned char *out = data; - + for (unsigned int i = 0; i < n; i++) { // FIXME: This implements hard decoding by slicing the input stream @@ -71,7 +71,7 @@ int main() // Every four symbols, perform the butterfly2 operation if ((count % 4) == 3) { - viterbi_butterfly2(viterbi_in, mettab, state0, state1); + viterbi_butterfly2(viterbi_in, mettab, state0, state1); // Every sixteen symbols, perform the readback operation if ((count > 64) && (count % 16) == 11) { @@ -79,9 +79,9 @@ int main() fwrite(out++, 1, 1, stdout); } } - + count++; - } + } } return 0; diff --git a/gnuradio-core/src/lib/viterbi/encode.cc b/gnuradio-core/src/lib/viterbi/encode.cc index 01acb3987..83a85fcac 100644 --- a/gnuradio-core/src/lib/viterbi/encode.cc +++ b/gnuradio-core/src/lib/viterbi/encode.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2008 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -22,9 +22,9 @@ /* * This is a minimal example demonstrating how to call the ECC encoder - * in continuous streaming mode. It accepts data on stdin and writes to + * in continuous streaming mode. It accepts data on stdin and writes to * stdout. - * + * * FIXME: This does not flush the final bits out of the encoder. * */ @@ -43,7 +43,7 @@ int main() unsigned char encoder_state = 0; unsigned char data[MAXCHUNKSIZE]; unsigned char syms[MAXENCSIZE]; - + while (!feof(stdin)) { unsigned int n = fread(data, 1, MAXCHUNKSIZE, stdin); encoder_state = encode(syms, data, n, encoder_state); diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gnuradio-core/src/lib/viterbi/metrics.c index 77c6a63c8..0d91c301f 100644 --- a/gnuradio-core/src/lib/viterbi/metrics.c +++ b/gnuradio-core/src/lib/viterbi/metrics.c @@ -1,26 +1,26 @@ /* * Copyright 1995 Phil Karn, KA9Q * Copyright 2008 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -/* +/* * Generate metric tables for a soft-decision convolutional decoder * assuming gaussian noise on a PSK channel. * @@ -48,7 +48,7 @@ extern double erf(double x); /* Normal function integrated from -Inf to x. Range: 0-1 */ #define normal(x) (0.5 + 0.5*erf((x)/M_SQRT2)) -/* Logarithm base 2 */ +/* Logarithm base 2 */ #define gr_log2(x) (log(x)*M_LOG2E) /* Generate log-likelihood metrics for 8-bit soft quantized channel @@ -65,33 +65,33 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ int s,bit; double metrics[2][256]; double p0,p1; - + /* Es/N0 as power ratio */ esn0 = pow(10.,esn0/10); - + noise = 0.5/esn0; /* only half the noise for BPSK */ noise = sqrt(noise); /* noise/signal Voltage ratio */ - + /* Zero is a special value, since this sample includes all * lower samples that were clipped to this value, i.e., it - * takes the whole lower tail of the curve + * takes the whole lower tail of the curve */ p1 = normal(((0-OFFSET+0.5)/amp - 1)/noise); /* P(s|1) */ - + /* Prob of this value occurring for a 0-bit */ /* P(s|0) */ p0 = normal(((0-OFFSET+0.5)/amp + 1)/noise); metrics[0][0] = gr_log2(2*p0/(p1+p0)) - bias; metrics[1][0] = gr_log2(2*p1/(p1+p0)) - bias; - + for(s=1;s<255;s++){ /* P(s|1), prob of receiving s given 1 transmitted */ p1 = normal(((s-OFFSET+0.5)/amp - 1)/noise) - normal(((s-OFFSET-0.5)/amp - 1)/noise); - + /* P(s|0), prob of receiving s given 0 transmitted */ p0 = normal(((s-OFFSET+0.5)/amp + 1)/noise) - normal(((s-OFFSET-0.5)/amp + 1)/noise); - + #ifdef notdef printf("P(%d|1) = %lg, P(%d|0) = %lg\n",s,p1,s,p0); #endif @@ -103,7 +103,7 @@ gen_met(int mettab[2][256], /* Metric table, [sent sym][rx symbol] */ p1 = 1 - normal(((255-OFFSET-0.5)/amp - 1)/noise); /* P(s|0) */ p0 = 1 - normal(((255-OFFSET-0.5)/amp + 1)/noise); - + metrics[0][255] = gr_log2(2*p0/(p1+p0)) - bias; metrics[1][255] = gr_log2(2*p1/(p1+p0)) - bias; #ifdef notdef diff --git a/gnuradio-core/src/lib/viterbi/tab.c b/gnuradio-core/src/lib/viterbi/tab.c index 1133c6308..1c135acfe 100644 --- a/gnuradio-core/src/lib/viterbi/tab.c +++ b/gnuradio-core/src/lib/viterbi/tab.c @@ -1,19 +1,19 @@ /* * Copyright 1995 Phil Karn, KA9Q * Copyright 2008 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, diff --git a/gnuradio-core/src/lib/viterbi/viterbi.c b/gnuradio-core/src/lib/viterbi/viterbi.c index 9f5c1e72a..fc8886603 100644 --- a/gnuradio-core/src/lib/viterbi/viterbi.c +++ b/gnuradio-core/src/lib/viterbi/viterbi.c @@ -1,26 +1,26 @@ /* * Copyright 1995 Phil Karn, KA9Q * Copyright 2008 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -/* +/* * Viterbi decoder for K=7 rate=1/2 convolutional code * Some modifications from original Karn code by Matt Ettus */ @@ -94,7 +94,7 @@ encode(unsigned char *symbols, unsigned char encstate) { int i; - + while(nbytes-- != 0){ for(i=7;i>=0;i--){ encstate = (encstate << 1) | ((*data >> i) & 1); @@ -103,7 +103,7 @@ encode(unsigned char *symbols, } data++; } - + return encstate; } @@ -120,16 +120,16 @@ viterbi(unsigned long *metric, /* Final path metric (returned value) */ long bestmetric; int beststate,i; struct viterbi_state state0[64],state1[64],*state,*next; - + state = state0; next = state1; - + /* Initialize starting metrics to prefer 0 state */ state[0].metric = 0; for(i=1;i<64;i++) state[i].metric = -999999; state[0].path = 0; - + for(bitcnt = 0;bitcnt < nbits;bitcnt++){ /* Read input symbol pair and compute all possible branch * metrics @@ -173,7 +173,7 @@ viterbi(unsigned long *metric, /* Final path metric (returned value) */ BUTTERFLY(29,0); BUTTERFLY(30,2); BUTTERFLY(31,3); - + /* Swap current and next states */ if(bitcnt & 1){ state = state0; @@ -205,7 +205,7 @@ viterbi(unsigned long *metric, /* Final path metric (returned value) */ #endif *data++ = state[beststate].path >> 24; } - + } /* Output remaining bits from 0 state */ // ETTUS Find best state instead @@ -219,7 +219,7 @@ viterbi(unsigned long *metric, /* Final path metric (returned value) */ } if((i = bitcnt % 8) != 6) state[beststate].path <<= 6-i; - + *data++ = state[beststate].path >> 24; *data++ = state[beststate].path >> 16; *data++ = state[beststate].path >> 8; @@ -245,7 +245,7 @@ viterbi_butterfly8(unsigned char *symbols, int mettab[2][256], struct viterbi_st { unsigned int bitcnt; int mets[4]; - + struct viterbi_state *state, *next; state = state0; next = state1; @@ -257,8 +257,8 @@ viterbi_butterfly8(unsigned char *symbols, int mettab[2][256], struct viterbi_st mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; symbols += 2; - - // These macro calls were generated by genbut.c + + // These macro calls were generated by genbut.c BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); @@ -267,7 +267,7 @@ viterbi_butterfly8(unsigned char *symbols, int mettab[2][256], struct viterbi_st BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); - + // Swap current and next states if(bitcnt & 1){ state = state0; @@ -284,19 +284,19 @@ viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_st { //unsigned int bitcnt; int mets[4]; - + struct viterbi_state *state, *next; state = state0; next = state1; // Operate on 4 symbols (2 bits) at a time - + // Read input symbol pair and compute all possible branch metrics mets[0] = mettab[0][symbols[0]] + mettab[0][symbols[1]]; mets[1] = mettab[0][symbols[0]] + mettab[1][symbols[1]]; mets[2] = mettab[1][symbols[0]] + mettab[0][symbols[1]]; mets[3] = mettab[1][symbols[0]] + mettab[1][symbols[1]]; - - // These macro calls were generated by genbut.c + + // These macro calls were generated by genbut.c BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); @@ -305,17 +305,17 @@ viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_st BUTTERFLY(20,1);BUTTERFLY(21,0);BUTTERFLY(22,2);BUTTERFLY(23,3); BUTTERFLY(24,2);BUTTERFLY(25,3);BUTTERFLY(26,1);BUTTERFLY(27,0); BUTTERFLY(28,1);BUTTERFLY(29,0);BUTTERFLY(30,2);BUTTERFLY(31,3); - + state = state1; next = state0; - + // Read input symbol pair and compute all possible branch metrics mets[0] = mettab[0][symbols[2]] + mettab[0][symbols[3]]; mets[1] = mettab[0][symbols[2]] + mettab[1][symbols[3]]; mets[2] = mettab[1][symbols[2]] + mettab[0][symbols[3]]; mets[3] = mettab[1][symbols[2]] + mettab[1][symbols[3]]; - - // These macro calls were generated by genbut.c + + // These macro calls were generated by genbut.c BUTTERFLY(0,0);BUTTERFLY(1,1);BUTTERFLY(2,3);BUTTERFLY(3,2); BUTTERFLY(4,3);BUTTERFLY(5,2);BUTTERFLY(6,0);BUTTERFLY(7,1); BUTTERFLY(8,0);BUTTERFLY(9,1);BUTTERFLY(10,3);BUTTERFLY(11,2); @@ -328,13 +328,13 @@ viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_st unsigned char viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf) { - // Produce output every 8 bits once path memory is full + // Produce output every 8 bits once path memory is full // if((bitcnt % 8) == 5 && bitcnt > 32) { - + // Find current best path unsigned int i,beststate; int bestmetric; - + bestmetric = state[0].metric; beststate = 0; for(i=1;i<64;i++) diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gnuradio-core/src/lib/viterbi/viterbi.h index 3a3ea5615..bcdbe116d 100644 --- a/gnuradio-core/src/lib/viterbi/viterbi.h +++ b/gnuradio-core/src/lib/viterbi/viterbi.h @@ -1,18 +1,18 @@ /* * Copyright 2008 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -46,7 +46,7 @@ GR_CORE_API void viterbi_chunks_init(struct viterbi_state* state); GR_CORE_API void -viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], +viterbi_butterfly2(unsigned char *symbols, int mettab[2][256], struct viterbi_state *state0, struct viterbi_state *state1); GR_CORE_API unsigned char -- cgit