Skip to content

komm.ViterbiStreamDecoder

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.

__call__

Parameters:

  • input (ArrayLike)

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

Returns:

  • output (NDArray[integer])

    The decoded bit sequence.

Examples:

>>> convolutional_code = komm.ConvolutionalCode([[0o7, 0o5]])
>>> decoder = komm.ViterbiStreamDecoder(convolutional_code, traceback_length=10)
>>> 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])
>>> decoder(np.zeros(2*10, dtype=int))
array([1, 0, 1, 1, 1, 0, 1, 1, 0, 0])