To set up the turbo encoder used in e.g. WCDMA the following code can be used (assuming a code block size of 320 bits):. More...
#include <itpp/comm/turbo.h>
Public Member Functions | |
Turbo_Codec (void) | |
Class constructor. | |
virtual | ~Turbo_Codec (void) |
Class destructor. | |
void | set_parameters (ivec gen1, ivec gen2, int constraint_length, const ivec &interleaver_sequence, int in_iterations=8, std::string in_metric="LOGMAX", double in_logmax_scale_factor=1.0, bool in_adaptive_stop=false, LLR_calc_unit lcalc=LLR_calc_unit()) |
Set parameters for the turbo encoder/decoder. | |
void | set_interleaver (const ivec &interleaver_sequence) |
Set a new internal interleaver sequence for the turbo encoder/decoder. | |
void | set_metric (std::string in_metric="LOGMAX", double in_logmax_scale_factor=1.0, LLR_calc_unit lcalc=LLR_calc_unit()) |
Set the decoder metric. | |
void | set_iterations (int in_iterations=8) |
Sets the number of decoding iterations. Default value is 8. | |
void | set_adaptive_stop (bool in_adaptive_stop=true) |
Use and adaptive number of iterations. | |
void | set_awgn_channel_parameters (double in_Ec, double in_N0) |
Set parameters for decoding on an AWGN channel. | |
void | set_scaling_factor (double in_Lc) |
Set scaling factor for decoding on e.g. Rayleigh fading channels. | |
void | encode (const bvec &input, bvec &output) |
Encoder function. | |
virtual void | decode (const vec &received_signal, bvec &decoded_bits, const bvec &true_bits="0") |
Decoder function. | |
virtual void | decode (const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits="0") |
Decoder function. | |
void | encode_block (const bvec &input, bvec &in1, bvec &in2, bmat &parity1, bmat &parity2) |
Encode a single block. | |
virtual void | decode_block (const vec &rec_syst1, const vec &rec_syst2, const mat &rec_parity1, const mat &rec_parity2, bmat &decoded_bits_i, int &nrof_used_iterations_i, const bvec &true_bits="0") |
Decode a single block. | |
long | get_Ncoded () |
Get number of coded bits. | |
long | get_Nuncoded () |
Get number of uncoded bits. | |
Protected Member Functions | |
void | decode_n3 (const vec &received_signal, bvec &decoded_bits, ivec &nrof_used_iterations, const bvec &true_bits="0") |
Special decoder function for R = 1/3 i.e. two parity bits for each systematic bit. | |
Protected Attributes | |
long | interleaver_size |
long | Ncoded |
long | Nuncoded |
int | m_tail |
int | n1 |
int | n2 |
int | n_tot |
int | iterations |
double | Ec |
double | N0 |
double | Lc |
double | R |
double | logmax_scale_factor |
bool | adaptive_stop |
std::string | metric |
bvec | decoded_bits_previous_iteration |
Rec_Syst_Conv_Code | rscc1 |
Rec_Syst_Conv_Code | rscc2 |
Sequence_Interleaver< bin > | bit_interleaver |
Sequence_Interleaver< double > | float_interleaver |
Related Functions | |
(Note that these are not member functions.) | |
ivec | wcdma_turbo_interleaver_sequence (int interleaver_size) |
Generates the interleaver sequence for the internal turbo encoder interleaver used in WCDMA. |
To set up the turbo encoder used in e.g. WCDMA the following code can be used (assuming a code block size of 320 bits):.
Turbo_Codec turbo; ivec gen(2); gen(0) = 013; gen(1) = 015; int constraint_length = 4; ivec interleaver_sequence = wcdma_turbo_interleaver_sequence( 320 ); turbo.set_parameters(gen, gen, constraint_length, interleaver_sequence);
Definition at line 57 of file turbo.h.
|
Class constructor.
|
|
Class destructor.
|
|
Set parameters for the turbo encoder/decoder.
Definition at line 38 of file turbo.cpp. References adaptive_stop, bit_interleaver, float_interleaver, interleaver_size, it_assert, it_error, iterations, Lc, logmax_scale_factor, m_tail, metric, n1, n2, n_tot, Ncoded, Nuncoded, rscc1, rscc2, itpp::Rec_Syst_Conv_Code::set_generator_polynomials(), itpp::Sequence_Interleaver< T >::set_interleaver_depth(), itpp::Sequence_Interleaver< T >::set_interleaver_sequence(), and itpp::Rec_Syst_Conv_Code::set_llrcalc(). |
|
Set a new internal interleaver sequence for the turbo encoder/decoder. By changing the interleaver sequence it is possible to change the code word size of the turbo codec. Note that you still must use the set_parameters function first to set the other parameters of the turbo codec. Definition at line 94 of file turbo.cpp. References bit_interleaver, float_interleaver, interleaver_size, m_tail, n1, n2, n_tot, Ncoded, Nuncoded, itpp::Sequence_Interleaver< T >::set_interleaver_depth(), and itpp::Sequence_Interleaver< T >::set_interleaver_sequence(). |
|
Set the decoder metric.
Definition at line 109 of file turbo.cpp. References it_error, logmax_scale_factor, metric, rscc1, rscc2, and itpp::Rec_Syst_Conv_Code::set_llrcalc(). |
|
Sets the number of decoding iterations. Default value is 8.
Definition at line 130 of file turbo.cpp. References iterations. |
|
Use and adaptive number of iterations.
When the adaptive stop criterion is used the iterations will stop before the maximum number of iterations is executed if the decoding results after one full iteration equals the previous iteration. Default value is Definition at line 135 of file turbo.cpp. References adaptive_stop. |
|
Set parameters for decoding on an AWGN channel.
Definition at line 140 of file turbo.cpp. References Ec, Lc, N0, and itpp::sqrt(). |
|
Set scaling factor for decoding on e.g. Rayleigh fading channels.
Setting the correct value of the channel reliability function is important for MAP decoder algorithms. However, if the Log-MAX decoding algorithm is used, then the value of Lc is not important. Assuming that the received soft values
where
where
Definition at line 147 of file turbo.cpp. References Lc. |
|
Encoder function. This function can encode several consecutive coding blocks. The output is organized as follows:
In the above expression
The tailbits from the first encoder are placed before the tailbits from the second encoder.
Definition at line 153 of file turbo.cpp. References encode_block(), n1, Ncoded, and Nuncoded. |
|
Decoder function. This function can decode several consecutive coding blocks that were encoded with the encode member function
|
|
Decoder function. This function can decode several consecutive coding blocks that were encoded with the encode member function
Definition at line 204 of file turbo.cpp. References decode_n3(), it_assert, iterations, metric, n2, Ncoded, Nuncoded, and itpp::Mat< Num_T >::set_size(). |
|
Encode a single block. This function is useful if rate matching is to be applied after the turbo encoder. The size of in1 and in2 equals the size of input plus the tail bits. Tailbits are appended ate the end of in1 and in2. The number of rows in parity1 and parity2 equals the lengths of in1 and in2 respectively. The number of columns of parity1 and parity2 equals the number of parity bits from the first and the second constituent encoders respectively.
Definition at line 291 of file turbo.cpp. References bit_interleaver, itpp::concat(), itpp::Rec_Syst_Conv_Code::encode_tail(), itpp::Sequence_Interleaver< T >::interleave(), it_assert, Nuncoded, rscc1, and rscc2. Referenced by encode(). |
|
Decode a single block. This function can decode a single coding blocks that was encoded with the encode_block member function. In order to speed up the decoding process it is possible to input the correct data bits. If this information is provided the decoder can stop iterating as soon as the decoded bits match the correct data bits. This simulation trick can greatly speed up the simulation time for high SNR cases when only a few iterations are required. If errors still exist after the maximum number of iterations have been performed, the decoding process stops. The matrix decoded_bits_i contains the result from decoding iteration i on row i. Even though both rec_syst1 and rec_syst2 are given as inputs, the systematic bits in rec_syst2 will in most cases be punctured and only the tailbits at the end of the vector rec_syst2 will have values different from zero.
Definition at line 321 of file turbo.cpp. References itpp::concat(), itpp::Sequence_Interleaver< T >::deinterleave(), float_interleaver, itpp::Sequence_Interleaver< T >::interleave(), interleaver_size, it_assert, iterations, itpp::Vec< Num_T >::left(), Nuncoded, itpp::Vec< Num_T >::right(), and itpp::Vec< Num_T >::set_size(). |
|
Get number of coded bits.
Definition at line 259 of file turbo.h. References Ncoded. |
|
Get number of uncoded bits.
Definition at line 262 of file turbo.h. References Nuncoded. |
|
Special decoder function for R = 1/3 i.e. two parity bits for each systematic bit.
Definition at line 440 of file turbo.cpp. References decoded_bits_previous_iteration, it_assert, and Ncoded. Referenced by decode(). |
|
Generates the interleaver sequence for the internal turbo encoder interleaver used in WCDMA.
|
Generated on Thu Apr 19 14:20:42 2007 for IT++ by Doxygen 1.4.6