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