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

Converts a vector of bytes with 1 bit in the LSB to a byte with k relevant 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 relevant 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

◆ pack_k_bits()

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

Make a pack_k_bits object.

Parameters
knumber of bits to be packed.

◆ ~pack_k_bits()

gr::blocks::kernel::pack_k_bits::~pack_k_bits ( )

Member Function Documentation

◆ k()

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

◆ pack()

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

◆ pack_rev()

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: