summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--gnuradio-core/CMakeLists.txt2
-rw-r--r--gnuradio-core/src/lib/CMakeLists.txt2
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt2
-rw-r--r--gnuradio-core/src/lib/general/general.i4
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc86
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h78
-rw-r--r--gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc62
-rw-r--r--gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h64
-rw-r--r--gnuradio-core/src/lib/reed-solomon/rs.h31
-rw-r--r--gr-atsc/src/lib/CMakeLists.txt4
-rw-r--r--gr-atsc/src/lib/atsci_reed_solomon.cc2
-rw-r--r--gr-fec/CMakeLists.txt109
-rw-r--r--gr-fec/doc/CMakeLists.txt23
-rw-r--r--gr-fec/doc/README.fec12
-rw-r--r--gr-fec/doc/fec.dox23
-rw-r--r--gr-fec/gnuradio-fec.pc.in11
-rw-r--r--gr-fec/grc/CMakeLists.txt22
-rw-r--r--gr-fec/grc/fec_block_tree.xml14
-rw-r--r--gr-fec/grc/fec_decode_ccsds_27_bb.xml (renamed from grc/blocks/gr_encode_ccsds_27_bb.xml)6
-rw-r--r--gr-fec/grc/fec_decode_ccsds_27_fb.xml (renamed from grc/blocks/gr_decode_ccsds_27_fb.xml)6
-rw-r--r--gr-fec/include/fec/CMakeLists.txt83
-rw-r--r--gr-fec/include/fec/api.h (renamed from gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i)20
-rw-r--r--gr-fec/include/fec/decode_ccsds_27_fb.h64
-rw-r--r--gr-fec/include/fec/encode_ccsds_27_bb.h61
-rw-r--r--gr-fec/lib/CMakeLists.txt56
-rw-r--r--gr-fec/lib/decode_ccsds_27_fb_impl.cc89
-rw-r--r--gr-fec/lib/decode_ccsds_27_fb_impl.h57
-rw-r--r--gr-fec/lib/encode_ccsds_27_bb_impl.cc65
-rw-r--r--gr-fec/lib/encode_ccsds_27_bb_impl.h47
-rw-r--r--gr-fec/lib/reed-solomon/CMakeLists.txt (renamed from gnuradio-core/src/lib/reed-solomon/CMakeLists.txt)22
-rw-r--r--gr-fec/lib/reed-solomon/Makefile.in.karn (renamed from gnuradio-core/src/lib/reed-solomon/Makefile.in.karn)0
-rw-r--r--gr-fec/lib/reed-solomon/README (renamed from gnuradio-core/src/lib/reed-solomon/README)3
-rw-r--r--gr-fec/lib/reed-solomon/README.karn (renamed from gnuradio-core/src/lib/reed-solomon/README.karn)0
-rw-r--r--gr-fec/lib/reed-solomon/ccsds.h (renamed from gnuradio-core/src/lib/reed-solomon/ccsds.h)0
-rw-r--r--gr-fec/lib/reed-solomon/char.h (renamed from gnuradio-core/src/lib/reed-solomon/char.h)10
-rw-r--r--gr-fec/lib/reed-solomon/decode_rs.c (renamed from gnuradio-core/src/lib/reed-solomon/decode_rs.c)0
-rw-r--r--gr-fec/lib/reed-solomon/decode_rs_ccsds.c (renamed from gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c)0
-rw-r--r--gr-fec/lib/reed-solomon/encode_rs.c (renamed from gnuradio-core/src/lib/reed-solomon/encode_rs.c)0
-rw-r--r--gr-fec/lib/reed-solomon/encode_rs_ccsds.c (renamed from gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c)0
-rw-r--r--gr-fec/lib/reed-solomon/exercise.c (renamed from gnuradio-core/src/lib/reed-solomon/exercise.c)0
-rw-r--r--gr-fec/lib/reed-solomon/fixed.h (renamed from gnuradio-core/src/lib/reed-solomon/fixed.h)6
-rw-r--r--gr-fec/lib/reed-solomon/gen_ccsds.c (renamed from gnuradio-core/src/lib/reed-solomon/gen_ccsds.c)0
-rw-r--r--gr-fec/lib/reed-solomon/gen_ccsds_tal.c (renamed from gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c)0
-rw-r--r--gr-fec/lib/reed-solomon/init_rs.c (renamed from gnuradio-core/src/lib/reed-solomon/init_rs.c)0
-rw-r--r--gr-fec/lib/reed-solomon/int.h (renamed from gnuradio-core/src/lib/reed-solomon/int.h)10
-rw-r--r--gr-fec/lib/reed-solomon/rs.3 (renamed from gnuradio-core/src/lib/reed-solomon/rs.3)0
-rw-r--r--gr-fec/lib/reed-solomon/rs.h31
-rw-r--r--gr-fec/lib/reed-solomon/rstest.c (renamed from gnuradio-core/src/lib/reed-solomon/rstest.c)0
-rw-r--r--gr-fec/lib/viterbi/CMakeLists.txt (renamed from gnuradio-core/src/lib/viterbi/CMakeLists.txt)12
-rw-r--r--gr-fec/lib/viterbi/decode.cc (renamed from gnuradio-core/src/lib/viterbi/decode.cc)0
-rw-r--r--gr-fec/lib/viterbi/encode.cc (renamed from gnuradio-core/src/lib/viterbi/encode.cc)0
-rw-r--r--gr-fec/lib/viterbi/metrics.c (renamed from gnuradio-core/src/lib/viterbi/metrics.c)0
-rw-r--r--gr-fec/lib/viterbi/tab.c (renamed from gnuradio-core/src/lib/viterbi/tab.c)0
-rw-r--r--gr-fec/lib/viterbi/viterbi.c (renamed from gnuradio-core/src/lib/viterbi/viterbi.c)0
-rw-r--r--gr-fec/lib/viterbi/viterbi.h (renamed from gnuradio-core/src/lib/viterbi/viterbi.h)12
-rw-r--r--gr-fec/python/CMakeLists.txt47
-rw-r--r--gr-fec/python/__init__.py26
-rwxr-xr-xgr-fec/python/qa_ecc_ccsds_27.py (renamed from gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py)5
-rw-r--r--gr-fec/swig/CMakeLists.txt53
-rw-r--r--gr-fec/swig/fec_swig.i (renamed from gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i)24
-rw-r--r--grc/blocks/block_tree.xml3
62 files changed, 970 insertions, 400 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7706466c44..151252c1da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -229,6 +229,7 @@ add_subdirectory(gruel)
add_subdirectory(gnuradio-core)
add_subdirectory(grc)
+add_subdirectory(gr-fec)
add_subdirectory(gr-fft)
add_subdirectory(gr-filter)
add_subdirectory(gr-atsc)
diff --git a/gnuradio-core/CMakeLists.txt b/gnuradio-core/CMakeLists.txt
index 4e76b3c5a6..f8ceac8c72 100644
--- a/gnuradio-core/CMakeLists.txt
+++ b/gnuradio-core/CMakeLists.txt
@@ -54,8 +54,6 @@ GR_SET_GLOBAL(GNURADIO_CORE_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/src/lib/filter
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/filter
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/missing
- ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/reed-solomon
- ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/viterbi
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/io
${CMAKE_CURRENT_BINARY_DIR}/src/lib/swig
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/swig
diff --git a/gnuradio-core/src/lib/CMakeLists.txt b/gnuradio-core/src/lib/CMakeLists.txt
index 9dfa47fd23..dcb81c36a2 100644
--- a/gnuradio-core/src/lib/CMakeLists.txt
+++ b/gnuradio-core/src/lib/CMakeLists.txt
@@ -28,10 +28,8 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
GR_INCLUDE_SUBDIRECTORY(missing)
GR_INCLUDE_SUBDIRECTORY(runtime)
GR_INCLUDE_SUBDIRECTORY(filter)
-GR_INCLUDE_SUBDIRECTORY(viterbi)
GR_INCLUDE_SUBDIRECTORY(general)
GR_INCLUDE_SUBDIRECTORY(gengen)
-GR_INCLUDE_SUBDIRECTORY(reed-solomon)
GR_INCLUDE_SUBDIRECTORY(io)
list(APPEND gnuradio_core_sources bug_work_around_6.cc)
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index 848d860a8f..67205d79b9 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -175,10 +175,8 @@ set(gr_core_general_triple_threats
gr_complex_to_xxx
gr_conjugate_cc
gr_copy
- gr_decode_ccsds_27_fb
gr_deinterleave
gr_delay
- gr_encode_ccsds_27_bb
gr_endian_swap
gr_fake_channel_coder_pp
gr_feval
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 93c5d5ddb4..b03d8bbb5e 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -90,8 +90,6 @@
#include <gr_bin_statistics_f.h>
#include <gr_peak_detector2_fb.h>
#include <gr_repeat.h>
-#include <gr_encode_ccsds_27_bb.h>
-#include <gr_decode_ccsds_27_fb.h>
#include <gr_stretch_ff.h>
#include <gr_copy.h>
#include <complex_vec_test.h>
@@ -172,8 +170,6 @@
%include "gr_bin_statistics_f.i"
%include "gr_peak_detector2_fb.i"
%include "gr_repeat.i"
-%include "gr_encode_ccsds_27_bb.i"
-%include "gr_decode_ccsds_27_fb.i"
%include "gr_stretch_ff.i"
%include "gr_copy.i"
%include "complex_vec_test.i"
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
deleted file mode 100644
index 319aceeaab..0000000000
--- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2010 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_decode_ccsds_27_fb.h>
-#include <gr_io_signature.h>
-
-gr_decode_ccsds_27_fb_sptr
-gr_make_decode_ccsds_27_fb()
-{
- return gnuradio::get_initial_sptr(new gr_decode_ccsds_27_fb());
-}
-
-gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb()
- : gr_sync_decimator("decode_ccsds_27_fb",
- gr_make_io_signature(1, 1, sizeof(float)),
- gr_make_io_signature(1, 1, sizeof(char)),
- 2*8) // Rate 1/2 code, unpacked to packed translation
-{
- float RATE = 0.5;
- float ebn0 = 12.0;
- float esn0 = RATE*pow(10.0, ebn0/10.0);
-
- gen_met(d_mettab, 100, esn0, 0.0, 256);
- viterbi_chunks_init(d_state0);
-}
-
-gr_decode_ccsds_27_fb::~gr_decode_ccsds_27_fb()
-{
-}
-
-int
-gr_decode_ccsds_27_fb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float *)input_items[0];
- unsigned char *out = (unsigned char *)output_items[0];
-
- for (int i = 0; i < noutput_items*16; i++) {
- // Translate and clip [-1.0..1.0] to [28..228]
- float sample = in[i]*100.0+128.0;
- if (sample > 255.0)
- sample = 255.0;
- else if (sample < 0.0)
- sample = 0.0;
- unsigned char sym = (unsigned char)(floor(sample));
-
- d_viterbi_in[d_count % 4] = sym;
- if ((d_count % 4) == 3) {
- // Every fourth symbol, perform butterfly operation
- viterbi_butterfly2(d_viterbi_in, d_mettab, d_state0, d_state1);
-
- // Every sixteenth symbol, read out a byte
- if (d_count % 16 == 11) {
- // long metric =
- viterbi_get_output(d_state0, out++);
- // printf("%li\n", *(out-1), metric);
- }
- }
-
- d_count++;
- }
-
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h
deleted file mode 100644
index df8e6f449d..0000000000
--- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-#ifndef INCLUDED_GR_DECODE_CCSDS_27_FB_H
-#define INCLUDED_GR_DECODE_CCSDS_27_FB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_decimator.h>
-
-extern "C" {
-#include <viterbi.h>
-}
-
-class gr_decode_ccsds_27_fb;
-
-typedef boost::shared_ptr<gr_decode_ccsds_27_fb> gr_decode_ccsds_27_fb_sptr;
-
-GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
-
-/*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard
- * \ingroup ecc
- *
- * This block performs soft-decision convolutional decoding using the Viterbi
- * algorithm.
- *
- * The input is a stream of (possibly noise corrupted) floating point values
- * nominally spanning [-1.0, 1.0], representing the encoded channel symbols
- * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
- *
- * The output is MSB first packed bytes of decoded values.
- *
- * As a rate 1/2 code, there will be one output byte for every 16 input symbols.
- *
- * This block is designed for continuous data streaming, not packetized data.
- * The first 32 bits out will be zeroes, with the output delayed four bytes
- * from the corresponding inputs.
- */
-
-class GR_CORE_API gr_decode_ccsds_27_fb : public gr_sync_decimator
-{
-private:
- friend GR_CORE_API gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb();
-
- gr_decode_ccsds_27_fb();
-
- // Viterbi state
- int d_mettab[2][256];
- struct viterbi_state d_state0[64];
- struct viterbi_state d_state1[64];
- unsigned char d_viterbi_in[16];
-
- int d_count;
-
-public:
- ~gr_decode_ccsds_27_fb();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_DECODE_CCSDS_27_FB_H */
diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc
deleted file mode 100644
index 4a92d113a5..0000000000
--- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2008,2010 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_encode_ccsds_27_bb.h>
-#include <gr_io_signature.h>
-
-extern "C" {
-#include <../viterbi/viterbi.h>
-}
-
-gr_encode_ccsds_27_bb_sptr
-gr_make_encode_ccsds_27_bb()
-{
- return gnuradio::get_initial_sptr(new gr_encode_ccsds_27_bb());
-}
-
-gr_encode_ccsds_27_bb::gr_encode_ccsds_27_bb()
- : gr_sync_interpolator("encode_ccsds_27_bb",
- gr_make_io_signature(1, 1, sizeof(char)),
- gr_make_io_signature(1, 1, sizeof(char)),
- 16) // Rate 1/2 code, packed to unpacked conversion
-{
- d_encstate = 0;
-}
-
-gr_encode_ccsds_27_bb::~gr_encode_ccsds_27_bb()
-{
-}
-
-int
-gr_encode_ccsds_27_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- unsigned char *in = (unsigned char *)input_items[0];
- unsigned char *out = (unsigned char *)output_items[0];
-
- d_encstate = encode(out, in, noutput_items/16, d_encstate);
-
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h b/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h
deleted file mode 100644
index 94e9c33f1b..0000000000
--- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- c++ -*- */
-/*
- * 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.
- */
-#ifndef INCLUDED_GR_ENCODE_CCSDS_27_BB_H
-#define INCLUDED_GR_ENCODE_CCSDS_27_BB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_interpolator.h>
-
-class gr_encode_ccsds_27_bb;
-
-typedef boost::shared_ptr<gr_encode_ccsds_27_bb> gr_encode_ccsds_27_bb_sptr;
-
-GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb();
-
-/*! \brief A rate 1/2, k=7 convolutional encoder for the CCSDS standard
- * \ingroup ecc
- *
- * This block performs convolutional encoding using the CCSDS standard
- * polynomial ("Voyager").
- *
- * The input is an MSB first packed stream of bits.
- *
- * The output is a stream of symbols 0 or 1 representing the encoded data.
- *
- * As a rate 1/2 code, there will be 16 output symbols for every input byte.
- *
- * This block is designed for continuous data streaming, not packetized data.
- * There is no provision to "flush" the encoder.
- */
-
-class GR_CORE_API gr_encode_ccsds_27_bb : public gr_sync_interpolator
-{
-private:
- friend GR_CORE_API gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb();
-
- gr_encode_ccsds_27_bb();
- unsigned char d_encstate;
-
- public:
- ~gr_encode_ccsds_27_bb();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_ENCODE_CCSDS_27_BB_H */
diff --git a/gnuradio-core/src/lib/reed-solomon/rs.h b/gnuradio-core/src/lib/reed-solomon/rs.h
deleted file mode 100644
index 97e78769ea..0000000000
--- a/gnuradio-core/src/lib/reed-solomon/rs.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <gr_core_api.h>
-/* User include file for the Reed-Solomon codec
- * Copyright 2002, Phil Karn KA9Q
- * May be used under the terms of the GNU General Public License (GPL)
- */
-
-/* General purpose RS codec, 8-bit symbols */
-GR_CORE_API void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity);
-GR_CORE_API int decode_rs_char(void *rs,unsigned char *data,int *eras_pos,
- int no_eras);
-GR_CORE_API void *init_rs_char(unsigned int symsize,unsigned int gfpoly,
- unsigned int fcr,unsigned int prim,unsigned int nroots);
-GR_CORE_API void free_rs_char(void *rs);
-
-/* General purpose RS codec, integer symbols */
-GR_CORE_API void encode_rs_int(void *rs,int *data,int *parity);
-GR_CORE_API int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras);
-GR_CORE_API void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
- unsigned int prim,unsigned int nroots);
-GR_CORE_API void free_rs_int(void *rs);
-
-/* CCSDS standard (255,223) RS codec with conventional (*not* dual-basis)
- * symbol representation
- */
-GR_CORE_API void encode_rs_8(unsigned char *data,unsigned char *parity);
-GR_CORE_API int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras);
-
-/* Tables to map from conventional->dual (Taltab) and
- * dual->conventional (Tal1tab) bases
- */
-extern unsigned char Taltab[],Tal1tab[];
diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt
index 6fc588b8a3..e1fd3248a4 100644
--- a/gr-atsc/src/lib/CMakeLists.txt
+++ b/gr-atsc/src/lib/CMakeLists.txt
@@ -24,6 +24,7 @@ include_directories(
${GNURADIO_CORE_INCLUDE_DIRS}
${GR_FILTER_INCLUDE_DIRS}
${GR_ANALOG_INCLUDE_DIRS}
+ ${GR_FEC_INCLUDE_DIRS}
${GR_ATSC_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
@@ -101,6 +102,7 @@ list(APPEND atsc_libs
gnuradio-analog
gnuradio-core
${Boost_LIBRARIES}
+ gnuradio-fec
)
add_library(gnuradio-atsc SHARED ${gr_atsc_sources})
@@ -133,7 +135,7 @@ list(APPEND test_atsci_sources
)
include(GrTest)
-set(GR_TEST_TARGET_DEPS gnuradio-atsc gnuradio-core gruel volk)
+set(GR_TEST_TARGET_DEPS gnuradio-atsc gnuradio-core gruel volk gnuradio-fec)
add_executable(test_atsci ${test_atsci_sources} test_atsci.cc)
target_link_libraries(test_atsci gnuradio-atsc gnuradio-core ${CPPUNIT_LIBRARIES})
GR_ADD_TEST(atsci-test test_atsci)
diff --git a/gr-atsc/src/lib/atsci_reed_solomon.cc b/gr-atsc/src/lib/atsci_reed_solomon.cc
index a4a40e3f17..34bfb14b10 100644
--- a/gr-atsc/src/lib/atsci_reed_solomon.cc
+++ b/gr-atsc/src/lib/atsci_reed_solomon.cc
@@ -25,7 +25,7 @@
#include <string.h>
extern "C" {
-#include "rs.h"
+#include <rs.h>
}
static const int rs_init_symsize = 8;
diff --git a/gr-fec/CMakeLists.txt b/gr-fec/CMakeLists.txt
new file mode 100644
index 0000000000..e072ce337e
--- /dev/null
+++ b/gr-fec/CMakeLists.txt
@@ -0,0 +1,109 @@
+# Copyright 2012 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+
+GR_REGISTER_COMPONENT("gr-fec" ENABLE_GR_FEC
+ Boost_FOUND
+ ENABLE_GRUEL
+ ENABLE_GR_CORE
+)
+
+GR_SET_GLOBAL(GR_FEC_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/viterbi
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/reed-solomon
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_FEC)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_FEC_DESCRIPTION "GNU Radio FEC Blocks")
+
+CPACK_COMPONENT("fec_runtime"
+ GROUP "FEC"
+ DISPLAY_NAME "Runtime"
+ DESCRIPTION "Runtime"
+ DEPENDS "core_runtime"
+)
+
+CPACK_COMPONENT("fec_devel"
+ GROUP "FEC"
+ DISPLAY_NAME "Development"
+ DESCRIPTION "C++ headers, package config, import libraries"
+ DEPENDS "core_devel"
+)
+
+CPACK_COMPONENT("fec_python"
+ GROUP "FEC"
+ DISPLAY_NAME "Python"
+ DESCRIPTION "Python modules for runtime; GRC xml files"
+ DEPENDS "core_python;fec_runtime"
+)
+
+CPACK_COMPONENT("fec_swig"
+ GROUP "FEC"
+ DISPLAY_NAME "SWIG"
+ DESCRIPTION "SWIG development .i files"
+ DEPENDS "core_swig;fec_python;fec_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include/fec)
+add_subdirectory(lib)
+if(ENABLE_PYTHON)
+ add_subdirectory(swig)
+ add_subdirectory(python)
+ add_subdirectory(grc)
+endif(ENABLE_PYTHON)
+#add_subdirectory(examples)
+add_subdirectory(doc)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-fec.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fec.pc
+@ONLY)
+
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-fec.pc
+ DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+ COMPONENT "fec_devel"
+)
+
+endif(ENABLE_GR_FEC)
diff --git a/gr-fec/doc/CMakeLists.txt b/gr-fec/doc/CMakeLists.txt
new file mode 100644
index 0000000000..776f1e2159
--- /dev/null
+++ b/gr-fec/doc/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright 2012 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.
+
+install(
+ FILES README.fec
+ DESTINATION ${GR_PKG_DOC_DIR}
+)
diff --git a/gr-fec/doc/README.fec b/gr-fec/doc/README.fec
new file mode 100644
index 0000000000..02374bca84
--- /dev/null
+++ b/gr-fec/doc/README.fec
@@ -0,0 +1,12 @@
+This is the gr-fec package. It contains all of the FEC
+encoders and decoders. To use the FEC blocks, the Python
+namespace is in gnuradio.fec, which would be normally
+imported as:
+
+ from gnuradio import fec
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(fec)
diff --git a/gr-fec/doc/fec.dox b/gr-fec/doc/fec.dox
new file mode 100644
index 0000000000..110dcb677e
--- /dev/null
+++ b/gr-fec/doc/fec.dox
@@ -0,0 +1,23 @@
+/*! \page page_digital Digital Modulation
+
+\section Introduction
+This is the gr-digital package. It contains all of the digital
+modulation blocks, utilities, and examples. To use the digital blocks,
+the Python namespaces is in gnuradio.digital, which would be normally
+imported as:
+
+\code
+ from gnuradio import digital
+\endcode
+
+See the Doxygen documentation for details about the blocks available
+in this package. The relevant blocks are listed in the \ref digital group.
+
+A quick listing of the details can be found in Python after importing
+by using:
+
+\code
+ help(digital)
+\endcode
+
+*/
diff --git a/gr-fec/gnuradio-fec.pc.in b/gr-fec/gnuradio-fec.pc.in
new file mode 100644
index 0000000000..3e0d308da7
--- /dev/null
+++ b/gr-fec/gnuradio-fec.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gnuradio-fec
+Description: GNU Radio's FEC signal processing blocks
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-fec
+Cflags: -I${includedir}
diff --git a/gr-fec/grc/CMakeLists.txt b/gr-fec/grc/CMakeLists.txt
new file mode 100644
index 0000000000..27cb5af854
--- /dev/null
+++ b/gr-fec/grc/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Copyright 2012 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.
+
+########################################################################
+file(GLOB xml_files "*.xml")
+install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "fec_python")
diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml
new file mode 100644
index 0000000000..3b54719c94
--- /dev/null
+++ b/gr-fec/grc/fec_block_tree.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Block Tree for gr-fec
+###################################################
+ -->
+<cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>FEC (New)</name>
+ <block>fec_decode_ccsds_27_fb</block>
+ <block>fec_encode_ccsds_27_bb</block>
+ </cat>
+</cat>
diff --git a/grc/blocks/gr_encode_ccsds_27_bb.xml b/gr-fec/grc/fec_decode_ccsds_27_bb.xml
index f31e6b6c82..ea11837c11 100644
--- a/grc/blocks/gr_encode_ccsds_27_bb.xml
+++ b/gr-fec/grc/fec_decode_ccsds_27_bb.xml
@@ -6,9 +6,9 @@
-->
<block>
<name>Encode CCSDS 27</name>
- <key>gr_encode_ccsds_27_bb</key>
- <import>from gnuradio import gr</import>
- <make>gr.encode_ccsds_27_bb()</make>
+ <key>fec_encode_ccsds_27_bb</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.encode_ccsds_27_bb()</make>
<sink>
<name>in</name>
<type>byte</type>
diff --git a/grc/blocks/gr_decode_ccsds_27_fb.xml b/gr-fec/grc/fec_decode_ccsds_27_fb.xml
index 03b31db831..4ea2a02bf9 100644
--- a/grc/blocks/gr_decode_ccsds_27_fb.xml
+++ b/gr-fec/grc/fec_decode_ccsds_27_fb.xml
@@ -6,9 +6,9 @@
-->
<block>
<name>Decode CCSDS 27</name>
- <key>gr_decode_ccsds_27_fb</key>
- <import>from gnuradio import gr</import>
- <make>gr.decode_ccsds_27_fb()</make>
+ <key>fec_decode_ccsds_27_fb</key>
+ <import>from gnuradio import fec</import>
+ <make>fec.decode_ccsds_27_fb()</make>
<sink>
<name>in</name>
<type>float</type>
diff --git a/gr-fec/include/fec/CMakeLists.txt b/gr-fec/include/fec/CMakeLists.txt
new file mode 100644
index 0000000000..5ef1ab01b5
--- /dev/null
+++ b/gr-fec/include/fec/CMakeLists.txt
@@ -0,0 +1,83 @@
+# Copyright 2012 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 helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
+#!${PYTHON_EXECUTABLE}
+
+import sys, os, re
+sys.path.append('${GR_CORE_PYTHONPATH}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
+
+if __name__ == '__main__':
+ import build_utils
+ root, inp = sys.argv[1:3]
+ for sig in sys.argv[3:]:
+ name = re.sub ('X+', sig, root)
+ d = build_utils.standard_dict(name, sig, 'fec')
+ build_utils.expand_template(d, inp)
+
+")
+
+macro(expand_h root)
+ #make a list of all the generated files
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #install rules for the generated h files
+ list(APPEND generated_includes ${expanded_files_h})
+endmacro(expand_h)
+
+########################################################################
+# Invoke macro to generate various sources
+########################################################################
+#expand_h(foo_XX ss ii cc)
+
+add_custom_target(fec_generated_includes DEPENDS
+ ${generated_includes}
+)
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ ${generated_includes}
+ api.h
+ decode_ccsds_27_fb.h
+ encode_ccsds_27_bb.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
+ COMPONENT "fec_devel"
+)
diff --git a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i b/gr-fec/include/fec/api.h
index e74e9174ac..5d4eeafe94 100644
--- a/gnuradio-core/src/lib/general/gr_encode_ccsds_27_bb.i
+++ b/gr-fec/include/fec/api.h
@@ -1,6 +1,5 @@
-/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,12 +19,15 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,encode_ccsds_27_bb);
+#ifndef INCLUDED_FEC_API_H
+#define INCLUDED_FEC_API_H
-gr_encode_ccsds_27_bb_sptr gr_make_encode_ccsds_27_bb ();
+#include <gruel/attributes.h>
-class gr_encode_ccsds_27_bb : public gr_sync_interpolator
-{
-private:
- gr_encode_ccsds_27_bb();
-};
+#ifdef gnuradio_blocks_EXPORTS
+# define FEC_API __GR_ATTR_EXPORT
+#else
+# define FEC_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_FEC_API_H */
diff --git a/gr-fec/include/fec/decode_ccsds_27_fb.h b/gr-fec/include/fec/decode_ccsds_27_fb.h
new file mode 100644
index 0000000000..73d3ebbef0
--- /dev/null
+++ b/gr-fec/include/fec/decode_ccsds_27_fb.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifndef INCLUDED_FEC_DECODE_CCSDS_27_FB_H
+#define INCLUDED_FEC_DECODE_CCSDS_27_FB_H
+
+#include <fec/api.h>
+#include <gr_sync_decimator.h>
+
+namespace gr {
+ namespace fec {
+
+ /*! \brief A rate 1/2, k=7 convolutional decoder for the CCSDS standard
+ * \ingroup ecc
+ *
+ * This block performs soft-decision convolutional decoding using the Viterbi
+ * algorithm.
+ *
+ * The input is a stream of (possibly noise corrupted) floating point values
+ * nominally spanning [-1.0, 1.0], representing the encoded channel symbols
+ * 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
+ *
+ * The output is MSB first packed bytes of decoded values.
+ *
+ * As a rate 1/2 code, there will be one output byte for every 16 input symbols.
+ *
+ * This block is designed for continuous data streaming, not packetized data.
+ * The first 32 bits out will be zeroes, with the output delayed four bytes
+ * from the corresponding inputs.
+ */
+
+ class FEC_API decode_ccsds_27_fb : virtual public gr_sync_decimator
+ {
+ public:
+
+ // gr::fec::decode_ccsds_27_fb::sptr
+ typedef boost::shared_ptr<decode_ccsds_27_fb> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_DECODE_CCSDS_27_FB_H */
diff --git a/gr-fec/include/fec/encode_ccsds_27_bb.h b/gr-fec/include/fec/encode_ccsds_27_bb.h
new file mode 100644
index 0000000000..4a0fecd357
--- /dev/null
+++ b/gr-fec/include/fec/encode_ccsds_27_bb.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifndef INCLUDED_FEC_ENCODE_CCSDS_27_BB_H
+#define INCLUDED_FEC_ENCODE_CCSDS_27_BB_H
+
+#include <fec/api.h>
+#include <gr_sync_interpolator.h>
+
+namespace gr {
+ namespace fec {
+
+ /*! \brief A rate 1/2, k=7 convolutional encoder for the CCSDS standard
+ * \ingroup ecc
+ *
+ * This block performs convolutional encoding using the CCSDS standard
+ * polynomial ("Voyager").
+ *
+ * The input is an MSB first packed stream of bits.
+ *
+ * The output is a stream of symbols 0 or 1 representing the encoded data.
+ *
+ * As a rate 1/2 code, there will be 16 output symbols for every input byte.
+ *
+ * This block is designed for continuous data streaming, not packetized data.
+ * There is no provision to "flush" the encoder.
+ */
+
+ class FEC_API encode_ccsds_27_bb : virtual public gr_sync_interpolator
+ {
+ public:
+
+ // gr::fec::encode_ccsds_27_bb::sptr
+ typedef boost::shared_ptr<encode_ccsds_27_bb> sptr;
+
+ static sptr make();
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_ENCODE_CCSDS_27_BB_H */
diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt
new file mode 100644
index 0000000000..422acb3607
--- /dev/null
+++ b/gr-fec/lib/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Copyright 2012 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.
+
+# These are convenience libraries of 3rd party code.
+# Change to test for distro provided packages
+GR_INCLUDE_SUBDIRECTORY(reed-solomon)
+GR_INCLUDE_SUBDIRECTORY(viterbi)
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GR_FEC_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+link_directories(${FEC_LIBRARY_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gnuradio_fec_sources
+ decode_ccsds_27_fb_impl.cc
+ encode_ccsds_27_bb_impl.cc
+)
+
+list(APPEND gnuradio_fec_libs
+ gnuradio-core
+ ${Boost_LIBRARIES}
+ ${FEC_LIBRARIES}
+)
+
+add_library(gnuradio-fec SHARED ${gnuradio_fec_sources})
+target_link_libraries(gnuradio-fec ${gnuradio_fec_libs})
+GR_LIBRARY_FOO(gnuradio-fec RUNTIME_COMPONENT "fec_runtime" DEVEL_COMPONENT "fec_devel")
+
diff --git a/gr-fec/lib/decode_ccsds_27_fb_impl.cc b/gr-fec/lib/decode_ccsds_27_fb_impl.cc
new file mode 100644
index 0000000000..87bdc46402
--- /dev/null
+++ b/gr-fec/lib/decode_ccsds_27_fb_impl.cc
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "decode_ccsds_27_fb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace fec {
+
+ decode_ccsds_27_fb::sptr decode_ccsds_27_fb::make()
+ {
+ return gnuradio::get_initial_sptr(new decode_ccsds_27_fb_impl());
+ }
+
+ decode_ccsds_27_fb_impl::decode_ccsds_27_fb_impl()
+ : gr_sync_decimator("decode_ccsds_27_fb",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(char)),
+ 2*8) // Rate 1/2 code, unpacked to packed conversion
+ {
+ float RATE = 0.5;
+ float ebn0 = 12.0;
+ float esn0 = RATE*pow(10.0, ebn0/10.0);
+
+ gen_met(d_mettab, 100, esn0, 0.0, 256);
+ viterbi_chunks_init(d_state0);
+ }
+
+ int
+ decode_ccsds_27_fb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ for (int i = 0; i < noutput_items*16; i++) {
+ // Translate and clip [-1.0..1.0] to [28..228]
+ float sample = in[i]*100.0+128.0;
+ if (sample > 255.0)
+ sample = 255.0;
+ else if (sample < 0.0)
+ sample = 0.0;
+ unsigned char sym = (unsigned char)(floor(sample));
+
+ d_viterbi_in[d_count % 4] = sym;
+ if ((d_count % 4) == 3) {
+ // Every fourth symbol, perform butterfly operation
+ viterbi_butterfly2(d_viterbi_in, d_mettab, d_state0, d_state1);
+
+ // Every sixteenth symbol, read out a byte
+ if (d_count % 16 == 11) {
+ // long metric =
+ viterbi_get_output(d_state0, out++);
+ // printf("%li\n", *(out-1), metric);
+ }
+ }
+
+ d_count++;
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace fec */
+}/* namespace gr */
diff --git a/gr-fec/lib/decode_ccsds_27_fb_impl.h b/gr-fec/lib/decode_ccsds_27_fb_impl.h
new file mode 100644
index 0000000000..c02e284e70
--- /dev/null
+++ b/gr-fec/lib/decode_ccsds_27_fb_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifndef INCLUDED_FEC_DECODE_CCSDS_27_FB_IMPL_H
+#define INCLUDED_FEC_DECODE_CCSDS_27_FB_IMPL_H
+
+#include <fec/decode_ccsds_27_fb.h>
+
+extern "C" {
+#include "viterbi/viterbi.h"
+}
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API decode_ccsds_27_fb_impl : public decode_ccsds_27_fb
+ {
+ private:
+ // Viterbi state
+ int d_mettab[2][256];
+ struct viterbi_state d_state0[64];
+ struct viterbi_state d_state1[64];
+ unsigned char d_viterbi_in[16];
+
+ int d_count;
+
+ public:
+ decode_ccsds_27_fb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_DECODE_CCSDS_27_FB_IMPL_H */
diff --git a/gr-fec/lib/encode_ccsds_27_bb_impl.cc b/gr-fec/lib/encode_ccsds_27_bb_impl.cc
new file mode 100644
index 0000000000..28ee450ef4
--- /dev/null
+++ b/gr-fec/lib/encode_ccsds_27_bb_impl.cc
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "encode_ccsds_27_bb_impl.h"
+#include <gr_io_signature.h>
+
+extern "C" {
+#include "viterbi/viterbi.h"
+}
+
+namespace gr {
+ namespace fec {
+
+ encode_ccsds_27_bb::sptr encode_ccsds_27_bb::make()
+ {
+ return gnuradio::get_initial_sptr(new encode_ccsds_27_bb_impl());
+ }
+
+ encode_ccsds_27_bb_impl::encode_ccsds_27_bb_impl()
+ : gr_sync_interpolator("encode_ccsds_27_bb",
+ gr_make_io_signature (1, 1, sizeof(char)),
+ gr_make_io_signature (1, 1, sizeof(char)),
+ 16) // Rate 1/2 code, packed to unpacked conversion
+ {
+ d_encstate = 0;
+ }
+
+ int
+ encode_ccsds_27_bb_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ unsigned char *in = (unsigned char *)input_items[0];
+ unsigned char *out = (unsigned char *)output_items[0];
+
+ d_encstate = encode(out, in, noutput_items/16, d_encstate);
+
+ return noutput_items;
+ }
+
+ } /* namespace fec */
+}/* namespace gr */
diff --git a/gr-fec/lib/encode_ccsds_27_bb_impl.h b/gr-fec/lib/encode_ccsds_27_bb_impl.h
new file mode 100644
index 0000000000..140f8c2ae4
--- /dev/null
+++ b/gr-fec/lib/encode_ccsds_27_bb_impl.h
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifndef INCLUDED_FEC_ENCODE_CCSDS_27_BB_IMPL_H
+#define INCLUDED_FEC_ENCODE_CCSDS_27_BB_IMPL_H
+
+#include <fec/encode_ccsds_27_bb.h>
+
+namespace gr {
+ namespace fec {
+
+ class FEC_API encode_ccsds_27_bb_impl : public encode_ccsds_27_bb
+ {
+ private:
+ unsigned char d_encstate;
+
+ public:
+ encode_ccsds_27_bb_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace fec */
+} /* namespace gr */
+
+#endif /* INCLUDED_FEC_ENCODE_CCSDS_27_BB_IMPL_H */
diff --git a/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt b/gr-fec/lib/reed-solomon/CMakeLists.txt
index f073249f62..0858a670c5 100644
--- a/gnuradio-core/src/lib/reed-solomon/CMakeLists.txt
+++ b/gr-fec/lib/reed-solomon/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,7 +32,7 @@ if(MSVC)
)
endif(MSVC)
-set(gr_core_rs_sources
+set(gr_fec_rs_sources
${CMAKE_CURRENT_SOURCE_DIR}/encode_rs.c
${CMAKE_CURRENT_SOURCE_DIR}/decode_rs.c
${CMAKE_CURRENT_SOURCE_DIR}/init_rs.c
@@ -41,22 +41,22 @@ set(gr_core_rs_sources
########################################################################
# Setup sources and includes
########################################################################
-list(APPEND gnuradio_core_sources ${gr_core_rs_sources})
+list(APPEND gnuradio_fec_sources ${gr_fec_rs_sources})
-install(
- FILES ${CMAKE_CURRENT_SOURCE_DIR}/rs.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
- COMPONENT "core_devel"
-)
+#install(
+# FILES ${CMAKE_CURRENT_SOURCE_DIR}/rs.h
+# DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
+# COMPONENT "fec_devel"
+#)
########################################################################
# Register unit tests
########################################################################
if(ENABLE_TESTING)
-add_executable(gr_core_rstest
- ${gr_core_rs_sources}
+add_executable(gr_fec_rstest
+ ${gr_fec_rs_sources}
${CMAKE_CURRENT_SOURCE_DIR}/rstest.c
${CMAKE_CURRENT_SOURCE_DIR}/exercise.c
)
-add_test(gr-core-reed-solomon-test gr_core_rstest)
+add_test(gr-fec-reed-solomon-test gr_fec_rstest)
endif(ENABLE_TESTING)
diff --git a/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn b/gr-fec/lib/reed-solomon/Makefile.in.karn
index 8550b41581..8550b41581 100644
--- a/gnuradio-core/src/lib/reed-solomon/Makefile.in.karn
+++ b/gr-fec/lib/reed-solomon/Makefile.in.karn
diff --git a/gnuradio-core/src/lib/reed-solomon/README b/gr-fec/lib/reed-solomon/README
index 341832dbd5..5c867638ef 100644
--- a/gnuradio-core/src/lib/reed-solomon/README
+++ b/gr-fec/lib/reed-solomon/README
@@ -1,5 +1,2 @@
This code is from http://people.qualcomm.com/karn/code/fec
It is based on reed-soloman-3.1.1 (1 Jan 2002).
-
-I has been converted to use automake, to better integrate with GNU
-Radio's build strategy.
diff --git a/gnuradio-core/src/lib/reed-solomon/README.karn b/gr-fec/lib/reed-solomon/README.karn
index f30644ffea..f30644ffea 100644
--- a/gnuradio-core/src/lib/reed-solomon/README.karn
+++ b/gr-fec/lib/reed-solomon/README.karn
diff --git a/gnuradio-core/src/lib/reed-solomon/ccsds.h b/gr-fec/lib/reed-solomon/ccsds.h
index 0f2bde6186..0f2bde6186 100644
--- a/gnuradio-core/src/lib/reed-solomon/ccsds.h
+++ b/gr-fec/lib/reed-solomon/ccsds.h
diff --git a/gnuradio-core/src/lib/reed-solomon/char.h b/gr-fec/lib/reed-solomon/char.h
index 7b2030a0b0..bc4fd8a1ba 100644
--- a/gnuradio-core/src/lib/reed-solomon/char.h
+++ b/gr-fec/lib/reed-solomon/char.h
@@ -6,7 +6,7 @@
#define DTYPE unsigned char
-#include <gr_core_api.h>
+#include <fec/api.h>
/* Reed-Solomon codec control block */
struct rs {
@@ -46,11 +46,11 @@ static inline unsigned int modnn(struct rs *rs, unsigned int x){
#define INIT_RS init_rs_char
#define FREE_RS free_rs_char
-GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
-GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras);
-GR_CORE_API void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
+FEC_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
+FEC_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras);
+FEC_API void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
unsigned int prim,unsigned int nroots);
-GR_CORE_API void FREE_RS(void *p);
+FEC_API void FREE_RS(void *p);
diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs.c b/gr-fec/lib/reed-solomon/decode_rs.c
index f9438cf266..f9438cf266 100644
--- a/gnuradio-core/src/lib/reed-solomon/decode_rs.c
+++ b/gr-fec/lib/reed-solomon/decode_rs.c
diff --git a/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c b/gr-fec/lib/reed-solomon/decode_rs_ccsds.c
index 2543d3a640..2543d3a640 100644
--- a/gnuradio-core/src/lib/reed-solomon/decode_rs_ccsds.c
+++ b/gr-fec/lib/reed-solomon/decode_rs_ccsds.c
diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs.c b/gr-fec/lib/reed-solomon/encode_rs.c
index cd31f32c6e..cd31f32c6e 100644
--- a/gnuradio-core/src/lib/reed-solomon/encode_rs.c
+++ b/gr-fec/lib/reed-solomon/encode_rs.c
diff --git a/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c b/gr-fec/lib/reed-solomon/encode_rs_ccsds.c
index a748b34689..a748b34689 100644
--- a/gnuradio-core/src/lib/reed-solomon/encode_rs_ccsds.c
+++ b/gr-fec/lib/reed-solomon/encode_rs_ccsds.c
diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gr-fec/lib/reed-solomon/exercise.c
index de33a6bff3..de33a6bff3 100644
--- a/gnuradio-core/src/lib/reed-solomon/exercise.c
+++ b/gr-fec/lib/reed-solomon/exercise.c
diff --git a/gnuradio-core/src/lib/reed-solomon/fixed.h b/gr-fec/lib/reed-solomon/fixed.h
index 30091e7bf3..ee4ae2e714 100644
--- a/gnuradio-core/src/lib/reed-solomon/fixed.h
+++ b/gr-fec/lib/reed-solomon/fixed.h
@@ -7,7 +7,7 @@
*/
#define DTYPE unsigned char
-#include <gr_core_api.h>
+#include <fec/api.h>
static inline int mod255(int x){
while (x >= 255) {
@@ -36,5 +36,5 @@ extern unsigned char CCSDS_poly[];
#define ENCODE_RS encode_rs_8
#define DECODE_RS decode_rs_8
-GR_CORE_API void ENCODE_RS(DTYPE *data,DTYPE *parity);
-GR_CORE_API int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras); \ No newline at end of file
+FEC_API void ENCODE_RS(DTYPE *data,DTYPE *parity);
+FEC_API int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras); \ No newline at end of file
diff --git a/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c b/gr-fec/lib/reed-solomon/gen_ccsds.c
index 1e4e4f5363..1e4e4f5363 100644
--- a/gnuradio-core/src/lib/reed-solomon/gen_ccsds.c
+++ b/gr-fec/lib/reed-solomon/gen_ccsds.c
diff --git a/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c b/gr-fec/lib/reed-solomon/gen_ccsds_tal.c
index 9dde18917b..9dde18917b 100644
--- a/gnuradio-core/src/lib/reed-solomon/gen_ccsds_tal.c
+++ b/gr-fec/lib/reed-solomon/gen_ccsds_tal.c
diff --git a/gnuradio-core/src/lib/reed-solomon/init_rs.c b/gr-fec/lib/reed-solomon/init_rs.c
index 4ec77cd723..4ec77cd723 100644
--- a/gnuradio-core/src/lib/reed-solomon/init_rs.c
+++ b/gr-fec/lib/reed-solomon/init_rs.c
diff --git a/gnuradio-core/src/lib/reed-solomon/int.h b/gr-fec/lib/reed-solomon/int.h
index 403d68757b..6bb00fd102 100644
--- a/gnuradio-core/src/lib/reed-solomon/int.h
+++ b/gr-fec/lib/reed-solomon/int.h
@@ -5,10 +5,10 @@
*/
#define DTYPE int
-#include <gr_core_api.h>
+#include <fec/api.h>
/* Reed-Solomon codec control block */
-struct GR_CORE_API rs {
+struct FEC_API rs {
unsigned int mm; /* Bits per symbol */
unsigned int nn; /* Symbols per block (= (1<<mm)-1) */
int *alpha_to; /* log lookup table */
@@ -45,11 +45,11 @@ static inline int modnn(struct rs *rs,int x){
#define INIT_RS init_rs_int
#define FREE_RS free_rs_int
-GR_CORE_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
-GR_CORE_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras);
+FEC_API void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
+FEC_API int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras);
void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
unsigned int prim,unsigned int nroots);
-GR_CORE_API void FREE_RS(void *p);
+FEC_API void FREE_RS(void *p);
diff --git a/gnuradio-core/src/lib/reed-solomon/rs.3 b/gr-fec/lib/reed-solomon/rs.3
index c3953ce57a..c3953ce57a 100644
--- a/gnuradio-core/src/lib/reed-solomon/rs.3
+++ b/gr-fec/lib/reed-solomon/rs.3
diff --git a/gr-fec/lib/reed-solomon/rs.h b/gr-fec/lib/reed-solomon/rs.h
new file mode 100644
index 0000000000..be7ed51b42
--- /dev/null
+++ b/gr-fec/lib/reed-solomon/rs.h
@@ -0,0 +1,31 @@
+#include <fec/api.h>
+/* User include file for the Reed-Solomon codec
+ * Copyright 2002, Phil Karn KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+
+/* General purpose RS codec, 8-bit symbols */
+FEC_API void encode_rs_char(void *rs,unsigned char *data,unsigned char *parity);
+FEC_API int decode_rs_char(void *rs,unsigned char *data,int *eras_pos,
+ int no_eras);
+FEC_API void *init_rs_char(unsigned int symsize,unsigned int gfpoly,
+ unsigned int fcr,unsigned int prim,unsigned int nroots);
+FEC_API void free_rs_char(void *rs);
+
+/* General purpose RS codec, integer symbols */
+FEC_API void encode_rs_int(void *rs,int *data,int *parity);
+FEC_API int decode_rs_int(void *rs,int *data,int *eras_pos,int no_eras);
+FEC_API void *init_rs_int(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
+ unsigned int prim,unsigned int nroots);
+FEC_API void free_rs_int(void *rs);
+
+/* CCSDS standard (255,223) RS codec with conventional (*not* dual-basis)
+ * symbol representation
+ */
+FEC_API void encode_rs_8(unsigned char *data,unsigned char *parity);
+FEC_API int decode_rs_8(unsigned char *data,int *eras_pos,int no_eras);
+
+/* Tables to map from conventional->dual (Taltab) and
+ * dual->conventional (Tal1tab) bases
+ */
+extern unsigned char Taltab[],Tal1tab[];
diff --git a/gnuradio-core/src/lib/reed-solomon/rstest.c b/gr-fec/lib/reed-solomon/rstest.c
index d8fc5448a7..d8fc5448a7 100644
--- a/gnuradio-core/src/lib/reed-solomon/rstest.c
+++ b/gr-fec/lib/reed-solomon/rstest.c
diff --git a/gnuradio-core/src/lib/viterbi/CMakeLists.txt b/gr-fec/lib/viterbi/CMakeLists.txt
index add5c77e80..6605556a84 100644
--- a/gnuradio-core/src/lib/viterbi/CMakeLists.txt
+++ b/gr-fec/lib/viterbi/CMakeLists.txt
@@ -43,16 +43,16 @@ endif(MSVC)
########################################################################
# Append gnuradio-core library sources
########################################################################
-list(APPEND gnuradio_core_sources ${viterbi_sources})
+list(APPEND gnuradio_fec_sources ${viterbi_sources})
########################################################################
# Install runtime headers
########################################################################
-install(
- FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
- COMPONENT "core_devel"
-)
+#install(
+# FILES ${CMAKE_CURRENT_SOURCE_DIR}/viterbi.h
+# DESTINATION ${GR_INCLUDE_DIR}/gnuradio/fec
+# COMPONENT "fec_devel"
+#)
########################################################################
# Create some text executables (not registered tests)
diff --git a/gnuradio-core/src/lib/viterbi/decode.cc b/gr-fec/lib/viterbi/decode.cc
index 368e697134..368e697134 100644
--- a/gnuradio-core/src/lib/viterbi/decode.cc
+++ b/gr-fec/lib/viterbi/decode.cc
diff --git a/gnuradio-core/src/lib/viterbi/encode.cc b/gr-fec/lib/viterbi/encode.cc
index 83a85fcacb..83a85fcacb 100644
--- a/gnuradio-core/src/lib/viterbi/encode.cc
+++ b/gr-fec/lib/viterbi/encode.cc
diff --git a/gnuradio-core/src/lib/viterbi/metrics.c b/gr-fec/lib/viterbi/metrics.c
index 0d91c301ff..0d91c301ff 100644
--- a/gnuradio-core/src/lib/viterbi/metrics.c
+++ b/gr-fec/lib/viterbi/metrics.c
diff --git a/gnuradio-core/src/lib/viterbi/tab.c b/gr-fec/lib/viterbi/tab.c
index 1c135acfee..1c135acfee 100644
--- a/gnuradio-core/src/lib/viterbi/tab.c
+++ b/gr-fec/lib/viterbi/tab.c
diff --git a/gnuradio-core/src/lib/viterbi/viterbi.c b/gr-fec/lib/viterbi/viterbi.c
index fc88866035..fc88866035 100644
--- a/gnuradio-core/src/lib/viterbi/viterbi.c
+++ b/gr-fec/lib/viterbi/viterbi.c
diff --git a/gnuradio-core/src/lib/viterbi/viterbi.h b/gr-fec/lib/viterbi/viterbi.h
index bcdbe116d6..97e09d4a8d 100644
--- a/gnuradio-core/src/lib/viterbi/viterbi.h
+++ b/gr-fec/lib/viterbi/viterbi.h
@@ -24,30 +24,30 @@
* But it fits so nicely into a 32-bit machine word...
*/
-#include <gr_core_api.h>
+#include <fec/api.h>
struct viterbi_state {
unsigned long path; /* Decoded path to this state */
long metric; /* Cumulative metric to this state */
};
-GR_CORE_API
+FEC_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 */
-GR_CORE_API unsigned char
+FEC_API unsigned char
encode(unsigned char *symbols, unsigned char *data,
unsigned int nbytes,unsigned char encstate);
-GR_CORE_API void
+FEC_API void
viterbi_chunks_init(struct viterbi_state* state);
- GR_CORE_API void
+ FEC_API void
viterbi_butterfly2(unsigned char *symbols, int mettab[2][256],
struct viterbi_state *state0, struct viterbi_state *state1);
-GR_CORE_API unsigned char
+FEC_API unsigned char
viterbi_get_output(struct viterbi_state *state, unsigned char *outbuf);
diff --git a/gr-fec/python/CMakeLists.txt b/gr-fec/python/CMakeLists.txt
new file mode 100644
index 0000000000..94dc38954d
--- /dev/null
+++ b/gr-fec/python/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Copyright 2012 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.
+
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/fec
+ COMPONENT "fec_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ set(GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gnuradio-core/src/python
+ ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig
+ ${CMAKE_BINARY_DIR}/gr-fec/python
+ ${CMAKE_BINARY_DIR}/gr-fec/swig
+ )
+ set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-fec)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-fec/python/__init__.py b/gr-fec/python/__init__.py
new file mode 100644
index 0000000000..7488f4cf44
--- /dev/null
+++ b/gr-fec/python/__init__.py
@@ -0,0 +1,26 @@
+#
+# Copyright 2012 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 the gr-fec package.
+'''
+
+from fec_swig import *
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py b/gr-fec/python/qa_ecc_ccsds_27.py
index 29122ff3ed..cded055b4a 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_ecc_ccsds_27.py
+++ b/gr-fec/python/qa_ecc_ccsds_27.py
@@ -21,6 +21,7 @@
#
from gnuradio import gr, gr_unittest
+import fec_swig as fec
class test_ccsds_27 (gr_unittest.TestCase):
@@ -34,11 +35,11 @@ class test_ccsds_27 (gr_unittest.TestCase):
src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
expected = (0, 0, 0, 0, 1, 2, 3, 4, 5, 6)
src = gr.vector_source_b(src_data)
- enc = gr.encode_ccsds_27_bb()
+ enc = fec.encode_ccsds_27_bb()
b2f = gr.char_to_float()
add = gr.add_const_ff(-0.5)
mul = gr.multiply_const_ff(2.0)
- dec = gr.decode_ccsds_27_fb()
+ dec = fec.decode_ccsds_27_fb()
dst = gr.vector_sink_b()
self.tb.connect(src, enc, b2f, add, mul, dec, dst)
self.tb.run()
diff --git a/gr-fec/swig/CMakeLists.txt b/gr-fec/swig/CMakeLists.txt
new file mode 100644
index 0000000000..e90cd9d0ac
--- /dev/null
+++ b/gr-fec/swig/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Copyright 2012 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_TARGET_DEPS core_swig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GR_FEC_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}/../include
+)
+
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fec_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+
+set(GR_SWIG_LIBRARIES gnuradio-fec)
+
+GR_SWIG_MAKE(fec_swig fec_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS fec_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/fec
+ COMPONENT "fec_python"
+)
+
+install(
+ FILES
+ fec_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/fec_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "fec_swig"
+)
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i b/gr-fec/swig/fec_swig.i
index f2e13b593a..3ffed89d27 100644
--- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.i
+++ b/gr-fec/swig/fec_swig.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,12 +20,20 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,decode_ccsds_27_fb);
+#define FEC_API
-gr_decode_ccsds_27_fb_sptr gr_make_decode_ccsds_27_fb ();
+%include "gnuradio.i"
-class gr_decode_ccsds_27_fb : public gr_sync_decimator
-{
-private:
- gr_decode_ccsds_27_fb();
-};
+//load generated python docstrings
+%include "fec_swig_doc.i"
+
+%{
+#include "fec/decode_ccsds_27_fb.h"
+#include "fec/encode_ccsds_27_bb.h"
+%}
+
+%include "fec/decode_ccsds_27_fb.h"
+%include "fec/encode_ccsds_27_bb.h"
+
+GR_SWIG_BLOCK_MAGIC2(fec, decode_ccsds_27_fb);
+GR_SWIG_BLOCK_MAGIC2(fec, encode_ccsds_27_bb);
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 842e32c15e..1950976815 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -151,9 +151,6 @@
<cat>
<name>Trellis</name>
</cat>
-
- <block>gr_encode_ccsds_27_bb</block>
- <block>gr_decode_ccsds_27_fb</block>
</cat>
<cat>
<name>Probes</name>