Skip to content

Commit abe571e

Browse files
committed
Adjust trellis to work in smaller send chunks
Smaller send chunks can cause the trellis to not go through all the depth. Causing the bits to not be decoded and ending in errors.
1 parent c5919c2 commit abe571e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

commpy/channelcoding/convcode.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,13 @@ def viterbi_decode(coded_bits, trellis, tb_depth=None, decoding_type='hard'):
695695
rate = k/n
696696
total_memory = trellis.total_memory
697697

698-
if tb_depth is None:
699-
tb_depth = 5*total_memory
700-
701698
# Number of message bits after decoding
702699
L = int(len(coded_bits)*rate)
703700

701+
if tb_depth is None:
702+
tb_depth = min(5 * total_memory, L)
703+
704+
704705
path_metrics = np.full((trellis.number_states, 2), np.inf)
705706
path_metrics[0][0] = 0
706707
paths = np.empty((trellis.number_states, tb_depth), 'int')

0 commit comments

Comments
 (0)