]> git.ipfire.org Git - thirdparty/zstd.git/commit
fixed Multi-threaded compression
authorYann Collet <cyan@fb.com>
Thu, 19 Jan 2017 18:32:55 +0000 (10:32 -0800)
committerYann Collet <cyan@fb.com>
Thu, 19 Jan 2017 18:32:55 +0000 (10:32 -0800)
commit32dfae6f9841871d88eadcd27a970efab71feb28
tree4ff13dac102918a952854bc73972b91dba4206d0
parent37226c1e9f968dd1a0f4bdbcfaf54716aa88697d
fixed Multi-threaded compression

MT compression generates a single frame.
Multi-threading operates by breaking the frames into independent sections.
But from a decoder perspective, there is no difference :
it's just a suite of blocks.

Problem is, decoder preserves repCodes from previous block to start decoding next block.
This is also valid between sections, since they are no different than changing block.

Previous version would incorrectly initialize repcodes to their default value at the beginning of each section.
When using them, there was a mismatch between encoder (default values) and decoder (values from previous block).

This change ensures that repcodes won't be used at the beginning of a new section.
It works by setting them to 0.
This only works with regular (single segment) variants : extDict variants will fail !
Fortunately, sections beyond the 1st one belong to this category.

To be checked : btopt strategy.
This change was only validated from fast to btlazy2 strategies.
lib/common/zstd_internal.h
lib/compress/zstd_compress.c
lib/compress/zstdmt_compress.c