[Top][All Lists]
[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: |
Tue, 18 Jul 2006 02:35:44 +0000 |
CVSROOT: /sources/gnuradio
Module name: gr-error-correcting-codes
Changes by: Michael Dickens <michaelld> 06/07/18 02:35:44
Modified files:
src/lib/libecc : encoder.cc encoder_convolutional.cc
encoder_convolutional_ic1_ic1.cc
src/lib/libecc/tests: qa_encoder_convolutional_ic1_ic1.cc
qa_encoder_convolutional_ic1_ic1.h
Log message:
Mods for proper termination in the FSM. Added extra QA tests for a
few more checks; termination seems to work, but more tests are required.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder.cc?cvsroot=gnuradio&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc?cvsroot=gnuradio&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional_ic1_ic1.cc?cvsroot=gnuradio&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc?cvsroot=gnuradio&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.h?cvsroot=gnuradio&r1=1.2&r2=1.3
Patches:
Index: encoder.cc
===================================================================
RCS file:
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- encoder.cc 14 Jul 2006 19:49:25 -0000 1.4
+++ encoder.cc 18 Jul 2006 02:35:44 -0000 1.5
@@ -28,15 +28,9 @@
#include <assert.h>
#include <iostream>
-#define DO_TIME_THOUGHPUT 1
-#define DO_PRINT_DEBUG 1
+#define DO_PRINT_DEBUG 0
-#if DO_TIME_THOUGHPUT
-#include <mld/mld_timer.h>
-#endif
-#if DO_PRINT_DEBUG
#include <mld/n2bs.h>
-#endif
char
encoder::sum_bits_mod2
Index: encoder_convolutional.cc
===================================================================
RCS file:
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- encoder_convolutional.cc 16 Jul 2006 20:53:59 -0000 1.10
+++ encoder_convolutional.cc 18 Jul 2006 02:35:44 -0000 1.11
@@ -28,15 +28,11 @@
#include <assert.h>
#include <iostream>
-#define DO_TIME_THOUGHPUT 1
-#define DO_PRINT_DEBUG 1
+#define DO_TIME_THOUGHPUT 0
+#define DO_PRINT_DEBUG 0
-#if DO_TIME_THOUGHPUT
#include <mld/mld_timer.h>
-#endif
-#if DO_PRINT_DEBUG
#include <mld/n2bs.h>
-#endif
static const int g_max_block_size_bits = 10000000;
static const int g_max_num_streams = 10;
@@ -506,10 +502,10 @@
(const char** in_buf,
char** out_buf)
{
-#if DO_TIME_THOUGHPUT
struct timeval t_tp;
+ if (DO_TIME_THOUGHPUT) {
start_timer (&t_tp);
-#endif
+ }
// reset buffer indices
@@ -582,7 +578,7 @@
// just in case; lop up to the max memory, counting down the
// number of output bits left
- if (d_do_termination == false) {
+ if (d_do_termination == true) {
encode_loop (in_buf, out_buf, &d_n_output_bits_left, d_max_delay);
// finished this loop; check for jumping to the next state
Index: encoder_convolutional_ic1_ic1.cc
===================================================================
RCS file:
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional_ic1_ic1.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- encoder_convolutional_ic1_ic1.cc 15 Jul 2006 23:48:15 -0000 1.5
+++ encoder_convolutional_ic1_ic1.cc 18 Jul 2006 02:35:44 -0000 1.6
@@ -27,12 +27,9 @@
#include <encoder_convolutional_ic1_ic1.h>
#include <assert.h>
#include <iostream>
-
-#define DO_PRINT_DEBUG 1
-
-#if DO_PRINT_DEBUG
#include <mld/n2bs.h>
-#endif
+
+#define DO_PRINT_DEBUG 0
static const int g_num_bits_per_byte = 8;
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.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- tests/qa_encoder_convolutional_ic1_ic1.cc 16 Jul 2006 20:54:00 -0000
1.3
+++ tests/qa_encoder_convolutional_ic1_ic1.cc 18 Jul 2006 02:35:44 -0000
1.4
@@ -28,8 +28,74 @@
#include <iomanip>
#include <stdio.h>
-const static bool t0_is_soai = false;
-const static int t0_total_n_delays = 2;
+
+void
+qa_encoder_convolutional_ic1_ic1::do_encoder_check
+(const char** c_in,
+ const char** c_res,
+ int n_output_items,
+ int block_size_bits,
+ int n_code_inputs,
+ int n_code_outputs,
+ const int* code_generators,
+ const int* code_feedback)
+{
+ 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];
+
+ encoder_convolutional_ic1_ic1* t_encoder;
+
+ 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);
+ }
+
+ 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];
+ }
+
+ t_encoder->encode (c_in, (char**) t_out, n_output_items);
+
+ 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]);
+ }
+ }
+
+ delete t_encoder;
+ t_encoder = 0;
+
+ for (int m = 0; m < n_code_outputs; m++) {
+ delete [] t_out[m];
+ t_out[m] = 0;
+ }
+ delete [] t_out;
+ t_out = 0;
+}
+
+// TEST 0
+//
+// checking for SOAI realization (implicitely)
+// no feedback, no termination
+
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;
@@ -61,8 +127,11 @@
t0_n_code_outputs, (const int*) t0_code_generator);
}
-const static bool t1_is_soai = true;
-const static int t1_total_n_delays = 2;
+// TEST 1
+//
+// checking for SIAO realization (implicitely)
+// no feedback, no termination
+
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;
@@ -94,8 +163,11 @@
t1_n_code_outputs, (const int*) t1_code_generator);
}
-const static bool t2_is_soai = true;
-const static int t2_total_n_delays = 2;
+// TEST 2
+//
+// checking for SIAO realization (implicitely)
+// with same feedback, no termination
+
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;
@@ -129,8 +201,11 @@
(const int*) t2_code_feedback);
}
-const static bool t3_is_soai = false;
-const static int t3_total_n_delays = 2;
+// TEST 3
+//
+// checking for SOAI realization (implicitely)
+// with same feedback, no termination
+
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;
@@ -164,64 +239,192 @@
(const int*) t3_code_feedback);
}
+// TEST 4
+//
+// checking for SIAO realization (implicitely),
+// with different feedbacks, no termination
+
+const static int t4_code_generator[6] = {1, 4, 0, 3, 1, 6};
+const static int t4_code_feedback[6] = {0, 7, 0, 5, 0, 5};
+const static int t4_n_code_inputs = 2;
+const static int t4_n_code_outputs = 3;
+const static int t4_n_input_items = 20;
+const static int t4_n_output_items = 20;
+
+const static char t4_in_0[t4_n_input_items] =
+ {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0};
+const static char t4_in_1[t4_n_input_items] =
+ {0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0};
+const static char* t4_in[t4_n_code_inputs] =
+ {t4_in_0, t4_in_1};
+
+const static char t4_res_0[t4_n_output_items] =
+ {0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0};
+const static char t4_res_1[t4_n_output_items] =
+ {0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0};
+const static char t4_res_2[t4_n_output_items] =
+ {0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0};
+const static char* t4_res[t4_n_code_outputs] =
+ {t4_res_0, t4_res_1, t4_res_2};
+
void
-qa_encoder_convolutional_ic1_ic1::do_encoder_check
-(const char** c_in,
- const char** c_res,
- int n_output_items,
- int block_size_bits,
- int n_code_inputs,
- int n_code_outputs,
- const int* code_generators,
- const int* code_feedback)
+qa_encoder_convolutional_ic1_ic1::t4
+()
{
- 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];
+ do_encoder_check ((const char**) t4_in, (const char**) t4_res,
+ t4_n_output_items, 100, t4_n_code_inputs,
+ t4_n_code_outputs, (const int*) t4_code_generator,
+ (const int*) t4_code_feedback);
+}
- encoder_convolutional_ic1_ic1* t_encoder;
+// TEST 5
+//
+// checking for SOAI realization (implicitely),
+// with different feedbacks, no termination
+
+const static int t5_code_generator[6] = {1, 0, 0, 1, 5, 7};
+const static int t5_code_feedback[6] = {0, 0, 0, 0, 7, 3};
+const static int t5_n_code_inputs = 2;
+const static int t5_n_code_outputs = 3;
+const static int t5_n_input_items = 19;
+const static int t5_n_output_items = 19;
- 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];
+const static char t5_in_0[t5_n_input_items] =
+ {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0};
+const static char t5_in_1[t5_n_input_items] =
+ {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0};
+const static char* t5_in[t5_n_code_inputs] =
+ {t5_in_0, t5_in_1};
- 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);
- }
+const static char t5_res_0[t5_n_output_items] =
+ {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0};
+const static char t5_res_1[t5_n_output_items] =
+ {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0};
+const static char t5_res_2[t5_n_output_items] =
+ {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0};
+const static char* t5_res[t5_n_code_outputs] =
+ {t5_res_0, t5_res_1, t5_res_2};
- 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];
- }
+void
+qa_encoder_convolutional_ic1_ic1::t5
+()
+{
+#if 0
+ do_encoder_check ((const char**) t5_in, (const char**) t5_res,
+ t5_n_output_items, 100, t5_n_code_inputs,
+ t5_n_code_outputs, (const int*) t5_code_generator);
+#endif
+}
- t_encoder->encode (c_in, (char**) t_out, n_output_items);
+// TEST 6
+//
+// checking for termination, no feedback
+
+const static int t6_code_generator[6] = {1, 0, 5, 0, 1, 6};
+const static int t6_n_code_inputs = 3;
+const static int t6_n_code_outputs = 2;
+const static int t6_n_input_items = 6;
+const static int t6_n_output_items = 8;
+
+const static char t6_in_0[t6_n_input_items] =
+ {0, 1, 0, 0, 1, 0};
+const static char t6_in_1[t6_n_input_items] =
+ {0, 1, 0, 0, 0, 0};
+const static char t6_in_2[t6_n_input_items] =
+ {0, 0, 1, 1, 1, 0};
+const static char* t6_in[t6_n_code_inputs] =
+ {t6_in_0, t6_in_1, t6_in_2};
+
+const static char t6_res_0[t6_n_output_items] =
+ {0, 1, 1, 1, 1, 1, 1, 0};
+const static char t6_res_1[t6_n_output_items] =
+ {0, 1, 0, 1, 0, 0, 1, 0};
+const static char* t6_res[t6_n_code_outputs] =
+ {t6_res_0, t6_res_1};
- 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]);
- }
- }
+void
+qa_encoder_convolutional_ic1_ic1::t6
+()
+{
+ do_encoder_check ((const char**) t6_in, (const char**) t6_res,
+ t6_n_output_items, 5, t6_n_code_inputs,
+ t6_n_code_outputs, (const int*) t6_code_generator);
+}
- delete t_encoder;
- t_encoder = 0;
+// TEST 7
+//
+// checking for termination, with same feedback
+
+const static int t7_code_generator[6] = {1, 0, 5, 0, 1, 6};
+const static int t7_code_feedback[6] = {0, 0, 7, 0, 0, 7};
+const static int t7_n_code_inputs = 3;
+const static int t7_n_code_outputs = 2;
+const static int t7_n_input_items = 17;
+const static int t7_n_output_items = 17;
- for (int m = 0; m < n_code_outputs; m++) {
- delete [] t_out[m];
- t_out[m] = 0;
- }
- delete [] t_out;
- t_out = 0;
+const static char t7_in_0[t7_n_input_items] =
+ {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0};
+const static char t7_in_1[t7_n_input_items] =
+ {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const static char t7_in_2[t7_n_input_items] =
+ {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0};
+const static char* t7_in[t7_n_code_inputs] =
+ {t7_in_0, t7_in_1, t7_in_2};
+
+const static char t7_res_0[t7_n_output_items] =
+ {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0};
+const static char t7_res_1[t7_n_output_items] =
+ {0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0};
+const static char* t7_res[t7_n_code_outputs] =
+ {t7_res_0, t7_res_1};
+
+void
+qa_encoder_convolutional_ic1_ic1::t7
+()
+{
+#if 0
+ do_encoder_check ((const char**) t7_in, (const char**) t7_res,
+ t7_n_output_items, 5, t7_n_code_inputs,
+ t7_n_code_outputs, (const int*) t7_code_generator,
+ (const int*) t7_code_feedback);
+#endif
+}
+
+// TEST 8
+//
+// checking for termination, with different feedback
+
+const static int t8_code_generator[6] = {1, 0, 5, 0, 1, 6};
+const static int t8_code_feedback[6] = {0, 0, 7, 0, 0, 3};
+const static int t8_n_code_inputs = 3;
+const static int t8_n_code_outputs = 2;
+const static int t8_n_input_items = 17;
+const static int t8_n_output_items = 17;
+
+const static char t8_in_0[t8_n_input_items] =
+ {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0};
+const static char t8_in_1[t8_n_input_items] =
+ {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+const static char t8_in_2[t8_n_input_items] =
+ {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0};
+const static char* t8_in[t8_n_code_inputs] =
+ {t8_in_0, t8_in_1, t8_in_2};
+
+const static char t8_res_0[t8_n_output_items] =
+ {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0};
+const static char t8_res_1[t8_n_output_items] =
+ {0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0};
+const static char* t8_res[t8_n_code_outputs] =
+ {t8_res_0, t8_res_1};
+
+void
+qa_encoder_convolutional_ic1_ic1::t8
+()
+{
+#if 0
+ do_encoder_check ((const char**) t8_in, (const char**) t8_res,
+ t8_n_output_items, 5, t8_n_code_inputs,
+ t8_n_code_outputs, (const int*) t8_code_generator,
+ (const int*) t8_code_feedback);
+#endif
}
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.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- tests/qa_encoder_convolutional_ic1_ic1.h 16 Jul 2006 20:54:00 -0000
1.2
+++ tests/qa_encoder_convolutional_ic1_ic1.h 18 Jul 2006 02:35:44 -0000
1.3
@@ -34,6 +34,11 @@
CPPUNIT_TEST (t1);
CPPUNIT_TEST (t2);
CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST (t6);
+ CPPUNIT_TEST (t7);
+ CPPUNIT_TEST (t8);
CPPUNIT_TEST_SUITE_END ();
private:
@@ -50,7 +55,11 @@
void t1 ();
void t2 ();
void t3 ();
+ void t4 ();
+ void t5 ();
+ void t6 ();
+ void t7 ();
+ void t8 ();
};
-
#endif /* INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H */