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/viterbi.h | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 gnuradio-core/src/lib/viterbi/viterbi.h (limited to 'gnuradio-core/src/lib/viterbi/viterbi.h') 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 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/viterbi.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi/viterbi.h') 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 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/viterbi.h') 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 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/viterbi.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi/viterbi.h') 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