Loading...
Searching...
No Matches
gr::blocks::kernel::pack_k_bits Class Reference
GNU Radio C++ Signal Processing Blocks » Byte Operators

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.
| ~pack_k_bits ()
void | pack (unsigned char *bytes, const unsigned char *bits, int nbytes) const
| Perform the packing.
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

  k | number of bits to be packed.

References k().

## ~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

Referenced by pack_k_bits().

## 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

  bytes | output vector (k-bits per byte) of the unpacked data
  bits | The input vector of bits to pack
  nbytes | The 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:

- pack_k_bits.h