File Index
Files and directories
Sign in
FILE

zstd_compress_sequences.h

File preview with syntax highlighting.

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