GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gr::blocks::kernel::unpack_k_bits Class Reference

Converts a byte with k relevent 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
 

Detailed Description

Converts a byte with k relevent 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]

Constructor & Destructor Documentation

gr::blocks::kernel::unpack_k_bits::unpack_k_bits ( unsigned  k)

Make an unpack_k_bits object.

Parameters
knumber of bits to unpack.
gr::blocks::kernel::unpack_k_bits::~unpack_k_bits ( )

Member Function Documentation

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.

Parameters
bitsoutput vector (1-bit per byte) of the unpacked data
bytesThe input vector of bytes to unpack
nbytesThe 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().


The documentation for this class was generated from the following file: