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 Makefi...


From: Michael Dickens
Subject: [Commit-gnuradio] gr-error-correcting-codes/src/lib/libecc Makefi...
Date: Fri, 14 Jul 2006 17:29:25 +0000

CVSROOT:        /sources/gnuradio
Module name:    gr-error-correcting-codes
Changes by:     Michael Dickens <michaelld>     06/07/14 17:29:25

Modified files:
        src/lib/libecc : Makefile.am encoder_convolutional.cc 
Added files:
        src/lib/libecc : qa_ecc.cc qa_ecc.h 
                         qa_encoder_convolutional_ic1_ic1.cc 
                         qa_encoder_convolutional_ic1_ic1.h 

Log message:
        Added initial QA test for the ic1_ic1 convolutional encoder, both code
        and updated Makefile.am; tweaked convolutional encoder programming for
        better cross-OS compiling compatibility (hopefully).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/Makefile.am?cvsroot=gnuradio&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc?cvsroot=gnuradio&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/qa_ecc.cc?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/qa_ecc.h?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/qa_encoder_convolutional_ic1_ic1.cc?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gr-error-correcting-codes/src/lib/libecc/qa_encoder_convolutional_ic1_ic1.h?cvsroot=gnuradio&rev=1.1

Patches:
Index: Makefile.am
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Makefile.am 9 Jul 2006 18:40:42 -0000       1.6
+++ Makefile.am 14 Jul 2006 17:29:25 -0000      1.7
@@ -25,7 +25,7 @@
 
 INCLUDES = $(STD_DEFINES_AND_INCLUDES) -I..
 
-noinst_LTLIBRARIES = libecc.la
+noinst_LTLIBRARIES = libecc.la libecc-qa.la
 
 libecc_la_SOURCES =                            \
        encoder.cc code_metrics.cc              \
@@ -43,7 +43,13 @@
        encoder_turbo.h                         \
        decoder.h decoder_viterbi.h             \
        decoder_viterbi_full_block.h            \
-       decoder_viterbi_full_block_i1_ic1.h
+       decoder_viterbi_full_block_i1_ic1.h     \
+       qa_encoder_convolutional_ic1_ic1.h      \
+       qa_ecc.h
+
+libecc_qa_la_SOURCES =                                 \
+       qa_encoder_convolutional_ic1_ic1.cc     \
+       qa_ecc.cc
 
 # link the library against the c++ standard library
 libecc_la_LIBADD =             \

Index: encoder_convolutional.cc
===================================================================
RCS file: 
/sources/gnuradio/gr-error-correcting-codes/src/lib/libecc/encoder_convolutional.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- encoder_convolutional.cc    14 Jul 2006 15:49:54 -0000      1.7
+++ encoder_convolutional.cc    14 Jul 2006 17:29:25 -0000      1.8
@@ -281,7 +281,8 @@
   std::vector<size_t> t_states_ndx_soai;
   size_t t_max_delay_soai, t_total_n_delays_soai, t_n_memories_soai;
 
-  t_fb_generators_soai = d_code_feedback;
+  for (size_t m = 0; m < d_code_feedback.size (); m++)
+    t_fb_generators_soai[m] = d_code_feedback[m];
   t_n_delays_soai = d_n_delays;
   t_io_num_soai = d_io_num;
   t_states_ndx_soai = d_states_ndx;
@@ -331,7 +332,9 @@
     // use soai
     d_do_encode_soai = true;
 
-    d_code_feedback = t_fb_generators_soai;
+    for (size_t m = 0; m < d_code_feedback.size (); m++)
+      d_code_feedback[m] = t_fb_generators_soai[m];
+
     d_n_delays = t_n_delays_soai;
     d_io_num = t_io_num_soai;
     d_states_ndx = t_states_ndx_soai;
@@ -367,9 +370,9 @@
 
     for (size_t m = 0; m < d_n_memories; m++) {
       if (d_n_delays[m] == sizeof (memory_t) * g_num_bits_per_byte)
-       d_max_mem_masks[m] = -1;
+       d_max_mem_masks[m] = ((memory_t) -1);
       else
-       d_max_mem_masks[m] = (2 << d_n_delays[m]) - 1;
+       d_max_mem_masks[m] = (memory_t)((2 << (d_n_delays[m])) - 1);
     }
   }
 

Index: qa_ecc.cc
===================================================================
RCS file: qa_ecc.cc
diff -N qa_ecc.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ qa_ecc.cc   14 Jul 2006 17:29:25 -0000      1.1
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * This class gathers together all the test cases for the gr
+ * directory into a single test suite.  As you create new test cases,
+ * add them here.
+ */
+
+#include <qa_ecc.h>
+#include <qa_encoder_convolutional_ic1_ic1.h>
+
+CppUnit::TestSuite*
+qa_ecc::suite
+()
+{
+  CppUnit::TestSuite* s = new CppUnit::TestSuite ("ecc");
+
+  s->addTest (qa_encoder_convolutional_ic1_ic1::suite ());
+  
+  return (s);
+}

Index: qa_ecc.h
===================================================================
RCS file: qa_ecc.h
diff -N qa_ecc.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ qa_ecc.h    14 Jul 2006 17:29:25 -0000      1.1
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _QA_ECC_H_
+#define _QA_ECC_H_
+
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr directory
+
+class qa_ecc {
+public:
+  //! return suite of tests for all of gr directory
+  static CppUnit::TestSuite *suite ();
+};
+
+#endif /* _QA_ECC_H_ */

Index: qa_encoder_convolutional_ic1_ic1.cc
===================================================================
RCS file: qa_encoder_convolutional_ic1_ic1.cc
diff -N qa_encoder_convolutional_ic1_ic1.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ qa_encoder_convolutional_ic1_ic1.cc 14 Jul 2006 17:29:25 -0000      1.1
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "encoder_convolutional_ic1_ic1.h"
+#include <qa_encoder_convolutional_ic1_ic1.h>
+#include <cppunit/TestAssert.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+#include <stdio.h>
+
+const static int t1_code_generator[6] = {1, 0, 5, 0, 1, 6};
+
+const static char t1_in_0[10] =
+  {0, 1, 0, 0, 1, 0, 1, 0, 0, 0};
+const static char t1_in_1[10] =
+  {0, 1, 0, 0, 0, 1, 1, 0, 0, 0};
+const static char t1_in_2[10] =
+  {0, 0, 1, 1, 1, 1, 1, 0, 0, 0};
+const static char* t1_in[3] =
+  {t1_in_0, t1_in_1, t1_in_2};
+
+const static char t1_res_0[10] =
+  {0, 0, 1, 1, 1, 1, 1, 0, 0, 0};
+const static char t1_res_1[10] =
+  {0, 0, 0, 1, 1, 1, 1, 1, 0, 0};
+const static char* t1_res[2] =
+  {t1_res_0, t1_res_1};
+
+void
+qa_encoder_convolutional_ic1_ic1::t0
+()
+{
+  int n_code_inputs = 3;
+  int n_code_outputs = 2;
+  int n_output_items = 10;
+  
+  do_encoder_check ((const char**) t1_in, (const char**) t1_res,
+                   n_output_items, 100, n_code_inputs,
+                   n_code_outputs, (const int*) t1_code_generator);
+}
+
+void
+qa_encoder_convolutional_ic1_ic1::t1
+()
+{
+}
+
+void
+qa_encoder_convolutional_ic1_ic1::t2
+()
+{
+}
+
+void
+qa_encoder_convolutional_ic1_ic1::t3
+()
+{
+}
+
+void
+qa_encoder_convolutional_ic1_ic1::do_encoder_check
+(const char** c_t1_in,
+ const char** c_t1_res,
+ int n_output_items,
+ int block_size_bits,
+ int n_code_inputs,
+ int n_code_outputs,
+ const int* code_generators)
+{
+  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 =
+    new encoder_convolutional_ic1_ic1 (block_size_bits,
+                                      n_code_inputs, 
+                                      n_code_outputs,
+                                      t_code_generators);
+
+  char** t1_out = new char*[3];
+  char* t1_out_0 = new char[n_output_items];
+  t1_out[0] = t1_out_0;
+  char* t1_out_1 = new char[n_output_items];
+  t1_out[1] = t1_out_1;
+  char* t1_out_2 = new char[n_output_items];
+  t1_out[2] = t1_out_2;
+  
+  t_encoder->encode (c_t1_in, n_output_items, (char**) t1_out);
+
+  for (int m = 0; m < n_code_outputs; m++) {
+    for (int n = 0; n < n_output_items; n++) {
+      CPPUNIT_ASSERT_EQUAL (c_t1_res[m][n], t1_out[m][n]);
+    }
+  }
+
+  delete t_encoder;
+}

Index: qa_encoder_convolutional_ic1_ic1.h
===================================================================
RCS file: qa_encoder_convolutional_ic1_ic1.h
diff -N qa_encoder_convolutional_ic1_ic1.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ qa_encoder_convolutional_ic1_ic1.h  14 Jul 2006 17:29:25 -0000      1.1
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H
+#define INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_encoder_convolutional_ic1_ic1 : public CppUnit::TestCase {
+
+  CPPUNIT_TEST_SUITE (qa_encoder_convolutional_ic1_ic1);
+  CPPUNIT_TEST (t0);
+  CPPUNIT_TEST (t1);
+  CPPUNIT_TEST (t2);
+  CPPUNIT_TEST (t3);
+  CPPUNIT_TEST_SUITE_END ();
+
+ private:
+  void do_encoder_check (const char** c_t1_in,
+                        const char** c_t1_res,
+                        int n_output_items,
+                        int block_size_bits,
+                        int n_code_inputs,
+                        int n_code_outputs,
+                        const int* code_generators);
+
+  void t0 ();
+  void t1 ();
+  void t2 ();
+  void t3 ();
+};
+
+
+#endif /* INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H */




reply via email to

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