[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] gr-error-correcting-codes/src/lib gr_streams_en...
From: |
Michael Dickens |
Subject: |
[Commit-gnuradio] gr-error-correcting-codes/src/lib gr_streams_en... |
Date: |
Fri, 14 Jul 2006 15:49:54 +0000 |
CVSROOT: /sources/gnuradio
Module name: gr-error-correcting-codes
Changes by: Michael Dickens <michaelld> 06/07/14 15:49:54
Modified files:
src/lib : gr_streams_encode_convolutional.cc
src/lib/libecc : encoder_convolutional.cc
Log message:
Added debugging comments to the gr-block;
Tweaked the feedback copying to mask off the LSB (&1), since its
absence is required for the feedback computations.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/gr_streams_encode_convolutional.cc?cvsroot=gnuradio&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc?cvsroot=gnuradio&r1=1.6&r2=1.7
Patches:
Index: gr_streams_encode_convolutional.cc
===================================================================
RCS file:
/sources/gnuradio/gr-error-correcting-codes/src/lib/gr_streams_encode_convolutional.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gr_streams_encode_convolutional.cc 9 Jul 2006 21:02:44 -0000 1.3
+++ gr_streams_encode_convolutional.cc 14 Jul 2006 15:49:54 -0000 1.4
@@ -130,6 +130,8 @@
(int n_code_inputs,
int n_code_outputs)
{
+ fprintf (stderr, "gr_s_e_c: d_encoder == %X\n", (unsigned int)d_encoder);
+
// create the correct input signature; 1 bit per input char
set_input_signature (gr_make_io_signature (n_code_inputs,
@@ -142,40 +144,38 @@
n_code_outputs,
sizeof (char)));
-// set the output multiple to 1 item, then let the encoder class
-// handle the rest internally
+ // no need to set the output multiple (to 1 item), since 1 is the
+ // default, and the encoder class handles the rest internally
- set_output_multiple (1);
+ // no need to set the relative rate (# out / # in) because for each
+ // input bit per input stream there is 1 output bit per output
+ // stream ... with a little added for termination, but ignore those.
}
gr_streams_encode_convolutional::~gr_streams_encode_convolutional
()
{
delete d_encoder;
+ d_encoder = 0;
}
/*
- * Compute the number of input bits (items in this case, since each
- * item has 1 bit in it) needed to produce 'n_output' bits (items in
- * this case, since each item has 1 bit in it).
- *
- * For convolutional encoders, there is 1 bit output per bit input per
- * stream, with the addition of a some bits for trellis termination if
- * selected. Thus the input:output bit ratio will be:
- *
- * if (streaming | no termination), 1:1
- *
- * if (not streaming & termination), roughly 1:(1+X), where "X" is the
- * total memory size of the code divided by the block length in bits.
- * But this also depends on the state of the FSM ... how many bits are
- * left before termination.
+ * Compute the number of input items needed to produce 'n_output'
+ * bits. Handled internally by the encoder.
*/
void gr_streams_encode_convolutional::forecast
(int noutput_items,
gr_vector_int &ninput_items_required)
{
+ fprintf (stderr, "gr_s_e_c::forecast: #out = %d\n",
+ noutput_items);
+
int ninput_items = d_encoder->compute_n_input_bits (noutput_items);
+
+ fprintf (stderr, "s_e_c::forecast: #out = %d, #in = %d\n",
+ noutput_items, ninput_items);
+
size_t ninputs = ninput_items_required.size();
for (size_t n = 0; n < ninputs; n++)
ninput_items_required[n] = ninput_items;
@@ -188,12 +188,18 @@
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ fprintf (stderr, "gr_s_e_c::general_work: Starting #out = %d\n",
+ noutput_items);
+
// FIXME: compute the actual number of output items (1 bit char's) created.
size_t t_n_input_items = d_encoder->compute_n_input_bits (noutput_items);
+
+#if 0
size_t t_n_output_items = d_encoder->compute_n_output_bits (t_n_input_items);
assert (t_n_output_items == ((size_t)noutput_items));
+#endif
// "work" is handled by the encoder; which returns the actual number
// of input items (1-bit char's) used.
@@ -202,6 +208,8 @@
(char **)(&output_items[0]),
(size_t) noutput_items);
+ assert (0);
+
// consume the number of used input items on all input streams
consume_each (t_n_input_items);
Index: libecc/encoder_convolutional.cc
===================================================================
RCS file:
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libecc/encoder_convolutional.cc 12 Jul 2006 23:43:38 -0000 1.6
+++ libecc/encoder_convolutional.cc 14 Jul 2006 15:49:54 -0000 1.7
@@ -411,9 +411,12 @@
std::cout << "\n";
}
- // get the FB code, and OR with 1 to make sure it's valid
+ // get the FB code; AND off the LSB for correct functionality
+ // during internal computations.
- t_in_code = ((*code_feedback)[maio(m,n)]) | 1;
+
+ t_in_code = ((memory_t)((*code_feedback)[maio(m,n)]));
+ t_in_code &= ((memory_t)(-2));
// find the memory requirement
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] gr-error-correcting-codes/src/lib gr_streams_en...,
Michael Dickens <=