zstd_compress_sequences.h 2.2 KB

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