Skip to content

komm.ConvolutionalStreamDecoder

Convolutional stream decoder using Viterbi algorithm. Decode a (hard or soft) bit stream given a convolutional code, assuming a traceback length (path memory) of $\tau$. At time $t$, the decoder chooses the path survivor with best metric at time $t - \tau$ and outputs the corresponding information bits. The output stream has a delay equal to $k \tau$, where $k$ is the number of input bits of the convolutional code. As a rule of thumb, the traceback length is chosen as $\tau = 5\mu$, where $\mu$ is the memory order of the convolutional code.

Attributes:

  • convolutional_code (ConvolutionalCode)

    The convolutional code.

  • traceback_length (int)

    The traceback length (path memory) $\tau$ of the decoder.

  • state (int)

    The current state of the decoder. The default value is 0.

  • input_type (str)

    The type of the input sequence, either hard or soft. The default value is hard.

Input:

  • in0 (Array1D[int] | Array1D[float])

    The (hard or soft) bit sequence to be decoded.

Output:

  • out0 (Array1D[int])

    The decoded bit sequence.

Examples:

>>> convolutional_code = komm.ConvolutionalCode([[0o7, 0o5]])
>>> convolutional_decoder = komm.ConvolutionalStreamDecoder(convolutional_code, traceback_length=10)
>>> convolutional_decoder([1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1])
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
>>> convolutional_decoder(np.zeros(2*10, dtype=int))
array([1, 0, 1, 1, 1, 0, 1, 1, 0, 0])