| 1 |
|
| 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"
|
| 16 | #include "../common/fse.h"
|
| 17 | #include "../common/zstd_internal.h"
|
| 18 |
|
| 19 | typedef enum {
|
| 20 | ZSTD_defaultDisallowed = 0,
|
| 21 | ZSTD_defaultAllowed = 1
|
| 22 | } ZSTD_DefaultPolicy_e;
|
| 23 |
|
| 24 | SymbolEncodingType_e
|
| 25 | ZSTD_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 |
|
| 33 | size_t
|
| 34 | ZSTD_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 |
|
| 42 | size_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 |
|
| 49 | size_t ZSTD_fseBitCost(
|
| 50 | FSE_CTable const* ctable,
|
| 51 | unsigned const* count,
|
| 52 | unsigned const max);
|
| 53 |
|
| 54 | size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog,
|
| 55 | unsigned const* count, unsigned const max);
|
| 56 | #endif
|