Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * Huffman coder, part of New Generation Entropy library
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * header file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2013-2016, Yann Collet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Redistribution and use in source and binary forms, with or without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * modification, are permitted provided that the following conditions are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *   * Redistributions of source code must retain the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * notice, this list of conditions and the following disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *   * Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * copyright notice, this list of conditions and the following disclaimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * in the documentation and/or other materials provided with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * This program is free software; you can redistribute it and/or modify it under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * the terms of the GNU General Public License version 2 as published by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * Free Software Foundation. This program is dual-licensed; you may select
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * either version 2 of the GNU General Public License ("GPL") or BSD license
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * ("BSD").
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * You can contact the author at :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #ifndef HUF_H_298734234
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define HUF_H_298734234
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) /* *** Dependencies *** */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include <linux/types.h> /* size_t */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /* ***   Tool functions *** */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) /* Error Management */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) /* ***   Advanced function   *** */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /** HUF_compress4X_wksp() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) *   Same as HUF_compress2(), but uses externally allocated `workSpace`, which must be a table of >= 1024 unsigned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) size_t HUF_compress4X_wksp(void *dst, size_t dstSize, const void *src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void *workSpace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 			   size_t wkspSize); /**< `workSpace` must be a table of at least HUF_COMPRESS_WORKSPACE_SIZE_U32 unsigned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) /* *** Dependencies *** */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #include "mem.h" /* U32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) /* *** Constants *** */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define HUF_TABLELOG_MAX 12     /* max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define HUF_TABLELOG_DEFAULT 11 /* tableLog by default, when not specified */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define HUF_SYMBOLVALUE_MAX 255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #error "HUF_TABLELOG_MAX is too large !"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /* ****************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) *  Static allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) ******************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) /* HUF buffer bounds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define HUF_CTABLEBOUND 129
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define HUF_BLOCKBOUND(size) (size + (size >> 8) + 8)			 /* only true if incompressible pre-filtered with fast heuristic */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) /* static allocation of HUF's Compression Table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	U32 name##hb[maxSymbolValue + 1];              \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	void *name##hv = &(name##hb);                  \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	HUF_CElt *name = (HUF_CElt *)(name##hv) /* no final ; */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) /* static allocation of HUF's DTable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) typedef U32 HUF_DTable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define HUF_DTABLE_SIZE(maxTableLog) (1 + (1 << (maxTableLog)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) HUF_DTable DTable[HUF_DTABLE_SIZE((maxTableLog)-1)] = {((U32)((maxTableLog)-1) * 0x01000001)}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define HUF_CREATE_STATIC_DTABLEX4(DTable, maxTableLog) HUF_DTable DTable[HUF_DTABLE_SIZE(maxTableLog)] = {((U32)(maxTableLog)*0x01000001)}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) /* The workspace must have alignment at least 4 and be at least this large */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define HUF_COMPRESS_WORKSPACE_SIZE (6 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define HUF_COMPRESS_WORKSPACE_SIZE_U32 (HUF_COMPRESS_WORKSPACE_SIZE / sizeof(U32))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) /* The workspace must have alignment at least 4 and be at least this large */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #define HUF_DECOMPRESS_WORKSPACE_SIZE (3 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* ****************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) *  Advanced decompression functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) ******************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) size_t HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize); /**< decodes RLE and uncompressed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 				size_t workspaceSize);							       /**< considers RLE and uncompressed as errors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 				   size_t workspaceSize); /**< single-symbol decoder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) size_t HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 				   size_t workspaceSize); /**< double-symbols decoder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* ****************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) *  HUF detailed API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) ******************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /*!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) HUF_compress() does the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 1. count symbol occurrence from source[] into table count[] using FSE_count()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 2. (optional) refine tableLog using HUF_optimalTableLog()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 3. build Huffman table from count using HUF_buildCTable()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 4. save Huffman table to memory buffer using HUF_writeCTable_wksp()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 5. encode the data stream using HUF_compress4X_usingCTable()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) The following API allows targeting specific sub-functions for advanced tasks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) For example, it's possible to compress several blocks using the same 'CTable',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) or to save and regenerate 'CTable' using external methods.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /* FSE_count() : find it within "fse.h" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) typedef struct HUF_CElt_s HUF_CElt; /* incomplete type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) size_t HUF_writeCTable_wksp(void *dst, size_t maxDstSize, const HUF_CElt *CTable, unsigned maxSymbolValue, unsigned huffLog, void *workspace, size_t workspaceSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) size_t HUF_compress4X_usingCTable(void *dst, size_t dstSize, const void *src, size_t srcSize, const HUF_CElt *CTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) typedef enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	HUF_repeat_none,  /**< Cannot use the previous table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	HUF_repeat_check, /**< Can use the previous table but it must be checked. Note : The previous table must have been constructed by HUF_compress{1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			     4}X_repeat */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	HUF_repeat_valid  /**< Can use the previous table and it is asumed to be valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) } HUF_repeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /** HUF_compress4X_repeat() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) *   Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) *   If it uses hufTable it does not modify hufTable or repeat.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) *   If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) *   If preferRepeat then the old table will always be used if valid. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) size_t HUF_compress4X_repeat(void *dst, size_t dstSize, const void *src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void *workSpace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 			     size_t wkspSize, HUF_CElt *hufTable, HUF_repeat *repeat,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			     int preferRepeat); /**< `workSpace` must be a table of at least HUF_COMPRESS_WORKSPACE_SIZE_U32 unsigned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /** HUF_buildCTable_wksp() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  *  Same as HUF_buildCTable(), but using externally allocated scratch buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  *  `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of 1024 unsigned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) size_t HUF_buildCTable_wksp(HUF_CElt *tree, const U32 *count, U32 maxSymbolValue, U32 maxNbBits, void *workSpace, size_t wkspSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /*! HUF_readStats() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	Read compact Huffman tree, saved by HUF_writeCTable().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	`huffWeight` is destination buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	@return : size read from `src` , or an error Code .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) size_t HUF_readStats_wksp(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 			  void *workspace, size_t workspaceSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) /** HUF_readCTable() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) *   Loading a CTable saved with HUF_writeCTable() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) size_t HUF_readCTable_wksp(HUF_CElt *CTable, unsigned maxSymbolValue, const void *src, size_t srcSize, void *workspace, size_t workspaceSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) HUF_decompress() does the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 1. select the decompression algorithm (X2, X4) based on pre-computed heuristics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 2. build Huffman table from save, using HUF_readDTableXn()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 3. decode 1 or 4 segments in parallel using HUF_decompressSXn_usingDTable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) /** HUF_selectDecoder() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) *   Tells which decoder is likely to decode faster,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) *   based on a set of pre-determined metrics.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) *   @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) *   Assumption : 0 < cSrcSize < dstSize <= 128 KB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) U32 HUF_selectDecoder(size_t dstSize, size_t cSrcSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) size_t HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) size_t HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) size_t HUF_decompress4X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) size_t HUF_decompress4X2_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) size_t HUF_decompress4X4_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) /* single stream variants */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) size_t HUF_compress1X_wksp(void *dst, size_t dstSize, const void *src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void *workSpace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			   size_t wkspSize); /**< `workSpace` must be a table of at least HUF_COMPRESS_WORKSPACE_SIZE_U32 unsigned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, size_t srcSize, const HUF_CElt *CTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /** HUF_compress1X_repeat() :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) *   Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *   If it uses hufTable it does not modify hufTable or repeat.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) *   If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) *   If preferRepeat then the old table will always be used if valid. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) size_t HUF_compress1X_repeat(void *dst, size_t dstSize, const void *src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void *workSpace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 			     size_t wkspSize, HUF_CElt *hufTable, HUF_repeat *repeat,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 			     int preferRepeat); /**< `workSpace` must be a table of at least HUF_COMPRESS_WORKSPACE_SIZE_U32 unsigned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) size_t HUF_decompress1X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 				   size_t workspaceSize); /**< single-symbol decoder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) size_t HUF_decompress1X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 				   size_t workspaceSize); /**< double-symbols decoder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) size_t HUF_decompress1X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 				    const HUF_DTable *DTable); /**< automatic selection of sing or double symbol decoder, based on DTable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) size_t HUF_decompress1X2_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) size_t HUF_decompress1X4_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) #endif /* HUF_H_298734234 */