commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] gr-error-correcting-codes/src/lib/libecc encode...


From: Michael Dickens
Subject: [Commit-gnuradio] gr-error-correcting-codes/src/lib/libecc encode...
Date: Sun, 16 Jul 2006 20:54:00 +0000

CVSROOT:        /sources/gnuradio
Module name:    gr-error-correcting-codes
Changes by:     Michael Dickens <michaelld>     06/07/16 20:54:00

Modified files:
        src/lib/libecc : encoder_convolutional.cc 
                         encoder_convolutional.h 
        src/lib/libecc/tests: qa_encoder_convolutional_ic1_ic1.cc 
                              qa_encoder_convolutional_ic1_ic1.h 

Log message:
        Changes to allow for feedback to work properly, along with QA testing
        for feedback.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc?cvsroot=gnuradio&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.h?cvsroot=gnuradio&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc?cvsroot=gnuradio&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.h?cvsroot=gnuradio&r1=1.1&r2=1.2

Patches:
Index: encoder_convolutional.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- encoder_convolutional.cc    15 Jul 2006 23:48:15 -0000      1.9
+++ encoder_convolutional.cc    16 Jul 2006 20:53:59 -0000      1.10
@@ -768,7 +768,7 @@
       d_memory[p] >>= 1;
 
       if (DO_PRINT_DEBUG) {
-       std::cout << "-> " << d_memory[p] << "\n";
+       std::cout << " -> " << d_memory[p] << "\n";
       }
     }
 
@@ -783,6 +783,10 @@
       }
     }
 
+    for (size_t p = 0; p < d_n_code_outputs; p++) {
+      d_current_outputs[p] = 0;
+    }
+
     // create the output bits, by XOR'ing the individual unique
     // memory(ies) into the correct output bit
 

Index: encoder_convolutional.h
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- encoder_convolutional.h     15 Jul 2006 23:48:15 -0000      1.6
+++ encoder_convolutional.h     16 Jul 2006 20:53:59 -0000      1.7
@@ -217,7 +217,7 @@
       }
     } else {
       if (d_do_feedback == true) {
-       encode_loop_siao (in_buf, out_buf, which_counter, how_many);
+       encode_loop_siao_fb (in_buf, out_buf, which_counter, how_many);
       } else {
        encode_loop_siao (in_buf, out_buf, which_counter, how_many);
       }

Index: tests/qa_encoder_convolutional_ic1_ic1.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- tests/qa_encoder_convolutional_ic1_ic1.cc   15 Jul 2006 23:48:15 -0000      
1.2
+++ tests/qa_encoder_convolutional_ic1_ic1.cc   16 Jul 2006 20:54:00 -0000      
1.3
@@ -28,6 +28,8 @@
 #include <iomanip>
 #include <stdio.h>
 
+const static bool t0_is_soai = false;
+const static int t0_total_n_delays = 2;
 const static int t0_code_generator[6] = {1, 0, 5, 0, 1, 6};
 const static int t0_n_code_inputs = 3;
 const static int t0_n_code_outputs = 2;
@@ -59,6 +61,8 @@
                    t0_n_code_outputs, (const int*) t0_code_generator);
 }
 
+const static bool t1_is_soai = true;
+const static int t1_total_n_delays = 2;
 const static int t1_code_generator[6] = {1, 0, 0, 1, 5, 6};
 const static int t1_n_code_inputs = 2;
 const static int t1_n_code_outputs = 3;
@@ -90,16 +94,74 @@
                    t1_n_code_outputs, (const int*) t1_code_generator);
 }
 
+const static bool t2_is_soai = true;
+const static int t2_total_n_delays = 2;
+const static int t2_code_generator[6] = {1, 0, 0, 1, 5, 6};
+const static int t2_code_feedback[6] = {0, 0, 0, 0, 7, 7};
+const static int t2_n_code_inputs = 2;
+const static int t2_n_code_outputs = 3;
+const static int t2_n_input_items = 19;
+const static int t2_n_output_items = 19;
+
+const static char t2_in_0[t2_n_input_items] =
+  {0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0};
+const static char t2_in_1[t2_n_input_items] =
+  {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0};
+const static char* t2_in[t2_n_code_inputs] =
+  {t2_in_0, t2_in_1};
+
+const static char t2_res_0[t2_n_output_items] =
+  {0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0};
+const static char t2_res_1[t2_n_output_items] =
+  {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0};
+const static char t2_res_2[t2_n_output_items] =
+  {0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0};
+const static char* t2_res[t2_n_code_outputs] =
+  {t2_res_0, t2_res_1, t2_res_2};
+
 void
 qa_encoder_convolutional_ic1_ic1::t2
 ()
 {
+  do_encoder_check ((const char**) t2_in, (const char**) t2_res,
+                   t2_n_output_items, 100, t2_n_code_inputs,
+                   t2_n_code_outputs, (const int*) t2_code_generator,
+                   (const int*) t2_code_feedback);
 }
 
+const static bool t3_is_soai = false;
+const static int t3_total_n_delays = 2;
+const static int t3_code_generator[6] = {1, 0, 5, 0, 1, 6};
+const static int t3_code_feedback[6] = {0, 0, 7, 0, 0, 7};
+const static int t3_n_code_inputs = 3;
+const static int t3_n_code_outputs = 2;
+const static int t3_n_input_items = 17;
+const static int t3_n_output_items = 17;
+
+const static char t3_in_0[t3_n_input_items] =
+  {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0};
+const static char t3_in_1[t3_n_input_items] =
+  {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const static char t3_in_2[t3_n_input_items] =
+  {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0};
+const static char* t3_in[t3_n_code_inputs] =
+  {t3_in_0, t3_in_1, t3_in_2};
+
+const static char t3_res_0[t3_n_output_items] =
+  {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0};
+const static char t3_res_1[t3_n_output_items] =
+  {0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0};
+const static char* t3_res[t3_n_code_outputs] =
+  {t3_res_0, t3_res_1};
+
 void
 qa_encoder_convolutional_ic1_ic1::t3
 ()
 {
+  do_encoder_check ((const char**) t3_in, (const char**) t3_res,
+                   t3_n_output_items, 100, t3_n_code_inputs,
+                   t3_n_code_outputs, (const int*) t3_code_generator,
+                   (const int*) t3_code_feedback);
 }
 
 void
@@ -110,36 +172,43 @@
  int block_size_bits,
  int n_code_inputs,
  int n_code_outputs,
- const int* code_generators)
+ const int* code_generators,
+ const int* code_feedback)
 {
-  std::cout << "Starting Encoder Check\n";
-
   std::vector<int> t_code_generators;
   t_code_generators.assign (n_code_inputs * n_code_outputs, 0);
   for (int m = 0; m < n_code_inputs * n_code_outputs; m++)
     t_code_generators[m] = code_generators[m];
 
-  std::cout << "Creating encoder.\n";
+  encoder_convolutional_ic1_ic1* t_encoder;
 
-  encoder_convolutional_ic1_ic1* t_encoder =
-    new encoder_convolutional_ic1_ic1 (block_size_bits,
+  if (code_feedback) {
+    std::vector<int> t_code_feedback;
+    t_code_feedback.assign (n_code_inputs * n_code_outputs, 0);
+    for (int m = 0; m < n_code_inputs * n_code_outputs; m++)
+      t_code_feedback[m] = code_feedback[m];
+
+    t_encoder = new encoder_convolutional_ic1_ic1
+      (block_size_bits,
+       n_code_inputs,
+       n_code_outputs,
+       t_code_generators,
+       t_code_feedback);
+  } else {
+    t_encoder = new encoder_convolutional_ic1_ic1
+      (block_size_bits,
                                       n_code_inputs, 
                                       n_code_outputs,
                                       t_code_generators);
-
-  std::cout << "Created encoder @ " << t_encoder << "\n";
+  }
 
   char** t_out = new char*[n_code_outputs];
   for (int m = 0; m < n_code_outputs; m++) {
     t_out[m] = new char[n_output_items];
   }
 
-  std::cout << "Encoding test stream.\n";
-
   t_encoder->encode (c_in, (char**) t_out, n_output_items);
 
-  std::cout << "Comparing results.\n";
-
   for (int m = 0; m < n_code_outputs; m++) {
     for (int n = 0; n < n_output_items; n++) {
       CPPUNIT_ASSERT_EQUAL (c_res[m][n], t_out[m][n]);

Index: tests/qa_encoder_convolutional_ic1_ic1.h
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- tests/qa_encoder_convolutional_ic1_ic1.h    14 Jul 2006 19:49:25 -0000      
1.1
+++ tests/qa_encoder_convolutional_ic1_ic1.h    16 Jul 2006 20:54:00 -0000      
1.2
@@ -43,7 +43,8 @@
                         int block_size_bits,
                         int n_code_inputs,
                         int n_code_outputs,
-                        const int* code_generators);
+                        const int* code_generators,
+                        const int* code_feedback = 0);
 
   void t0 ();
   void t1 ();




reply via email to

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