[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 45/57: fec: wip: using unpack/pack k bits k
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 45/57: fec: wip: using unpack/pack k bits kernels instead of copying logic in here. |
Date: |
Wed, 21 May 2014 03:10:30 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 86c7f2844331b6759461acf1afbe8e9c60a678a0
Author: Tom Rondeau <address@hidden>
Date: Fri May 16 12:18:46 2014 -0400
fec: wip: using unpack/pack k bits kernels instead of copying logic in here.
Need to remove volk_malloc from encode.
---
gr-fec/lib/async_encoder_impl.cc | 24 ++++++++++--------------
gr-fec/lib/async_encoder_impl.h | 4 ++++
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/gr-fec/lib/async_encoder_impl.cc b/gr-fec/lib/async_encoder_impl.cc
index 6f9b54b..de760b1 100644
--- a/gr-fec/lib/async_encoder_impl.cc
+++ b/gr-fec/lib/async_encoder_impl.cc
@@ -49,6 +49,9 @@ namespace gr {
d_out_port = pmt::mp("out");
d_encoder = my_encoder;
+ d_unpack = new blocks::kernel::unpack_k_bits(8);
+ d_pack = new blocks::kernel::pack_k_bits(8);
+
message_port_register_in(d_in_port);
message_port_register_out(d_out_port);
set_msg_handler(d_in_port, boost::bind(&async_encoder_impl::encode, this
,_1) );
@@ -56,6 +59,8 @@ namespace gr {
async_encoder_impl::~async_encoder_impl()
{
+ delete d_unpack;
+ delete d_pack;
}
void
@@ -72,20 +77,16 @@ namespace gr {
uint8_t* bits_in = (uint8_t*)volk_malloc(nbits*sizeof(uint8_t),
volk_get_alignment());
- // Stolen from unpack_k_bits
- int n = 0;
- for(int i = 0; i < nbytes; i++) {
- uint8_t t = bytes_in[i];
- for(int j = 7; j >= 0; j--)
- bits_in[n++] = (t >> j) & 0x01;
- }
+ // Encoder takes a stream of bits, but PDU's are received as
+ // bytes, so we unpack them here.
+ d_unpack->unpack(bits_in, bytes_in, nbytes);
d_encoder->set_frame_size(nbits);
int nbits_out = d_encoder->get_output_size();
int nbytes_out = nbits_out/8;
- // get pmt buffer pointers
+ // buffers for bits/bytes to go to
uint8_t* bits_out = (uint8_t*)volk_malloc(nbits_out*sizeof(uint8_t),
volk_get_alignment());
uint8_t* bytes_out = (uint8_t*)volk_malloc(nbytes_out*sizeof(uint8_t),
@@ -95,12 +96,7 @@ namespace gr {
d_encoder->generic_work((void*)bits_in, (void*)bits_out);
// Stolen from pack_k_bits
- for(int i = 0; i < nbytes_out; i++) {
- bytes_out[i] = 0x00;
- for(int j = 0; j < 8; j++) {
- bytes_out[i] |= (0x01 & bits_out[i*8+j])<<(8-j-1);
- }
- }
+ d_pack->pack(bytes_out, bits_out, nbytes_out);
//pmt::pmt_t outvec = pmt::init_u8vector(nouts, u8out);
pmt::pmt_t outvec = pmt::init_u8vector(nbytes_out, bytes_out);
diff --git a/gr-fec/lib/async_encoder_impl.h b/gr-fec/lib/async_encoder_impl.h
index 38ae685..4090d77 100644
--- a/gr-fec/lib/async_encoder_impl.h
+++ b/gr-fec/lib/async_encoder_impl.h
@@ -24,6 +24,8 @@
#define INCLUDED_FEC_ASYNC_ENCODER_IMPL_H
#include <gnuradio/fec/async_encoder.h>
+#include <gnuradio/blocks/unpack_k_bits.h>
+#include <gnuradio/blocks/pack_k_bits.h>
namespace gr {
namespace fec {
@@ -39,6 +41,8 @@ namespace gr {
pmt::pmt_t d_out_port;
void encode(pmt::pmt_t msg);
+ blocks::kernel::unpack_k_bits *d_unpack;
+ blocks::kernel::pack_k_bits *d_pack;
public:
async_encoder_impl(generic_encoder::sptr my_encoder);
- [Commit-gnuradio] [gnuradio] 43/57: digital: added option to packet_utils.unmake_packet to check or not check the CRC., (continued)
- [Commit-gnuradio] [gnuradio] 43/57: digital: added option to packet_utils.unmake_packet to check or not check the CRC., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 44/57: blocks: adds kernels for pack_k_bits and unpack_k_bits., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 30/57: runtime: configuring loggers in gr Python module for easy use in Python., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 39/57: digital: modified tagged stream correlate access code., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 37/57: Revert "blocks: add optional argument to deinterleave and interleave ctors to not set relative rate.", git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 42/57: fec: wip: fixing formatting., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 32/57: blocks: add optional argument to deinterleave and interleave ctors to not set relative rate., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 48/57: fec: wip: adding extended encoder for async version., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 47/57: digital: don't need the FEC info for the tagged stream corr access code., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 46/57: blocks: adding an option to swap the order of the output bits of a repack_bits block., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 45/57: fec: wip: using unpack/pack k bits kernels instead of copying logic in here.,
git <=
- [Commit-gnuradio] [gnuradio] 56/57: Merge branch 'fecapi', git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 51/57: Revert "blocks: adding an option to swap the order of the output bits of a repack_bits block.", git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 22/57: fec: wip: adding block that correlates against an access code and produces a tagged stream ofthe payload (stripped access code)., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 53/57: fec: wip: adding qa code., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 50/57: fec: wip: adding concept of padding for CC encoder/decoder., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 54/57: fec: mostly documentation updates, spell check, etc., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 55/57: fec: wip: fixing up allocated memory; allowing async encoder deployment to be used with CCSDS (packed input requirement)., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 41/57: digital: adding an async message passsing CRC32 calc/check block for PDUs., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 38/57: fec: wip: cleaning up tagged decoder, rep code., git, 2014/05/20
- [Commit-gnuradio] [gnuradio] 57/57: digital: fixing up some work done in the fec api development., git, 2014/05/20