162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (c) Yann Collet, Facebook, Inc. 362306a36Sopenharmony_ci * All rights reserved. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * This source code is licensed under both the BSD-style license (found in the 662306a36Sopenharmony_ci * LICENSE file in the root directory of this source tree) and the GPLv2 (found 762306a36Sopenharmony_ci * in the COPYING file in the root directory of this source tree). 862306a36Sopenharmony_ci * You may select, at your option, one of the above-listed licenses. 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef ZSTD_COMPRESS_SEQUENCES_H 1262306a36Sopenharmony_ci#define ZSTD_COMPRESS_SEQUENCES_H 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include "../common/fse.h" /* FSE_repeat, FSE_CTable */ 1562306a36Sopenharmony_ci#include "../common/zstd_internal.h" /* symbolEncodingType_e, ZSTD_strategy */ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_citypedef enum { 1862306a36Sopenharmony_ci ZSTD_defaultDisallowed = 0, 1962306a36Sopenharmony_ci ZSTD_defaultAllowed = 1 2062306a36Sopenharmony_ci} ZSTD_defaultPolicy_e; 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_cisymbolEncodingType_e 2362306a36Sopenharmony_ciZSTD_selectEncodingType( 2462306a36Sopenharmony_ci FSE_repeat* repeatMode, unsigned const* count, unsigned const max, 2562306a36Sopenharmony_ci size_t const mostFrequent, size_t nbSeq, unsigned const FSELog, 2662306a36Sopenharmony_ci FSE_CTable const* prevCTable, 2762306a36Sopenharmony_ci short const* defaultNorm, U32 defaultNormLog, 2862306a36Sopenharmony_ci ZSTD_defaultPolicy_e const isDefaultAllowed, 2962306a36Sopenharmony_ci ZSTD_strategy const strategy); 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_cisize_t 3262306a36Sopenharmony_ciZSTD_buildCTable(void* dst, size_t dstCapacity, 3362306a36Sopenharmony_ci FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type, 3462306a36Sopenharmony_ci unsigned* count, U32 max, 3562306a36Sopenharmony_ci const BYTE* codeTable, size_t nbSeq, 3662306a36Sopenharmony_ci const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax, 3762306a36Sopenharmony_ci const FSE_CTable* prevCTable, size_t prevCTableSize, 3862306a36Sopenharmony_ci void* entropyWorkspace, size_t entropyWorkspaceSize); 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_cisize_t ZSTD_encodeSequences( 4162306a36Sopenharmony_ci void* dst, size_t dstCapacity, 4262306a36Sopenharmony_ci FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, 4362306a36Sopenharmony_ci FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, 4462306a36Sopenharmony_ci FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, 4562306a36Sopenharmony_ci seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2); 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_cisize_t ZSTD_fseBitCost( 4862306a36Sopenharmony_ci FSE_CTable const* ctable, 4962306a36Sopenharmony_ci unsigned const* count, 5062306a36Sopenharmony_ci unsigned const max); 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_cisize_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog, 5362306a36Sopenharmony_ci unsigned const* count, unsigned const max); 5462306a36Sopenharmony_ci#endif /* ZSTD_COMPRESS_SEQUENCES_H */ 55