mirror of
https://github.com/lz4/lz4.git
synced 2024-11-24 10:24:00 +08:00
modified a few traces for debug
This commit is contained in:
parent
1838803948
commit
8af32ce6f7
@ -594,7 +594,6 @@ LZ4_FORCE_INLINE void LZ4_prepareTable(
|
||||
cctx->tableType = clearedTable;
|
||||
} else {
|
||||
DEBUGLOG(4, "Re-use hash table (no reset)");
|
||||
//if (tableType == byU32) cctx->currentOffset += 64 KB;
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,9 +601,11 @@ LZ4_FORCE_INLINE void LZ4_prepareTable(
|
||||
* than compressing without a gap. However, compressing with
|
||||
* currentOffset == 0 is faster still, so we preserve that case.
|
||||
*/
|
||||
DEBUGLOG(2, "tableType=%u, currentOffset=%u", cctx->tableType, cctx->currentOffset);
|
||||
if (cctx->currentOffset != 0 && tableType == byU32) {
|
||||
cctx->currentOffset += 64 KB;
|
||||
}
|
||||
DEBUGLOG(2, "currentOffset: %u", cctx->currentOffset);
|
||||
|
||||
/* Finally, clear history */
|
||||
cctx->dictCtx = NULL;
|
||||
@ -1267,7 +1268,7 @@ int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize)
|
||||
const BYTE* const dictEnd = p + dictSize;
|
||||
const BYTE* base;
|
||||
|
||||
DEBUGLOG(4, "LZ4_loadDict %p", LZ4_dict);
|
||||
DEBUGLOG(4, "LZ4_loadDict (%p into %p)", dictionary, LZ4_dict);
|
||||
|
||||
LZ4_prepareTable(dict, 0, tableType);
|
||||
|
||||
|
@ -336,7 +336,7 @@ LZ4_FORCE_INLINE int LZ4HC_encodeSequence (
|
||||
U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0;
|
||||
U32 const cost = 1 + llAdd + ll + 2 + mlAdd;
|
||||
if (start==NULL) start = *anchor; /* only works for single segment */
|
||||
//g_debuglog_enable = (pos >= 2228) & (pos <= 2262);
|
||||
/* g_debuglog_enable = (pos >= 2228) & (pos <= 2262); */
|
||||
DEBUGLOG(6, "pos:%7u -- literals:%3u, match:%4i, offset:%5u, cost:%3u + %u",
|
||||
pos,
|
||||
(U32)(*ip - *anchor), matchLength, (U32)(*ip-match),
|
||||
@ -1137,15 +1137,14 @@ static int LZ4HC_compress_optimal (
|
||||
encode: /* cur, last_match_pos, best_mlen, best_off must be set */
|
||||
assert(cur < LZ4_OPT_NUM);
|
||||
assert(last_match_pos >= 1); /* == 1 when only one candidate */
|
||||
DEBUGLOG(6, "reverse traversal, looking for shortest path")
|
||||
DEBUGLOG(6, "last_match_pos = %i", last_match_pos);
|
||||
DEBUGLOG(6, "reverse traversal, looking for shortest path (last_match_pos=%i)", last_match_pos);
|
||||
{ int candidate_pos = cur;
|
||||
int selected_matchLength = best_mlen;
|
||||
int selected_offset = best_off;
|
||||
while (1) { /* from end to beginning */
|
||||
int const next_matchLength = opt[candidate_pos].mlen; /* can be 1, means literal */
|
||||
int const next_offset = opt[candidate_pos].off;
|
||||
DEBUGLOG(6, "pos %i: sequence length %i", candidate_pos, selected_matchLength);
|
||||
DEBUGLOG(7, "pos %i: sequence length %i", candidate_pos, selected_matchLength);
|
||||
opt[candidate_pos].mlen = selected_matchLength;
|
||||
opt[candidate_pos].off = selected_offset;
|
||||
selected_matchLength = next_matchLength;
|
||||
|
@ -632,13 +632,15 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
|
||||
FUZ_CHECKTEST(ret>0, "LZ4_compress_fast_continue using ExtDict should fail : one missing byte for output buffer : %i written, %i buffer", ret, blockContinueCompressedSize);
|
||||
|
||||
FUZ_DISPLAYTEST("test LZ4_compress_fast_continue() with dictionary loaded with LZ4_loadDict()");
|
||||
DISPLAYLEVEL(5, " compress %i bytes from buffer(%p) into dst(%p) using dict(%p) of size %i \n", blockSize, block, decodedBuffer, dict, dictSize);
|
||||
LZ4_loadDict(&LZ4dict, dict, dictSize);
|
||||
ret = LZ4_compress_fast_continue(&LZ4dict, block, compressedBuffer, blockSize, blockContinueCompressedSize, 1);
|
||||
FUZ_CHECKTEST(ret!=blockContinueCompressedSize, "LZ4_compress_limitedOutput_compressed size is different (%i != %i)", ret, blockContinueCompressedSize);
|
||||
FUZ_CHECKTEST(ret<=0, "LZ4_compress_fast_continue should work : enough size available within output buffer");
|
||||
|
||||
/* Decompress with dictionary as external */
|
||||
FUZ_DISPLAYTEST("test LZ4_decompress_fast_usingDict(): decoding %i bytes, dict(%p) of size %i", blockSize, dict, dictSize);
|
||||
FUZ_DISPLAYTEST("test LZ4_decompress_fast_usingDict() with dictionary as extDict");
|
||||
DISPLAYLEVEL(5, " decoding %i bytes from buffer(%p) using dict(%p) of size %i \n", blockSize, decodedBuffer, dict, dictSize);
|
||||
decodedBuffer[blockSize] = 0;
|
||||
ret = LZ4_decompress_fast_usingDict(compressedBuffer, decodedBuffer, blockSize, dict, dictSize);
|
||||
FUZ_CHECKTEST(ret!=blockContinueCompressedSize, "LZ4_decompress_fast_usingDict did not read all compressed block input");
|
||||
|
Loading…
Reference in New Issue
Block a user