You might want to check out "Turbo code"
It approaches the channel max capacity and is the basis for modern cellular internet (3G/4G).
It is also used for deep space communications, where squeezing every bit is essential.
The wikipedia article is quite well crafted. https://en.wikipedia.org/wiki/Turbo_code
For a sample CPP implementation can be found here. http://the-art-of-ecc.com/topics.html