Use faster CRC16 algorithm to speed up encoding/decoding#57
Conversation
|
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. Please investigate. |
|
Thanks for looking into this! Indeed, there was a bug in Should be fixed now. |
This suggests that the travis build tests are incomplete. Looking into that now. |
|
@erikd Any news on this? Are you going to merge it? |
|
Superceded by comment below. |
|
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. |
|
Let me know if I can help with the tests. I could implement them and add the commits here. |
|
Thanks for the offer, but this is one I'd prefer to do myself. This weekend at the latest. |
|
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. |
|
OK, no problem. I think I can do this by Saturday. |
|
Is this still needed? If so, it needs a rebase. |
|
Thanks for merging the tests! I'll rebase this one later today. |
Update FLAC__BitReader structure in unit test.
|
The PR is rebased now. Should be ready for merging once the Travis build completes. |
|
Thanks @enzo1982 ! |
Hi all,
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.
See here for my original article on this and here for the discussion on HydrogenAudio.
It would be great to see this added to the official FLAC source.
Robert