| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| /* ****************************************************************** | ||
| hist : Histogram functions | ||
| part of Finite State Entropy project | ||
| Copyright (C) 2013-present, Yann Collet. | ||
| BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
| * Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above | ||
| copyright notice, this list of conditions and the following disclaimer | ||
| in the documentation and/or other materials provided with the | ||
| distribution. | ||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| You can contact the author at : | ||
| - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy | ||
| - Public forum : https://groups.google.com/forum/#!forum/lz4c | ||
| ****************************************************************** */ | ||
|
|
||
| /* --- dependencies --- */ | ||
| #include "mem.h" /* U32, BYTE, etc. */ | ||
| #include "debug.h" /* assert, DEBUGLOG */ | ||
| #include "error_private.h" /* ERROR */ | ||
| #include "hist.h" | ||
|
|
||
|
|
||
| /* --- Error management --- */ | ||
| unsigned HIST_isError(size_t code) { return ERR_isError(code); } | ||
|
|
||
| /*-************************************************************** | ||
| * Histogram functions | ||
| ****************************************************************/ | ||
| unsigned HIST_count_simple(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize) | ||
| { | ||
| const BYTE* ip = (const BYTE*)src; | ||
| const BYTE* const end = ip + srcSize; | ||
| unsigned maxSymbolValue = *maxSymbolValuePtr; | ||
| unsigned largestCount=0; | ||
|
|
||
| memset(count, 0, (maxSymbolValue+1) * sizeof(*count)); | ||
| if (srcSize==0) { *maxSymbolValuePtr = 0; return 0; } | ||
|
|
||
| while (ip<end) { | ||
| assert(*ip <= maxSymbolValue); | ||
| count[*ip++]++; | ||
| } | ||
|
|
||
| while (!count[maxSymbolValue]) maxSymbolValue--; | ||
| *maxSymbolValuePtr = maxSymbolValue; | ||
|
|
||
| { U32 s; | ||
| for (s=0; s<=maxSymbolValue; s++) | ||
| if (count[s] > largestCount) largestCount = count[s]; | ||
| } | ||
|
|
||
| return largestCount; | ||
| } | ||
|
|
||
| typedef enum { trustInput, checkMaxSymbolValue } HIST_checkInput_e; | ||
|
|
||
| /* HIST_count_parallel_wksp() : | ||
| * store histogram into 4 intermediate tables, recombined at the end. | ||
| * this design makes better use of OoO cpus, | ||
| * and is noticeably faster when some values are heavily repeated. | ||
| * But it needs some additional workspace for intermediate tables. | ||
| * `workSpace` size must be a table of size >= HIST_WKSP_SIZE_U32. | ||
| * @return : largest histogram frequency, | ||
| * or an error code (notably when histogram would be larger than *maxSymbolValuePtr). */ | ||
| static size_t HIST_count_parallel_wksp( | ||
| unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* source, size_t sourceSize, | ||
| HIST_checkInput_e check, | ||
| U32* const workSpace) | ||
| { | ||
| const BYTE* ip = (const BYTE*)source; | ||
| const BYTE* const iend = ip+sourceSize; | ||
| unsigned maxSymbolValue = *maxSymbolValuePtr; | ||
| unsigned max=0; | ||
| U32* const Counting1 = workSpace; | ||
| U32* const Counting2 = Counting1 + 256; | ||
| U32* const Counting3 = Counting2 + 256; | ||
| U32* const Counting4 = Counting3 + 256; | ||
|
|
||
| memset(workSpace, 0, 4*256*sizeof(unsigned)); | ||
|
|
||
| /* safety checks */ | ||
| if (!sourceSize) { | ||
| memset(count, 0, maxSymbolValue + 1); | ||
| *maxSymbolValuePtr = 0; | ||
| return 0; | ||
| } | ||
| if (!maxSymbolValue) maxSymbolValue = 255; /* 0 == default */ | ||
|
|
||
| /* by stripes of 16 bytes */ | ||
| { U32 cached = MEM_read32(ip); ip += 4; | ||
| while (ip < iend-15) { | ||
| U32 c = cached; cached = MEM_read32(ip); ip += 4; | ||
| Counting1[(BYTE) c ]++; | ||
| Counting2[(BYTE)(c>>8) ]++; | ||
| Counting3[(BYTE)(c>>16)]++; | ||
| Counting4[ c>>24 ]++; | ||
| c = cached; cached = MEM_read32(ip); ip += 4; | ||
| Counting1[(BYTE) c ]++; | ||
| Counting2[(BYTE)(c>>8) ]++; | ||
| Counting3[(BYTE)(c>>16)]++; | ||
| Counting4[ c>>24 ]++; | ||
| c = cached; cached = MEM_read32(ip); ip += 4; | ||
| Counting1[(BYTE) c ]++; | ||
| Counting2[(BYTE)(c>>8) ]++; | ||
| Counting3[(BYTE)(c>>16)]++; | ||
| Counting4[ c>>24 ]++; | ||
| c = cached; cached = MEM_read32(ip); ip += 4; | ||
| Counting1[(BYTE) c ]++; | ||
| Counting2[(BYTE)(c>>8) ]++; | ||
| Counting3[(BYTE)(c>>16)]++; | ||
| Counting4[ c>>24 ]++; | ||
| } | ||
| ip-=4; | ||
| } | ||
|
|
||
| /* finish last symbols */ | ||
| while (ip<iend) Counting1[*ip++]++; | ||
|
|
||
| if (check) { /* verify stats will fit into destination table */ | ||
| U32 s; for (s=255; s>maxSymbolValue; s--) { | ||
| Counting1[s] += Counting2[s] + Counting3[s] + Counting4[s]; | ||
| if (Counting1[s]) return ERROR(maxSymbolValue_tooSmall); | ||
| } } | ||
|
|
||
| { U32 s; | ||
| if (maxSymbolValue > 255) maxSymbolValue = 255; | ||
| for (s=0; s<=maxSymbolValue; s++) { | ||
| count[s] = Counting1[s] + Counting2[s] + Counting3[s] + Counting4[s]; | ||
| if (count[s] > max) max = count[s]; | ||
| } } | ||
|
|
||
| while (!count[maxSymbolValue]) maxSymbolValue--; | ||
| *maxSymbolValuePtr = maxSymbolValue; | ||
| return (size_t)max; | ||
| } | ||
|
|
||
| /* HIST_countFast_wksp() : | ||
| * Same as HIST_countFast(), but using an externally provided scratch buffer. | ||
| * `workSpace` is a writable buffer which must be 4-bytes aligned, | ||
| * `workSpaceSize` must be >= HIST_WKSP_SIZE | ||
| */ | ||
| size_t HIST_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* source, size_t sourceSize, | ||
| void* workSpace, size_t workSpaceSize) | ||
| { | ||
| if (sourceSize < 1500) /* heuristic threshold */ | ||
| return HIST_count_simple(count, maxSymbolValuePtr, source, sourceSize); | ||
| if ((size_t)workSpace & 3) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ | ||
| if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall); | ||
| return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, trustInput, (U32*)workSpace); | ||
| } | ||
|
|
||
| /* fast variant (unsafe : won't check if src contains values beyond count[] limit) */ | ||
| size_t HIST_countFast(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* source, size_t sourceSize) | ||
| { | ||
| unsigned tmpCounters[HIST_WKSP_SIZE_U32]; | ||
| return HIST_countFast_wksp(count, maxSymbolValuePtr, source, sourceSize, tmpCounters, sizeof(tmpCounters)); | ||
| } | ||
|
|
||
| /* HIST_count_wksp() : | ||
| * Same as HIST_count(), but using an externally provided scratch buffer. | ||
| * `workSpace` size must be table of >= HIST_WKSP_SIZE_U32 unsigned */ | ||
| size_t HIST_count_wksp(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* source, size_t sourceSize, | ||
| void* workSpace, size_t workSpaceSize) | ||
| { | ||
| if ((size_t)workSpace & 3) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ | ||
| if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall); | ||
| if (*maxSymbolValuePtr < 255) | ||
| return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, checkMaxSymbolValue, (U32*)workSpace); | ||
| *maxSymbolValuePtr = 255; | ||
| return HIST_countFast_wksp(count, maxSymbolValuePtr, source, sourceSize, workSpace, workSpaceSize); | ||
| } | ||
|
|
||
| size_t HIST_count(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize) | ||
| { | ||
| unsigned tmpCounters[HIST_WKSP_SIZE_U32]; | ||
| return HIST_count_wksp(count, maxSymbolValuePtr, src, srcSize, tmpCounters, sizeof(tmpCounters)); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /* ****************************************************************** | ||
| hist : Histogram functions | ||
| part of Finite State Entropy project | ||
| Copyright (C) 2013-present, Yann Collet. | ||
| BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) | ||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
| * Redistributions of source code must retain the above copyright | ||
| notice, this list of conditions and the following disclaimer. | ||
| * Redistributions in binary form must reproduce the above | ||
| copyright notice, this list of conditions and the following disclaimer | ||
| in the documentation and/or other materials provided with the | ||
| distribution. | ||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| You can contact the author at : | ||
| - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy | ||
| - Public forum : https://groups.google.com/forum/#!forum/lz4c | ||
| ****************************************************************** */ | ||
|
|
||
| /* --- dependencies --- */ | ||
| #include <stddef.h> /* size_t */ | ||
|
|
||
|
|
||
| /* --- simple histogram functions --- */ | ||
|
|
||
| /*! HIST_count(): | ||
| * Provides the precise count of each byte within a table 'count'. | ||
| * 'count' is a table of unsigned int, of minimum size (*maxSymbolValuePtr+1). | ||
| * Updates *maxSymbolValuePtr with actual largest symbol value detected. | ||
| * @return : count of the most frequent symbol (which isn't identified). | ||
| * or an error code, which can be tested using HIST_isError(). | ||
| * note : if return == srcSize, there is only one symbol. | ||
| */ | ||
| size_t HIST_count(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize); | ||
|
|
||
| unsigned HIST_isError(size_t code); /**< tells if a return value is an error code */ | ||
|
|
||
|
|
||
| /* --- advanced histogram functions --- */ | ||
|
|
||
| #define HIST_WKSP_SIZE_U32 1024 | ||
| #define HIST_WKSP_SIZE (HIST_WKSP_SIZE_U32 * sizeof(unsigned)) | ||
| /** HIST_count_wksp() : | ||
| * Same as HIST_count(), but using an externally provided scratch buffer. | ||
| * Benefit is this function will use very little stack space. | ||
| * `workSpace` is a writable buffer which must be 4-bytes aligned, | ||
| * `workSpaceSize` must be >= HIST_WKSP_SIZE | ||
| */ | ||
| size_t HIST_count_wksp(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize, | ||
| void* workSpace, size_t workSpaceSize); | ||
|
|
||
| /** HIST_countFast() : | ||
| * same as HIST_count(), but blindly trusts that all byte values within src are <= *maxSymbolValuePtr. | ||
| * This function is unsafe, and will segfault if any value within `src` is `> *maxSymbolValuePtr` | ||
| */ | ||
| size_t HIST_countFast(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize); | ||
|
|
||
| /** HIST_countFast_wksp() : | ||
| * Same as HIST_countFast(), but using an externally provided scratch buffer. | ||
| * `workSpace` is a writable buffer which must be 4-bytes aligned, | ||
| * `workSpaceSize` must be >= HIST_WKSP_SIZE | ||
| */ | ||
| size_t HIST_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize, | ||
| void* workSpace, size_t workSpaceSize); | ||
|
|
||
| /*! HIST_count_simple() : | ||
| * Same as HIST_countFast(), this function is unsafe, | ||
| * and will segfault if any value within `src` is `> *maxSymbolValuePtr`. | ||
| * It is also a bit slower for large inputs. | ||
| * However, it does not need any additional memory (not even on stack). | ||
| * @return : count of the most frequent symbol. | ||
| * Note this function doesn't produce any error (i.e. it must succeed). | ||
| */ | ||
| unsigned HIST_count_simple(unsigned* count, unsigned* maxSymbolValuePtr, | ||
| const void* src, size_t srcSize); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| /*-************************************* | ||
| * Dependencies | ||
| ***************************************/ | ||
| #include "zstd_compress_literals.h" | ||
|
|
||
| size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize) | ||
| { | ||
| BYTE* const ostart = (BYTE* const)dst; | ||
| U32 const flSize = 1 + (srcSize>31) + (srcSize>4095); | ||
|
|
||
| RETURN_ERROR_IF(srcSize + flSize > dstCapacity, dstSize_tooSmall); | ||
|
|
||
| switch(flSize) | ||
| { | ||
| case 1: /* 2 - 1 - 5 */ | ||
| ostart[0] = (BYTE)((U32)set_basic + (srcSize<<3)); | ||
| break; | ||
| case 2: /* 2 - 2 - 12 */ | ||
| MEM_writeLE16(ostart, (U16)((U32)set_basic + (1<<2) + (srcSize<<4))); | ||
| break; | ||
| case 3: /* 2 - 2 - 20 */ | ||
| MEM_writeLE32(ostart, (U32)((U32)set_basic + (3<<2) + (srcSize<<4))); | ||
| break; | ||
| default: /* not necessary : flSize is {1,2,3} */ | ||
| assert(0); | ||
| } | ||
|
|
||
| memcpy(ostart + flSize, src, srcSize); | ||
| return srcSize + flSize; | ||
| } | ||
|
|
||
| size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize) | ||
| { | ||
| BYTE* const ostart = (BYTE* const)dst; | ||
| U32 const flSize = 1 + (srcSize>31) + (srcSize>4095); | ||
|
|
||
| (void)dstCapacity; /* dstCapacity already guaranteed to be >=4, hence large enough */ | ||
|
|
||
| switch(flSize) | ||
| { | ||
| case 1: /* 2 - 1 - 5 */ | ||
| ostart[0] = (BYTE)((U32)set_rle + (srcSize<<3)); | ||
| break; | ||
| case 2: /* 2 - 2 - 12 */ | ||
| MEM_writeLE16(ostart, (U16)((U32)set_rle + (1<<2) + (srcSize<<4))); | ||
| break; | ||
| case 3: /* 2 - 2 - 20 */ | ||
| MEM_writeLE32(ostart, (U32)((U32)set_rle + (3<<2) + (srcSize<<4))); | ||
| break; | ||
| default: /* not necessary : flSize is {1,2,3} */ | ||
| assert(0); | ||
| } | ||
|
|
||
| ostart[flSize] = *(const BYTE*)src; | ||
| return flSize+1; | ||
| } | ||
|
|
||
| size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf, | ||
| ZSTD_hufCTables_t* nextHuf, | ||
| ZSTD_strategy strategy, int disableLiteralCompression, | ||
| void* dst, size_t dstCapacity, | ||
| const void* src, size_t srcSize, | ||
| void* entropyWorkspace, size_t entropyWorkspaceSize, | ||
| const int bmi2) | ||
| { | ||
| size_t const minGain = ZSTD_minGain(srcSize, strategy); | ||
| size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB); | ||
| BYTE* const ostart = (BYTE*)dst; | ||
| U32 singleStream = srcSize < 256; | ||
| symbolEncodingType_e hType = set_compressed; | ||
| size_t cLitSize; | ||
|
|
||
| DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i)", | ||
| disableLiteralCompression); | ||
|
|
||
| /* Prepare nextEntropy assuming reusing the existing table */ | ||
| memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); | ||
|
|
||
| if (disableLiteralCompression) | ||
| return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); | ||
|
|
||
| /* small ? don't even attempt compression (speed opt) */ | ||
| # define COMPRESS_LITERALS_SIZE_MIN 63 | ||
| { size_t const minLitSize = (prevHuf->repeatMode == HUF_repeat_valid) ? 6 : COMPRESS_LITERALS_SIZE_MIN; | ||
| if (srcSize <= minLitSize) return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); | ||
| } | ||
|
|
||
| RETURN_ERROR_IF(dstCapacity < lhSize+1, dstSize_tooSmall, "not enough space for compression"); | ||
| { HUF_repeat repeat = prevHuf->repeatMode; | ||
| int const preferRepeat = strategy < ZSTD_lazy ? srcSize <= 1024 : 0; | ||
| if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1; | ||
| cLitSize = singleStream ? | ||
| HUF_compress1X_repeat( | ||
| ostart+lhSize, dstCapacity-lhSize, src, srcSize, | ||
| 255, 11, entropyWorkspace, entropyWorkspaceSize, | ||
| (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2) : | ||
| HUF_compress4X_repeat( | ||
| ostart+lhSize, dstCapacity-lhSize, src, srcSize, | ||
| 255, 11, entropyWorkspace, entropyWorkspaceSize, | ||
| (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2); | ||
| if (repeat != HUF_repeat_none) { | ||
| /* reused the existing table */ | ||
| hType = set_repeat; | ||
| } | ||
| } | ||
|
|
||
| if ((cLitSize==0) | (cLitSize >= srcSize - minGain) | ERR_isError(cLitSize)) { | ||
| memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); | ||
| return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); | ||
| } | ||
| if (cLitSize==1) { | ||
| memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); | ||
| return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize); | ||
| } | ||
|
|
||
| if (hType == set_compressed) { | ||
| /* using a newly constructed table */ | ||
| nextHuf->repeatMode = HUF_repeat_check; | ||
| } | ||
|
|
||
| /* Build header */ | ||
| switch(lhSize) | ||
| { | ||
| case 3: /* 2 - 2 - 10 - 10 */ | ||
| { U32 const lhc = hType + ((!singleStream) << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<14); | ||
| MEM_writeLE24(ostart, lhc); | ||
| break; | ||
| } | ||
| case 4: /* 2 - 2 - 14 - 14 */ | ||
| { U32 const lhc = hType + (2 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<18); | ||
| MEM_writeLE32(ostart, lhc); | ||
| break; | ||
| } | ||
| case 5: /* 2 - 2 - 18 - 18 */ | ||
| { U32 const lhc = hType + (3 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<22); | ||
| MEM_writeLE32(ostart, lhc); | ||
| ostart[4] = (BYTE)(cLitSize >> 10); | ||
| break; | ||
| } | ||
| default: /* not possible : lhSize is {3,4,5} */ | ||
| assert(0); | ||
| } | ||
| return lhSize+cLitSize; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTD_COMPRESS_LITERALS_H | ||
| #define ZSTD_COMPRESS_LITERALS_H | ||
|
|
||
| #include "zstd_compress_internal.h" /* ZSTD_hufCTables_t, ZSTD_minGain() */ | ||
|
|
||
|
|
||
| size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize); | ||
|
|
||
| size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize); | ||
|
|
||
| size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf, | ||
| ZSTD_hufCTables_t* nextHuf, | ||
| ZSTD_strategy strategy, int disableLiteralCompression, | ||
| void* dst, size_t dstCapacity, | ||
| const void* src, size_t srcSize, | ||
| void* entropyWorkspace, size_t entropyWorkspaceSize, | ||
| const int bmi2); | ||
|
|
||
| #endif /* ZSTD_COMPRESS_LITERALS_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTD_COMPRESS_SEQUENCES_H | ||
| #define ZSTD_COMPRESS_SEQUENCES_H | ||
|
|
||
| #include "fse.h" /* FSE_repeat, FSE_CTable */ | ||
| #include "zstd_internal.h" /* symbolEncodingType_e, ZSTD_strategy */ | ||
|
|
||
| typedef enum { | ||
| ZSTD_defaultDisallowed = 0, | ||
| ZSTD_defaultAllowed = 1 | ||
| } ZSTD_defaultPolicy_e; | ||
|
|
||
| symbolEncodingType_e | ||
| ZSTD_selectEncodingType( | ||
| FSE_repeat* repeatMode, unsigned const* count, unsigned const max, | ||
| size_t const mostFrequent, size_t nbSeq, unsigned const FSELog, | ||
| FSE_CTable const* prevCTable, | ||
| short const* defaultNorm, U32 defaultNormLog, | ||
| ZSTD_defaultPolicy_e const isDefaultAllowed, | ||
| ZSTD_strategy const strategy); | ||
|
|
||
| size_t | ||
| ZSTD_buildCTable(void* dst, size_t dstCapacity, | ||
| FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type, | ||
| unsigned* count, U32 max, | ||
| const BYTE* codeTable, size_t nbSeq, | ||
| const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax, | ||
| const FSE_CTable* prevCTable, size_t prevCTableSize, | ||
| void* entropyWorkspace, size_t entropyWorkspaceSize); | ||
|
|
||
| size_t ZSTD_encodeSequences( | ||
| void* dst, size_t dstCapacity, | ||
| FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, | ||
| FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, | ||
| FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, | ||
| seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2); | ||
|
|
||
| #endif /* ZSTD_COMPRESS_SEQUENCES_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTD_DOUBLE_FAST_H | ||
| #define ZSTD_DOUBLE_FAST_H | ||
|
|
||
| #if defined (__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "mem.h" /* U32 */ | ||
| #include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ | ||
|
|
||
| void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, | ||
| void const* end, ZSTD_dictTableLoadMethod_e dtlm); | ||
| size_t ZSTD_compressBlock_doubleFast( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_doubleFast_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_doubleFast_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
|
|
||
| #if defined (__cplusplus) | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ZSTD_DOUBLE_FAST_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTD_FAST_H | ||
| #define ZSTD_FAST_H | ||
|
|
||
| #if defined (__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "mem.h" /* U32 */ | ||
| #include "zstd_compress_internal.h" | ||
|
|
||
| void ZSTD_fillHashTable(ZSTD_matchState_t* ms, | ||
| void const* end, ZSTD_dictTableLoadMethod_e dtlm); | ||
| size_t ZSTD_compressBlock_fast( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_fast_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_fast_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| #if defined (__cplusplus) | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ZSTD_FAST_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTD_LAZY_H | ||
| #define ZSTD_LAZY_H | ||
|
|
||
| #if defined (__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "zstd_compress_internal.h" | ||
|
|
||
| U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip); | ||
|
|
||
| void ZSTD_preserveUnsortedMark (U32* const table, U32 const size, U32 const reducerValue); /*! used in ZSTD_reduceIndex(). preemptively increase value of ZSTD_DUBT_UNSORTED_MARK */ | ||
|
|
||
| size_t ZSTD_compressBlock_btlazy2( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_lazy2( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_lazy( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_greedy( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| size_t ZSTD_compressBlock_btlazy2_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_lazy2_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_lazy_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_greedy_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| size_t ZSTD_compressBlock_greedy_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_lazy_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_lazy2_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_btlazy2_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| #if defined (__cplusplus) | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ZSTD_LAZY_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| */ | ||
|
|
||
| #ifndef ZSTD_LDM_H | ||
| #define ZSTD_LDM_H | ||
|
|
||
| #if defined (__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "zstd_compress_internal.h" /* ldmParams_t, U32 */ | ||
| #include "zstd.h" /* ZSTD_CCtx, size_t */ | ||
|
|
||
| /*-************************************* | ||
| * Long distance matching | ||
| ***************************************/ | ||
|
|
||
| #define ZSTD_LDM_DEFAULT_WINDOW_LOG ZSTD_WINDOWLOG_LIMIT_DEFAULT | ||
|
|
||
| /** | ||
| * ZSTD_ldm_generateSequences(): | ||
| * | ||
| * Generates the sequences using the long distance match finder. | ||
| * Generates long range matching sequences in `sequences`, which parse a prefix | ||
| * of the source. `sequences` must be large enough to store every sequence, | ||
| * which can be checked with `ZSTD_ldm_getMaxNbSeq()`. | ||
| * @returns 0 or an error code. | ||
| * | ||
| * NOTE: The user must have called ZSTD_window_update() for all of the input | ||
| * they have, even if they pass it to ZSTD_ldm_generateSequences() in chunks. | ||
| * NOTE: This function returns an error if it runs out of space to store | ||
| * sequences. | ||
| */ | ||
| size_t ZSTD_ldm_generateSequences( | ||
| ldmState_t* ldms, rawSeqStore_t* sequences, | ||
| ldmParams_t const* params, void const* src, size_t srcSize); | ||
|
|
||
| /** | ||
| * ZSTD_ldm_blockCompress(): | ||
| * | ||
| * Compresses a block using the predefined sequences, along with a secondary | ||
| * block compressor. The literals section of every sequence is passed to the | ||
| * secondary block compressor, and those sequences are interspersed with the | ||
| * predefined sequences. Returns the length of the last literals. | ||
| * Updates `rawSeqStore.pos` to indicate how many sequences have been consumed. | ||
| * `rawSeqStore.seq` may also be updated to split the last sequence between two | ||
| * blocks. | ||
| * @return The length of the last literals. | ||
| * | ||
| * NOTE: The source must be at most the maximum block size, but the predefined | ||
| * sequences can be any size, and may be longer than the block. In the case that | ||
| * they are longer than the block, the last sequences may need to be split into | ||
| * two. We handle that case correctly, and update `rawSeqStore` appropriately. | ||
| * NOTE: This function does not return any errors. | ||
| */ | ||
| size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| /** | ||
| * ZSTD_ldm_skipSequences(): | ||
| * | ||
| * Skip past `srcSize` bytes worth of sequences in `rawSeqStore`. | ||
| * Avoids emitting matches less than `minMatch` bytes. | ||
| * Must be called for data with is not passed to ZSTD_ldm_blockCompress(). | ||
| */ | ||
| void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, | ||
| U32 const minMatch); | ||
|
|
||
|
|
||
| /** ZSTD_ldm_getTableSize() : | ||
| * Estimate the space needed for long distance matching tables or 0 if LDM is | ||
| * disabled. | ||
| */ | ||
| size_t ZSTD_ldm_getTableSize(ldmParams_t params); | ||
|
|
||
| /** ZSTD_ldm_getSeqSpace() : | ||
| * Return an upper bound on the number of sequences that can be produced by | ||
| * the long distance matcher, or 0 if LDM is disabled. | ||
| */ | ||
| size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize); | ||
|
|
||
| /** ZSTD_ldm_adjustParameters() : | ||
| * If the params->hashRateLog is not set, set it to its default value based on | ||
| * windowLog and params->hashLog. | ||
| * | ||
| * Ensures that params->bucketSizeLog is <= params->hashLog (setting it to | ||
| * params->hashLog if it is not). | ||
| * | ||
| * Ensures that the minMatchLength >= targetLength during optimal parsing. | ||
| */ | ||
| void ZSTD_ldm_adjustParameters(ldmParams_t* params, | ||
| ZSTD_compressionParameters const* cParams); | ||
|
|
||
| #if defined (__cplusplus) | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ZSTD_FAST_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTD_OPT_H | ||
| #define ZSTD_OPT_H | ||
|
|
||
| #if defined (__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "zstd_compress_internal.h" | ||
|
|
||
| /* used in ZSTD_loadDictionaryContent() */ | ||
| void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend); | ||
|
|
||
| size_t ZSTD_compressBlock_btopt( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_btultra( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_btultra2( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
|
|
||
| size_t ZSTD_compressBlock_btopt_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_btultra_dictMatchState( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| size_t ZSTD_compressBlock_btopt_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
| size_t ZSTD_compressBlock_btultra_extDict( | ||
| ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], | ||
| void const* src, size_t srcSize); | ||
|
|
||
| /* note : no btultra2 variant for extDict nor dictMatchState, | ||
| * because btultra2 is not meant to work with dictionaries | ||
| * and is only specific for the first block (no prefix) */ | ||
|
|
||
| #if defined (__cplusplus) | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ZSTD_OPT_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #ifndef ZSTDMT_COMPRESS_H | ||
| #define ZSTDMT_COMPRESS_H | ||
|
|
||
| #if defined (__cplusplus) | ||
| extern "C" { | ||
| #endif | ||
|
|
||
|
|
||
| /* Note : This is an internal API. | ||
| * These APIs used to be exposed with ZSTDLIB_API, | ||
| * because it used to be the only way to invoke MT compression. | ||
| * Now, it's recommended to use ZSTD_compress2 and ZSTD_compressStream2() | ||
| * instead. | ||
| * | ||
| * If you depend on these APIs and can't switch, then define | ||
| * ZSTD_LEGACY_MULTITHREADED_API when making the dynamic library. | ||
| * However, we may completely remove these functions in a future | ||
| * release, so please switch soon. | ||
| * | ||
| * This API requires ZSTD_MULTITHREAD to be defined during compilation, | ||
| * otherwise ZSTDMT_createCCtx*() will fail. | ||
| */ | ||
|
|
||
| #ifdef ZSTD_LEGACY_MULTITHREADED_API | ||
| # define ZSTDMT_API ZSTDLIB_API | ||
| #else | ||
| # define ZSTDMT_API | ||
| #endif | ||
|
|
||
| /* === Dependencies === */ | ||
| #include <stddef.h> /* size_t */ | ||
| #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters */ | ||
| #include "zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */ | ||
|
|
||
|
|
||
| /* === Constants === */ | ||
| #ifndef ZSTDMT_NBWORKERS_MAX | ||
| # define ZSTDMT_NBWORKERS_MAX 200 | ||
| #endif | ||
| #ifndef ZSTDMT_JOBSIZE_MIN | ||
| # define ZSTDMT_JOBSIZE_MIN (1 MB) | ||
| #endif | ||
| #define ZSTDMT_JOBLOG_MAX (MEM_32bits() ? 29 : 30) | ||
| #define ZSTDMT_JOBSIZE_MAX (MEM_32bits() ? (512 MB) : (1024 MB)) | ||
|
|
||
|
|
||
| /* === Memory management === */ | ||
| typedef struct ZSTDMT_CCtx_s ZSTDMT_CCtx; | ||
| /* Requires ZSTD_MULTITHREAD to be defined during compilation, otherwise it will return NULL. */ | ||
| ZSTDMT_API ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbWorkers); | ||
| /* Requires ZSTD_MULTITHREAD to be defined during compilation, otherwise it will return NULL. */ | ||
| ZSTDMT_API ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers, | ||
| ZSTD_customMem cMem); | ||
| ZSTDMT_API size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx); | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_sizeof_CCtx(ZSTDMT_CCtx* mtctx); | ||
|
|
||
|
|
||
| /* === Simple one-pass compression function === */ | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx, | ||
| void* dst, size_t dstCapacity, | ||
| const void* src, size_t srcSize, | ||
| int compressionLevel); | ||
|
|
||
|
|
||
|
|
||
| /* === Streaming functions === */ | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_initCStream(ZSTDMT_CCtx* mtctx, int compressionLevel); | ||
| ZSTDMT_API size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* mtctx, unsigned long long pledgedSrcSize); /**< if srcSize is not known at reset time, use ZSTD_CONTENTSIZE_UNKNOWN. Note: for compatibility with older programs, 0 means the same as ZSTD_CONTENTSIZE_UNKNOWN, but it will change in the future to mean "empty" */ | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_nextInputSizeHint(const ZSTDMT_CCtx* mtctx); | ||
| ZSTDMT_API size_t ZSTDMT_compressStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output, ZSTD_inBuffer* input); | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_flushStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output); /**< @return : 0 == all flushed; >0 : still some data to be flushed; or an error code (ZSTD_isError()) */ | ||
| ZSTDMT_API size_t ZSTDMT_endStream(ZSTDMT_CCtx* mtctx, ZSTD_outBuffer* output); /**< @return : 0 == all flushed; >0 : still some data to be flushed; or an error code (ZSTD_isError()) */ | ||
|
|
||
|
|
||
| /* === Advanced functions and parameters === */ | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_compress_advanced(ZSTDMT_CCtx* mtctx, | ||
| void* dst, size_t dstCapacity, | ||
| const void* src, size_t srcSize, | ||
| const ZSTD_CDict* cdict, | ||
| ZSTD_parameters params, | ||
| int overlapLog); | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx, | ||
| const void* dict, size_t dictSize, /* dict can be released after init, a local copy is preserved within zcs */ | ||
| ZSTD_parameters params, | ||
| unsigned long long pledgedSrcSize); /* pledgedSrcSize is optional and can be zero == unknown */ | ||
|
|
||
| ZSTDMT_API size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx, | ||
| const ZSTD_CDict* cdict, | ||
| ZSTD_frameParameters fparams, | ||
| unsigned long long pledgedSrcSize); /* note : zero means empty */ | ||
|
|
||
| /* ZSTDMT_parameter : | ||
| * List of parameters that can be set using ZSTDMT_setMTCtxParameter() */ | ||
| typedef enum { | ||
| ZSTDMT_p_jobSize, /* Each job is compressed in parallel. By default, this value is dynamically determined depending on compression parameters. Can be set explicitly here. */ | ||
| ZSTDMT_p_overlapLog, /* Each job may reload a part of previous job to enhance compression ratio; 0 == no overlap, 6(default) == use 1/8th of window, >=9 == use full window. This is a "sticky" parameter : its value will be re-used on next compression job */ | ||
| ZSTDMT_p_rsyncable /* Enables rsyncable mode. */ | ||
| } ZSTDMT_parameter; | ||
|
|
||
| /* ZSTDMT_setMTCtxParameter() : | ||
| * allow setting individual parameters, one at a time, among a list of enums defined in ZSTDMT_parameter. | ||
| * The function must be called typically after ZSTD_createCCtx() but __before ZSTDMT_init*() !__ | ||
| * Parameters not explicitly reset by ZSTDMT_init*() remain the same in consecutive compression sessions. | ||
| * @return : 0, or an error code (which can be tested using ZSTD_isError()) */ | ||
| ZSTDMT_API size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter, int value); | ||
|
|
||
| /* ZSTDMT_getMTCtxParameter() : | ||
| * Query the ZSTDMT_CCtx for a parameter value. | ||
| * @return : 0, or an error code (which can be tested using ZSTD_isError()) */ | ||
| ZSTDMT_API size_t ZSTDMT_getMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter, int* value); | ||
|
|
||
|
|
||
| /*! ZSTDMT_compressStream_generic() : | ||
| * Combines ZSTDMT_compressStream() with optional ZSTDMT_flushStream() or ZSTDMT_endStream() | ||
| * depending on flush directive. | ||
| * @return : minimum amount of data still to be flushed | ||
| * 0 if fully flushed | ||
| * or an error code | ||
| * note : needs to be init using any ZSTD_initCStream*() variant */ | ||
| ZSTDMT_API size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx, | ||
| ZSTD_outBuffer* output, | ||
| ZSTD_inBuffer* input, | ||
| ZSTD_EndDirective endOp); | ||
|
|
||
|
|
||
| /* ======================================================== | ||
| * === Private interface, for use by ZSTD_compress.c === | ||
| * === Not exposed in libzstd. Never invoke directly === | ||
| * ======================================================== */ | ||
|
|
||
| /*! ZSTDMT_toFlushNow() | ||
| * Tell how many bytes are ready to be flushed immediately. | ||
| * Probe the oldest active job (not yet entirely flushed) and check its output buffer. | ||
| * If return 0, it means there is no active job, | ||
| * or, it means oldest job is still active, but everything produced has been flushed so far, | ||
| * therefore flushing is limited by speed of oldest job. */ | ||
| size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx* mtctx); | ||
|
|
||
| /*! ZSTDMT_CCtxParam_setMTCtxParameter() | ||
| * like ZSTDMT_setMTCtxParameter(), but into a ZSTD_CCtx_Params */ | ||
| size_t ZSTDMT_CCtxParam_setMTCtxParameter(ZSTD_CCtx_params* params, ZSTDMT_parameter parameter, int value); | ||
|
|
||
| /*! ZSTDMT_CCtxParam_setNbWorkers() | ||
| * Set nbWorkers, and clamp it. | ||
| * Also reset jobSize and overlapLog */ | ||
| size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers); | ||
|
|
||
| /*! ZSTDMT_updateCParams_whileCompressing() : | ||
| * Updates only a selected set of compression parameters, to remain compatible with current frame. | ||
| * New parameters will be applied to next compression job. */ | ||
| void ZSTDMT_updateCParams_whileCompressing(ZSTDMT_CCtx* mtctx, const ZSTD_CCtx_params* cctxParams); | ||
|
|
||
| /*! ZSTDMT_getFrameProgression(): | ||
| * tells how much data has been consumed (input) and produced (output) for current frame. | ||
| * able to count progression inside worker threads. | ||
| */ | ||
| ZSTD_frameProgression ZSTDMT_getFrameProgression(ZSTDMT_CCtx* mtctx); | ||
|
|
||
|
|
||
| /*! ZSTDMT_initCStream_internal() : | ||
| * Private use only. Init streaming operation. | ||
| * expects params to be valid. | ||
| * must receive dict, or cdict, or none, but not both. | ||
| * @return : 0, or an error code */ | ||
| size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs, | ||
| const void* dict, size_t dictSize, ZSTD_dictContentType_e dictContentType, | ||
| const ZSTD_CDict* cdict, | ||
| ZSTD_CCtx_params params, unsigned long long pledgedSrcSize); | ||
|
|
||
|
|
||
| #if defined (__cplusplus) | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* ZSTDMT_COMPRESS_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,240 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| /* zstd_ddict.c : | ||
| * concentrates all logic that needs to know the internals of ZSTD_DDict object */ | ||
|
|
||
| /*-******************************************************* | ||
| * Dependencies | ||
| *********************************************************/ | ||
| #include <string.h> /* memcpy, memmove, memset */ | ||
| #include "cpu.h" /* bmi2 */ | ||
| #include "mem.h" /* low level memory routines */ | ||
| #define FSE_STATIC_LINKING_ONLY | ||
| #include "fse.h" | ||
| #define HUF_STATIC_LINKING_ONLY | ||
| #include "huf.h" | ||
| #include "zstd_decompress_internal.h" | ||
| #include "zstd_ddict.h" | ||
|
|
||
| #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) | ||
| # include "zstd_legacy.h" | ||
| #endif | ||
|
|
||
|
|
||
|
|
||
| /*-******************************************************* | ||
| * Types | ||
| *********************************************************/ | ||
| struct ZSTD_DDict_s { | ||
| void* dictBuffer; | ||
| const void* dictContent; | ||
| size_t dictSize; | ||
| ZSTD_entropyDTables_t entropy; | ||
| U32 dictID; | ||
| U32 entropyPresent; | ||
| ZSTD_customMem cMem; | ||
| }; /* typedef'd to ZSTD_DDict within "zstd.h" */ | ||
|
|
||
| const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict) | ||
| { | ||
| assert(ddict != NULL); | ||
| return ddict->dictContent; | ||
| } | ||
|
|
||
| size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict) | ||
| { | ||
| assert(ddict != NULL); | ||
| return ddict->dictSize; | ||
| } | ||
|
|
||
| void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) | ||
| { | ||
| DEBUGLOG(4, "ZSTD_copyDDictParameters"); | ||
| assert(dctx != NULL); | ||
| assert(ddict != NULL); | ||
| dctx->dictID = ddict->dictID; | ||
| dctx->prefixStart = ddict->dictContent; | ||
| dctx->virtualStart = ddict->dictContent; | ||
| dctx->dictEnd = (const BYTE*)ddict->dictContent + ddict->dictSize; | ||
| dctx->previousDstEnd = dctx->dictEnd; | ||
| if (ddict->entropyPresent) { | ||
| dctx->litEntropy = 1; | ||
| dctx->fseEntropy = 1; | ||
| dctx->LLTptr = ddict->entropy.LLTable; | ||
| dctx->MLTptr = ddict->entropy.MLTable; | ||
| dctx->OFTptr = ddict->entropy.OFTable; | ||
| dctx->HUFptr = ddict->entropy.hufTable; | ||
| dctx->entropy.rep[0] = ddict->entropy.rep[0]; | ||
| dctx->entropy.rep[1] = ddict->entropy.rep[1]; | ||
| dctx->entropy.rep[2] = ddict->entropy.rep[2]; | ||
| } else { | ||
| dctx->litEntropy = 0; | ||
| dctx->fseEntropy = 0; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| static size_t | ||
| ZSTD_loadEntropy_intoDDict(ZSTD_DDict* ddict, | ||
| ZSTD_dictContentType_e dictContentType) | ||
| { | ||
| ddict->dictID = 0; | ||
| ddict->entropyPresent = 0; | ||
| if (dictContentType == ZSTD_dct_rawContent) return 0; | ||
|
|
||
| if (ddict->dictSize < 8) { | ||
| if (dictContentType == ZSTD_dct_fullDict) | ||
| return ERROR(dictionary_corrupted); /* only accept specified dictionaries */ | ||
| return 0; /* pure content mode */ | ||
| } | ||
| { U32 const magic = MEM_readLE32(ddict->dictContent); | ||
| if (magic != ZSTD_MAGIC_DICTIONARY) { | ||
| if (dictContentType == ZSTD_dct_fullDict) | ||
| return ERROR(dictionary_corrupted); /* only accept specified dictionaries */ | ||
| return 0; /* pure content mode */ | ||
| } | ||
| } | ||
| ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE); | ||
|
|
||
| /* load entropy tables */ | ||
| RETURN_ERROR_IF(ZSTD_isError(ZSTD_loadDEntropy( | ||
| &ddict->entropy, ddict->dictContent, ddict->dictSize)), | ||
| dictionary_corrupted); | ||
| ddict->entropyPresent = 1; | ||
| return 0; | ||
| } | ||
|
|
||
|
|
||
| static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict, | ||
| const void* dict, size_t dictSize, | ||
| ZSTD_dictLoadMethod_e dictLoadMethod, | ||
| ZSTD_dictContentType_e dictContentType) | ||
| { | ||
| if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) { | ||
| ddict->dictBuffer = NULL; | ||
| ddict->dictContent = dict; | ||
| if (!dict) dictSize = 0; | ||
| } else { | ||
| void* const internalBuffer = ZSTD_malloc(dictSize, ddict->cMem); | ||
| ddict->dictBuffer = internalBuffer; | ||
| ddict->dictContent = internalBuffer; | ||
| if (!internalBuffer) return ERROR(memory_allocation); | ||
| memcpy(internalBuffer, dict, dictSize); | ||
| } | ||
| ddict->dictSize = dictSize; | ||
| ddict->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian */ | ||
|
|
||
| /* parse dictionary content */ | ||
| FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) ); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, | ||
| ZSTD_dictLoadMethod_e dictLoadMethod, | ||
| ZSTD_dictContentType_e dictContentType, | ||
| ZSTD_customMem customMem) | ||
| { | ||
| if (!customMem.customAlloc ^ !customMem.customFree) return NULL; | ||
|
|
||
| { ZSTD_DDict* const ddict = (ZSTD_DDict*) ZSTD_malloc(sizeof(ZSTD_DDict), customMem); | ||
| if (ddict == NULL) return NULL; | ||
| ddict->cMem = customMem; | ||
| { size_t const initResult = ZSTD_initDDict_internal(ddict, | ||
| dict, dictSize, | ||
| dictLoadMethod, dictContentType); | ||
| if (ZSTD_isError(initResult)) { | ||
| ZSTD_freeDDict(ddict); | ||
| return NULL; | ||
| } } | ||
| return ddict; | ||
| } | ||
| } | ||
|
|
||
| /*! ZSTD_createDDict() : | ||
| * Create a digested dictionary, to start decompression without startup delay. | ||
| * `dict` content is copied inside DDict. | ||
| * Consequently, `dict` can be released after `ZSTD_DDict` creation */ | ||
| ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize) | ||
| { | ||
| ZSTD_customMem const allocator = { NULL, NULL, NULL }; | ||
| return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator); | ||
| } | ||
|
|
||
| /*! ZSTD_createDDict_byReference() : | ||
| * Create a digested dictionary, to start decompression without startup delay. | ||
| * Dictionary content is simply referenced, it will be accessed during decompression. | ||
| * Warning : dictBuffer must outlive DDict (DDict must be freed before dictBuffer) */ | ||
| ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize) | ||
| { | ||
| ZSTD_customMem const allocator = { NULL, NULL, NULL }; | ||
| return ZSTD_createDDict_advanced(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, allocator); | ||
| } | ||
|
|
||
|
|
||
| const ZSTD_DDict* ZSTD_initStaticDDict( | ||
| void* sBuffer, size_t sBufferSize, | ||
| const void* dict, size_t dictSize, | ||
| ZSTD_dictLoadMethod_e dictLoadMethod, | ||
| ZSTD_dictContentType_e dictContentType) | ||
| { | ||
| size_t const neededSpace = sizeof(ZSTD_DDict) | ||
| + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize); | ||
| ZSTD_DDict* const ddict = (ZSTD_DDict*)sBuffer; | ||
| assert(sBuffer != NULL); | ||
| assert(dict != NULL); | ||
| if ((size_t)sBuffer & 7) return NULL; /* 8-aligned */ | ||
| if (sBufferSize < neededSpace) return NULL; | ||
| if (dictLoadMethod == ZSTD_dlm_byCopy) { | ||
| memcpy(ddict+1, dict, dictSize); /* local copy */ | ||
| dict = ddict+1; | ||
| } | ||
| if (ZSTD_isError( ZSTD_initDDict_internal(ddict, | ||
| dict, dictSize, | ||
| ZSTD_dlm_byRef, dictContentType) )) | ||
| return NULL; | ||
| return ddict; | ||
| } | ||
|
|
||
|
|
||
| size_t ZSTD_freeDDict(ZSTD_DDict* ddict) | ||
| { | ||
| if (ddict==NULL) return 0; /* support free on NULL */ | ||
| { ZSTD_customMem const cMem = ddict->cMem; | ||
| ZSTD_free(ddict->dictBuffer, cMem); | ||
| ZSTD_free(ddict, cMem); | ||
| return 0; | ||
| } | ||
| } | ||
|
|
||
| /*! ZSTD_estimateDDictSize() : | ||
| * Estimate amount of memory that will be needed to create a dictionary for decompression. | ||
| * Note : dictionary created by reference using ZSTD_dlm_byRef are smaller */ | ||
| size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod) | ||
| { | ||
| return sizeof(ZSTD_DDict) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize); | ||
| } | ||
|
|
||
| size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict) | ||
| { | ||
| if (ddict==NULL) return 0; /* support sizeof on NULL */ | ||
| return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ; | ||
| } | ||
|
|
||
| /*! ZSTD_getDictID_fromDDict() : | ||
| * Provides the dictID of the dictionary loaded into `ddict`. | ||
| * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty. | ||
| * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */ | ||
| unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict) | ||
| { | ||
| if (ddict==NULL) return 0; | ||
| return ZSTD_getDictID_fromDict(ddict->dictContent, ddict->dictSize); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
|
|
||
| #ifndef ZSTD_DDICT_H | ||
| #define ZSTD_DDICT_H | ||
|
|
||
| /*-******************************************************* | ||
| * Dependencies | ||
| *********************************************************/ | ||
| #include <stddef.h> /* size_t */ | ||
| #include "zstd.h" /* ZSTD_DDict, and several public functions */ | ||
|
|
||
|
|
||
| /*-******************************************************* | ||
| * Interface | ||
| *********************************************************/ | ||
|
|
||
| /* note: several prototypes are already published in `zstd.h` : | ||
| * ZSTD_createDDict() | ||
| * ZSTD_createDDict_byReference() | ||
| * ZSTD_createDDict_advanced() | ||
| * ZSTD_freeDDict() | ||
| * ZSTD_initStaticDDict() | ||
| * ZSTD_sizeof_DDict() | ||
| * ZSTD_estimateDDictSize() | ||
| * ZSTD_getDictID_fromDict() | ||
| */ | ||
|
|
||
| const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict); | ||
| size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict); | ||
|
|
||
| void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); | ||
|
|
||
|
|
||
|
|
||
| #endif /* ZSTD_DDICT_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
|
|
||
| #ifndef ZSTD_DEC_BLOCK_H | ||
| #define ZSTD_DEC_BLOCK_H | ||
|
|
||
| /*-******************************************************* | ||
| * Dependencies | ||
| *********************************************************/ | ||
| #include <stddef.h> /* size_t */ | ||
| #include "zstd.h" /* DCtx, and some public functions */ | ||
| #include "zstd_internal.h" /* blockProperties_t, and some public functions */ | ||
| #include "zstd_decompress_internal.h" /* ZSTD_seqSymbol */ | ||
|
|
||
|
|
||
| /* === Prototypes === */ | ||
|
|
||
| /* note: prototypes already published within `zstd.h` : | ||
| * ZSTD_decompressBlock() | ||
| */ | ||
|
|
||
| /* note: prototypes already published within `zstd_internal.h` : | ||
| * ZSTD_getcBlockSize() | ||
| * ZSTD_decodeSeqHeaders() | ||
| */ | ||
|
|
||
|
|
||
| /* ZSTD_decompressBlock_internal() : | ||
| * decompress block, starting at `src`, | ||
| * into destination buffer `dst`. | ||
| * @return : decompressed block size, | ||
| * or an error code (which can be tested using ZSTD_isError()) | ||
| */ | ||
| size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, | ||
| void* dst, size_t dstCapacity, | ||
| const void* src, size_t srcSize, const int frame); | ||
|
|
||
| /* ZSTD_buildFSETable() : | ||
| * generate FSE decoding table for one symbol (ll, ml or off) | ||
| * this function must be called with valid parameters only | ||
| * (dt is large enough, normalizedCounter distribution total is a power of 2, max is within range, etc.) | ||
| * in which case it cannot fail. | ||
| * Internal use only. | ||
| */ | ||
| void ZSTD_buildFSETable(ZSTD_seqSymbol* dt, | ||
| const short* normalizedCounter, unsigned maxSymbolValue, | ||
| const U32* baseValue, const U32* nbAdditionalBits, | ||
| unsigned tableLog); | ||
|
|
||
|
|
||
| #endif /* ZSTD_DEC_BLOCK_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| /* | ||
| * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. | ||
| * All rights reserved. | ||
| * | ||
| * This source code is licensed under both the BSD-style license (found in the | ||
| * LICENSE file in the root directory of this source tree) and the GPLv2 (found | ||
| * in the COPYING file in the root directory of this source tree). | ||
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
|
|
||
| /* zstd_decompress_internal: | ||
| * objects and definitions shared within lib/decompress modules */ | ||
|
|
||
| #ifndef ZSTD_DECOMPRESS_INTERNAL_H | ||
| #define ZSTD_DECOMPRESS_INTERNAL_H | ||
|
|
||
|
|
||
| /*-******************************************************* | ||
| * Dependencies | ||
| *********************************************************/ | ||
| #include "mem.h" /* BYTE, U16, U32 */ | ||
| #include "zstd_internal.h" /* ZSTD_seqSymbol */ | ||
|
|
||
|
|
||
|
|
||
| /*-******************************************************* | ||
| * Constants | ||
| *********************************************************/ | ||
| static const U32 LL_base[MaxLL+1] = { | ||
| 0, 1, 2, 3, 4, 5, 6, 7, | ||
| 8, 9, 10, 11, 12, 13, 14, 15, | ||
| 16, 18, 20, 22, 24, 28, 32, 40, | ||
| 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, | ||
| 0x2000, 0x4000, 0x8000, 0x10000 }; | ||
|
|
||
| static const U32 OF_base[MaxOff+1] = { | ||
| 0, 1, 1, 5, 0xD, 0x1D, 0x3D, 0x7D, | ||
| 0xFD, 0x1FD, 0x3FD, 0x7FD, 0xFFD, 0x1FFD, 0x3FFD, 0x7FFD, | ||
| 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD, | ||
| 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD }; | ||
|
|
||
| static const U32 OF_bits[MaxOff+1] = { | ||
| 0, 1, 2, 3, 4, 5, 6, 7, | ||
| 8, 9, 10, 11, 12, 13, 14, 15, | ||
| 16, 17, 18, 19, 20, 21, 22, 23, | ||
| 24, 25, 26, 27, 28, 29, 30, 31 }; | ||
|
|
||
| static const U32 ML_base[MaxML+1] = { | ||
| 3, 4, 5, 6, 7, 8, 9, 10, | ||
| 11, 12, 13, 14, 15, 16, 17, 18, | ||
| 19, 20, 21, 22, 23, 24, 25, 26, | ||
| 27, 28, 29, 30, 31, 32, 33, 34, | ||
| 35, 37, 39, 41, 43, 47, 51, 59, | ||
| 67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803, | ||
| 0x1003, 0x2003, 0x4003, 0x8003, 0x10003 }; | ||
|
|
||
|
|
||
| /*-******************************************************* | ||
| * Decompression types | ||
| *********************************************************/ | ||
| typedef struct { | ||
| U32 fastMode; | ||
| U32 tableLog; | ||
| } ZSTD_seqSymbol_header; | ||
|
|
||
| typedef struct { | ||
| U16 nextState; | ||
| BYTE nbAdditionalBits; | ||
| BYTE nbBits; | ||
| U32 baseValue; | ||
| } ZSTD_seqSymbol; | ||
|
|
||
| #define SEQSYMBOL_TABLE_SIZE(log) (1 + (1 << (log))) | ||
|
|
||
| typedef struct { | ||
| ZSTD_seqSymbol LLTable[SEQSYMBOL_TABLE_SIZE(LLFSELog)]; /* Note : Space reserved for FSE Tables */ | ||
| ZSTD_seqSymbol OFTable[SEQSYMBOL_TABLE_SIZE(OffFSELog)]; /* is also used as temporary workspace while building hufTable during DDict creation */ | ||
| ZSTD_seqSymbol MLTable[SEQSYMBOL_TABLE_SIZE(MLFSELog)]; /* and therefore must be at least HUF_DECOMPRESS_WORKSPACE_SIZE large */ | ||
| HUF_DTable hufTable[HUF_DTABLE_SIZE(HufLog)]; /* can accommodate HUF_decompress4X */ | ||
| U32 rep[ZSTD_REP_NUM]; | ||
| } ZSTD_entropyDTables_t; | ||
|
|
||
| typedef enum { ZSTDds_getFrameHeaderSize, ZSTDds_decodeFrameHeader, | ||
| ZSTDds_decodeBlockHeader, ZSTDds_decompressBlock, | ||
| ZSTDds_decompressLastBlock, ZSTDds_checkChecksum, | ||
| ZSTDds_decodeSkippableHeader, ZSTDds_skipFrame } ZSTD_dStage; | ||
|
|
||
| typedef enum { zdss_init=0, zdss_loadHeader, | ||
| zdss_read, zdss_load, zdss_flush } ZSTD_dStreamStage; | ||
|
|
||
| typedef enum { | ||
| ZSTD_use_indefinitely = -1, /* Use the dictionary indefinitely */ | ||
| ZSTD_dont_use = 0, /* Do not use the dictionary (if one exists free it) */ | ||
| ZSTD_use_once = 1 /* Use the dictionary once and set to ZSTD_dont_use */ | ||
| } ZSTD_dictUses_e; | ||
|
|
||
| struct ZSTD_DCtx_s | ||
| { | ||
| const ZSTD_seqSymbol* LLTptr; | ||
| const ZSTD_seqSymbol* MLTptr; | ||
| const ZSTD_seqSymbol* OFTptr; | ||
| const HUF_DTable* HUFptr; | ||
| ZSTD_entropyDTables_t entropy; | ||
| U32 workspace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; /* space needed when building huffman tables */ | ||
| const void* previousDstEnd; /* detect continuity */ | ||
| const void* prefixStart; /* start of current segment */ | ||
| const void* virtualStart; /* virtual start of previous segment if it was just before current one */ | ||
| const void* dictEnd; /* end of previous segment */ | ||
| size_t expected; | ||
| ZSTD_frameHeader fParams; | ||
| U64 decodedSize; | ||
| blockType_e bType; /* used in ZSTD_decompressContinue(), store blockType between block header decoding and block decompression stages */ | ||
| ZSTD_dStage stage; | ||
| U32 litEntropy; | ||
| U32 fseEntropy; | ||
| XXH64_state_t xxhState; | ||
| size_t headerSize; | ||
| ZSTD_format_e format; | ||
| const BYTE* litPtr; | ||
| ZSTD_customMem customMem; | ||
| size_t litSize; | ||
| size_t rleSize; | ||
| size_t staticSize; | ||
| int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */ | ||
|
|
||
| /* dictionary */ | ||
| ZSTD_DDict* ddictLocal; | ||
| const ZSTD_DDict* ddict; /* set by ZSTD_initDStream_usingDDict(), or ZSTD_DCtx_refDDict() */ | ||
| U32 dictID; | ||
| int ddictIsCold; /* if == 1 : dictionary is "new" for working context, and presumed "cold" (not in cpu cache) */ | ||
| ZSTD_dictUses_e dictUses; | ||
|
|
||
| /* streaming */ | ||
| ZSTD_dStreamStage streamStage; | ||
| char* inBuff; | ||
| size_t inBuffSize; | ||
| size_t inPos; | ||
| size_t maxWindowSize; | ||
| char* outBuff; | ||
| size_t outBuffSize; | ||
| size_t outStart; | ||
| size_t outEnd; | ||
| size_t lhSize; | ||
| void* legacyContext; | ||
| U32 previousLegacyVersion; | ||
| U32 legacyVersion; | ||
| U32 hostageByte; | ||
| int noForwardProgress; | ||
|
|
||
| /* workspace */ | ||
| BYTE litBuffer[ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH]; | ||
| BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX]; | ||
| }; /* typedef'd to ZSTD_DCtx within "zstd.h" */ | ||
|
|
||
|
|
||
| /*-******************************************************* | ||
| * Shared internal functions | ||
| *********************************************************/ | ||
|
|
||
| /*! ZSTD_loadDEntropy() : | ||
| * dict : must point at beginning of a valid zstd dictionary. | ||
| * @return : size of entropy tables read */ | ||
| size_t ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, | ||
| const void* const dict, size_t const dictSize); | ||
|
|
||
| /*! ZSTD_checkContinuity() : | ||
| * check if next `dst` follows previous position, where decompression ended. | ||
| * If yes, do nothing (continue on current segment). | ||
| * If not, classify previous segment as "external dictionary", and start a new segment. | ||
| * This function cannot fail. */ | ||
| void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst); | ||
|
|
||
|
|
||
| #endif /* ZSTD_DECOMPRESS_INTERNAL_H */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <ItemGroup Label="ProjectConfigurations"> | ||
| <ProjectConfiguration Include="Debug|ARM64"> | ||
| <Configuration>Debug</Configuration> | ||
| <Platform>ARM64</Platform> | ||
| </ProjectConfiguration> | ||
| <ProjectConfiguration Include="Debug|x64"> | ||
| <Configuration>Debug</Configuration> | ||
| <Platform>x64</Platform> | ||
| </ProjectConfiguration> | ||
| <ProjectConfiguration Include="Release|ARM64"> | ||
| <Configuration>Release</Configuration> | ||
| <Platform>ARM64</Platform> | ||
| </ProjectConfiguration> | ||
| <ProjectConfiguration Include="Release|x64"> | ||
| <Configuration>Release</Configuration> | ||
| <Platform>x64</Platform> | ||
| </ProjectConfiguration> | ||
| </ItemGroup> | ||
| <PropertyGroup Label="Globals"> | ||
| <VCProjectVersion>16.0</VCProjectVersion> | ||
| <ProjectGuid>{1BEA10F3-80CE-4BC4-9331-5769372CDF99}</ProjectGuid> | ||
| <RootNamespace>zstd</RootNamespace> | ||
| <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
| </PropertyGroup> | ||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
| <PropertyGroup Label="Configuration"> | ||
| <ConfigurationType>StaticLibrary</ConfigurationType> | ||
| <PlatformToolset>v142</PlatformToolset> | ||
| <CharacterSet>Unicode</CharacterSet> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> | ||
| <UseDebugLibraries>true</UseDebugLibraries> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> | ||
| <UseDebugLibraries>false</UseDebugLibraries> | ||
| </PropertyGroup> | ||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
| <ImportGroup Label="ExtensionSettings"> | ||
| </ImportGroup> | ||
| <ImportGroup Label="PropertySheets"> | ||
| <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
| <Import Project="..\..\Source\VSProps\Base.props" /> | ||
| <Import Project="..\..\Source\VSProps\ClDisableAllWarnings.props" /> | ||
| </ImportGroup> | ||
| <PropertyGroup Label="UserMacros" /> | ||
| <ItemDefinitionGroup> | ||
| <ClCompile> | ||
| <AdditionalIncludeDirectories>lib;lib/common;lib/decompress;lib/compress;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
| <PreprocessorDefinitions>XXH_NAMESPACE=ZSTD_;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
| </ClCompile> | ||
| </ItemDefinitionGroup> | ||
| <ItemGroup> | ||
| <ClCompile Include="lib\common\debug.c" /> | ||
| <ClCompile Include="lib\common\entropy_common.c" /> | ||
| <ClCompile Include="lib\common\error_private.c" /> | ||
| <ClCompile Include="lib\common\fse_decompress.c" /> | ||
| <ClCompile Include="lib\common\pool.c" /> | ||
| <ClCompile Include="lib\common\threading.c" /> | ||
| <ClCompile Include="lib\common\xxhash.c" /> | ||
| <ClCompile Include="lib\common\zstd_common.c" /> | ||
| <ClCompile Include="lib\compress\fse_compress.c" /> | ||
| <ClCompile Include="lib\compress\hist.c" /> | ||
| <ClCompile Include="lib\compress\huf_compress.c" /> | ||
| <ClCompile Include="lib\compress\zstdmt_compress.c" /> | ||
| <ClCompile Include="lib\compress\zstd_compress.c" /> | ||
| <ClCompile Include="lib\compress\zstd_compress_literals.c" /> | ||
| <ClCompile Include="lib\compress\zstd_compress_sequences.c" /> | ||
| <ClCompile Include="lib\compress\zstd_double_fast.c" /> | ||
| <ClCompile Include="lib\compress\zstd_fast.c" /> | ||
| <ClCompile Include="lib\compress\zstd_lazy.c" /> | ||
| <ClCompile Include="lib\compress\zstd_ldm.c" /> | ||
| <ClCompile Include="lib\compress\zstd_opt.c" /> | ||
| <ClCompile Include="lib\decompress\huf_decompress.c" /> | ||
| <ClCompile Include="lib\decompress\zstd_ddict.c" /> | ||
| <ClCompile Include="lib\decompress\zstd_decompress.c" /> | ||
| <ClCompile Include="lib\decompress\zstd_decompress_block.c" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ClInclude Include="lib\common\bitstream.h" /> | ||
| <ClInclude Include="lib\common\compiler.h" /> | ||
| <ClInclude Include="lib\common\cpu.h" /> | ||
| <ClInclude Include="lib\common\debug.h" /> | ||
| <ClInclude Include="lib\common\error_private.h" /> | ||
| <ClInclude Include="lib\common\fse.h" /> | ||
| <ClInclude Include="lib\common\huf.h" /> | ||
| <ClInclude Include="lib\common\mem.h" /> | ||
| <ClInclude Include="lib\common\pool.h" /> | ||
| <ClInclude Include="lib\common\threading.h" /> | ||
| <ClInclude Include="lib\common\xxhash.h" /> | ||
| <ClInclude Include="lib\common\zstd_errors.h" /> | ||
| <ClInclude Include="lib\common\zstd_internal.h" /> | ||
| <ClInclude Include="lib\compress\hist.h" /> | ||
| <ClInclude Include="lib\compress\zstdmt_compress.h" /> | ||
| <ClInclude Include="lib\compress\zstd_compress_internal.h" /> | ||
| <ClInclude Include="lib\compress\zstd_compress_literals.h" /> | ||
| <ClInclude Include="lib\compress\zstd_compress_sequences.h" /> | ||
| <ClInclude Include="lib\compress\zstd_cwksp.h" /> | ||
| <ClInclude Include="lib\compress\zstd_double_fast.h" /> | ||
| <ClInclude Include="lib\compress\zstd_fast.h" /> | ||
| <ClInclude Include="lib\compress\zstd_lazy.h" /> | ||
| <ClInclude Include="lib\compress\zstd_ldm.h" /> | ||
| <ClInclude Include="lib\compress\zstd_opt.h" /> | ||
| <ClInclude Include="lib\decompress\zstd_ddict.h" /> | ||
| <ClInclude Include="lib\decompress\zstd_decompress_block.h" /> | ||
| <ClInclude Include="lib\decompress\zstd_decompress_internal.h" /> | ||
| <ClInclude Include="lib\zstd.h" /> | ||
| </ItemGroup> | ||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
| <ImportGroup Label="ExtensionTargets"> | ||
| </ImportGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <ItemGroup> | ||
| <ClCompile Include="lib\common\debug.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\entropy_common.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\error_private.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\fse_decompress.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\pool.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\threading.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\xxhash.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\common\zstd_common.c"> | ||
| <Filter>common</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\decompress\huf_decompress.c"> | ||
| <Filter>decompress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\decompress\zstd_ddict.c"> | ||
| <Filter>decompress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\decompress\zstd_decompress.c"> | ||
| <Filter>decompress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\decompress\zstd_decompress_block.c"> | ||
| <Filter>decompress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\fse_compress.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\hist.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\huf_compress.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_compress.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_compress_literals.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_compress_sequences.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_double_fast.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_fast.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_lazy.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_ldm.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstd_opt.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| <ClCompile Include="lib\compress\zstdmt_compress.c"> | ||
| <Filter>compress</Filter> | ||
| </ClCompile> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ClInclude Include="lib\zstd.h" /> | ||
| <ClInclude Include="lib\common\debug.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\error_private.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\pool.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\threading.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\xxhash.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\bitstream.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\compiler.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\cpu.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\fse.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\huf.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\mem.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\zstd_errors.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\common\zstd_internal.h"> | ||
| <Filter>common</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\decompress\zstd_ddict.h"> | ||
| <Filter>decompress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\decompress\zstd_decompress_block.h"> | ||
| <Filter>decompress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\decompress\zstd_decompress_internal.h"> | ||
| <Filter>decompress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\hist.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_compress_internal.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_compress_literals.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_compress_sequences.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_cwksp.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_double_fast.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_fast.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_lazy.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_ldm.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstd_opt.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| <ClInclude Include="lib\compress\zstdmt_compress.h"> | ||
| <Filter>compress</Filter> | ||
| </ClInclude> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Filter Include="common"> | ||
| <UniqueIdentifier>{e5afedd6-70b2-4294-b99d-e46a6ea9524c}</UniqueIdentifier> | ||
| </Filter> | ||
| <Filter Include="decompress"> | ||
| <UniqueIdentifier>{09a75e83-2919-4d9e-9b05-26773de1e6bc}</UniqueIdentifier> | ||
| </Filter> | ||
| <Filter Include="compress"> | ||
| <UniqueIdentifier>{f84516ac-36c5-446d-a33f-58b78ba358f6}</UniqueIdentifier> | ||
| </Filter> | ||
| </ItemGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -35,7 +35,7 @@ | ||
| #include <limits> | ||
| #include <type_traits> | ||
|
|
||
| #include "Common/Inline.h" | ||
|
|
||
| /* | ||
| * Abstract bitfield class | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,7 +9,7 @@ | ||
|
|
||
| #include "Common/BitField.h" | ||
| #include "Common/CommonTypes.h" | ||
| #include "Common/Inline.h" | ||
|
|
||
| enum class EFBCopyFormat; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -7,7 +7,7 @@ | ||
| #include <cstring> | ||
|
|
||
| #include "Common/CommonTypes.h" | ||
| #include "Common/Inline.h" | ||
| #include "Common/Swap.h" | ||
|
|
||
| class DataReader | ||