Hello everyone! I continue to remake my old C++ audio data compression software. Maybe it goes not so fast, but I already see the end of doing that in sight. And today let's talk about binary encoding.

Every compression software needs to make a representation of original information data in the smallest amount of bits possible. So we need to find a way to make our data to use the smallest amount of bits possible. The process of doing it is called Entropy Coding. More information about it you can find here ->>> link

In my DWA audio compression software I use Elias Gamma Codes. Elias Gamma Codes are universal codes for encoding positive integers developed by Peter Elias, just take a look at this picture - I think that it perfectly shows how it works:

As it can be seen from the picture, Elias Codes are variable-length codes, and they have a prefix, which consists of zeroes and the data block. In case the decimal value is 0 the prefix is not needed. Elias Codes are most efficient when we need to store decimal values that are close to zero - and this is exactly what I do in my audio compression software.  And here it is - my source code: