Show HN: SIMD Viterbi Decoder in Rust
Posted by brian-armstrong 2 days ago
I wrote libcorrect in C in 2016 and wanted to revisit it in Rust. Instead of doing just a direct conversion, I went down the rabbit hole of making Rust's std::simd work for me. I ended up with a templated, generic Viterbi decoder for convolutional codes that dispatches the decode at runtime depending on which instruction sets are available. For small rates and orders, the entire decode lives in registers. Larger codes work through memory but take advantage of some acceleration structures.
I also spent some time building a tool to find optimal (max d_free) conv codes for a given rate and order. Of course, there are better mechanisms available today, but I'm happy to talk through anything I learned in the process.
Comments
Comment by nickcw 1 day ago
Next LDPC codes?
Comment by brian-armstrong 1 day ago
As far as LDPC, I'd love to, but I need to get a better understanding of them first. I'll probably go for Turbo next just because conceptually they feel closer to the convolutional codes I have already. But time willing, it'd be fun to do both.
Comment by eminence32 2 days ago
Comment by brian-armstrong 2 days ago
Comment by femto 1 day ago
Comment by brian-armstrong 1 day ago
Comment by femto 1 day ago
"How do you find the speed of the Rust version of your FEC vs, the C version?"
translates from "Australian" to "English" as:
"What is the speed of the Rust version of your FEC vs, the C version?
Though it was interesting to know how you do it. I'm interested in the speed, as I once looked into using Rust for a signal processing project, but ultimately went with C++ because the team wasn't familiar with Rust. At the time, it seemed to me that Rust had the potential to go faster.
Comment by brian-armstrong 1 day ago
tldr: My library matches or beats libfec's SSE2 assembly for convolutional codes and pretty steadily beats it in Reed-Solomon. For the convolutional codes, my crate is using a generic, templated decoder rather than hand-written assembly, so it was nice to see that I could match the performance.
Comment by femto 1 day ago
Comment by johschmitz 1 day ago
Comment by ChadNauseam 2 days ago