Blocks for forward error correction.
Creates the decoder block for use in GNU Radio flowgraphs from a given FEC API object derived from the generic_decoder class.
Decodes frames received as async messages over a message port. This decoder deployment expects messages of soft decision symbols in and can produce either packed, PDU messages ( = True) or messages full of unpacked bits ( = False).
This decoder works off a full message as one frame or block to decode. The message length is used to calculate the frame length. To support this, the decoder variable used will have had its frame_size set. This block treats that initial frame_size value as the maximum transmission unit (MTU) and will not process frames larger than that after being decoded.
The packed PDU form of this deployment is designed to work well with other PDU-based blocks to operate within the processing flow of data packets or frames.
Due to differences in how data is packed and processed, this block also offers the ability to change the direction of how bits are packed. All inputs messages are one soft decision per item. By default, the mode is set to True. Using this setup allows the async block to behave with PDUs in the same operation and format as the tagged stream decoders. That is, putting the same data into both the tagged stream decoder deployment and this with the default setting should produce the same data.
Because the block handles data as a full frame per message, this decoder deployment cannot work with any decoders that require history. For example, the gr::fec::code::cc_decoder decoder in streaming mode requires an extra rate*(K-1) bits to complete the decoding, so it would have to wait for the next message to come in and finish processing. Therefore, the streaming mode of the CC decoder is not allowed. The other three modes will work with this deployment since the frame is self-contained for decoding.
Constructor Specific Documentation:
Build the PDU-based FEC decoder block from an FECAPI decoder object.
Parameters: |
|
---|
declare_sample_delay(async_decoder_sptr self, unsigned int delay)
pc_input_buffers_full_avg(async_decoder_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(async_decoder_sptr self) -> pmt_vector_float
Creates the encoder block for use in GNU Radio flowgraphs with async message from a given FEC API object derived from the generic_encoder class.
Encodes frames received as async messages or as a PDU over a message port. This encoder works off a full message as one frame or block to encode. The message length is used as the frame length. To support this, the encoder variable used will have had its frame_size set. This block treats that initial frame_size value as the maximum transmission unit (MTU) and will not process frames larger than that.
This deployment works off messages and expects them to either be messages full of unpacked bits or PDU messages, which means full bytes of a frame from the higher layers, including things like headers, tails, CRC check bytes, etc. For handling PDUs, set the option of this deployment block to True. The block will then use the FEC API to properly unpack the bits from the PDU, pass it through the encoder, and repack them to output the PDUs for the next stage of processing.
The packed PDU form of this deployment is designed to work well with other PDU-based blocks to operate within the processing flow of data packets or frames.
Due to differences in how data is packed and processed, this block also offers the ability to change the direction of how bits are unpacked and packed, where reading or writing from the LSB or MSB. By default, the and modes are set to True. Using this setup allows the async block to behave with PDUs in the same operation and format as the tagged stream encoders. That is, putting the same data into both the tagged stream encoder deployment and this with these default settings should produce the same data.
Constructor Specific Documentation:
Build the PDU-based FEC encoder block from an FECAPI encoder object.
Parameters: |
|
---|
declare_sample_delay(async_encoder_sptr self, unsigned int delay)
pc_input_buffers_full_avg(async_encoder_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(async_encoder_sptr self) -> pmt_vector_float
BER block in FECAPI.
This block measures the bit error rate between two streams of packed data. It compares the bits of each streams and counts the number of incorrect bits between them. It outputs the log of the bit error rate, so a value of -X is 10^{-X} bit errors.
When the is set to false (default), it is in streaming mode. This means that the output is constantly producing the current value of the BER. In this mode, there is a single output BER calculation per chunk of bytes passed to it, so there is no exact timing between calculations of BER. In this mode, the other two parameters to the constructor are ignored.
When is true, the block is in test mode. This mode is used in the ber_curve_gen example and for other offline analysis of BER curves. Here, the block waits until at least are observed and then produces a BER calculation. The parameter helps make sure that the simulation is controlled. If the BER calculation drops bellow the setting, the block will exit and simply return the set limit; the real BER is therefore some amount lower than this.
Note that this block takes in data as packed bytes with 8-bits per byte used. It outputs a stream of floats as the log-scale BER.
Constructor Specific Documentation:
Calculate the BER between two streams of data.
Parameters: |
|
---|
declare_sample_delay(ber_bf_sptr self, unsigned int delay)
pc_input_buffers_full_avg(ber_bf_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(ber_bf_sptr self) -> pmt_vector_float
Correlate block in FECAPI.
What does this block do?
Constructor Specific Documentation:
Parameters: |
|
---|
This subroutine will find the encoded data garble rate corresponding to a syndrome density of `target’, that is created with an annihilating polynomial with ‘taps’ number of taps.
declare_sample_delay(conv_bit_corr_bb_sptr self, unsigned int delay)
pc_input_buffers_full_avg(conv_bit_corr_bb_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(conv_bit_corr_bb_sptr self) -> pmt_vector_float
A rate 1/2, k=7 convolutional decoder for the CCSDS standard.
This block performs soft-decision convolutional decoding using the Viterbi algorithm.
The input is a stream of (possibly noise corrupted) floating point values nominally spanning [-1.0, 1.0], representing the encoded channel symbols 0 (-1.0) and 1 (1.0), with erased symbols at 0.0.
The output is MSB first packed bytes of decoded values.
As a rate 1/2 code, there will be one output byte for every 16 input symbols.
This block is designed for continuous data streaming, not packetized data. The first 32 bits out will be zeroes, with the output delayed four bytes from the corresponding inputs.
Constructor Specific Documentation:
declare_sample_delay(decode_ccsds_27_fb_sptr self, unsigned int delay)
pc_input_buffers_full_avg(decode_ccsds_27_fb_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(decode_ccsds_27_fb_sptr self) -> pmt_vector_float
General FEC decoding block that takes in a decoder variable object (derived from gr::fec::general_decoder) for use in a flowgraph.
This block uses a decoder variable object (derived from gr::fec::generic_decoder) to decode data within a flowgraph. This block interacts with the general FECAPI architecture to handle all passing all input and output data in a flowgraph. The decoder variable takes care of understanding the requirements, data types and sizes, and boundary conditions of the specific FEC decoding algorithm.
Generally, this block is used within the fec.extended_decoder Python block to handle some input/output formatting issues. In the FECAPI, the decoder variable sets properties like the input and output types and sizes and whether the output is packed or unpacked bytes. The fec.extended_decoder uses this information to set up an gr::hier_block2 structure to make sure the I/O to the variable is handled consistently, such as to make sure all inputs are floats with one soft symbol per item and the outputs are unpacked bytes with the bit in the LSB.
See gr::fec::generic_decoder for detail on what information an FECAPI variable object can set if using this block directly and not as part of the fec.extended_decoder.
Constructor Specific Documentation:
Create the FEC decoder block by taking in the FECAPI decoder object as well as input and output sizes.
Parameters: |
|
---|
declare_sample_delay(decoder_sptr self, unsigned int delay)
pc_input_buffers_full_avg(decoder_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(decoder_sptr self) -> pmt_vector_float
Depuncture a stream of samples.
Depuncture a given block of input samples of . The items produced is based on the pattern . Basically, if:
This block is designed for unpacked bits - that is, every input sample is a bit, either a 1 or 0. It’s possible to use packed bits as symbols, but the depuncturing will be done on the symbol level, not the bit level.
is specified as a 32-bit integer that we can convert into the vector _puncpat used in the algorithm above:
Example:
The gr.fec Python module provides a read_bitlist function that can turn a string of a puncture pattern into the correct integer form. The pattern of 0xEF could be specified as fec.readbitlist(“11101111”). Also, this allows us to use puncsize=len(“11101111”) to make sure that our sizes are set up correctly for the pattern we want.
The fec.extended_decoder takes in the puncture pattern directly as a string and uses the readbitlist inside to do the conversion.
The parameter delays the application of the puncture pattern. This is equivalent to circularly rotating the by . Note that because of the circular shift, the delay should be between 0 and , but this is not enforced; the effective delay will simply be mod . A negative value here is ignored.
Constructor Specific Documentation:
Constructs a depuncture block.
Parameters: |
|
---|
declare_sample_delay(depuncture_bb_sptr self, unsigned int delay)
pc_input_buffers_full_avg(depuncture_bb_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(depuncture_bb_sptr self) -> pmt_vector_float
A rate 1/2, k=7 convolutional encoder for the CCSDS standard.
This block performs convolutional encoding using the CCSDS standard polynomial (“Voyager”).
The input is an MSB first packed stream of bits.
The output is a stream of symbols 0 or 1 representing the encoded data.
As a rate 1/2 code, there will be 16 output symbols for every input byte.
This block is designed for continuous data streaming, not packetized data. There is no provision to “flush” the encoder.
Constructor Specific Documentation:
declare_sample_delay(encode_ccsds_27_bb_sptr self, unsigned int delay)
pc_input_buffers_full_avg(encode_ccsds_27_bb_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(encode_ccsds_27_bb_sptr self) -> pmt_vector_float
Creates the encoder block for use in GNU Radio flowgraphs from a given FECAPI object derived from the generic_encoder class.
Generally, we would use the fec.extended_encoder Python implementation to instantiate this. The extended_encoder wraps up a few more details, like taking care of puncturing as well as the encoder itself.
Constructor Specific Documentation:
Build the FEC encoder block from an FECAPI encoder object.
Parameters: |
|
---|
declare_sample_delay(encoder_sptr self, unsigned int delay)
pc_input_buffers_full_avg(encoder_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(encoder_sptr self) -> pmt_vector_float
Parent class for FECAPI objects.
Parent of a decoder variable class for FECAPI that will fit into the gr::fec::decoder block to handle FEC decoding. This class provides the basic information required to fit into the FECAPI structure. It provides information about input and output data types, potential data conversions, and a few other parameters useful to establish the decoder’s behavior.
We create objects from FECAPI-derived classes to go into the actual GNU Radio decoder block. Each object contains its own state and so there should be a one-to-one mapping of an FECAPI object and a GR decoder block. Sharing these objects is not guaranteed to be thread-safe.
This is a pure virtual class and must be derived from by a child class.
Sets up history for the decoder when the decoder is required to look ahead in the data stream in order to finish its processing.
The child class MAY implement this function. If not reimplemented, it returns 0.
Set up a conversion type required to setup the data properly for this decoder. The decoder itself will not implement the conversion and expects an external wrapper (e.g., fec.extended_decoder) to read this value and “do the right thing” to format the data.
The default behavior is ‘none’, which means no conversion is required. Whatever the get_input_item_size() value returns, the input is expected to conform directly to this.
This may also return ‘uchar’, which indicates that the wrapper should convert the standard float samples to unsigned characters, either hard sliced or 8-bit soft symbols. See gr::fec::code::cc_decoder as an example decoder that uses this conversion format.
If ‘packed_bits’, the block expects the inputs to be packed hard bits. Each input item is a unsigned char where each of the 8-bits is a hard bit value.
The child class SHOULD implement this function. If not reimplemented, it returns “none”.
Sets the size of an input item, as in the size of a char or float item.
The child class SHOULD implement this function. If not reimplemented, it returns sizeof(float) as the decoders typically expect floating point input types.
Returns the input size in items that the decoder object uses to decode a full frame. Often, this number is the number of bits per frame if the input format is unpacked. If the block expects packed bytes, then this value should be the number of bytes (number of bits / 8) per input frame.
The child class MUST implement this function.
Get repetitions to decode.
The child class should implement this function and return the number of iterations required to decode.
Set up a conversion type required to understand the output style of this decoder. Generally, follow-on processing expects unpacked bits, so we specify the conversion type here to indicate what the wrapper (e.g., fec.extended_decoder) should do to convert the output samples from the decoder into unpacked bits.
The default behavior is ‘none’, which means no conversion is required. This should mean that the output data is produced from this decoder as unpacked bit.
If ‘unpack’, the block produces packed bytes that should be unpacked by the wrapper. See gr::fec::code::ccsds_decoder as an example of a decoder that produces packed bytes.
The child class SHOULD implement this function. If not reimplemented, it returns “none”.
Sets the size of an output item, as in the size of a char or float item.
The child class SHOULD implement this function. If not reimplemented, it returns sizeof(char) as the decoders typically expect to produce bits or bytes.
Returns the output size in items that the decoder object produces after decoding a full frame. Often, this number is the number of bits in the outputted frame if the input format is unpacked. If the block produces packed bytes, then this value should be the number of bytes (number of bits / 8) per frame produced. This value is generally something like get_input_size()/R for a 1/R rate code.
The child class MUST implement this function.
Some decoders require the input items to float around a particular soft value. We can set that floating value by setting this value to return some non-zero number.
The fec.extended_decoder block will use this to create an add_const_ff block before the decoder block to adjust all input samples appropriately.
The child class MAY implement this function. If not reimplemented, it returns 0.
Returns the rate of the code. For every r input bits, there is 1 output bit, so the rate is 1/r. Used for setting things like the encoder block’s relative rate.
This function MUST be reimplemented by the child class.
Updates the size of a decoded frame.
The child class MUST implement this function and interpret how the information affects the block’s behavior. It should also provide bounds checks.
Proxy of C++ gr::fec::generic_encoder class
Set up a conversion type required to setup the data properly for this encoder. The encoder itself will not implement the conversion and expects an external wrapper (e.g., fec.extended_encoder) to read this value and “do the right thing” to format the data.
The default behavior is ‘none’, which means no conversion is required. Whatever the get_input_item_size() value returns, the input is expected to conform directly to this. Generally, this means unpacked bytes.
If ‘pack’, the block expects the inputs to be packed bytes. The wrapper should implement a gr::blocks::pack_k_bits_bb(8) block for this.
The child class MAY implement this function. If not reimplemented, it returns “none”.
Returns the input size in items that the encoder object uses to encode a full frame. Often, this number is the number of bits per frame if the input format is unpacked. If the block expects packed bytes, then this value should be the number of bytes (number of bits / 8) per input frame.
The child class MUST implement this function.
Set up a conversion type required to understand the output style of this encoder. Generally an encoder will produce unpacked bytes with a bit set in the LSB.
The default behavior is ‘none’, which means no conversion is required and the encoder produces unpacked bytes.
If ‘packed_bits’, the block produces packed bits and the wrapper should unpack these (using, for instance, gr::block::unpack_k_bits_bb(8)).
The child class MAY implement this function. If not reimplemented, it returns “none”.
Returns the output size in items that the encoder object produces after encoding a full frame. Often, this number is the number of bits in the outputted frame if the input format is unpacked. If the block produces packed bytes, then this value should be the number of bytes (number of bits / 8) per frame produced. This value is generally something like R*get_input_size() for a 1/R rate code.
The child class MUST implement this function.
Returns the rate of the code. For every 1 input bit, there are r output bits, so the rate is 1/r. Used for setting things like the encoder block’s relative rate.
This function MUST be reimplemented by the child class.
Updates the size of the frame to encode.
The child class MUST implement this function and interpret how the information affects the block’s behavior. It should also provide bounds checks.
Puncture a stream of unpacked bits.
Puncture a given block of input samples of . The items produced is based on pattern . Basically, if:
This block is designed for unpacked bits - that is, every input sample is a bit, either a 1 or 0. It’s possible to use packed bits as symbols, but the puncturing will be done on the symbol level, not the bit level.
is specified as a 32-bit integer that we can convert into the vector _puncpat used in the algorithm above:
Example:
The gr.fec Python module provides a read_bitlist function that can turn a string of a puncture pattern into the correct integer form. The pattern of 0xEF could be specified as fec.readbitlist(“11101111”). Also, this allows us to use puncsize=len(“11101111”) to make sure that our sizes are set up correctly for the pattern we want.
The fec.extended_encoder takes in the puncture pattern directly as a string and uses the readbitlist inside to do the conversion.
Note that due to the above concept, the default setting in the extended encoder of ‘11’ translates into no puncturing.
The parameter delays the application of the puncture pattern. This is equivalent to circularly rotating the by . Note that because of the circular shift, the delay should be between 0 and , but this is not enforced; the effective delay will simply be mod . A negative value here is ignored.
Constructor Specific Documentation:
Constructs a puncture block for unpacked bits.
Parameters: |
|
---|
declare_sample_delay(puncture_bb_sptr self, unsigned int delay)
pc_input_buffers_full_avg(puncture_bb_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(puncture_bb_sptr self) -> pmt_vector_float
Puncture a stream of floats.
For a given block of input samples of , the items produced is based on . Basically, if:
This block is designed for floats, generally 1’s and -1’s. It’s possible to use other float values as symbols, but this is not the expected operation.
is specified as a 32-bit integer that we can convert into the vector _puncpat used in the algorithm above:
Example:
The gr.fec Python module provides a read_bitlist function that can turn a string of a puncture pattern into the correct integer form. The pattern of 0xEF could be specified as fec.readbitlist(“11101111”). Also, this allows us to use puncsize=len(“11101111”) to make sure that our sizes are set up correctly for the pattern we want.
The fec.extended_encoder takes in the puncture pattern directly as a string and uses the readbitlist inside to do the conversion.
Note that due to the above concept, the default setting in the extended encoder of ‘11’ translates into no puncturing.
The parameter delays the application of the puncture pattern. This is equivalent to circularly rotating the by . Note that because of the circular shift, the delay should be between 0 and , but this is not enforced; the effective delay will simply be mod . A negative value here is ignored.
Constructor Specific Documentation:
Constructs a puncture block for floats.
Parameters: |
|
---|
declare_sample_delay(puncture_ff_sptr self, unsigned int delay)
pc_input_buffers_full_avg(puncture_ff_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(puncture_ff_sptr self) -> pmt_vector_float
General FEC decoding block that takes in a decoder variable object (derived from gr::fec::general_decoder) for use in a flowgraph.
This block uses a decoder variable object (derived from gr::fec::generic_decoder) to decode data within a flowgraph. This block interacts with the general FECAPI architecture to handle all passing all input and output data in a flowgraph. The decoder variable takes care of understanding the requirements, data types and sizes, and boundary conditions of the specific FEC decoding algorithm.
Generally, this block is used within the fec.extended_decoder Python block to handle some input/output formatting issues. In the FECAPI, the decoder variable sets properties like the input and output types and sizes and whether the output is packed or unpacked bytes. The fec.extended_decoder uses this information to set up an gr::hier_block2 structure to make sure the I/O to the variable is handled consistently, such as to make sure all inputs are floats with one soft symbol per item and the outputs are unpacked bytes with the bit in the LSB.
See gr::fec::generic_decoder for detail on what information an FECAPI variable object can set if using this block directly and not as part of the fec.extended_decoder.
Constructor Specific Documentation:
Create the FEC decoder block by taking in the FECAPI decoder object as well as input and output sizes.
Parameters: |
|
---|
declare_sample_delay(tagged_decoder_sptr self, unsigned int delay)
pc_input_buffers_full_avg(tagged_decoder_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(tagged_decoder_sptr self) -> pmt_vector_float
Creates the encoder block for use in GNU Radio flowgraphs from a given FECAPI object derived from the generic_encoder class.
Generally, we would use the fec.extended_encoder Python implementation to instantiate this. The extended_encoder wraps up a few more details, like taking care of puncturing as well as the encoder itself.
Constructor Specific Documentation:
Build the FEC encoder block from an FECAPI encoder object.
Parameters: |
|
---|
declare_sample_delay(tagged_encoder_sptr self, unsigned int delay)
pc_input_buffers_full_avg(tagged_encoder_sptr self) -> pmt_vector_float
pc_output_buffers_full_avg(tagged_encoder_sptr self) -> pmt_vector_float