Contributing a Golay encoder/decoder to codec2

I've been following the development of FreeDV, a libre very-low bitrate digital voice system for amateur radio. Central to this is codec2, the codec used in the system. A few days ago a thread popped on the mailing list that the existing implementation of binary Golay codes was not (L)GPL compatible and that a replacement was needed. Since I've held a bit of an interest in forward error correction (FEC) lately I decided to take a stab at reimplementation.

The implementation ended up not taking terribly long. The main issue was that the old decoder would shift the return value of golay23_decode() left 11 bits compared to golay23_encode() whereas my initial attempt would do the most obvious thing, having golay23_decode(golay23_encode(x)) == x. But once I figured this out the rest was trivial.

The result of my efforts can now be seen in golay32.c on the codec2-dev SVN. This whole thing is also giving me inspiration to continue further down the FEC path, which is especially relevant for the ULV project (putting a scientific instrument on the moon). I might do a post with more information about that on the other blog..