xref: /linux/lib/zstd/compress/zstd_opt.h (revision e61f33273ca755b3e2ebee4520a76097199dc7a8)
1 /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
2 /*
3  * Copyright (c) Meta Platforms, Inc. and affiliates.
4  * All rights reserved.
5  *
6  * This source code is licensed under both the BSD-style license (found in the
7  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
8  * in the COPYING file in the root directory of this source tree).
9  * You may select, at your option, one of the above-listed licenses.
10  */
11 
12 #ifndef ZSTD_OPT_H
13 #define ZSTD_OPT_H
14 
15 #include "zstd_compress_internal.h"
16 
17 #if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
18  || !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
19  || !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
20 /* used in ZSTD_loadDictionaryContent() */
21 void ZSTD_updateTree(ZSTD_MatchState_t* ms, const BYTE* ip, const BYTE* iend);
22 #endif
23 
24 #ifndef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR
25 size_t ZSTD_compressBlock_btopt(
26         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
27         void const* src, size_t srcSize);
28 size_t ZSTD_compressBlock_btopt_dictMatchState(
29         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
30         void const* src, size_t srcSize);
31 size_t ZSTD_compressBlock_btopt_extDict(
32         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
33         void const* src, size_t srcSize);
34 
35 #define ZSTD_COMPRESSBLOCK_BTOPT ZSTD_compressBlock_btopt
36 #define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE ZSTD_compressBlock_btopt_dictMatchState
37 #define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT ZSTD_compressBlock_btopt_extDict
38 #else
39 #define ZSTD_COMPRESSBLOCK_BTOPT NULL
40 #define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE NULL
41 #define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT NULL
42 #endif
43 
44 #ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
45 size_t ZSTD_compressBlock_btultra(
46         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
47         void const* src, size_t srcSize);
48 size_t ZSTD_compressBlock_btultra_dictMatchState(
49         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
50         void const* src, size_t srcSize);
51 size_t ZSTD_compressBlock_btultra_extDict(
52         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
53         void const* src, size_t srcSize);
54 
55         /* note : no btultra2 variant for extDict nor dictMatchState,
56          * because btultra2 is not meant to work with dictionaries
57          * and is only specific for the first block (no prefix) */
58 size_t ZSTD_compressBlock_btultra2(
59         ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
60         void const* src, size_t srcSize);
61 
62 #define ZSTD_COMPRESSBLOCK_BTULTRA ZSTD_compressBlock_btultra
63 #define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState
64 #define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict
65 #define ZSTD_COMPRESSBLOCK_BTULTRA2 ZSTD_compressBlock_btultra2
66 #else
67 #define ZSTD_COMPRESSBLOCK_BTULTRA NULL
68 #define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE NULL
69 #define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT NULL
70 #define ZSTD_COMPRESSBLOCK_BTULTRA2 NULL
71 #endif
72 
73 #endif /* ZSTD_OPT_H */
74