Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Use faster CRC16 algorithm to speed up encoding/decoding #57
This PR replaces the single look-up-table CRC16 implementation with the slicing-by-8 algorithm. The new algorithm is approximately 5 times faster than single table lookup CRC and improves FLAC encoding/decoding performance by about 5%.
The PR consists of 3 commits:
The last of the relevant patents on this algorithm expired in December 2017. The slicing algorithm is already used by zlib, the Linux kernel and other projects.
It would be great to see this added to the official FLAC source.
I make x86-64 builds of FLAC with MinGW and GCC 7.3.0.
This code passes all tests when I build it with '--host=x86_64-w64-mingw32' option, but fails with '--enable-64-bit-words --host=x86_64-w64-mingw32' option.
The last line of the output of 'make check':
and test_libFLAC.exe crashes with 0xc0000005 exception.
Thanks for looking into this!
Indeed, there was a bug in
Should be fixed now.
I've just had a look at this and it looks good, but there is no test in the test suite that would fail if this was wrong.
Let my update the test suite on master (which will test the CRC functionality currently on master) then I can run the new tests with this code.
Update: I'm going to try and get these tests done over the next couple of days.
And then life got in the way.
@enzo1982 If you could write some tests. Would be really good to do this in a separate PR, with just the tests (and removing the unused CRC8 functions). We could then get that merged and rebase this PR on top of it to make absolutely 100% sure nothing gets broken.