1*01826a49SYabin Cui /* 2*01826a49SYabin Cui * Copyright (c) Meta Platforms, Inc. and affiliates. 3*01826a49SYabin Cui * All rights reserved. 4*01826a49SYabin Cui * 5*01826a49SYabin Cui * This source code is licensed under both the BSD-style license (found in the 6*01826a49SYabin Cui * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7*01826a49SYabin Cui * in the COPYING file in the root directory of this source tree). 8*01826a49SYabin Cui * You may select, at your option, one of the above-listed licenses. 9*01826a49SYabin Cui */ 10*01826a49SYabin Cui 11*01826a49SYabin Cui #ifndef ZSTD_COMPRESS_SEQUENCES_H 12*01826a49SYabin Cui #define ZSTD_COMPRESS_SEQUENCES_H 13*01826a49SYabin Cui 14*01826a49SYabin Cui #include "../common/fse.h" /* FSE_repeat, FSE_CTable */ 15*01826a49SYabin Cui #include "../common/zstd_internal.h" /* symbolEncodingType_e, ZSTD_strategy */ 16*01826a49SYabin Cui 17*01826a49SYabin Cui typedef enum { 18*01826a49SYabin Cui ZSTD_defaultDisallowed = 0, 19*01826a49SYabin Cui ZSTD_defaultAllowed = 1 20*01826a49SYabin Cui } ZSTD_defaultPolicy_e; 21*01826a49SYabin Cui 22*01826a49SYabin Cui symbolEncodingType_e 23*01826a49SYabin Cui ZSTD_selectEncodingType( 24*01826a49SYabin Cui FSE_repeat* repeatMode, unsigned const* count, unsigned const max, 25*01826a49SYabin Cui size_t const mostFrequent, size_t nbSeq, unsigned const FSELog, 26*01826a49SYabin Cui FSE_CTable const* prevCTable, 27*01826a49SYabin Cui short const* defaultNorm, U32 defaultNormLog, 28*01826a49SYabin Cui ZSTD_defaultPolicy_e const isDefaultAllowed, 29*01826a49SYabin Cui ZSTD_strategy const strategy); 30*01826a49SYabin Cui 31*01826a49SYabin Cui size_t 32*01826a49SYabin Cui ZSTD_buildCTable(void* dst, size_t dstCapacity, 33*01826a49SYabin Cui FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type, 34*01826a49SYabin Cui unsigned* count, U32 max, 35*01826a49SYabin Cui const BYTE* codeTable, size_t nbSeq, 36*01826a49SYabin Cui const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax, 37*01826a49SYabin Cui const FSE_CTable* prevCTable, size_t prevCTableSize, 38*01826a49SYabin Cui void* entropyWorkspace, size_t entropyWorkspaceSize); 39*01826a49SYabin Cui 40*01826a49SYabin Cui size_t ZSTD_encodeSequences( 41*01826a49SYabin Cui void* dst, size_t dstCapacity, 42*01826a49SYabin Cui FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, 43*01826a49SYabin Cui FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, 44*01826a49SYabin Cui FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, 45*01826a49SYabin Cui seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2); 46*01826a49SYabin Cui 47*01826a49SYabin Cui size_t ZSTD_fseBitCost( 48*01826a49SYabin Cui FSE_CTable const* ctable, 49*01826a49SYabin Cui unsigned const* count, 50*01826a49SYabin Cui unsigned const max); 51*01826a49SYabin Cui 52*01826a49SYabin Cui size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog, 53*01826a49SYabin Cui unsigned const* count, unsigned const max); 54*01826a49SYabin Cui #endif /* ZSTD_COMPRESS_SEQUENCES_H */ 55