commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3282 - in gnuradio/trunk/gr-error-correcting-codes/sr


From: michaelld
Subject: [Commit-gnuradio] r3282 - in gnuradio/trunk/gr-error-correcting-codes/src/lib: . libecc
Date: Mon, 14 Aug 2006 16:44:49 -0600 (MDT)

Author: michaelld
Date: 2006-08-14 16:44:48 -0600 (Mon, 14 Aug 2006)
New Revision: 3282

Modified:
   
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
   
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
   gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
   gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
   gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc
   gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.cc
   gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.h
   gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/encoder.cc
Log:
Fixes YA compile issue of a sloppy use of "const" ... should compile
now on all systems (with warnings possibly, but no errors). Mods which
force template expansion for a specific metric PDF function type
<float>, while still allowing for use-defined M-ary precision of the metrics.



Modified: 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
===================================================================
--- 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
   2006-08-14 22:40:46 UTC (rev 3281)
+++ 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.cc
   2006-08-14 22:44:48 UTC (rev 3282)
@@ -35,7 +35,7 @@
  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 @@
  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 @@
  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 @@
  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)

Modified: 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
===================================================================
--- 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
    2006-08-14 22:40:46 UTC (rev 3281)
+++ 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_metrics_decode_viterbi_full_block.h
    2006-08-14 22:44:48 UTC (rev 3282)
@@ -39,7 +39,7 @@
  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 @@
  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 @@
                         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 */

Modified: 
gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc
===================================================================
--- gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc     
2006-08-14 22:40:46 UTC (rev 3281)
+++ gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.cc     
2006-08-14 22:44:48 UTC (rev 3282)
@@ -84,7 +84,6 @@
   // 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 @@
   // 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 @@
     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

Modified: gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h
===================================================================
--- gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h      
2006-08-14 22:40:46 UTC (rev 3281)
+++ gnuradio/trunk/gr-error-correcting-codes/src/lib/ecc_syms_to_metrics.h      
2006-08-14 22:44:48 UTC (rev 3282)
@@ -106,16 +106,10 @@
                       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);
 

Modified: 
gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc
===================================================================
--- gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc     
2006-08-14 22:40:46 UTC (rev 3281)
+++ gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/code_metrics.cc     
2006-08-14 22:44:48 UTC (rev 3282)
@@ -324,6 +324,21 @@
     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
 

Modified: gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.cc
===================================================================
--- gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.cc  
2006-08-14 22:40:46 UTC (rev 3281)
+++ gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.cc  
2006-08-14 22:44:48 UTC (rev 3282)
@@ -47,15 +47,16 @@
  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 @@
   // 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 @@
   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 @@
     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 @@
 
   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 @@
  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 @@
   // 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 @@
   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 @@
     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 @@
 
   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();

Modified: gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.h
===================================================================
--- gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.h   
2006-08-14 22:40:46 UTC (rev 3281)
+++ gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/decoder.h   
2006-08-14 22:44:48 UTC (rev 3282)
@@ -83,7 +83,7 @@
   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;
 };

Modified: gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/encoder.cc
===================================================================
--- gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/encoder.cc  
2006-08-14 22:40:46 UTC (rev 3281)
+++ gnuradio/trunk/gr-error-correcting-codes/src/lib/libecc/encoder.cc  
2006-08-14 22:44:48 UTC (rev 3282)
@@ -118,6 +118,11 @@
       "  # 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 @@
       "  # 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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]