summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc12
-rw-r--r--gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h12
-rw-r--r--gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc5
-rw-r--r--gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h8
-rw-r--r--gr-error-correcting-codes/src/lib/libecc/code_metrics.cc15
-rw-r--r--gr-error-correcting-codes/src/lib/libecc/decoder.cc60
-rw-r--r--gr-error-correcting-codes/src/lib/libecc/decoder.h2
-rw-r--r--gr-error-correcting-codes/src/lib/libecc/encoder.cc10
8 files changed, 81 insertions, 43 deletions
diff --git a/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc b/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
index dfb00932a..937cd8e91 100644
--- a/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
+++ b/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
@@ -35,7 +35,7 @@ ecc_make_metrics_decode_viterbi_full_block
int frame_size_bits,
int n_code_inputs,
int n_code_outputs,
- const std::vector<int> &code_generator,
+ const std::vector<int>& code_generator,
bool do_termination,
int start_memory_state,
int end_memory_state)
@@ -58,8 +58,8 @@ ecc_make_metrics_decode_viterbi_full_block_feedback
int frame_size_bits,
int n_code_inputs,
int n_code_outputs,
- const std::vector<int> &code_generator,
- const std::vector<int> &code_feedback,
+ const std::vector<int>& code_generator,
+ const std::vector<int>& code_feedback,
bool do_termination,
int start_memory_state,
int end_memory_state)
@@ -82,7 +82,7 @@ ecc_metrics_decode_viterbi_full_block::ecc_metrics_decode_viterbi_full_block
int frame_size_bits,
int n_code_inputs,
int n_code_outputs,
- const std::vector<int> &code_generator,
+ const std::vector<int>& code_generator,
bool do_termination,
int start_memory_state,
int end_memory_state)
@@ -106,8 +106,8 @@ ecc_metrics_decode_viterbi_full_block::ecc_metrics_decode_viterbi_full_block
int frame_size_bits,
int n_code_inputs,
int n_code_outputs,
- const std::vector<int> &code_generator,
- const std::vector<int> &code_feedback,
+ const std::vector<int>& code_generator,
+ const std::vector<int>& code_feedback,
bool do_termination,
int start_memory_state,
int end_memory_state)
diff --git a/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h b/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
index b25f35b1f..aa2e5ebad 100644
--- a/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
+++ b/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
@@ -39,7 +39,7 @@ ecc_make_metrics_decode_viterbi_full_block
int frame_size_bits,
int n_code_inputs,
int n_code_outputs,
- std::vector<int>& code_generator,
+ const std::vector<int>& code_generator,
bool do_termination = true,
int start_memory_state = 0,
int end_memory_state = 0);
@@ -50,8 +50,8 @@ ecc_make_metrics_decode_viterbi_full_block_feedback
int frame_size_bits,
int n_code_inputs,
int n_code_outputs,
- std::vector<int>& code_generator,
- std::vector<int>& code_feedback,
+ const std::vector<int>& code_generator,
+ const std::vector<int>& code_feedback,
bool do_termination = true,
int start_memory_state = 0,
int end_memory_state = 0);
@@ -159,9 +159,9 @@ public:
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);
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items);
};
#endif /* INCLUDED_ECC_METRICS_DECODE_VITERBI_FULL_BLOCK_H */
diff --git a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
index 0235ab69b..027241f6d 100644
--- a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
+++ b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
@@ -84,7 +84,6 @@ ecc_syms_to_metrics::ecc_syms_to_metrics
// use the static "create" member function to create the actual
// code_metrics to use.
-#if 0
d_code_metrics_table = libecc_code_metrics_create_table<float>
(&pdf_fcn_0,
&pdf_fcn_1,
@@ -96,7 +95,6 @@ ecc_syms_to_metrics::ecc_syms_to_metrics
// get the output item size in bytes from the new code_metrics.
d_out_item_size_bytes = d_code_metrics_table->out_item_size_bytes ();
-#endif
// set the output signature to match that which the code_metrics
// will generate.
@@ -137,11 +135,8 @@ ecc_syms_to_metrics::general_work
float* t_in_buf = (float*)(&input_items[n]);
void* t_out_buf_0_bit = (void*)(&(output_items[2*n]));
void* t_out_buf_1_bit = (void*)(&(output_items[(2*n)+1]));
-
-#if 0
d_code_metrics_table->convert (l_n_output_items, t_in_buf,
t_out_buf_0_bit, t_out_buf_1_bit);
-#endif
}
// consume the number of used input items on all input streams
diff --git a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
index 4405241f0..0f4577ad7 100644
--- a/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
+++ b/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
@@ -106,16 +106,10 @@ protected:
int sample_precision);
size_t d_out_item_size_bytes;
-#if 0
code_metrics_table<float>* d_code_metrics_table;
-#endif
public:
- ~ecc_syms_to_metrics() {
-#if 0
- delete d_code_metrics_table;
-#endif
- };
+ ~ecc_syms_to_metrics() {delete d_code_metrics_table;};
bool check_topology (int ninputs, int noutputs);
diff --git a/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc b/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc
index c1278498d..cd4ffe232 100644
--- a/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc
+++ b/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc
@@ -324,6 +324,21 @@ code_metrics_table_work<pdf_fcn_io_t,metric_t>::convert
lookup (*sym++, (void*) l_bit_0++, (void*) l_bit_1++);
}
+// force the compiler to instantiate a particular version of the
+// templated super-class, for <float> PDF function precision because
+// all code_metrics classes are created by this function, this is the
+// only one which is required to instantaite.
+
+template
+code_metrics_table<float>*
+libecc_code_metrics_create_table<float>
+(float (*pdf_fcn_0_bit) (float),
+ float (*pdf_fcn_1_bit) (float),
+ size_t n_samples,
+ float min_sample,
+ float max_sample,
+ int sample_precision);
+
#if 0
// for compute_all_outputs
diff --git a/gr-error-correcting-codes/src/lib/libecc/decoder.cc b/gr-error-correcting-codes/src/lib/libecc/decoder.cc
index ff4889b23..b0cf8e81f 100644
--- a/gr-error-correcting-codes/src/lib/libecc/decoder.cc
+++ b/gr-error-correcting-codes/src/lib/libecc/decoder.cc
@@ -47,15 +47,16 @@ decoder::decode
size_t n_bits_to_output)
{
if (in_buf == 0) {
- std::cerr << "decoder::decode: Error: input buffer is NULL.\n";
+ std::cerr << "decoder::decode{output}: Error: input buffer is NULL.\n";
assert (0);
}
if (out_buf == 0) {
- std::cerr << "decoder::decode: Error: output buffer is NULL.\n";
+ std::cerr << "decoder::decode{output}: Error: output buffer is NULL.\n";
assert (0);
}
if (n_bits_to_output == 0) {
- std::cerr << "decoder::decode: Warning: no output bits requested.\n";
+ std::cerr << "decoder::decode{output}: Warning: "
+ "no output bits requested.\n";
return (0);
}
@@ -68,7 +69,7 @@ decoder::decode
// check that there are enough output buffer items
if (d_out_buf->n_items_left() < n_bits_to_output) {
- std::cerr << "encoder::encode: Warning: output buffer size (" <<
+ std::cerr << "encoder::encode{output}: Warning: output buffer size (" <<
d_out_buf->n_items_left() << ") is less than the desired number "
"of output items (" << n_bits_to_output <<
") ... using lower number.\n";
@@ -80,7 +81,7 @@ decoder::decode
size_t n_items_to_input = compute_n_input_items (n_bits_to_output);
if (d_in_buf->n_items_left() < n_items_to_input) {
- std::cerr << "encoder::encode: Warning: input buffer size (" <<
+ std::cerr << "encoder::encode{output}: Warning: input buffer size (" <<
d_in_buf->n_items_left() << ") is less than the computed number "
"of required input items (" << n_items_to_input <<
") ... using lower number.\n";
@@ -88,10 +89,18 @@ decoder::decode
n_bits_to_output = compute_n_output_bits (n_items_to_input);
}
+ // set the correct number of I/O bits
+
+ d_n_items_to_input = n_items_to_input;
+ d_n_bits_to_output = n_bits_to_output;
+
if (DO_PRINT_DEBUG) {
std::cout <<
- "# output bits = " << n_bits_to_output << "\n"
- "# input items = " << n_items_to_input << "\n";
+ "Before Decoding{output}:\n"
+ " # output bits = " << d_n_bits_to_output << "\n"
+ " # input items = " << d_n_items_to_input << "\n"
+ " # output bits used = " << d_out_buf->n_items_used() << "\n"
+ " # input items used = " << d_in_buf->n_items_used() << "\n";
}
// call the private decode function
@@ -100,8 +109,11 @@ decoder::decode
if (DO_PRINT_DEBUG) {
std::cout <<
- "# input items used = " << d_in_buf->n_items_used() << "\n"
- "# output bits used = " << d_out_buf->n_items_used() << "\n";
+ "After Encoding{output}:\n"
+ " # output bits = " << d_n_bits_to_output << "\n"
+ " # input items = " << d_n_items_to_input << "\n"
+ " # output bits used = " << d_out_buf->n_items_used() << "\n"
+ " # input items used = " << d_in_buf->n_items_used() << "\n";
}
size_t n_items_used = d_in_buf->n_items_used ();
@@ -134,15 +146,16 @@ decoder::decode
code_output_ptr out_buf)
{
if (in_buf == 0) {
- std::cerr << "encoder::encode: Error: input buffer is NULL.\n";
+ std::cerr << "encoder::encode{input}: Error: input buffer is NULL.\n";
assert (0);
}
if (out_buf == 0) {
- std::cerr << "encoder::encode: Error: output buffer is NULL.\n";
+ std::cerr << "encoder::encode{input}: Error: output buffer is NULL.\n";
assert (0);
}
if (n_items_to_input == 0) {
- std::cerr << "encoder::encode: Warning: no input items requested.\n";
+ std::cerr << "encoder::encode{input}: Warning: "
+ "no input items requested.\n";
return (0);
}
@@ -155,7 +168,7 @@ decoder::decode
// check that there are enough input buffer items
if (d_in_buf->n_items_left() < n_items_to_input) {
- std::cerr << "encoder::encode: Warning: input buffer size (" <<
+ std::cerr << "encoder::encode{input}: Warning: input buffer size (" <<
d_in_buf->n_items_left() << ") is less than the desired number "
"of input items (" << n_items_to_input <<
") ... using lower number.\n";
@@ -167,7 +180,7 @@ decoder::decode
size_t n_bits_to_output = compute_n_output_bits (n_items_to_input);
if (d_out_buf->n_items_left() < n_bits_to_output) {
- std::cerr << "encoder::encode: Warning: output buffer size (" <<
+ std::cerr << "encoder::encode{input}: Warning: output buffer size (" <<
d_out_buf->n_items_left() << ") is less than the computed number "
"of required output items (" << n_bits_to_output <<
") ... using lower number.\n";
@@ -175,10 +188,18 @@ decoder::decode
n_items_to_input = compute_n_input_items (n_bits_to_output);
}
+ // set the correct number of I/O bits
+
+ d_n_items_to_input = n_items_to_input;
+ d_n_bits_to_output = n_bits_to_output;
+
if (DO_PRINT_DEBUG) {
std::cout <<
- "# output bits = " << n_bits_to_output << "\n"
- "# input items = " << n_items_to_input << "\n";
+ "Before Decoding{output}:\n"
+ " # output bits = " << d_n_bits_to_output << "\n"
+ " # input items = " << d_n_items_to_input << "\n"
+ " # output bits used = " << d_out_buf->n_items_used() << "\n"
+ " # input items used = " << d_in_buf->n_items_used() << "\n";
}
// call the private decode function
@@ -187,8 +208,11 @@ decoder::decode
if (DO_PRINT_DEBUG) {
std::cout <<
- "# input items used = " << d_in_buf->n_items_used() << "\n"
- "# output bits used = " << d_out_buf->n_items_used() << "\n";
+ "After Encoding{output}:\n"
+ " # output bits = " << d_n_bits_to_output << "\n"
+ " # input items = " << d_n_items_to_input << "\n"
+ " # output bits used = " << d_out_buf->n_items_used() << "\n"
+ " # input items used = " << d_in_buf->n_items_used() << "\n";
}
size_t n_items_used = d_out_buf->n_items_used();
diff --git a/gr-error-correcting-codes/src/lib/libecc/decoder.h b/gr-error-correcting-codes/src/lib/libecc/decoder.h
index 860800110..b8a2acf12 100644
--- a/gr-error-correcting-codes/src/lib/libecc/decoder.h
+++ b/gr-error-correcting-codes/src/lib/libecc/decoder.h
@@ -83,7 +83,7 @@ protected:
virtual void decode_private () = 0;
size_t d_block_size_bits, d_n_code_inputs, d_n_code_outputs;
- size_t d_total_n_dec_bits;
+ size_t d_total_n_dec_bits, d_n_items_to_input, d_n_bits_to_output;
code_input_ptr d_in_buf;
code_output_ptr d_out_buf;
};
diff --git a/gr-error-correcting-codes/src/lib/libecc/encoder.cc b/gr-error-correcting-codes/src/lib/libecc/encoder.cc
index 7e7718af1..124c1eb1d 100644
--- a/gr-error-correcting-codes/src/lib/libecc/encoder.cc
+++ b/gr-error-correcting-codes/src/lib/libecc/encoder.cc
@@ -118,6 +118,11 @@ encoder::encode
" # input bits used = " << d_in_buf->n_items_used() << "\n";
}
+ // clear these buffers, just in case
+
+ d_in_buf = 0;
+ d_out_buf = 0;
+
// return the actual number of input bits used
return (n_bits_to_input - d_n_bits_to_input);
@@ -209,6 +214,11 @@ encoder::encode
" # input bits used = " << d_in_buf->n_items_used() << "\n";
}
+ // clear these buffers, just in case
+
+ d_in_buf = 0;
+ d_out_buf = 0;
+
// return the actual number of output bits written
return (n_bits_to_output - d_n_bits_to_output);