zstd_compress_sequences.h 2.2 KB

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