| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 1 | /* |
| 2 | zstd - standard compression library |
| 3 | Header File for static linking only |
| 4 | Copyright (C) 2014-2015, Yann Collet. |
| 5 | |
| 6 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) |
| 7 | |
| 8 | Redistribution and use in source and binary forms, with or without |
| 9 | modification, are permitted provided that the following conditions are |
| 10 | met: |
| 11 | * Redistributions of source code must retain the above copyright |
| 12 | notice, this list of conditions and the following disclaimer. |
| 13 | * Redistributions in binary form must reproduce the above |
| 14 | copyright notice, this list of conditions and the following disclaimer |
| 15 | in the documentation and/or other materials provided with the |
| 16 | distribution. |
| 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | |
| 29 | You can contact the author at : |
| 30 | - zstd source repository : https://github.com/Cyan4973/zstd |
| 31 | - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c |
| 32 | */ |
| Yann Collet | aa07405 | 2015-10-30 11:21:50 +0100 | [diff] [blame] | 33 | #ifndef ZSTD_STATIC_H |
| 34 | #define ZSTD_STATIC_H |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 35 | |
| Yann Collet | 59aac5f | 2015-10-14 16:28:19 +0100 | [diff] [blame] | 36 | /* The objects defined into this file should be considered experimental. |
| 37 | * They are not labelled stable, as their prototype may change in the future. |
| 38 | * You can use them for tests, provide feedback, or if you can endure risk of future changes. |
| 39 | */ |
| 40 | |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 41 | #if defined (__cplusplus) |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 45 | /* ************************************* |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 46 | * Includes |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 47 | ***************************************/ |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 48 | #include "zstd.h" |
| Yann Collet | 5be2dd2 | 2015-11-11 13:43:58 +0100 | [diff] [blame] | 49 | #include "mem.h" |
| 50 | |
| 51 | |
| 52 | /* ************************************* |
| 53 | * Types |
| 54 | ***************************************/ |
| Yann Collet | 5be2dd2 | 2015-11-11 13:43:58 +0100 | [diff] [blame] | 55 | #define ZSTD_WINDOWLOG_MAX 26 |
| 56 | #define ZSTD_WINDOWLOG_MIN 18 |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 57 | #define ZSTD_WINDOWLOG_ABSOLUTEMIN 11 |
| Yann Collet | 5be2dd2 | 2015-11-11 13:43:58 +0100 | [diff] [blame] | 58 | #define ZSTD_CONTENTLOG_MAX (ZSTD_WINDOWLOG_MAX+1) |
| 59 | #define ZSTD_CONTENTLOG_MIN 4 |
| 60 | #define ZSTD_HASHLOG_MAX 28 |
| 61 | #define ZSTD_HASHLOG_MIN 4 |
| 62 | #define ZSTD_SEARCHLOG_MAX (ZSTD_CONTENTLOG_MAX-1) |
| 63 | #define ZSTD_SEARCHLOG_MIN 1 |
| 64 | #define ZSTD_SEARCHLENGTH_MAX 7 |
| 65 | #define ZSTD_SEARCHLENGTH_MIN 4 |
| 66 | |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 67 | /** from faster to stronger */ |
| 68 | typedef enum { ZSTD_fast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2, ZSTD_btlazy2 } ZSTD_strategy; |
| 69 | |
| 70 | typedef struct |
| 71 | { |
| 72 | U64 srcSize; /* optional : tells how much bytes are present in the frame. Use 0 if not known. */ |
| 73 | U32 windowLog; /* largest match distance : larger == more compression, more memory needed during decompression */ |
| 74 | U32 contentLog; /* full search segment : larger == more compression, slower, more memory (useless for fast) */ |
| 75 | U32 hashLog; /* dispatch table : larger == more memory, faster */ |
| 76 | U32 searchLog; /* nb of searches : larger == more compression, slower */ |
| 77 | U32 searchLength; /* size of matches : larger == faster decompression, sometimes less compression */ |
| 78 | ZSTD_strategy strategy; |
| 79 | } ZSTD_parameters; |
| 80 | |
| 81 | |
| 82 | /* ************************************* |
| 83 | * Advanced function |
| 84 | ***************************************/ |
| 85 | /** ZSTD_getParams |
| 86 | * return ZSTD_parameters structure for a selected compression level and srcSize. |
| 87 | * srcSizeHint value is optional, select 0 if not known */ |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 88 | ZSTDLIB_API ZSTD_parameters ZSTD_getParams(int compressionLevel, U64 srcSizeHint); |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 89 | |
| 90 | /** ZSTD_validateParams |
| 91 | * correct params value to remain within authorized range */ |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 92 | ZSTDLIB_API void ZSTD_validateParams(ZSTD_parameters* params); |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 93 | |
| 94 | /** ZSTD_compress_advanced |
| 95 | * Same as ZSTD_compressCCtx(), with fine-tune control of each compression parameter */ |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 96 | ZSTDLIB_API size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx, |
| 97 | void* dst, size_t maxDstSize, |
| 98 | const void* src, size_t srcSize, |
| 99 | ZSTD_parameters params); |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 100 | |
| 101 | |
| 102 | /* ************************************** |
| 103 | * Streaming functions (bufferless mode) |
| 104 | ****************************************/ |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 105 | ZSTDLIB_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize, int compressionLevel); |
| 106 | ZSTDLIB_API size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* ctx, void* dst, size_t maxDstSize, ZSTD_parameters params); |
| 107 | ZSTDLIB_API size_t ZSTD_compress_insertDictionary(ZSTD_CCtx* ctx, const void* src, size_t srcSize); |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 108 | |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 109 | ZSTDLIB_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); |
| 110 | ZSTDLIB_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t maxDstSize); |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 111 | |
| Yann Collet | 53fbf01 | 2015-11-28 14:08:01 +0100 | [diff] [blame] | 112 | /** |
| 113 | Streaming compression, bufferless mode |
| 114 | |
| 115 | A ZSTD_CCtx object is required to track streaming operations. |
| 116 | Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage it. |
| 117 | A ZSTD_CCtx object can be re-used multiple times. |
| 118 | |
| 119 | First operation is to start a new frame. |
| 120 | Use ZSTD_compressBegin(). |
| 121 | You may also prefer the advanced derivative ZSTD_compressBegin_advanced(), for finer parameter control. |
| 122 | |
| Yann Collet | 0cde77b | 2015-12-08 14:47:46 +0100 | [diff] [blame] | 123 | It's then possible to add a dictionary with ZSTD_compress_insertDictionary() |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 124 | Note that dictionary presence is a "hidden" information, |
| 125 | the decoder needs to be aware that it is required for proper decoding, or decoding will fail. |
| 126 | |
| Yann Collet | 53fbf01 | 2015-11-28 14:08:01 +0100 | [diff] [blame] | 127 | Then, consume your input using ZSTD_compressContinue(). |
| 128 | The interface is synchronous, so all input will be consumed. |
| 129 | You must ensure there is enough space in destination buffer to store compressed data under worst case scenario. |
| 130 | Worst case evaluation is provided by ZSTD_compressBound(). |
| 131 | |
| 132 | Finish a frame with ZSTD_compressEnd(), which will write the epilogue. |
| 133 | Without it, the frame will be considered incomplete by decoders. |
| 134 | You can then re-use ZSTD_CCtx to compress new frames. |
| 135 | */ |
| 136 | |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 137 | |
| 138 | typedef struct ZSTD_DCtx_s ZSTD_DCtx; |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 139 | ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx(void); |
| 140 | ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 141 | |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 142 | ZSTDLIB_API size_t ZSTD_resetDCtx(ZSTD_DCtx* dctx); |
| 143 | ZSTDLIB_API size_t ZSTD_getFrameParams(ZSTD_parameters* params, const void* src, size_t srcSize); |
| 144 | ZSTDLIB_API void ZSTD_decompress_insertDictionary(ZSTD_DCtx* ctx, const void* src, size_t srcSize); |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 145 | |
| Christophe Chevalier | c6e8453 | 2015-12-07 17:44:09 +0100 | [diff] [blame] | 146 | ZSTDLIB_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx); |
| 147 | ZSTDLIB_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 148 | |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 149 | /** |
| 150 | Streaming decompression, bufferless mode |
| 151 | |
| 152 | A ZSTD_DCtx object is required to track streaming operations. |
| 153 | Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it. |
| 154 | A ZSTD_DCtx object can be re-used multiple times. Use ZSTD_resetDCtx() to return to fresh status. |
| 155 | |
| 156 | First operation is to retrieve frame parameters, using ZSTD_getFrameParams(). |
| 157 | This function doesn't consume its input. It needs enough input data to properly decode the frame header. |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 158 | Objective is to retrieve *params.windowlog, to know minimum amount of memory required during decoding. |
| Yann Collet | 800fa6c | 2015-11-27 14:30:23 +0100 | [diff] [blame] | 159 | Result : 0 when successful, it means the ZSTD_parameters structure has been filled. |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 160 | >0 : means there is not enough data into src. Provides the expected size to successfully decode header. |
| 161 | errorCode, which can be tested using ZSTD_isError() (For example, if it's not a ZSTD header) |
| 162 | |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 163 | Then, you can optionally insert a dictionary. This operation must mimic the compressor behavior, otherwise decompression will fail or be corrupted. |
| 164 | |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 165 | Then it's possible to start decompression. |
| 166 | Use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively. |
| 167 | ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue(). |
| Yann Collet | 417890c | 2015-12-04 17:16:37 +0100 | [diff] [blame] | 168 | ZSTD_decompressContinue() requires this exact amount of bytes, or it will fail. |
| Yann Collet | 800fa6c | 2015-11-27 14:30:23 +0100 | [diff] [blame] | 169 | ZSTD_decompressContinue() needs previous data blocks during decompression, up to (1 << windowlog). |
| 170 | They should preferably be located contiguously, prior to current block. Alternatively, a round buffer is also possible. |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 171 | |
| 172 | @result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst'. |
| 173 | It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header. |
| 174 | |
| 175 | A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero. |
| 176 | */ |
| 177 | |
| 178 | |
| 179 | /* ************************************* |
| 180 | * Pre-defined compression levels |
| 181 | ***************************************/ |
| 182 | #define ZSTD_MAX_CLEVEL 20 |
| Christophe Chevalier | 2abb04d | 2015-12-09 23:55:23 +0100 | [diff] [blame] | 183 | ZSTDLIB_API unsigned ZSTD_maxCLevel (void); |
| Yann Collet | d608088 | 2015-12-09 09:05:22 +0100 | [diff] [blame] | 184 | static const ZSTD_parameters ZSTD_defaultParameters[4][ZSTD_MAX_CLEVEL+1] = { |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 185 | { /* "default" */ |
| Yann Collet | a308259 | 2015-12-02 13:38:48 +0100 | [diff] [blame] | 186 | /* W, C, H, S, L, strat */ |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 187 | { 0, 18, 12, 12, 1, 4, ZSTD_fast }, /* level 0 - never used */ |
| 188 | { 0, 19, 13, 14, 1, 7, ZSTD_fast }, /* level 1 */ |
| 189 | { 0, 19, 15, 16, 1, 6, ZSTD_fast }, /* level 2 */ |
| 190 | { 0, 20, 18, 20, 1, 6, ZSTD_fast }, /* level 3 */ |
| 191 | { 0, 21, 19, 21, 1, 6, ZSTD_fast }, /* level 4 */ |
| 192 | { 0, 20, 14, 18, 3, 5, ZSTD_greedy }, /* level 5 */ |
| 193 | { 0, 20, 18, 19, 3, 5, ZSTD_greedy }, /* level 6 */ |
| 194 | { 0, 21, 17, 20, 3, 5, ZSTD_lazy }, /* level 7 */ |
| 195 | { 0, 21, 19, 20, 3, 5, ZSTD_lazy }, /* level 8 */ |
| 196 | { 0, 21, 20, 20, 3, 5, ZSTD_lazy2 }, /* level 9 */ |
| 197 | { 0, 21, 19, 21, 4, 5, ZSTD_lazy2 }, /* level 10 */ |
| 198 | { 0, 22, 20, 22, 4, 5, ZSTD_lazy2 }, /* level 11 */ |
| 199 | { 0, 22, 20, 22, 5, 5, ZSTD_lazy2 }, /* level 12 */ |
| 200 | { 0, 22, 21, 22, 5, 5, ZSTD_lazy2 }, /* level 13 */ |
| 201 | { 0, 22, 22, 23, 5, 5, ZSTD_lazy2 }, /* level 14 */ |
| 202 | { 0, 23, 23, 23, 5, 5, ZSTD_lazy2 }, /* level 15 */ |
| 203 | { 0, 23, 21, 22, 5, 5, ZSTD_btlazy2 }, /* level 16 */ |
| 204 | { 0, 23, 24, 23, 4, 5, ZSTD_btlazy2 }, /* level 17 */ |
| 205 | { 0, 25, 24, 23, 5, 5, ZSTD_btlazy2 }, /* level 18 */ |
| 206 | { 0, 25, 26, 23, 5, 5, ZSTD_btlazy2 }, /* level 19 */ |
| Yann Collet | 53fbf01 | 2015-11-28 14:08:01 +0100 | [diff] [blame] | 207 | { 0, 26, 27, 25, 9, 5, ZSTD_btlazy2 }, /* level 20 */ |
| Yann Collet | 5be2dd2 | 2015-11-11 13:43:58 +0100 | [diff] [blame] | 208 | }, |
| Yann Collet | d608088 | 2015-12-09 09:05:22 +0100 | [diff] [blame] | 209 | { /* for srcSize <= 256 KB */ |
| Yann Collet | f54f570 | 2015-12-16 19:38:54 +0100 | [diff] [blame^] | 210 | /* W, C, H, S, L, strat */ |
| 211 | { 0, 18, 13, 14, 1, 7, ZSTD_fast }, /* level 0 - never used */ |
| 212 | { 0, 18, 14, 15, 1, 6, ZSTD_fast }, /* level 1 */ |
| 213 | { 0, 18, 14, 15, 1, 5, ZSTD_fast }, /* level 2 */ |
| 214 | { 0, 18, 12, 15, 3, 7, ZSTD_greedy }, /* level 3 */ |
| 215 | { 0, 18, 13, 15, 4, 7, ZSTD_greedy }, /* level 4 */ |
| 216 | { 0, 18, 14, 15, 5, 7, ZSTD_greedy }, /* level 5 */ |
| 217 | { 0, 18, 13, 15, 4, 7, ZSTD_lazy }, /* level 6 */ |
| 218 | { 0, 18, 14, 16, 5, 7, ZSTD_lazy }, /* level 7 */ |
| 219 | { 0, 18, 15, 16, 6, 7, ZSTD_lazy }, /* level 8 */ |
| 220 | { 0, 18, 15, 15, 7, 7, ZSTD_lazy }, /* level 9 */ |
| 221 | { 0, 18, 16, 16, 7, 7, ZSTD_lazy }, /* level 10 */ |
| 222 | { 0, 18, 16, 16, 8, 4, ZSTD_lazy }, /* level 11 */ |
| 223 | { 0, 18, 17, 16, 8, 4, ZSTD_lazy }, /* level 12 */ |
| 224 | { 0, 18, 17, 16, 9, 4, ZSTD_lazy }, /* level 13 */ |
| 225 | { 0, 18, 18, 16, 9, 4, ZSTD_lazy }, /* level 14 */ |
| 226 | { 0, 18, 17, 17, 9, 4, ZSTD_lazy2 }, /* level 15 */ |
| 227 | { 0, 18, 18, 18, 9, 4, ZSTD_lazy2 }, /* level 16 */ |
| 228 | { 0, 18, 18, 18, 10, 4, ZSTD_lazy2 }, /* level 17 */ |
| 229 | { 0, 18, 18, 18, 11, 4, ZSTD_lazy2 }, /* level 18 */ |
| 230 | { 0, 18, 18, 18, 12, 4, ZSTD_lazy2 }, /* level 19 */ |
| 231 | { 0, 18, 18, 18, 13, 4, ZSTD_lazy2 }, /* level 20 */ |
| Yann Collet | d608088 | 2015-12-09 09:05:22 +0100 | [diff] [blame] | 232 | }, |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 233 | { /* for srcSize <= 128 KB */ |
| Yann Collet | a308259 | 2015-12-02 13:38:48 +0100 | [diff] [blame] | 234 | /* W, C, H, S, L, strat */ |
| Yann Collet | 88fcd29 | 2015-11-25 14:42:45 +0100 | [diff] [blame] | 235 | { 0, 17, 12, 12, 1, 4, ZSTD_fast }, /* level 0 - never used */ |
| 236 | { 0, 17, 12, 13, 1, 6, ZSTD_fast }, /* level 1 */ |
| 237 | { 0, 17, 15, 16, 1, 5, ZSTD_fast }, /* level 2 */ |
| 238 | { 0, 17, 16, 17, 1, 5, ZSTD_fast }, /* level 3 */ |
| 239 | { 0, 17, 13, 15, 2, 4, ZSTD_greedy }, /* level 4 */ |
| 240 | { 0, 17, 15, 17, 3, 4, ZSTD_greedy }, /* level 5 */ |
| 241 | { 0, 17, 14, 17, 3, 4, ZSTD_lazy }, /* level 6 */ |
| 242 | { 0, 17, 16, 17, 4, 4, ZSTD_lazy }, /* level 7 */ |
| 243 | { 0, 17, 16, 17, 4, 4, ZSTD_lazy2 }, /* level 8 */ |
| 244 | { 0, 17, 17, 16, 5, 4, ZSTD_lazy2 }, /* level 9 */ |
| 245 | { 0, 17, 17, 16, 6, 4, ZSTD_lazy2 }, /* level 10 */ |
| 246 | { 0, 17, 17, 16, 7, 4, ZSTD_lazy2 }, /* level 11 */ |
| 247 | { 0, 17, 17, 16, 8, 4, ZSTD_lazy2 }, /* level 12 */ |
| 248 | { 0, 17, 18, 16, 4, 4, ZSTD_btlazy2 }, /* level 13 */ |
| 249 | { 0, 17, 18, 16, 5, 4, ZSTD_btlazy2 }, /* level 14 */ |
| 250 | { 0, 17, 18, 16, 6, 4, ZSTD_btlazy2 }, /* level 15 */ |
| 251 | { 0, 17, 18, 16, 7, 4, ZSTD_btlazy2 }, /* level 16 */ |
| 252 | { 0, 17, 18, 16, 8, 4, ZSTD_btlazy2 }, /* level 17 */ |
| 253 | { 0, 17, 18, 16, 9, 4, ZSTD_btlazy2 }, /* level 18 */ |
| 254 | { 0, 17, 18, 16, 10, 4, ZSTD_btlazy2 }, /* level 19 */ |
| 255 | { 0, 17, 18, 18, 12, 4, ZSTD_btlazy2 }, /* level 20 */ |
| 256 | }, |
| Yann Collet | a308259 | 2015-12-02 13:38:48 +0100 | [diff] [blame] | 257 | { /* for srcSize <= 16 KB */ |
| 258 | /* W, C, H, S, L, strat */ |
| 259 | { 0, 0, 0, 0, 0, 0, ZSTD_fast }, /* level 0 - never used */ |
| 260 | { 0, 14, 14, 14, 1, 4, ZSTD_fast }, /* level 1 */ |
| 261 | { 0, 14, 14, 16, 1, 4, ZSTD_fast }, /* level 1 */ |
| 262 | { 0, 14, 14, 14, 5, 4, ZSTD_greedy }, /* level 3 */ |
| 263 | { 0, 14, 14, 14, 8, 4, ZSTD_greedy }, /* level 4 */ |
| 264 | { 0, 14, 11, 14, 6, 4, ZSTD_lazy }, /* level 5 */ |
| 265 | { 0, 14, 14, 13, 6, 5, ZSTD_lazy }, /* level 6 */ |
| 266 | { 0, 14, 14, 14, 7, 6, ZSTD_lazy }, /* level 7 */ |
| 267 | { 0, 14, 14, 14, 8, 4, ZSTD_lazy }, /* level 8 */ |
| 268 | { 0, 14, 14, 15, 9, 4, ZSTD_lazy }, /* level 9 */ |
| 269 | { 0, 14, 14, 15, 10, 4, ZSTD_lazy }, /* level 10 */ |
| 270 | { 0, 14, 15, 15, 6, 4, ZSTD_btlazy2 }, /* level 11 */ |
| 271 | { 0, 14, 15, 15, 7, 4, ZSTD_btlazy2 }, /* level 12 */ |
| 272 | { 0, 14, 15, 15, 8, 4, ZSTD_btlazy2 }, /* level 13 */ |
| 273 | { 0, 14, 15, 15, 9, 4, ZSTD_btlazy2 }, /* level 14 */ |
| 274 | { 0, 14, 15, 15, 10, 4, ZSTD_btlazy2 }, /* level 15 */ |
| 275 | { 0, 14, 15, 15, 11, 4, ZSTD_btlazy2 }, /* level 16 */ |
| 276 | { 0, 14, 15, 15, 12, 4, ZSTD_btlazy2 }, /* level 17 */ |
| 277 | { 0, 14, 15, 15, 13, 4, ZSTD_btlazy2 }, /* level 18 */ |
| 278 | { 0, 14, 15, 15, 14, 4, ZSTD_btlazy2 }, /* level 19 */ |
| 279 | { 0, 14, 15, 15, 15, 4, ZSTD_btlazy2 }, /* level 20 */ |
| 280 | }, |
| Yann Collet | 5be2dd2 | 2015-11-11 13:43:58 +0100 | [diff] [blame] | 281 | }; |
| 282 | |
| 283 | |
| 284 | /* ************************************* |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 285 | * Error management |
| Yann Collet | 353c5d2 | 2015-10-21 14:39:26 +0100 | [diff] [blame] | 286 | ***************************************/ |
| Yann Collet | b1f3f4b | 2015-10-18 22:18:32 +0100 | [diff] [blame] | 287 | #include "error.h" |
| Yann Collet | 439eb77 | 2015-01-31 10:52:59 +0100 | [diff] [blame] | 288 | |
| 289 | |
| 290 | #if defined (__cplusplus) |
| 291 | } |
| Yann Collet | c5d46b5 | 2015-02-16 18:06:26 +0100 | [diff] [blame] | 292 | #endif |
| Yann Collet | aa07405 | 2015-10-30 11:21:50 +0100 | [diff] [blame] | 293 | |
| 294 | #endif /* ZSTD_STATIC_H */ |