Update to Fast LZMA2 1.0.0

This commit is contained in:
conor42
2019-03-18 00:05:50 +10:00
parent f531a44f1c
commit d85962e654
43 changed files with 5467 additions and 3943 deletions

View File

@@ -20,8 +20,9 @@
#include "radix_internal.h"
#include "lzma2_enc.h"
#include "fast-lzma2.h"
#include "fl2threading.h"
#include "fl2pool.h"
#include "fl2_threading.h"
#include "fl2_pool.h"
#include "dict_buffer.h"
#ifndef NO_XXHASH
# include "xxhash.h"
#endif
@@ -30,19 +31,6 @@
extern "C" {
#endif
typedef struct {
unsigned dictionaryLog; /* largest match distance : larger == more compression, more memory needed during decompression; >= 27 == more memory, slower */
unsigned overlapFraction; /* overlap between consecutive blocks in 1/16 units: larger == more compression, slower */
unsigned chainLog; /* fully searched segment : larger == more compression, slower, more memory; hybrid mode only (ultra) */
unsigned searchLog; /* nb of searches : larger == more compression, slower; hybrid mode only (ultra) */
unsigned searchDepth; /* maximum depth for resolving string matches : larger == more compression, slower; >= 64 == more memory, slower */
unsigned fastLength; /* acceptable match size for parser, not less than searchDepth : larger == more compression, slower; fast bytes parameter from 7-zip */
unsigned divideAndConquer; /* split long chains of 2-byte matches into shorter chains with a small overlap : faster, somewhat less compression; enabled by default */
unsigned bufferLog; /* buffer size for processing match chains is (dictionaryLog - bufferLog) : when divideAndConquer enabled, affects compression; */
/* when divideAndConquer disabled, affects speed in a hardware-dependent manner */
FL2_strategy strategy; /* encoder strategy : fast, optimized or ultra (hybrid) */
} FL2_compressionParameters;
/*-*************************************
* Context memory management
***************************************/
@@ -60,38 +48,43 @@ typedef struct {
typedef struct {
FL2_CCtx* cctx;
FL2_lzmaEncoderCtx* enc;
LZMA2_ECtx* enc;
FL2_dataBlock block;
size_t cSize;
} FL2_job;
struct FL2_CCtx_s {
DICT_buffer buf;
FL2_CCtx_params params;
#ifndef FL2_SINGLETHREAD
FL2POOL_ctx* factory;
FL2POOL_ctx* compressThread;
#endif
FL2_dataBlock curBlock;
size_t asyncRes;
size_t threadCount;
size_t outThread;
size_t outPos;
size_t dictMax;
U64 block_total;
U64 streamTotal;
U64 streamCsize;
FL2_matchTable* matchTable;
#ifndef FL2_SINGLETHREAD
U32 timeout;
#endif
U32 rmfWeight;
U32 encWeight;
FL2_atomic progressIn;
FL2_atomic progressOut;
int canceled;
BYTE wroteProp;
BYTE endMarked;
BYTE loopCount;
BYTE lockParams;
unsigned jobCount;
FL2_job jobs[1];
};
struct FL2_CStream_s {
FL2_CCtx* cctx;
FL2_blockBuffer inBuff;
#ifndef NO_XXHASH
XXH32_state_t *xxh;
#endif
size_t thread_count;
size_t out_thread;
size_t out_pos;
size_t hash_pos;
BYTE end_marked;
BYTE wrote_prop;
};
#if defined (__cplusplus)
}
#endif