Converts a vector of bytes with 1 bit in the LSB to a byte with k relevent bits. More...
#include <gnuradio/blocks/pack_k_bits.h>
Public Member Functions | |
pack_k_bits (unsigned k) | |
Make a pack_k_bits object. More... | |
~pack_k_bits () | |
void | pack (unsigned char *bytes, const unsigned char *bits, int nbytes) const |
Perform the packing. More... | |
void | pack_rev (unsigned char *bytes, const unsigned char *bits, int nbytes) const |
int | k () const |
Converts a vector of bytes with 1 bit in the LSB to a byte with k relevent bits.
Example: k = 4 in = [0,1,0,1, 0x81,0x00,0x00,0x00] out = [0x05, 0x08]
k = 8 in = [1,1,1,1, 0,1,0,1, 0,0,0,0, 1,0,0,0] out = [0xf5, 0x08]
gr::blocks::kernel::pack_k_bits::pack_k_bits | ( | unsigned | k | ) |
Make a pack_k_bits object.
k | number of bits to be packed. |
gr::blocks::kernel::pack_k_bits::~pack_k_bits | ( | ) |
int gr::blocks::kernel::pack_k_bits::k | ( | ) | const |
void gr::blocks::kernel::pack_k_bits::pack | ( | unsigned char * | bytes, |
const unsigned char * | bits, | ||
int | nbytes | ||
) | const |
Perform the packing.
This block performs no bounds checking. It assumes that the input, in
, has of length k*nbytes and that the output vector, out
, has nbytes
available for writing.
bytes | output vector (k-bits per byte) of the unpacked data |
bits | The input vector of bits to pack |
nbytes | The number of output bytes |
void gr::blocks::kernel::pack_k_bits::pack_rev | ( | unsigned char * | bytes, |
const unsigned char * | bits, | ||
int | nbytes | ||
) | const |
Same as pack() but reverses the bits.