commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 34/39: fec: LDPC: changing namespace of ldp


From: git
Subject: [Commit-gnuradio] [gnuradio] 34/39: fec: LDPC: changing namespace of ldpc_encoder back.
Date: Thu, 15 Oct 2015 21:21:33 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 12564af5eb11740216651735f3a58c2c37b0b1d0
Author: Tom Rondeau <address@hidden>
Date:   Mon Oct 12 11:22:07 2015 -0400

    fec: LDPC: changing namespace of ldpc_encoder back.
    
    Keep the original API for this class in 3.7. We should convert this to
    gr::fec::code in 3.8.
---
 gr-fec/include/gnuradio/fec/ldpc_encoder.h |  22 ++---
 gr-fec/lib/ldpc_encoder_impl.cc            | 142 ++++++++++++++---------------
 gr-fec/lib/ldpc_encoder_impl.h             |  45 +++++----
 3 files changed, 101 insertions(+), 108 deletions(-)

diff --git a/gr-fec/include/gnuradio/fec/ldpc_encoder.h 
b/gr-fec/include/gnuradio/fec/ldpc_encoder.h
index 5a8bb6c..aef3119 100755
--- a/gr-fec/include/gnuradio/fec/ldpc_encoder.h
+++ b/gr-fec/include/gnuradio/fec/ldpc_encoder.h
@@ -31,21 +31,19 @@
 
 namespace gr {
   namespace fec {
-    namespace code {
 
-      class FEC_API ldpc_encoder : virtual public generic_encoder
-      {
-      public:
-        static generic_encoder::sptr make(std::string alist_file, unsigned int 
gap=0);
-        static generic_encoder::sptr make_H(const ldpc_H_matrix::sptr H_obj);
+    class FEC_API ldpc_encoder : virtual public generic_encoder
+    {
+    public:
+      static generic_encoder::sptr make(std::string alist_file, unsigned int 
gap=0);
+      static generic_encoder::sptr make_H(const code::ldpc_H_matrix::sptr 
H_obj);
 
-        virtual double rate() = 0;
-        virtual bool set_frame_size(unsigned int frame_size) = 0;
-        virtual int get_output_size() = 0;
-        virtual int get_input_size() = 0;
-      };
+      virtual double rate() = 0;
+      virtual bool set_frame_size(unsigned int frame_size) = 0;
+      virtual int get_output_size() = 0;
+      virtual int get_input_size() = 0;
+    };
 
-    }
   }
 }
 
diff --git a/gr-fec/lib/ldpc_encoder_impl.cc b/gr-fec/lib/ldpc_encoder_impl.cc
index ccc9de8..95879ea 100755
--- a/gr-fec/lib/ldpc_encoder_impl.cc
+++ b/gr-fec/lib/ldpc_encoder_impl.cc
@@ -33,93 +33,91 @@
 
 namespace gr {
   namespace fec {
-    namespace code{
 
-      generic_encoder::sptr
-      ldpc_encoder::make(std::string alist_file, unsigned int gap)
-      {
-        ldpc_H_matrix::sptr H_obj = ldpc_H_matrix::make(alist_file, gap);
-        return make_H(H_obj);
-      }
-
-      generic_encoder::sptr
-      ldpc_encoder::make_H(const ldpc_H_matrix::sptr H_obj)
-      {
-        return generic_encoder::sptr
-          (new ldpc_encoder_impl(H_obj));
-      }
+    generic_encoder::sptr
+    ldpc_encoder::make(std::string alist_file, unsigned int gap)
+    {
+      code::ldpc_H_matrix::sptr H_obj = code::ldpc_H_matrix::make(alist_file, 
gap);
+      return make_H(H_obj);
+    }
 
-      ldpc_encoder_impl::ldpc_encoder_impl(const ldpc_H_matrix::sptr H_obj)
-        : generic_encoder("ldpc_encoder")
-      {
-        // LDPC parity check matrix to use for encoding
-        d_H = H_obj;
+    generic_encoder::sptr
+    ldpc_encoder::make_H(const code::ldpc_H_matrix::sptr H_obj)
+    {
+      return generic_encoder::sptr
+        (new ldpc_encoder_impl(H_obj));
+    }
 
-        d_rate = static_cast<double>(d_H->n())/static_cast<double>(d_H->k());
+    ldpc_encoder_impl::ldpc_encoder_impl(const code::ldpc_H_matrix::sptr H_obj)
+      : generic_encoder("ldpc_encoder")
+    {
+      // LDPC parity check matrix to use for encoding
+      d_H = H_obj;
 
-        // Set frame size to k, the # of bits in the information word
-        // All buffers and settings will be based on this value.
-        set_frame_size(d_H->k());
-      }
+      d_rate = static_cast<double>(d_H->n())/static_cast<double>(d_H->k());
 
-      ldpc_encoder_impl::~ldpc_encoder_impl()
-      {
-      }
+      // Set frame size to k, the # of bits in the information word
+      // All buffers and settings will be based on this value.
+      set_frame_size(d_H->k());
+    }
 
-      int
-      ldpc_encoder_impl::get_output_size()
-      {
-        //return outputSize;
-        return d_output_size;
-      }
+    ldpc_encoder_impl::~ldpc_encoder_impl()
+    {
+    }
 
-      int
-      ldpc_encoder_impl::get_input_size()
-      {
-        //return inputSize;
-        return d_frame_size;
-      }
+    int
+    ldpc_encoder_impl::get_output_size()
+    {
+      //return outputSize;
+      return d_output_size;
+    }
 
-      bool
-      ldpc_encoder_impl::set_frame_size(unsigned int frame_size)
-      {
-        bool ret = true;
+    int
+    ldpc_encoder_impl::get_input_size()
+    {
+      //return inputSize;
+      return d_frame_size;
+    }
 
-        if(frame_size % d_H->k() != 0) {
-          GR_LOG_ERROR(d_logger, boost::format("Frame size (%1% bits) must be 
a "
-                                               "multiple of the information 
word "
-                                               "size of the LDPC matrix 
(%2%).") \
-                       % frame_size % (d_H->k()));
-          throw std::runtime_error("ldpc_encoder: cannot use frame size.");
-        }
+    bool
+    ldpc_encoder_impl::set_frame_size(unsigned int frame_size)
+    {
+      bool ret = true;
+
+      if(frame_size % d_H->k() != 0) {
+        GR_LOG_ERROR(d_logger, boost::format("Frame size (%1% bits) must be a "
+                                             "multiple of the information word 
"
+                                             "size of the LDPC matrix (%2%).") 
\
+                     % frame_size % (d_H->k()));
+        throw std::runtime_error("ldpc_encoder: cannot use frame size.");
+      }
 
-        d_frame_size = frame_size;
+      d_frame_size = frame_size;
 
-        d_output_size = static_cast<int>(d_rate * d_frame_size);
+      d_output_size = static_cast<int>(d_rate * d_frame_size);
 
-        return ret;
-      }
+      return ret;
+    }
 
-      double
-      ldpc_encoder_impl::rate()
-      {
-        return d_rate;
-      }
+    double
+    ldpc_encoder_impl::rate()
+    {
+      return d_rate;
+    }
 
-      void
-      ldpc_encoder_impl::generic_work(void *inbuffer, void *outbuffer)
-      {
-        // Populate the information word
-        const unsigned char *in = (const unsigned char *)inbuffer;
-        unsigned char *out = (unsigned char*)outbuffer;
-
-        int j = 0;
-        for(int i = 0; i < get_input_size(); i+=d_H->k()) {
-          d_H->encode(&out[j], &in[i]);
-          j += d_H->n();
-        }
+    void
+    ldpc_encoder_impl::generic_work(void *inbuffer, void *outbuffer)
+    {
+      // Populate the information word
+      const unsigned char *in = (const unsigned char *)inbuffer;
+      unsigned char *out = (unsigned char*)outbuffer;
+
+      int j = 0;
+      for(int i = 0; i < get_input_size(); i+=d_H->k()) {
+        d_H->encode(&out[j], &in[i]);
+        j += d_H->n();
       }
-
     }
+
   }
 }
diff --git a/gr-fec/lib/ldpc_encoder_impl.h b/gr-fec/lib/ldpc_encoder_impl.h
index 00dd194..4a6bd82 100644
--- a/gr-fec/lib/ldpc_encoder_impl.h
+++ b/gr-fec/lib/ldpc_encoder_impl.h
@@ -24,40 +24,37 @@
 #define INCLUDED_LDPC_ENCODER_IMPL_H
 
 #include <gnuradio/fec/ldpc_encoder.h>
-#include <gnuradio/fec/ldpc_G_matrix.h>
 
 namespace gr {
   namespace fec {
-    namespace code {
 
-      class ldpc_encoder_impl : public ldpc_encoder
-      {
-      private:
-        // plug into the generic fec api
-        void generic_work(void *inbuffer, void *outbuffer);
+    class ldpc_encoder_impl : public ldpc_encoder
+    {
+    private:
+      // plug into the generic fec api
+      void generic_work(void *inbuffer, void *outbuffer);
 
-        // Number of bits in the frame to be encoded
-        unsigned int d_frame_size;
+      // Number of bits in the frame to be encoded
+      unsigned int d_frame_size;
 
-        // Number of output bits after coding
-        int d_output_size;
+      // Number of output bits after coding
+      int d_output_size;
 
-        // Rate of the code, n/k
-        double d_rate;
+      // Rate of the code, n/k
+      double d_rate;
 
-        // LDPC parity check matrix object
-        ldpc_H_matrix::sptr d_H;
+      // LDPC parity check matrix object
+      code::ldpc_H_matrix::sptr d_H;
 
-      public:
-        ldpc_encoder_impl(const ldpc_H_matrix::sptr H_obj);
-        ~ldpc_encoder_impl();
+    public:
+      ldpc_encoder_impl(const code::ldpc_H_matrix::sptr H_obj);
+      ~ldpc_encoder_impl();
 
-        double rate();
-        bool set_frame_size(unsigned int frame_size);
-        int get_output_size();
-        int get_input_size();
-      };
-    }
+      double rate();
+      bool set_frame_size(unsigned int frame_size);
+      int get_output_size();
+      int get_input_size();
+    };
   }
 }
 



reply via email to

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