summaryrefslogtreecommitdiff
path: root/gr-fec/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-fec/lib')
-rw-r--r--gr-fec/lib/async_decoder_impl.cc5
-rw-r--r--gr-fec/lib/ldpc_decoder.cc3
-rwxr-xr-xgr-fec/lib/ldpc_encoder.cc2
3 files changed, 9 insertions, 1 deletions
diff --git a/gr-fec/lib/async_decoder_impl.cc b/gr-fec/lib/async_decoder_impl.cc
index 3044a2cdf8..2cdea6a1a6 100644
--- a/gr-fec/lib/async_decoder_impl.cc
+++ b/gr-fec/lib/async_decoder_impl.cc
@@ -145,6 +145,8 @@ namespace gr {
volk_32f_s32f_multiply_32f(d_tmp_f32, f32in, 48.0f, nbits_in);
}
else {
+
+ // grow d_tmp_f32 if needed
if(nbits_in > d_max_bits_in){
d_max_bits_in = nbits_in;
volk_free(d_tmp_f32);
@@ -168,10 +170,11 @@ namespace gr {
}
else {
for(size_t i=0; i<nblocks; i++){
- d_decoder->generic_work((void*)d_tmp_f32, (void*)u8out);
+ d_decoder->generic_work((void*)&d_tmp_f32[i*d_decoder->get_input_size()], (void*)&u8out[i*d_decoder->get_output_size()]);
}
}
+ meta = pmt::dict_add(meta, pmt::mp("iterations"), pmt::mp(d_decoder->get_iterations()) );
message_port_pub(d_out_port, pmt::cons(meta, outvec));
}
diff --git a/gr-fec/lib/ldpc_decoder.cc b/gr-fec/lib/ldpc_decoder.cc
index 3f545eda34..066024c9e0 100644
--- a/gr-fec/lib/ldpc_decoder.cc
+++ b/gr-fec/lib/ldpc_decoder.cc
@@ -45,6 +45,8 @@ ldpc_decoder::make(std::string alist_file, float sigma, int max_iterations)
ldpc_decoder::ldpc_decoder (std::string alist_file, float sigma, int max_iterations)
: generic_decoder("ldpc_decoder")
{
+ if(!boost::filesystem::exists( alist_file ))
+ throw std::runtime_error("Bad AList file name!");
d_list.read(alist_file.c_str());
d_code.set_alist(d_list);
d_spa.set_alist_sigma(d_list, sigma);
@@ -73,6 +75,7 @@ void ldpc_decoder::generic_work(void *inBuffer, void *outBuffer) {
std::vector<char> estimate( d_spa.decode(rx, &n_iterations) );
std::vector<char> data( d_code.get_systematic_bits(estimate) );
memcpy(out, &data[0], outputSize);
+ d_iterations = n_iterations;
}
int ldpc_decoder::get_input_item_size() {
diff --git a/gr-fec/lib/ldpc_encoder.cc b/gr-fec/lib/ldpc_encoder.cc
index a181c28c3e..813715a06b 100755
--- a/gr-fec/lib/ldpc_encoder.cc
+++ b/gr-fec/lib/ldpc_encoder.cc
@@ -41,6 +41,8 @@ ldpc_encoder::make(std::string alist_file)
ldpc_encoder::ldpc_encoder (std::string alist_file)
{
+ if(!boost::filesystem::exists( alist_file ))
+ throw std::runtime_error("Bad AList file name!");
d_list.read(alist_file.c_str());
d_code.set_alist(d_list);
inputSize = d_code.dimension();