Viterbi.c, integer overflow at cumulative metric

Hi all,

I noticed that in viterbi.c when input symbol pair quality is
good, branch metrics ‘mets[ ]’ maximum value is 512. In case of
errorless input symbols, this causes cumulative metric increase
by 512 for the best path for each decoded bit. In BUTTERFLY
macro, m0 and m1 are type of int, i.e. they can hold integers
less than 2^31, but since metric increases by 8x2^9=2^12 for
each output byte, this implies that after 2^31 / 2^12 = 2^19:th
byte occurs an integer overflow and decoder output gets messy.

This is simple to check, if you connect constant source of -1’s
to ccsds27decoder and write output to a file and then run
hexdump of the file.

I corrected this by changing the type of m0, m1 and metric to
long long, when the integer overflow should not exist before
2^51:th byte. However, with periodic initialization of metric
the integer overflow of cumulative metric would be fully avoided.

Best regards,
Vesa Vaskelainen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Vesa,

the cc_decoder_impl.cc and it’s corresponding volk kernel
“volk_8u_x4_conv_k7_r2_8u.h” in gr-fec avoid this problem already by
normalizing the path metric after each step in the trellis. I’m not
sure if they are on the master branch yet, but you can check out
Tom R.'s gnuradio repo (trondeau (Tom Rondeau) · GitHub).

  • -Jan

On 14.07.2014 08:54, Vaskelainen Vesa wrote:

_______________________________________________ Discuss-gnuradio
mailing list [email protected]
Discuss-gnuradio Info Page

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTw4SLAAoJEJmPbVa7qwgjz+MH/2qUOYHwxCpAqwUtpXe0eOEX
+wf4FvJhFTMUdNf/WmlUMt28jtYc3a0xjkJVD+vQO1vNP2e4GlQsB2Rywe5ZUf71
0fDghklVRjN+idwRZWV51FDxpvdU8Tk1kC4PYI/8s1FZ+M7uGc/bLB8LMO7MCNwG
QgjPW7Hl+efUXoYtDshueWY8RbmccUg7EzWNqAgryumkKai3tsg3yODNNMtBrouE
R9DPO4ZbUwcqogk5EpIQxoYusRT2OmLDxD0XE80IuJ/VHLd0j6qdbXULHrj33XGz
o6XP2+nS1Yj1Mw8zcnxdBcG1M4V3B7r2q9UXtmVh6RU1qZDNoNQo69c+h1n2k8E=
=+K4q
-----END PGP SIGNATURE-----

On Mon, Jul 14, 2014 at 3:19 AM, Jan Krämer [email protected]
wrote:

  • -Jan

Yes, this was merged into the master branch:

http://gnuradio.org/doc/doxygen/page_fec.html

Tom