GNU Radio C++ API Reference: gr::blocks::kernel::unpack_k_bits Class Reference

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

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

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

  k | number of bits to unpack.

References k().

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

Referenced by unpack_k_bits().

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

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

- unpack_k_bits.h