/* * Copyright (c) Yann Collet, Facebook, Inc. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. */ /* zstd_decompress_internal: * objects and definitions shared within lib/decompress modules */ #ifndef ZSTD_DECOMPRESS_INTERNAL_H #define ZSTD_DECOMPRESS_INTERNAL_H /*-******************************************************* * Dependencies *********************************************************/ #include "../common/mem.h" /* BYTE, U16, U32 */ #include "../common/zstd_internal.h" /* constants : MaxLL, MaxML, MaxOff, LLFSELog, etc. */ /*-******************************************************* * Constants *********************************************************/ static UNUSED_ATTR const U32 LL_base[MaxLL+1] = …; static UNUSED_ATTR const U32 OF_base[MaxOff+1] = …; static UNUSED_ATTR const U8 OF_bits[MaxOff+1] = …; static UNUSED_ATTR const U32 ML_base[MaxML+1] = …; /*-******************************************************* * Decompression types *********************************************************/ ZSTD_seqSymbol_header; ZSTD_seqSymbol; #define SEQSYMBOL_TABLE_SIZE(log) … #define ZSTD_BUILD_FSE_TABLE_WKSP_SIZE … #define ZSTD_BUILD_FSE_TABLE_WKSP_SIZE_U32 … ZSTD_entropyDTables_t; ZSTD_dStage; ZSTD_dStreamStage; ZSTD_dictUses_e; /* Hashset for storing references to multiple ZSTD_DDict within ZSTD_DCtx */ ZSTD_DDictHashSet; #ifndef ZSTD_DECODER_INTERNAL_BUFFER #define ZSTD_DECODER_INTERNAL_BUFFER … #endif #define ZSTD_LBMIN … #define ZSTD_LBMAX … /* extra buffer, compensates when dst is not large enough to store litBuffer */ #define ZSTD_LITBUFFEREXTRASIZE … ZSTD_litLocation_e; struct ZSTD_DCtx_s { … }; /* typedef'd to ZSTD_DCtx within "zstd.h" */ MEM_STATIC int ZSTD_DCtx_get_bmi2(const struct ZSTD_DCtx_s *dctx) { … } /*-******************************************************* * Shared internal functions *********************************************************/ /*! ZSTD_loadDEntropy() : * dict : must point at beginning of a valid zstd dictionary. * @return : size of dictionary header (size of magic number + dict ID + entropy tables) */ size_t ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, const void* const dict, size_t const dictSize); /*! ZSTD_checkContinuity() : * check if next `dst` follows previous position, where decompression ended. * If yes, do nothing (continue on current segment). * If not, classify previous segment as "external dictionary", and start a new segment. * This function cannot fail. */ void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst, size_t dstSize); #endif /* ZSTD_DECOMPRESS_INTERNAL_H */