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