commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 16/43: fec: LDPC async decoder now running


From: git
Subject: [Commit-gnuradio] [gnuradio] 16/43: fec: LDPC async decoder now running
Date: Thu, 2 Apr 2015 19:15:50 +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 1bd6282cc2523b6f149abf66946ead0309632a4a
Author: Tim O'Shea <address@hidden>
Date:   Wed Apr 1 14:13:42 2015 -0700

    fec: LDPC async decoder now running
---
 gr-fec/include/gnuradio/fec/ldpc_decoder.h |  2 +-
 gr-fec/lib/async_decoder_impl.cc           | 28 ++++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/gr-fec/include/gnuradio/fec/ldpc_decoder.h 
b/gr-fec/include/gnuradio/fec/ldpc_decoder.h
index 3a80dcb..705bbab 100644
--- a/gr-fec/include/gnuradio/fec/ldpc_decoder.h
+++ b/gr-fec/include/gnuradio/fec/ldpc_decoder.h
@@ -60,7 +60,7 @@ class FEC_API ldpc_decoder : public generic_decoder {
  public:
     ~ldpc_decoder ();
 
-    double rate() { return (1.0*get_output_item_size() / 
get_input_item_size()); }
+    double rate() { return (1.0*get_output_size() / get_input_size()); }
     bool set_frame_size(unsigned int frame_size) { return false; }
 
     static generic_decoder::sptr
diff --git a/gr-fec/lib/async_decoder_impl.cc b/gr-fec/lib/async_decoder_impl.cc
index f5924ec..3044a2c 100644
--- a/gr-fec/lib/async_decoder_impl.cc
+++ b/gr-fec/lib/async_decoder_impl.cc
@@ -114,15 +114,27 @@ namespace gr {
       int diff = d_decoder->rate()*d_decoder->get_input_size() - 
d_decoder->get_output_size();
 
       int nbits_in = pmt::length(bits);
-      int nbits_out = nbits_in*d_decoder->rate() - diff;
+      size_t nbits_out = 0;        
+      size_t nblocks = 1;
+      bool variable_frame_size = d_decoder->set_frame_size(nbits_out);
 
       // Check here if the frame size is larger than what we've
       // allocated for in the constructor.
-      if(nbits_in > d_max_bits_in) {
+      if(variable_frame_size && (nbits_in > d_max_bits_in)) {
         throw std::runtime_error("async_decoder: Received frame larger than 
max frame size.");
       }
 
-      d_decoder->set_frame_size(nbits_out);
+      // set up nbits_out
+      if(variable_frame_size){
+        nbits_out = nbits_in*d_decoder->rate() - diff;
+        } else {
+            nblocks = nbits_in / d_decoder->get_input_size();
+            nbits_out = nblocks * d_decoder->get_output_size();
+            if(nblocks * d_decoder->get_input_size() != nbits_in){
+                throw std::runtime_error("bad block multiple in!");
+            }
+        }
+
 
       size_t o0(0);
       const float* f32in = pmt::f32vector_elements(bits, o0);
@@ -133,6 +145,12 @@ namespace gr {
         volk_32f_s32f_multiply_32f(d_tmp_f32, f32in, 48.0f, nbits_in);
       }
       else {
+        if(nbits_in > d_max_bits_in){
+            d_max_bits_in = nbits_in;
+            volk_free(d_tmp_f32);
+            d_tmp_f32 = (float*)volk_malloc(d_max_bits_in*sizeof(float),
+                        volk_get_alignment());
+            }
         memcpy(d_tmp_f32, f32in, nbits_in*sizeof(float));
       }
 
@@ -149,7 +167,9 @@ namespace gr {
         d_decoder->generic_work((void*)d_tmp_u8, (void*)u8out);
       }
       else {
-        d_decoder->generic_work((void*)d_tmp_f32, (void*)u8out);
+        for(size_t i=0; i<nblocks; i++){
+          d_decoder->generic_work((void*)d_tmp_f32, (void*)u8out);
+          }
       }
 
       message_port_pub(d_out_port, pmt::cons(meta, outvec));



reply via email to

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