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