zstd/lib/common
Nick Terrell e103d7b4a6
Fix superblock mode (#2100)
Fixes:

Enable RLE blocks for superblock mode
Fix the limitation that the literals block must shrink. Instead, when we're within 200 bytes of the next header byte size, we will just use the next one up. That way we should (almost?) always have space for the table.
Remove the limitation that the first sub-block MUST have compressed literals and be compressed. Now one sub-block MUST be compressed (otherwise we fall back to raw block which is okay, since that is streamable). If no block has compressed literals that is okay, we will fix up the next Huffman table.
Handle the case where the last sub-block is uncompressed (maybe it is very small). Before it would skip superblock in this case, now we allow the last sub-block to be uncompressed. To do this we need to regenerate the correct repcodes.
Respect disableLiteralsCompression in superblock mode
Fix superblock mode to handle a block consisting of only compressed literals
Fix a off by 1 error in superblock mode that disabled it whenever there were last literals
Fix superblock mode with long literals/matches (> 0xFFFF)
Allow superblock mode to repeat Huffman tables
Respect ZSTD_minGain().
Tests:

Simple check for the condition in #2096.
When the simple_round_trip fuzzer enables superblock mode, it checks that the compressed size isn't expanded too much.
Remaining limitations:

O(targetCBlockSize^2) because we recompute statistics every sequence
Unable to split literals of length > targetCBlockSize into multiple sequences
Refuses to generate sub-blocks that don't shrink the compressed data, so we could end up with large sub-blocks. We should emit those sections as uncompressed blocks instead.
...
Fixes #2096
2020-05-01 16:11:47 -07:00
..
bitstream.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
compiler.h Merge pull request #2040 from caoyzh/dev-2 2020-04-08 13:14:47 -07:00
cpu.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
debug.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
debug.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
entropy_common.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
error_private.c [lib] Add ZSTD_d_stableOutBuffer 2020-04-27 18:09:44 -07:00
error_private.h Code replicated in compression and decompression moved to shared headers 2020-04-07 11:02:06 +02:00
fse_decompress.c Code replicated in compression and decompression moved to shared headers 2020-04-07 11:02:06 +02:00
fse.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
huf.h Fix superblock mode (#2100) 2020-05-01 16:11:47 -07:00
mem.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
pool.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
pool.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
threading.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
threading.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
xxhash.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
xxhash.h Fix copyright and license lines 2020-03-26 17:02:06 -07:00
zstd_common.c Fix copyright and license lines 2020-03-26 17:02:06 -07:00
zstd_errors.h [lib] Add ZSTD_d_stableOutBuffer 2020-04-27 18:09:44 -07:00
zstd_internal.h Fix superblock mode (#2100) 2020-05-01 16:11:47 -07:00