xref: /netbsd-src/external/bsd/zstd/dist/lib/compress/zstd_compress_literals.h (revision 3117ece4fc4a4ca4489ba793710b60b0d26bab6c)
1*3117ece4Schristos /*
2*3117ece4Schristos  * Copyright (c) Meta Platforms, Inc. and affiliates.
3*3117ece4Schristos  * All rights reserved.
4*3117ece4Schristos  *
5*3117ece4Schristos  * This source code is licensed under both the BSD-style license (found in the
6*3117ece4Schristos  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7*3117ece4Schristos  * in the COPYING file in the root directory of this source tree).
8*3117ece4Schristos  * You may select, at your option, one of the above-listed licenses.
9*3117ece4Schristos  */
10*3117ece4Schristos 
11*3117ece4Schristos #ifndef ZSTD_COMPRESS_LITERALS_H
12*3117ece4Schristos #define ZSTD_COMPRESS_LITERALS_H
13*3117ece4Schristos 
14*3117ece4Schristos #include "zstd_compress_internal.h" /* ZSTD_hufCTables_t, ZSTD_minGain() */
15*3117ece4Schristos 
16*3117ece4Schristos 
17*3117ece4Schristos size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize);
18*3117ece4Schristos 
19*3117ece4Schristos /* ZSTD_compressRleLiteralsBlock() :
20*3117ece4Schristos  * Conditions :
21*3117ece4Schristos  * - All bytes in @src are identical
22*3117ece4Schristos  * - dstCapacity >= 4 */
23*3117ece4Schristos size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize);
24*3117ece4Schristos 
25*3117ece4Schristos /* ZSTD_compressLiterals():
26*3117ece4Schristos  * @entropyWorkspace: must be aligned on 4-bytes boundaries
27*3117ece4Schristos  * @entropyWorkspaceSize : must be >= HUF_WORKSPACE_SIZE
28*3117ece4Schristos  * @suspectUncompressible: sampling checks, to potentially skip huffman coding
29*3117ece4Schristos  */
30*3117ece4Schristos size_t ZSTD_compressLiterals (void* dst, size_t dstCapacity,
31*3117ece4Schristos                         const void* src, size_t srcSize,
32*3117ece4Schristos                               void* entropyWorkspace, size_t entropyWorkspaceSize,
33*3117ece4Schristos                         const ZSTD_hufCTables_t* prevHuf,
34*3117ece4Schristos                               ZSTD_hufCTables_t* nextHuf,
35*3117ece4Schristos                               ZSTD_strategy strategy, int disableLiteralCompression,
36*3117ece4Schristos                               int suspectUncompressible,
37*3117ece4Schristos                               int bmi2);
38*3117ece4Schristos 
39*3117ece4Schristos #endif /* ZSTD_COMPRESS_LITERALS_H */
40