summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/lz4frame.c8
-rw-r--r--programs/bench.c13
-rw-r--r--programs/bench.h1
-rw-r--r--programs/lz4cli.c4
4 files changed, 18 insertions, 8 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index ffd0e9c..cba5744 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -1959,11 +1959,11 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx,
(void)readCRC;
(void)resultCRC;
#endif
- nextSrcSizeHint = 0;
- LZ4F_resetDecompressionContext(dctx);
- doAnotherStage = 0;
- break;
}
+ nextSrcSizeHint = 0;
+ LZ4F_resetDecompressionContext(dctx);
+ doAnotherStage = 0;
+ break;
case dstage_getSFrameSize:
if ((srcEnd - srcPtr) >= 4) {
diff --git a/programs/bench.c b/programs/bench.c
index 7836717..00de426 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -123,6 +123,7 @@ static size_t g_blockSize = 0;
int g_additionalParam = 0;
int g_benchSeparately = 0;
int g_decodeOnly = 0;
+unsigned g_skipChecksums = 0;
void BMK_setNotificationLevel(unsigned level) { g_displayLevel=level; }
@@ -140,6 +141,8 @@ void BMK_setBenchSeparately(int separate) { g_benchSeparately = (separate!=0); }
void BMK_setDecodeOnlyMode(int set) { g_decodeOnly = (set!=0); }
+void BMK_skipChecksums(int skip) { g_skipChecksums = (skip!=0); }
+
/* *************************************
* Compression state management
@@ -318,10 +321,11 @@ LZ4F_decompress_binding(const char* src, char* dst,
{
size_t dstSize = (size_t)dstCapacity;
size_t readSize = (size_t)srcSize;
+ LZ4F_decompressOptions_t const dOpt = { 1, g_skipChecksums, 0, 0 };
size_t const decStatus = LZ4F_decompress(g_dctx,
dst, &dstSize,
src, &readSize,
- NULL /* dOptPtr */);
+ &dOpt);
if ( (decStatus == 0) /* decompression successful */
&& ((int)readSize==srcSize) /* consume all input */ )
return (int)dstSize;
@@ -775,7 +779,12 @@ int BMK_benchFiles(const char** fileNamesTable, unsigned nbFiles,
if (cLevel > LZ4HC_CLEVEL_MAX) cLevel = LZ4HC_CLEVEL_MAX;
if (g_decodeOnly) {
- DISPLAYLEVEL(2, "Benchmark Decompression (only) of LZ4 Frame \n");
+ DISPLAYLEVEL(2, "Benchmark Decompression of LZ4 Frame ");
+ if (g_skipChecksums) {
+ DISPLAYLEVEL(2, "_without_ checksum even when present \n");
+ } else {
+ DISPLAYLEVEL(2, "+ Checksum when present \n");
+ }
cLevelLast = cLevel;
}
if (cLevelLast > LZ4HC_CLEVEL_MAX) cLevelLast = LZ4HC_CLEVEL_MAX;
diff --git a/programs/bench.h b/programs/bench.h
index 9b0f667..1d81a99 100644
--- a/programs/bench.h
+++ b/programs/bench.h
@@ -47,6 +47,7 @@ void BMK_setBlockSize(size_t blockSize); /* Internally cut input file(s) into
void BMK_setNotificationLevel(unsigned level); /* Influence verbosity level */
void BMK_setBenchSeparately(int separate); /* When providing multiple files, output one result per file */
void BMK_setDecodeOnlyMode(int set); /* v1.9.4+: set benchmark mode to decode only */
+void BMK_skipChecksums(int skip); /* v1.9.4+: only useful for DecodeOnlyMode; do not calculate checksum when present, to save CPU time */
void BMK_setAdditionalParam(int additionalParam); /* hidden param, influence output format, for python parsing */
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 42132b9..ca4951e 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -389,8 +389,8 @@ int main(int argc, const char** argv)
if (!strcmp(argument, "--no-force")) { LZ4IO_setOverwrite(prefs, 0); continue; }
if ((!strcmp(argument, "--stdout"))
|| (!strcmp(argument, "--to-stdout"))) { forceStdout=1; output_filename=stdoutmark; continue; }
- if (!strcmp(argument, "--frame-crc")) { LZ4IO_setStreamChecksumMode(prefs, 1); continue; }
- if (!strcmp(argument, "--no-frame-crc")) { LZ4IO_setStreamChecksumMode(prefs, 0); continue; }
+ if (!strcmp(argument, "--frame-crc")) { LZ4IO_setStreamChecksumMode(prefs, 1); BMK_skipChecksums(0); continue; }
+ if (!strcmp(argument, "--no-frame-crc")) { LZ4IO_setStreamChecksumMode(prefs, 0); BMK_skipChecksums(1); continue; }
if (!strcmp(argument, "--content-size")) { LZ4IO_setContentSize(prefs, 1); continue; }
if (!strcmp(argument, "--no-content-size")) { LZ4IO_setContentSize(prefs, 0); continue; }
if (!strcmp(argument, "--list")) { mode = om_list; continue; }