[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3372 - in gnuradio/branches/developers/michaelld/wip/
From: |
michaelld |
Subject: |
[Commit-gnuradio] r3372 - in gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib: . libecc |
Date: |
Mon, 21 Aug 2006 20:19:29 -0600 (MDT) |
Author: michaelld
Date: 2006-08-21 20:19:29 -0600 (Mon, 21 Aug 2006)
New Revision: 3372
Added:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.cc
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.h
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.i
Removed:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.i
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/Makefile.am
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc.i
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.cc
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.h
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.cc
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.h
Log:
WIP: Updated for "make check" to work.
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/Makefile.am
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/Makefile.am
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/Makefile.am
2006-08-22 02:19:29 UTC (rev 3372)
@@ -39,7 +39,7 @@
LOCAL_IFILES = \
$(top_srcdir)/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.i \
-
$(top_srcdir)/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.i
\
+
$(top_srcdir)/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.i
\
$(top_srcdir)/gr-error-correcting-codes/src/lib/ecc_streams_encode_convolutional.i
\
$(top_srcdir)/gr-error-correcting-codes/src/lib/ecc_streams_encode_turbo.i
\
$(top_srcdir)/gr-error-correcting-codes/src/lib/ecc.i
@@ -62,11 +62,11 @@
ourlib_LTLIBRARIES = _ecc.la
# These are the source files that go into the shared library
-_ecc_la_SOURCES = \
- ecc_syms_to_metrics.cc \
- ecc_metrics_decode_viterbi_full_block.cc \
- ecc_streams_encode_convolutional.cc \
- ecc_streams_encode_turbo.cc \
+_ecc_la_SOURCES = \
+ ecc_syms_to_metrics.cc \
+ ecc_metrics_decode_viterbi_lazy.cc \
+ ecc_streams_encode_convolutional.cc \
+ ecc_streams_encode_turbo.cc \
ecc.cc
# magic flags
@@ -80,10 +80,10 @@
-lstdc++
# These headers get installed in ${prefix}/include/gnuradio
-grinclude_HEADERS = \
- ecc_syms_to_metrics.h \
- ecc_metrics_decode_viterbi_full_block.h \
- ecc_streams_encode_convolutional.h \
+grinclude_HEADERS = \
+ ecc_syms_to_metrics.h \
+ ecc_metrics_decode_viterbi_lazy.h \
+ ecc_streams_encode_convolutional.h \
ecc_streams_encode_turbo.h
# These swig headers get installed in ${prefix}/include/gnuradio/swig
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc.i
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc.i
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc.i
2006-08-22 02:19:29 UTC (rev 3372)
@@ -29,7 +29,7 @@
#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
#include <ecc_streams_encode_convolutional.h>
#include <ecc_streams_encode_turbo.h>
-#include <ecc_metrics_decode_viterbi_full_block.h>
+#include <ecc_metrics_decode_viterbi_lazy.h>
#include <ecc_syms_to_metrics.h>
#include <stdexcept>
@@ -37,5 +37,5 @@
%include "ecc_streams_encode_convolutional.i"
%include "ecc_streams_encode_turbo.i"
-%include "ecc_metrics_decode_viterbi_full_block.i"
+%include "ecc_metrics_decode_viterbi_lazy.i"
%include "ecc_syms_to_metrics.i"
Deleted:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
Deleted:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
Deleted:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.i
Added:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.cc
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.cc
(rev 0)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.cc
2006-08-22 02:19:29 UTC (rev 3372)
@@ -0,0 +1,198 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <ecc_metrics_decode_viterbi_lazy.h>
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <iostream>
+
+ecc_metrics_decode_viterbi_lazy_sptr
+ecc_make_metrics_decode_viterbi_lazy
+(const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision,
+ int full_or_partial,
+ int n_bits_before_decode)
+{
+ return ecc_metrics_decode_viterbi_lazy_sptr
+ (new ecc_metrics_decode_viterbi_lazy
+ (encoder,
+ sample_precision,
+ full_or_partial,
+ n_bits_before_decode));
+}
+
+ecc_metrics_decode_viterbi_lazy::~ecc_metrics_decode_viterbi_lazy
+()
+{
+ delete d_decoder;
+ d_decoder = 0;
+ delete d_in_buf;
+ d_in_buf = 0;
+ delete d_out_buf;
+ d_out_buf = 0;
+}
+
+ecc_metrics_decode_viterbi_lazy::ecc_metrics_decode_viterbi_lazy
+(const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision,
+ int full_or_partial,
+ int n_bits_before_decode)
+ : gr_block ("metrics_decode_viterbi_lazy",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (0, 0, 0))
+{
+ if (encoder == 0) {
+ std::cerr << "ecc_metrics_decode_viterbi_lazy:: Error: "
+ "Provided encoder is NULL.\n";
+ assert (0);
+ }
+
+ d_encoder = encoder->encoder ();
+
+ // check the sample precision
+
+ if ((sample_precision < 1) |
+ (sample_precision > 32)) {
+ std::cerr << "ecc_metrics_decode_viterbi_lazy:: Error: "
+ "Provided sample precision (" << sample_precision <<
+ ") must be in the range [1,32] for the lazy viterbi decoder.\n";
+ assert (0);
+ }
+
+ u_int8_t l_sample_precision = (u_int8_t) sample_precision;
+
+ // convert the full or partial to a bool
+
+ bool l_full_or_partial = ((full_or_partial == 1) ?
+ G_LIBECC_DECODE_FULL :
+ G_LIBECC_DECODE_PARTIAL);
+
+ // check the # of bits before decode, if partial
+
+ if (l_full_or_partial == G_LIBECC_DECODE_PARTIAL) {
+ if (n_bits_before_decode < 0) {
+ std::cerr << "ecc_metrics_decode_viterbi_lazy:: Error: "
+ "Provided n_bits_before_decode (" << n_bits_before_decode <<
+ ") must be non-negative.\n";
+ assert (0);
+ }
+ }
+
+ size_t l_n_bits_before_decode = (size_t) l_full_or_partial;
+
+ // create the decoder
+
+ d_decoder = new decoder_viterbi_lazy (d_encoder,
+ l_sample_precision,
+ l_full_or_partial,
+ l_n_bits_before_decode);
+
+ // the input model: individual input streams; two per metric type
+ // (0-bit, 1-bit), single metric per input item (float, char, short,
+ // long)
+ //
+ // the "ic1l" output model:
+ // individual output streams per decoded code input stream;
+ // each item is a 'char' type with 1 bit aligned on the LSB.
+
+ size_t n_code_inputs = d_encoder->n_code_inputs ();
+ size_t n_code_outputs = d_encoder->n_code_outputs ();
+
+ d_out_buf = new code_output_ic1l (n_code_inputs);
+
+ // output signature is always the same:
+ // sizeof (char) with 1 bit per char as the LSB
+
+ set_output_signature (gr_make_io_signature (n_code_inputs,
+ n_code_inputs,
+ sizeof (char)));
+
+ // determine the input signature element size
+ size_t l_input_item_size_bytes;
+
+ if (sample_precision <= 8) {
+ // use char
+ l_input_item_size_bytes = sizeof (char);
+ d_in_buf = new code_input_ic (n_code_outputs);
+ } else if (sample_precision <= 16) {
+ // use short
+ l_input_item_size_bytes = sizeof (short);
+ d_in_buf = new code_input_is (n_code_outputs);
+ } else {
+ // use long
+ l_input_item_size_bytes = sizeof (long);
+ d_in_buf = new code_input_il (n_code_outputs);
+ }
+
+ set_input_signature (gr_make_io_signature (2*n_code_outputs,
+ 2*n_code_outputs,
+ l_input_item_size_bytes));
+}
+
+void ecc_metrics_decode_viterbi_lazy::forecast
+(int noutput_items,
+ gr_vector_int& ninput_items_required)
+{
+ int ninput_items = d_decoder->compute_n_input_items (noutput_items);
+ size_t ninputs = ninput_items_required.size();
+ for (size_t n = 0; n < ninputs; n++)
+ ninput_items_required[n] = ninput_items;
+}
+
+int
+ecc_metrics_decode_viterbi_lazy::general_work
+(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items)
+{
+ // compute the actual number of output items (1 bit char's) created.
+
+ size_t t_n_input_items = d_decoder->compute_n_input_items (noutput_items);
+#if 0
+ size_t t_n_output_items = d_decoder->compute_n_output_bits (t_n_input_items);
+ assert (t_n_output_items == ((size_t)noutput_items));
+#endif
+
+ // setup the i/o buffers
+
+ d_in_buf->set_buffer ((void**)(&input_items[0]), t_n_input_items);
+ d_out_buf->set_buffer ((void**)(&output_items[0]), noutput_items);
+
+ // "work" is handled by the decoder; which returns the actual number
+ // of input items (metrics) used.
+
+ t_n_input_items = d_decoder->decode (d_in_buf, d_out_buf,
+ (size_t) noutput_items);
+
+ // consume the number of used input items on all input streams
+
+ consume_each (t_n_input_items);
+
+ // returns number of items written to each output stream
+
+ return (noutput_items);
+}
Added:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.h
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.h
(rev 0)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.h
2006-08-22 02:19:29 UTC (rev 3372)
@@ -0,0 +1,113 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_ECC_METRICS_DECODE_VITERBI_LAZY_H
+#define INCLUDED_ECC_METRICS_DECODE_VITERBI_LAZY_H
+
+#include <ecc_streams_encode_convolutional.h>
+#include <libecc/decoder_viterbi_lazy.h>
+
+class ecc_metrics_decode_viterbi_lazy;
+
+typedef boost::shared_ptr<ecc_metrics_decode_viterbi_lazy>
+ecc_metrics_decode_viterbi_lazy_sptr;
+
+ecc_metrics_decode_viterbi_lazy_sptr
+ecc_make_metrics_decode_viterbi_lazy
+(const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision = 10,
+ int full_or_partial = 0,
+ int n_bits_before_decode = 0);
+
+/*!
+ * \brief Decode the incoming streams using a Viterbi-style decoder,
+ * full trellis block decoding.
+ *
+ * input: symbol metrics data.
+ *
+ * output: stream(s) of char, single bit stored in the LSB.
+ */
+
+class ecc_metrics_decode_viterbi_lazy : public gr_block
+{
+protected:
+ friend ecc_metrics_decode_viterbi_lazy_sptr
+ ecc_make_metrics_decode_viterbi_lazy
+ (const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision,
+ int full_or_partial,
+ int n_bits_before_decode);
+
+/*
+ * encoder: the encoder which was used for the original data
+ *
+ * sample_precision: if in [1,32] (== M), then use M-ary integer
+ * precision and each metric will always be in [0,(2^M)-1].
+ * Otherwise not valid for the Lazy decoder.
+ *
+ * full_or_partial: full == 1; otherwise partial is assumed
+ *
+ * full decoding: requires block coding, and decodes the whole
+ * block (plus any termination bits). Requires more memory than
+ * partial block, even though there is less bookkeeping for each
+ * output bit.
+ *
+ * partial decoding: works on block or stream data, and parses
+ * only a fixed number of input time-metrics before deciding
+ * output time-bit. Requires less memory than full block
+ * decoding, but also more bookkeeping for each output bit.
+ *
+ * n_bits_before_decode: For partial decoding only; will be ignored
+ * for full block decoding. The number of time-metrics (code output
+ * bits) to process before deciding on an output bit.
+ * 0: use 5.3 constriant-length bits
+ * otherwise: use the number of bits provided
+ */
+
+ ecc_metrics_decode_viterbi_lazy
+ (const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision,
+ int full_or_partial,
+ int n_bits_before_decode);
+
+ void setup_io_signatures (int sample_precision,
+ int n_code_inputs,
+ int n_code_outputs);
+
+ encoder_convolutional* d_encoder;
+ decoder_viterbi_lazy* d_decoder;
+ code_input_ptr d_in_buf;
+ code_output_ptr d_out_buf;
+
+public:
+ ~ecc_metrics_decode_viterbi_lazy ();
+
+ virtual void forecast (int noutput_items,
+ gr_vector_int& ninput_items_required);
+
+ virtual int general_work (int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items);
+};
+
+#endif /* INCLUDED_ECC_METRICS_DECODE_VITERBI_LAZY_H */
Added:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.i
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.i
(rev 0)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_lazy.i
2006-08-22 02:19:29 UTC (rev 3372)
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(ecc,metrics_decode_viterbi_lazy);
+
+ecc_metrics_decode_viterbi_lazy_sptr
+ecc_make_metrics_decode_viterbi_lazy
+(const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision,
+ int full_or_partial,
+ int n_bits_before_decode);
+
+class ecc_metrics_decode_viterbi_lazy : public gr_block
+{
+ ecc_metrics_decode_viterbi_lazy
+ (const ecc_streams_encode_convolutional_sptr& encoder,
+ int sample_precision,
+ int full_or_partial,
+ int n_bits_before_decode);
+};
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
2006-08-22 02:19:29 UTC (rev 3372)
@@ -84,22 +84,9 @@
// use the static "create" member function to create the actual
// code_syms_to_metrics to use.
-<<<<<<< .working
-<<<<<<< .working
- d_code_metrics_table = libecc_code_syms_to_metrics_create_table<float>
+ d_code_metrics_table = libecc_code_syms_to_metrics_create<float>
(&pdf_fcn_0, &pdf_fcn_1, n_samples,
min_sample, max_sample,sample_precision);
-=======
-=======
->>>>>>> .merge-right.r3361
- d_code_metrics_table = libecc_code_metrics_create_table<float>
- (&pdf_fcn_0,
- &pdf_fcn_1,
- n_samples,
- min_sample,
- max_sample,
- sample_precision);
->>>>>>> .merge-right.r3343
// get the output item size in bytes from the new
// code_syms_to_metrics.
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
2006-08-22 02:19:29 UTC (rev 3372)
@@ -106,17 +106,7 @@
int sample_precision);
size_t d_out_item_size_bytes;
-<<<<<<< .working
-<<<<<<< .working
code_syms_to_metrics<float>* d_code_metrics_table;
-=======
-=======
->>>>>>> .merge-right.r3361
- code_metrics_table<float>* d_code_metrics_table;
-<<<<<<< .working
->>>>>>> .merge-right.r3343
-=======
->>>>>>> .merge-right.r3361
public:
~ecc_syms_to_metrics() {delete d_code_metrics_table;};
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.cc
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.cc
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.cc
2006-08-22 02:19:29 UTC (rev 3372)
@@ -31,7 +31,7 @@
template<typename pdf_fcn_io_t>
code_syms_to_metrics<pdf_fcn_io_t>*
-libecc_code_syms_to_metrics_create_table
+libecc_code_syms_to_metrics_create
(pdf_fcn_io_t (*pdf_fcn_0_bit) (pdf_fcn_io_t),
pdf_fcn_io_t (*pdf_fcn_1_bit) (pdf_fcn_io_t),
size_t n_samples,
@@ -40,27 +40,27 @@
int sample_precision)
{
if (! pdf_fcn_0_bit) {
- std::cerr << "libecc_code_syms_to_metrics_create_table: Error: "
+ std::cerr << "libecc_code_syms_to_metrics_create: Error: "
"pdf_fcn_0_bit must be a non-null pointer to function.\n";
assert (0);
}
if (! pdf_fcn_1_bit) {
- std::cerr << "libecc_code_syms_to_metrics_create_table: Error: "
+ std::cerr << "libecc_code_syms_to_metrics_create: Error: "
"pdf_fcn_0_bit must be a non-null pointer to function.\n";
assert (0);
}
if (n_samples < 2) {
- std::cerr << "libecc_code_syms_to_metrics_create_table: Error: "
+ std::cerr << "libecc_code_syms_to_metrics_create: Error: "
"n_samples must be at least 2.\n";
assert (0);
}
if (min_sample >= max_sample) {
- std::cerr << "libecc_code_syms_to_metrics_create_table: Error: "
+ std::cerr << "libecc_code_syms_to_metrics_create: Error: "
"min_sample must be less than max_sample.\n";
assert (0);
}
if ((sample_precision < 0) | (sample_precision > 32)) {
- std::cerr << "libecc_code_syms_to_metrics_create_table: Error: "
+ std::cerr << "libecc_code_syms_to_metrics_create: Error: "
"sample_precision must be between 0 and 32.\n";
assert (0);
}
@@ -331,7 +331,7 @@
template
code_syms_to_metrics<float>*
-libecc_code_syms_to_metrics_create_table<float>
+libecc_code_syms_to_metrics_create<float>
(float (*pdf_fcn_0_bit) (float),
float (*pdf_fcn_1_bit) (float),
size_t n_samples,
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.h
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.h
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/code_syms_to_metrics.h
2006-08-22 02:19:29 UTC (rev 3372)
@@ -31,7 +31,7 @@
template<typename pdf_fcn_io_t>
code_syms_to_metrics<pdf_fcn_io_t>*
-libecc_code_syms_to_metrics_create_table
+libecc_code_syms_to_metrics_create
(pdf_fcn_io_t (*pdf_fcn_0_bit) (pdf_fcn_io_t),
pdf_fcn_io_t (*pdf_fcn_1_bit) (pdf_fcn_io_t),
size_t n_samples,
@@ -136,7 +136,7 @@
int sample_precision = 10);
friend code_syms_to_metrics<pdf_fcn_io_t>*
- libecc_code_syms_to_metrics_create_table<pdf_fcn_io_t>
+ libecc_code_syms_to_metrics_create<pdf_fcn_io_t>
(pdf_fcn_io_t (*pdf_fcn_0_bit) (pdf_fcn_io_t),
pdf_fcn_io_t (*pdf_fcn_1_bit) (pdf_fcn_io_t),
size_t n_samples,
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.cc
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.cc
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.cc
2006-08-22 02:19:29 UTC (rev 3372)
@@ -66,8 +66,8 @@
// get the trellis
- d_encoder = (code_convolutional_trellis*) encoder;
- d_trellis = d_encoder->trellis ();
+ d_encoder = (encoder_convolutional*) encoder;
+ d_trellis = (code_convolutional_trellis*) d_encoder->trellis ();
// fill the class variables
@@ -191,6 +191,68 @@
}
template<typename computation_t>
+size_t
+decoder_viterbi<computation_t>::compute_n_input_items
+(size_t n_output_bits)
+{
+ size_t n_input_items = n_output_bits;
+
+ if (d_do_streaming == true) {
+
+ // stream decoding: generally 1:1, excluding those first few bits
+
+ if (d_total_n_dec_bits < d_n_bits_before_decode) {
+
+ // still in the first d_n_bits_before_decode input items;
+
+ if ((d_total_n_dec_bits + n_output_bits) < d_n_bits_before_decode) {
+
+ // request is still within the first d_n_bits_before_decode;
+
+ n_input_items += (d_n_bits_before_decode -
+ (d_total_n_dec_bits + n_output_bits));
+ } else {
+
+ // request is outside the first d_n_bits_before_decode;
+
+ n_input_items += (d_n_bits_before_decode - d_total_n_dec_bits);
+ }
+ }
+ } else {
+
+ // block decoding
+
+ if (d_do_full_or_partial == G_LIBECC_DECODE_PARTIAL) {
+
+ // for partial, depends on many properties
+
+ } else {
+
+ // for full block decoding, depends on where in the FSM, as well
+ // as any termination bits; each block must be full before decoding.
+
+ size_t t_total_out_bits = ((d_n_dec_bits > d_block_size_bits) ?
+ d_block_size_bits :
+ d_n_dec_bits);
+ size_t t_n_blocks = ceilf (((float)(n_output_bits + t_total_out_bits)) /
+ ((float) d_block_size_bits));
+ n_input_items = ((t_n_blocks * d_total_n_inputs_per_stream) -
+ t_total_out_bits);
+ }
+ }
+
+ return (0);
+}
+
+template<typename computation_t>
+size_t
+decoder_viterbi<computation_t>::compute_n_output_bits
+(size_t n_input_items)
+{
+ return (0);
+}
+
+template<typename computation_t>
void
decoder_viterbi<computation_t>::expand_node
(void* in_node)
@@ -215,7 +277,7 @@
d_term_ndx[0] = d_n_states;
for (memory_t m = 0; m < d_n_states; m++)
- d_term_states_ndx[0] = m;
+ d_term_states_ndx[0][m] = m;
// FIXME: this might not be necessary; might be necessary to set
// just the [0] entries
@@ -287,3 +349,10 @@
#endif
}
+template
+class decoder_viterbi<float>;
+// ::decode_private();
+
+template
+class decoder_viterbi<unsigned long>;
+//::decode_private();
Modified:
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.h
===================================================================
---
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.h
2006-08-22 02:16:00 UTC (rev 3371)
+++
gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib/libecc/decoder_viterbi.h
2006-08-22 02:19:29 UTC (rev 3372)
@@ -79,7 +79,6 @@
// bits) to process before deciding on an output bit.
// 0: use 5.3 constriant-length bits
// otherwise: use the number of bits provided
- //
decoder_viterbi (const encoder_convolutional* encoder,
u_int8_t sample_precision = 10,
@@ -88,6 +87,9 @@
virtual ~decoder_viterbi () {};
+ virtual size_t compute_n_input_items (size_t n_output_bits);
+ virtual size_t compute_n_output_bits (size_t n_input_items);
+
protected:
// reset the state trellis; requires that
// "d_n_state_trellis_time_bits" be set beforehand, and depends on
@@ -160,7 +162,7 @@
size_t d_time_count, d_total_n_inputs_per_stream;
size_t d_n_saved_bits, d_n_saved_bits_start_ndx, d_n_traceback_els;
size_t d_n_states, d_n_input_combinations, d_n_bits_to_term;
- size_t d_states_ndx, d_total_n_nodes_to_alloc;
+ size_t d_states_ndx, d_total_n_nodes_to_alloc, d_n_dec_bits;
size_t d_n_code_outputs, d_n_code_inputs;
size_t d_n_state_trellis_time_bits, d_n_bits_before_decode;
bool d_do_termination, d_do_streaming, d_do_full_or_partial;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3372 - in gnuradio/branches/developers/michaelld/wip/gr-error-correcting-codes/src/lib: . libecc,
michaelld <=