GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
gr::blocks::kernel::unpack_k_bits Class Reference

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
 

Detailed Description

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]

Constructor & Destructor Documentation

◆ unpack_k_bits()

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

Make an unpack_k_bits object.

Parameters
knumber of bits to unpack.

◆ ~unpack_k_bits()

gr::blocks::kernel::unpack_k_bits::~unpack_k_bits ( )

Member Function Documentation

◆ k()

int gr::blocks::kernel::unpack_k_bits::k ( ) const

◆ unpack()

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

◆ unpack_rev()

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: