Converts a byte with k relevant bits to k output bytes with 1 bit in the LSB. More...
#include <gnuradio/blocks/unpack_k_bits.h>
Public Member Functions | |
unpack_k_bits (unsigned k) | |
Make an unpack_k_bits object. More... | |
~unpack_k_bits () | |
void | unpack (unsigned char *bits, const unsigned char *bytes, int nbytes) const |
Perform the unpacking. More... | |
void | unpack_rev (unsigned char *bits, const unsigned char *bytes, int nbytes) const |
int | k () const |
Converts a byte with k relevant bits to k output bytes with 1 bit in the LSB.
This is the algorithm kernel for the gr::blocks::unpack_k_bits_bb block.
Example: k = 4 in = [0xf5, 0x08] out = [0,1,0,1, 1,0,0,0]
k = 8 in = [0xf5, 0x08] out = [1,1,1,1, 0,1,0,1, 0,0,0,0, 1,0,0,0]
gr::blocks::kernel::unpack_k_bits::unpack_k_bits | ( | unsigned | k | ) |
Make an unpack_k_bits object.
k | number of bits to unpack. |
gr::blocks::kernel::unpack_k_bits::~unpack_k_bits | ( | ) |
int gr::blocks::kernel::unpack_k_bits::k | ( | ) | const |
void gr::blocks::kernel::unpack_k_bits::unpack | ( | unsigned char * | bits, |
const unsigned char * | bytes, | ||
int | nbytes | ||
) | const |
Perform the unpacking.
This function performs no bounds checking. It assumes that the input, in
, has of length nbytes
and that the output vector, out
, has k*nbytes available for writing.
bits | output vector (1-bit per byte) of the unpacked data |
bytes | The input vector of bytes to unpack |
nbytes | The number of input bytes |
void gr::blocks::kernel::unpack_k_bits::unpack_rev | ( | unsigned char * | bits, |
const unsigned char * | bytes, | ||
int | nbytes | ||
) | const |
Unpacks in reverse order from unpack().