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
Full-length input messages are encoded using specified 2-D TPC code pairs. Row-wise
encoding uses the
(NC,KC)
code pair and column-wise encoding uses the
(NR,KR)
code pair. The input vector length must be KR
· KC. The input message bits vector is
arranged into a
KR-by-KC
matrix.

Row-wise encoding uses an
(NC,KC)
systematic linear block encoder with KC bits
per row. The row-wise encoding results in a
KR-by-NC
matrix that includes parity bits added to each row.

Next, column-wise encoding uses an
(NR,KR)
systematic linear block encoder on each of the
NC columns. Applying this 2-D TPC encoding
to the initial
KR-by-KC
matrix results in an
NR-by-NC
matrix that includes parity bits added to each row and column.
The 2-D TPC full-code matrix is reshaped into a column vector of length
NR ·
NC and returned as the TPC-encoded
output.
Construction of Shortened Message Product Codes
Shortened input messages are encoded using specified 2-D TPC code pairs. Row-wise
encoding uses the
(NC,KC)
code pair and column-wise encoding uses an
(NR,KR)
code pair. The input vector length must be SR
· SC. The input shortened message bits vector
is arranged into an
SR-by-SC
matrix. The shortened message matrix prepends two dimensions by padding the beginning of
the message matrix with zeros. The resulting matrix is a
KR-by-KC
matrix.

Row-wise encoding uses an
(NC,KC)
systematic linear block encoder with KC bits
per row. The row-wise encoding results in a
KR-by-NC
matrix that includes parity bits added to each row.

Next, the column-wise encoding uses an
(NR,KR)
systematic linear block encoder on each of the
NC columns.
Applying this 2-D TPC encoding to the initial
KR-by-KC
matrix and excluding the zero-padded bits from the output results in an
(NR–KR+SR)-by-(NC–KC+SC)
matrix. This matrix includes parity bits added to each row and column.

The 2-D TPC shortened-code matrix is reshaped into a column vector of length
(NR–KR+SR)
·
(NC–KC+SC)
and returned as the TPC-encoded output.