zstd_opt.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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_OPT_H
  12. #define ZSTD_OPT_H
  13. #include "zstd_compress_internal.h"
  14. #if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
  15. || !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
  16. || !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
  17. /* used in ZSTD_loadDictionaryContent() */
  18. void ZSTD_updateTree(ZSTD_MatchState_t* ms, const BYTE* ip, const BYTE* iend);
  19. #endif
  20. #ifndef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR
  21. size_t ZSTD_compressBlock_btopt(
  22. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  23. void const* src, size_t srcSize);
  24. size_t ZSTD_compressBlock_btopt_dictMatchState(
  25. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  26. void const* src, size_t srcSize);
  27. size_t ZSTD_compressBlock_btopt_extDict(
  28. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  29. void const* src, size_t srcSize);
  30. #define ZSTD_COMPRESSBLOCK_BTOPT ZSTD_compressBlock_btopt
  31. #define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE ZSTD_compressBlock_btopt_dictMatchState
  32. #define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT ZSTD_compressBlock_btopt_extDict
  33. #else
  34. #define ZSTD_COMPRESSBLOCK_BTOPT NULL
  35. #define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE NULL
  36. #define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT NULL
  37. #endif
  38. #ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
  39. size_t ZSTD_compressBlock_btultra(
  40. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  41. void const* src, size_t srcSize);
  42. size_t ZSTD_compressBlock_btultra_dictMatchState(
  43. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  44. void const* src, size_t srcSize);
  45. size_t ZSTD_compressBlock_btultra_extDict(
  46. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  47. void const* src, size_t srcSize);
  48. /* note : no btultra2 variant for extDict nor dictMatchState,
  49. * because btultra2 is not meant to work with dictionaries
  50. * and is only specific for the first block (no prefix) */
  51. size_t ZSTD_compressBlock_btultra2(
  52. ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
  53. void const* src, size_t srcSize);
  54. #define ZSTD_COMPRESSBLOCK_BTULTRA ZSTD_compressBlock_btultra
  55. #define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState
  56. #define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict
  57. #define ZSTD_COMPRESSBLOCK_BTULTRA2 ZSTD_compressBlock_btultra2
  58. #else
  59. #define ZSTD_COMPRESSBLOCK_BTULTRA NULL
  60. #define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE NULL
  61. #define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT NULL
  62. #define ZSTD_COMPRESSBLOCK_BTULTRA2 NULL
  63. #endif
  64. #endif /* ZSTD_OPT_H */