Main Content

tpcenc

Turbo product code (TPC) encoder

Description

example

code = tpcenc(msg,N,K) performs 2-D TPC encoding of the input message, msg, using two linear block codes specified by codeword length N and message length K. For a description of 2-D TPC encoding, see Turbo Product Code Construction.

example

code = tpcenc(msg,N,K,S) performs 2-D TPC encoding on the shortened input message of length S, using a 2-D TPC encoder specified by codeword length (NK+S) and message length S.

Examples

collapse all

Encode a random bit vector using 2-D turbo product coding (TPC) with extended Hamming codes and extended BCH codes.

Specify (N,K) code pairs for TPC encoding.

N = [32;64]; 
K = [21;57]; 

Generate a column vector of random message bits. The desired length for the message bits is the product of elements in K.

msg = randi([0 1],prod(K),1);

TPC-encode the message.

code = tpcenc(msg,N,K);

Verify that the length of the encoded codeword is the product of elements in N.

size(code)
ans = 1×2

        2048           1

prod(N)
ans = 2048

Encode a random bit vector using 2-D turbo product coding (TPC), applying message shortening.

Specify (N,K) code pairs and S for TPC encoding.

N = [32;64];
K = [21;57];
S = [19;24];

Generate a column vector of random message bits. The desired length for the shortened message bits is the product of the elements in S.

msg = randi([0 1],prod(S),1);

TPC-encode the shortened message.

code = tpcenc(msg,N,K,S);

Verify that the length of the encoded codeword is the product of elements in (N-K+S).

size(code)
ans = 1×2

   930     1

prod(N-K+S)
ans = 930

Input Arguments

collapse all

Input message bits to encode, specified as a column vector.

  • For a full-length input messages, the length of the column vector must be the product of the elements in K.

  • For a shortened input messages, the length of the column vector must be the product of the elements in S.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | logical

Codeword length, specified as a two-element integer vector, [NR; NC]. NR represents the number of rows in the product code matrix. NC represents the number of columns in the product code matrix. For more information about NR and NC, see Turbo Product Code Construction. For a list of valid (N(i),K(i)) code pairs, see Component Codes.

Data Types: double

Message length, specified as a two-element integer vector, [KR; KC]. For a full-length message, the input column vector containing the message bits to encode is arranged into a KR-by-KC matrix. KR represents the number of rows in the message matrix. KC represents the number of columns in the message matrix. For more information about KR and KC, see Turbo Product Code Construction. For a list of valid (N(i),K(i)) code pairs, see Component Codes.

Data Types: double

Shortened message length, specified as a two-element integer vector, [SR; SC]. For a shortened message, the input column vector containing the message bits to encode is arranged into an SR-by-SC matrix. SR represents the number of rows in the matrix. SC represents the number of columns in the matrix. For more information about SR and SC, see Turbo Product Code Construction.

When you specify this parameter, specify N and K vectors for the full-length TPC codes that are shortened to (N(i)–K(i)+S(i), S(i)) codes.

Data Types: double

Output Arguments

collapse all

TPC-encoded message, returned as a column vector with the same data type as the input message bits.

  • For full-length input messages, the length of the returned column vector is the product of the elements in N.

  • For shortened input messages, the length of the returned column vector is the product of the elements in (NK+S).

More About

collapse all

Component Codes

This table lists the supported component code pairs for the row (NR,KR) and column (NC,KC) parameters.

  • NR and KR represent the number of rows in the product code matrix and message matrix, respectively.

  • NC and KC represent the number of columns in the product code matrix and message matrix, respectively.

Within each code type, any two component code pairs can form a 2-D TPC code. The table also includes the error-correction capability for each code pair.

Code typeComponent Code Pairs(NR,KR) and (NC,KC)Error-Correction Capability (T)
Hamming code(255,247)1
(127,120)1
(63,57)1
(31,26)1
(15,11)1
(7,4)1
Extended Hamming code (256,247)1
(128,120)1
(64,57)1
(32,26)1
(16,11)1
(8,4)1
BCH code(255,239)2
(127,113)2
(63,51)2
(31,21)2
(15,7)2
Extended BCH code(256,239)2
(128,113)2
(64,51)2
(32,21)2
(16,7)2
Parity check code(256,255)-
(128,127)-
(64,63)-
(32,31)-
(16,15)-
(8,7)-
(4,3)-

Turbo Product Code Construction

Turbo product codes (TPC) are a form of concatenated codes used as forward error-correcting (FEC) codes. Two or more component block codes, such as systematic linear block codes, are used to construct TPCs. This encoder implements 2-D product code encoding, as described in [1], using two Linear Block Codes.

The TPC encoder accepts either full-length or shortened messages.

 Construction of Full-Length Message Product Codes

 Construction of Shortened Message Product Codes

References

[1] Pyndiah, R. M. "Near-Optimum Decoding of Product Codes: Block Turbo Codes." IEEE Transactions on Communications. Volume 46, Number 8, August 1998, pp. 1003–1010.

Extended Capabilities

Version History

Introduced in R2018a

See Also

Functions

Objects

Blocks