Debian Codegraph @

Utilities/cmzstd/lib/compress/zstd_compress_sequences.h

raw
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_COMPRESS_SEQUENCES_H
12 #define ZSTD_COMPRESS_SEQUENCES_H
13
14 #include "zstd_compress_internal.h" /* SeqDef */
15 #include "../common/fse.h" /* FSE_repeat, FSE_CTable */
16 #include "../common/zstd_internal.h" /* SymbolEncodingType_e, ZSTD_strategy */
17
18 typedef enum {
19 ZSTD_defaultDisallowed = 0,
20 ZSTD_defaultAllowed = 1
21 } ZSTD_DefaultPolicy_e;
22
23 SymbolEncodingType_e
24 ZSTD_selectEncodingType(
25 FSE_repeat* repeatMode, unsigned const* count, unsigned const max,
26 size_t const mostFrequent, size_t nbSeq, unsigned const FSELog,
27 FSE_CTable const* prevCTable,
28 short const* defaultNorm, U32 defaultNormLog,
29 ZSTD_DefaultPolicy_e const isDefaultAllowed,
30 ZSTD_strategy const strategy);
31
32 size_t
33 ZSTD_buildCTable(void* dst, size_t dstCapacity,
34 FSE_CTable* nextCTable, U32 FSELog, SymbolEncodingType_e type,
35 unsigned* count, U32 max,
36 const BYTE* codeTable, size_t nbSeq,
37 const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax,
38 const FSE_CTable* prevCTable, size_t prevCTableSize,
39 void* entropyWorkspace, size_t entropyWorkspaceSize);
40
41 size_t ZSTD_encodeSequences(
42 void* dst, size_t dstCapacity,
43 FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
44 FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
45 FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
46 SeqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2);
47
48 size_t ZSTD_fseBitCost(
49 FSE_CTable const* ctable,
50 unsigned const* count,
51 unsigned const max);
52
53 size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog,
54 unsigned const* count, unsigned const max);
55 #endif /* ZSTD_COMPRESS_SEQUENCES_H */