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/encode.cc | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 gnuradio-core/src/lib/viterbi/encode.cc (limited to 'gnuradio-core/src/lib/viterbi/encode.cc') 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; +} -- 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/encode.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gnuradio-core/src/lib/viterbi/encode.cc') 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); -- cgit