Search code examples
gnuradiognuradio-companion

What do packed_to_unpacked blocks do in GNU RADIO?


Could somebody give me an example(e.g. input->output) of what this block does? Explanation is also appreciated.


Solution

  • From the official documentation (which, if your GNU Radio build is intact, you can also access from the documentation tab of your block properties in GRC):

    Convert a stream of packed bytes or shorts to stream of unpacked bytes or shorts.

    input: stream of unsigned char; output: stream of unsigned char

    This is the inverse of gr::blocks::unpacked_to_packed_XX.

    The bits in the bytes or shorts input stream are grouped into chunks of bits_per_chunk bits and each resulting chunk is written right- justified to the output stream of bytes or shorts. All b or 16 bits of the each input bytes or short are processed. The right thing is done if bits_per_chunk is not a power of two.

    The combination of gr::blocks::packed_to_unpacked_XX_ followed by gr_chunks_to_symbols_Xf or gr_chunks_to_symbols_Xc handles the general case of mapping from a stream of bytes or shorts into arbitrary float or complex symbols.

    so, you get a byte in, consisting of 8 bits, and you produce bytes, each of one with bits_per_chunk bits set according to the input. Example (let bits_per_chunk=1, MSB first):

    in 0b11110000
    out 0b00000001 0b00000001 0b00000001 0b00000001 0b00000000 0b00000000 0b00000000 0b00000000