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::pack_k_bits Class Reference

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
 

Detailed Description

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]

Constructor & Destructor Documentation

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

Make a pack_k_bits object.

Parameters
knumber of bits to be packed.
gr::blocks::kernel::pack_k_bits::~pack_k_bits ( )

Member Function Documentation

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.

Parameters
bytesoutput vector (k-bits per byte) of the unpacked data
bitsThe input vector of bits to pack
nbytesThe 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.


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