Packed to Unpacked: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Block Docs]]
[[Category:Block Docs]]
Converts a stream of packed bytes or shorts to stream of unpacked bytes or shorts
Converts a stream of packed bytes, shorts or ints into a stream of unpacked bytes, shorts or ints.


This is the inverse of [[Unpacked to Packed]]
This is the inverse of [[Unpacked to Packed]]


The bits in the bytes or shorts input stream are grouped into chunks of bits and each resulting chunk is written right-justified to the output stream of bytes or shorts. All 8 or 16 bits of the each input byte or short are processed.  
The bits in the input stream are separated into groups of bits according to the number of bits per chunk. All 8, 16 or 32 bits of the each input are processed. The resulting chunk is written right-justified to the output stream of bytes, shorts or ints.  


The combination of this block followed by [[Chunks to Symbols]] handles the general case of mapping from a stream of bytes or shorts into arbitrary float or complex symbols.
The combination of this block followed by [[Chunks to Symbols]] handles the general case of mapping from a stream of bytes or shorts into arbitrary float or complex symbols.


== Parameters ==  
== Parameters ==  
; bits_per_chunk
; Bits per Chunk
: How many bits to include in each output byte/short
: How many bits to include in each output byte/short/int


; endianness
; Endianness
: Whether to start with the MSB or LSB when processing the input bits
: Whether to start with the MSB or LSB when processing the input bits


Line 19: Line 19:


== Example Flowgraph ==
== Example Flowgraph ==
(This is not actually a flowgraph, it's just an example of the block being used)


If bits_per_chunk = 1 and MSB is selected,
If bits_per_chunk = 1 and MSB is selected,
Line 25: Line 27:


output : 0b00000001 0b00000001 0b00000001 0b00000001 0b00000000 0b00000000 0b00000000 0b00000000
output : 0b00000001 0b00000001 0b00000001 0b00000001 0b00000000 0b00000000 0b00000000 0b00000000
== Source Files ==
; C++ files
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/packed_to_unpacked_impl.cc packed_to_unpacked_impl.cc]
; Header files
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/packed_to_unpacked_impl.h packed_to_unpacked_impl.h]
; Public header files
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/include/gnuradio/blocks/packed_to_unpacked.h packed_to_unpacked.h]
; Block definition
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml blocks_packed_to_unpacked_xx.block.yml]

Latest revision as of 18:05, 18 May 2024

Converts a stream of packed bytes, shorts or ints into a stream of unpacked bytes, shorts or ints.

This is the inverse of Unpacked to Packed

The bits in the input stream are separated into groups of bits according to the number of bits per chunk. All 8, 16 or 32 bits of the each input are processed. The resulting chunk is written right-justified to the output stream of bytes, shorts or ints.

The combination of this block followed by Chunks to Symbols handles the general case of mapping from a stream of bytes or shorts into arbitrary float or complex symbols.

Parameters

Bits per Chunk
How many bits to include in each output byte/short/int
Endianness
Whether to start with the MSB or LSB when processing the input bits
Number of Ports
Number of input and output ports, in case you need multiple parallel streams

Example Flowgraph

(This is not actually a flowgraph, it's just an example of the block being used)

If bits_per_chunk = 1 and MSB is selected,

input : 0b11110000

output : 0b00000001 0b00000001 0b00000001 0b00000001 0b00000000 0b00000000 0b00000000 0b00000000

Source Files

C++ files
packed_to_unpacked_impl.cc
Header files
packed_to_unpacked_impl.h
Public header files
packed_to_unpacked.h
Block definition
blocks_packed_to_unpacked_xx.block.yml