2015-10-18 21:18:32 +00:00
/* ******************************************************************
2016-04-22 10:43:18 +00:00
Huffman coder , part of New Generation Entropy library
2015-10-18 21:18:32 +00:00
header file
2016-01-23 18:28:41 +00:00
Copyright ( C ) 2013 - 2016 , Yann Collet .
2015-10-18 21:18:32 +00:00
BSD 2 - Clause License ( http : //www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are
met :
* Redistributions of source code must retain the above copyright
notice , this list of conditions and the following disclaimer .
* Redistributions in binary form must reproduce the above
copyright notice , this list of conditions and the following disclaimer
in the documentation and / or other materials provided with the
distribution .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
" AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT
LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL ,
SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT
LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
You can contact the author at :
- Source repository : https : //github.com/Cyan4973/FiniteStateEntropy
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2016-06-08 09:11:02 +00:00
# ifndef HUF_H_298734234
# define HUF_H_298734234
2015-10-18 21:18:32 +00:00
# if defined (__cplusplus)
extern " C " {
# endif
2016-06-04 23:50:33 +00:00
/* *** Dependencies *** */
2015-10-18 21:18:32 +00:00
# include <stddef.h> /* size_t */
2016-06-10 22:23:43 +00:00
/* *** simple functions *** */
/**
2016-03-20 04:40:39 +00:00
HUF_compress ( ) :
2016-06-04 23:50:33 +00:00
Compress content from buffer ' src ' , of size ' srcSize ' , into buffer ' dst ' .
2016-06-08 09:11:02 +00:00
' dst ' buffer must be already allocated .
Compression runs faster if ` dstCapacity ` > = HUF_compressBound ( srcSize ) .
2016-06-10 22:23:43 +00:00
` srcSize ` must be < = ` HUF_BLOCKSIZE_MAX ` = = 128 KB .
@ return : size of compressed data ( < = ` dstCapacity ` ) .
2015-10-18 21:18:32 +00:00
Special values : if return = = 0 , srcData is not compressible = > Nothing is stored within dst ! ! !
2016-03-20 04:40:39 +00:00
if return = = 1 , srcData is a single repeated byte symbol ( RLE compression ) .
2015-10-18 21:18:32 +00:00
if HUF_isError ( return ) , compression failed ( more details using HUF_getErrorName ( ) )
2016-06-10 22:23:43 +00:00
*/
size_t HUF_compress ( void * dst , size_t dstCapacity ,
const void * src , size_t srcSize ) ;
2015-10-18 21:18:32 +00:00
2016-06-10 22:23:43 +00:00
/**
2016-03-20 04:40:39 +00:00
HUF_decompress ( ) :
2016-04-22 10:43:18 +00:00
Decompress HUF data from buffer ' cSrc ' , of size ' cSrcSize ' ,
2016-06-04 23:50:33 +00:00
into already allocated buffer ' dst ' , of minimum size ' dstSize ' .
2016-12-02 02:24:59 +00:00
` originalSize ` : * * must * * be the * * * exact * * * size of original ( uncompressed ) data .
2016-01-23 18:28:41 +00:00
Note : in contrast with FSE , HUF_decompress can regenerate
RLE ( cSrcSize = = 1 ) and uncompressed ( cSrcSize = = dstSize ) data ,
because it knows size to regenerate .
2016-12-02 02:24:59 +00:00
@ return : size of regenerated data ( = = originalSize ) ,
2016-01-06 00:58:37 +00:00
or an error code , which can be tested using HUF_isError ( )
2015-10-18 21:18:32 +00:00
*/
2016-12-02 02:24:59 +00:00
size_t HUF_decompress ( void * dst , size_t originalSize ,
2016-06-10 22:23:43 +00:00
const void * cSrc , size_t cSrcSize ) ;
2015-10-18 21:18:32 +00:00
2016-12-02 01:47:30 +00:00
/* *** Tool functions *** */
2016-12-02 15:13:41 +00:00
# define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
2016-06-04 23:50:33 +00:00
size_t HUF_compressBound ( size_t size ) ; /**< maximum compressed size (worst case) */
2015-10-18 21:18:32 +00:00
/* Error Management */
2016-03-20 04:40:39 +00:00
unsigned HUF_isError ( size_t code ) ; /**< tells if a return value is an error code */
const char * HUF_getErrorName ( size_t code ) ; /**< provides error code string (useful for debugging) */
2015-10-18 21:18:32 +00:00
2016-12-02 01:47:30 +00:00
/* *** Advanced function *** */
2015-10-18 21:18:32 +00:00
2016-06-04 23:50:33 +00:00
/** HUF_compress2() :
2016-12-02 02:24:59 +00:00
* Same as HUF_compress ( ) , but offers direct control over ` maxSymbolValue ` and ` tableLog ` .
* ` tableLog ` must be ` < = HUF_TABLELOG_MAX ` . */
2016-06-04 23:50:33 +00:00
size_t HUF_compress2 ( void * dst , size_t dstSize , const void * src , size_t srcSize , unsigned maxSymbolValue , unsigned tableLog ) ;
2015-10-18 21:18:32 +00:00
2016-12-02 00:13:35 +00:00
/** HUF_compress4X_wksp() :
2016-12-02 01:47:30 +00:00
* Same as HUF_compress2 ( ) , but uses externally allocated ` workSpace ` , which must be a table of > = 1024 unsigned */
2017-03-03 00:38:07 +00:00
size_t HUF_compress4X_wksp ( void * dst , size_t dstSize , const void * src , size_t srcSize , unsigned maxSymbolValue , unsigned tableLog , void * workSpace , size_t wkspSize ) ; /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
2016-12-02 00:13:35 +00:00
2016-06-04 22:42:28 +00:00
# ifdef HUF_STATIC_LINKING_ONLY
/* *** Dependencies *** */
2016-06-04 23:50:33 +00:00
# include "mem.h" /* U32 */
2016-06-04 22:42:28 +00:00
2016-06-04 23:33:55 +00:00
/* *** Constants *** */
2017-03-06 05:07:20 +00:00
# define HUF_TABLELOG_MAX 12 /* max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */
2016-07-17 14:21:37 +00:00
# define HUF_TABLELOG_DEFAULT 11 /* tableLog by default, when not specified */
2017-03-06 05:07:20 +00:00
# define HUF_SYMBOLVALUE_MAX 255
# define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
2016-06-04 23:33:55 +00:00
# if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX)
# error "HUF_TABLELOG_MAX is too large !"
# endif
2016-06-04 22:42:28 +00:00
/* ****************************************
* Static allocation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* HUF buffer bounds */
# define HUF_CTABLEBOUND 129
# define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true if incompressible pre-filtered with fast heuristic */
# define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */
/* static allocation of HUF's Compression Table */
# define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \
U32 name # # hb [ maxSymbolValue + 1 ] ; \
void * name # # hv = & ( name # # hb ) ; \
HUF_CElt * name = ( HUF_CElt * ) ( name # # hv ) /* no final ; */
/* static allocation of HUF's DTable */
2016-06-10 22:23:43 +00:00
typedef U32 HUF_DTable ;
2016-06-08 09:11:02 +00:00
# define HUF_DTABLE_SIZE(maxTableLog) (1 + (1<<(maxTableLog)))
2016-06-04 22:42:28 +00:00
# define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) \
2016-12-02 02:24:59 +00:00
HUF_DTable DTable [ HUF_DTABLE_SIZE ( ( maxTableLog ) - 1 ) ] = { ( ( U32 ) ( ( maxTableLog ) - 1 ) * 0x01000001 ) }
2016-06-04 22:42:28 +00:00
# define HUF_CREATE_STATIC_DTABLEX4(DTable, maxTableLog) \
2016-12-02 02:24:59 +00:00
HUF_DTable DTable [ HUF_DTABLE_SIZE ( maxTableLog ) ] = { ( ( U32 ) ( maxTableLog ) * 0x01000001 ) }
2016-06-04 22:42:28 +00:00
2017-03-03 00:38:07 +00:00
/* The workspace must have alignment at least 4 and be at least this large */
# define HUF_WORKSPACE_SIZE (6 << 10)
# define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32))
2016-06-04 22:42:28 +00:00
/* ****************************************
* Advanced decompression functions
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2016-06-10 22:23:43 +00:00
size_t HUF_decompress4X2 ( void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< single-symbol decoder */
size_t HUF_decompress4X4 ( void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< double-symbols decoder */
2016-06-22 11:15:53 +00:00
size_t HUF_decompress4X_DCtx ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< decodes RLE and uncompressed */
2016-06-11 21:26:22 +00:00
size_t HUF_decompress4X_hufOnly ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< considers RLE and uncompressed as errors */
2016-06-10 23:46:03 +00:00
size_t HUF_decompress4X2_DCtx ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< single-symbol decoder */
size_t HUF_decompress4X4_DCtx ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< double-symbols decoder */
2016-06-04 22:42:28 +00:00
/* ****************************************
* HUF detailed API
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*!
HUF_compress ( ) does the following :
1. count symbol occurrence from source [ ] into table count [ ] using FSE_count ( )
2. ( optional ) refine tableLog using HUF_optimalTableLog ( )
3. build Huffman table from count using HUF_buildCTable ( )
4. save Huffman table to memory buffer using HUF_writeCTable ( )
5. encode the data stream using HUF_compress4X_usingCTable ( )
The following API allows targeting specific sub - functions for advanced tasks .
For example , it ' s possible to compress several blocks using the same ' CTable ' ,
or to save and regenerate ' CTable ' using external methods .
*/
/* FSE_count() : find it within "fse.h" */
unsigned HUF_optimalTableLog ( unsigned maxTableLog , size_t srcSize , unsigned maxSymbolValue ) ;
typedef struct HUF_CElt_s HUF_CElt ; /* incomplete type */
size_t HUF_buildCTable ( HUF_CElt * CTable , const unsigned * count , unsigned maxSymbolValue , unsigned maxNbBits ) ;
size_t HUF_writeCTable ( void * dst , size_t maxDstSize , const HUF_CElt * CTable , unsigned maxSymbolValue , unsigned huffLog ) ;
size_t HUF_compress4X_usingCTable ( void * dst , size_t dstSize , const void * src , size_t srcSize , const HUF_CElt * CTable ) ;
Allow compressor to repeat Huffman tables
* Compressor saves most recently used Huffman table and reuses it
if it produces better results.
* I attempted to preserve CPU usage profile.
I intentionally left all of the existing heuristics in place.
There is only a speed difference on the second block and later.
When compressing large enough blocks (say >= 4 KiB) there is
no significant difference in compression speed.
Dictionary compression of one block is the same speed for blocks
with literals <= 1 KiB, and after that the difference is not
very significant.
* In the synthetic data, with blocks 10 KB or smaller, most blocks
can't use repeated tables because the previous block did not
contain a symbol that the current block contains.
Once blocks are about 12 KB or more, most previous blocks have
valid Huffman tables for the current block, and the compression
ratio and decompression speed jumped.
* In silesia blocks as small as 4KB can frequently reuse the
previous Huffman table (85%), but it isn't as profitable, and
the previous Huffman table only gets used about 3% of the time.
* Microbenchmarks show that `HUF_validateCTable()` takes ~55 ns
and `HUF_estimateCompressedSize()` takes ~35 ns.
They are decently well optimized, the first versions took 90 ns
and 120 ns respectively. `HUF_validateCTable()` could be twice as
fast, if we cast the `HUF_CElt*` to a `U32*` and compare to 0.
However, `U32` has an alignment of 4 instead of 2, so I think that
might be undefined behavior.
* I've ran `zstreamtest` compiled normally, with UASAN and with MSAN
for 4 hours each.
The worst case for the speed difference is a bunch of small blocks
in the same frame. I modified `bench.c` to compress the input in a
single frame but with blocks of the given block size, set by `-B`.
Benchmarks on level 1:
| Program | Block size | Corpus | Ratio | Compression MB/s | Decompression MB/s |
|-----------|------------|-----------|-------|------------------|--------------------|
| zstd.base | 256 | synthetic | 2.364 | 110.0 | 297.0 |
| zstd | 256 | synthetic | 2.367 | 108.9 | 297.0 |
| zstd.base | 256 | silesia | 2.204 | 93.8 | 415.7 |
| zstd | 256 | silesia | 2.204 | 93.4 | 415.7 |
| zstd.base | 512 | synthetic | 2.594 | 144.2 | 420.0 |
| zstd | 512 | synthetic | 2.599 | 141.5 | 425.7 |
| zstd.base | 512 | silesia | 2.358 | 118.4 | 432.6 |
| zstd | 512 | silesia | 2.358 | 119.8 | 432.6 |
| zstd.base | 1024 | synthetic | 2.790 | 192.3 | 594.1 |
| zstd | 1024 | synthetic | 2.794 | 192.3 | 600.0 |
| zstd.base | 1024 | silesia | 2.524 | 148.2 | 464.2 |
| zstd | 1024 | silesia | 2.525 | 148.2 | 467.6 |
| zstd.base | 4096 | synthetic | 3.023 | 300.0 | 1000.0 |
| zstd | 4096 | synthetic | 3.024 | 300.0 | 1010.1 |
| zstd.base | 4096 | silesia | 2.779 | 223.1 | 623.5 |
| zstd | 4096 | silesia | 2.779 | 223.1 | 636.0 |
| zstd.base | 16384 | synthetic | 3.131 | 350.0 | 1150.1 |
| zstd | 16384 | synthetic | 3.152 | 350.0 | 1630.3 |
| zstd.base | 16384 | silesia | 2.871 | 296.5 | 883.3 |
| zstd | 16384 | silesia | 2.872 | 294.4 | 898.3 |
2017-03-02 01:51:56 +00:00
typedef enum {
HUF_repeat_none , /**< Cannot use the previous table */
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, 4}X_repeat */
HUF_repeat_valid /**< Can use the previous table and it is asumed to be valid */
} HUF_repeat ;
/** HUF_compress4X_repeat() :
* Same as HUF_compress4X_wksp ( ) , but considers using hufTable if * repeat ! = HUF_repeat_none .
* If it uses hufTable it does not modify hufTable or repeat .
2017-03-03 20:30:24 +00:00
* If it doesn ' t , it sets * repeat = HUF_repeat_none , and it sets hufTable to the table used .
* If preferRepeat then the old table will always be used if valid . */
size_t HUF_compress4X_repeat ( void * dst , size_t dstSize , const void * src , size_t srcSize , unsigned maxSymbolValue , unsigned tableLog , void * workSpace , size_t wkspSize , HUF_CElt * hufTable , HUF_repeat * repeat , int preferRepeat ) ; /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
2016-06-04 22:42:28 +00:00
2016-12-02 01:47:30 +00:00
/** HUF_buildCTable_wksp() :
* Same as HUF_buildCTable ( ) , but using externally allocated scratch buffer .
* ` workSpace ` must be aligned on 4 - bytes boundaries , and be at least as large as a table of 1024 unsigned .
*/
size_t HUF_buildCTable_wksp ( HUF_CElt * tree , const U32 * count , U32 maxSymbolValue , U32 maxNbBits , void * workSpace , size_t wkspSize ) ;
2016-06-08 09:11:02 +00:00
/*! HUF_readStats() :
Read compact Huffman tree , saved by HUF_writeCTable ( ) .
` huffWeight ` is destination buffer .
@ return : size read from ` src ` , or an error Code .
Note : Needed by HUF_readCTable ( ) and HUF_readDTableXn ( ) . */
size_t HUF_readStats ( BYTE * huffWeight , size_t hwSize , U32 * rankStats ,
U32 * nbSymbolsPtr , U32 * tableLogPtr ,
const void * src , size_t srcSize ) ;
/** HUF_readCTable() :
* Loading a CTable saved with HUF_writeCTable ( ) */
size_t HUF_readCTable ( HUF_CElt * CTable , unsigned maxSymbolValue , const void * src , size_t srcSize ) ;
/*
2016-06-04 22:42:28 +00:00
HUF_decompress ( ) does the following :
2016-06-08 09:11:02 +00:00
1. select the decompression algorithm ( X2 , X4 ) based on pre - computed heuristics
2016-06-04 22:42:28 +00:00
2. build Huffman table from save , using HUF_readDTableXn ( )
3. decode 1 or 4 segments in parallel using HUF_decompressSXn_usingDTable
*/
2016-06-08 09:11:02 +00:00
/** HUF_selectDecoder() :
* Tells which decoder is likely to decode faster ,
* based on a set of pre - determined metrics .
* @ return : 0 = = HUF_decompress4X2 , 1 = = HUF_decompress4X4 .
* Assumption : 0 < cSrcSize < dstSize < = 128 KB */
U32 HUF_selectDecoder ( size_t dstSize , size_t cSrcSize ) ;
size_t HUF_readDTableX2 ( HUF_DTable * DTable , const void * src , size_t srcSize ) ;
size_t HUF_readDTableX4 ( HUF_DTable * DTable , const void * src , size_t srcSize ) ;
2016-06-10 22:23:43 +00:00
size_t HUF_decompress4X_usingDTable ( void * dst , size_t maxDstSize , const void * cSrc , size_t cSrcSize , const HUF_DTable * DTable ) ;
2016-06-08 09:11:02 +00:00
size_t HUF_decompress4X2_usingDTable ( void * dst , size_t maxDstSize , const void * cSrc , size_t cSrcSize , const HUF_DTable * DTable ) ;
size_t HUF_decompress4X4_usingDTable ( void * dst , size_t maxDstSize , const void * cSrc , size_t cSrcSize , const HUF_DTable * DTable ) ;
2016-06-04 22:42:28 +00:00
/* single stream variants */
size_t HUF_compress1X ( void * dst , size_t dstSize , const void * src , size_t srcSize , unsigned maxSymbolValue , unsigned tableLog ) ;
2017-03-03 00:38:07 +00:00
size_t HUF_compress1X_wksp ( void * dst , size_t dstSize , const void * src , size_t srcSize , unsigned maxSymbolValue , unsigned tableLog , void * workSpace , size_t wkspSize ) ; /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
2016-06-04 22:42:28 +00:00
size_t HUF_compress1X_usingCTable ( void * dst , size_t dstSize , const void * src , size_t srcSize , const HUF_CElt * CTable ) ;
Allow compressor to repeat Huffman tables
* Compressor saves most recently used Huffman table and reuses it
if it produces better results.
* I attempted to preserve CPU usage profile.
I intentionally left all of the existing heuristics in place.
There is only a speed difference on the second block and later.
When compressing large enough blocks (say >= 4 KiB) there is
no significant difference in compression speed.
Dictionary compression of one block is the same speed for blocks
with literals <= 1 KiB, and after that the difference is not
very significant.
* In the synthetic data, with blocks 10 KB or smaller, most blocks
can't use repeated tables because the previous block did not
contain a symbol that the current block contains.
Once blocks are about 12 KB or more, most previous blocks have
valid Huffman tables for the current block, and the compression
ratio and decompression speed jumped.
* In silesia blocks as small as 4KB can frequently reuse the
previous Huffman table (85%), but it isn't as profitable, and
the previous Huffman table only gets used about 3% of the time.
* Microbenchmarks show that `HUF_validateCTable()` takes ~55 ns
and `HUF_estimateCompressedSize()` takes ~35 ns.
They are decently well optimized, the first versions took 90 ns
and 120 ns respectively. `HUF_validateCTable()` could be twice as
fast, if we cast the `HUF_CElt*` to a `U32*` and compare to 0.
However, `U32` has an alignment of 4 instead of 2, so I think that
might be undefined behavior.
* I've ran `zstreamtest` compiled normally, with UASAN and with MSAN
for 4 hours each.
The worst case for the speed difference is a bunch of small blocks
in the same frame. I modified `bench.c` to compress the input in a
single frame but with blocks of the given block size, set by `-B`.
Benchmarks on level 1:
| Program | Block size | Corpus | Ratio | Compression MB/s | Decompression MB/s |
|-----------|------------|-----------|-------|------------------|--------------------|
| zstd.base | 256 | synthetic | 2.364 | 110.0 | 297.0 |
| zstd | 256 | synthetic | 2.367 | 108.9 | 297.0 |
| zstd.base | 256 | silesia | 2.204 | 93.8 | 415.7 |
| zstd | 256 | silesia | 2.204 | 93.4 | 415.7 |
| zstd.base | 512 | synthetic | 2.594 | 144.2 | 420.0 |
| zstd | 512 | synthetic | 2.599 | 141.5 | 425.7 |
| zstd.base | 512 | silesia | 2.358 | 118.4 | 432.6 |
| zstd | 512 | silesia | 2.358 | 119.8 | 432.6 |
| zstd.base | 1024 | synthetic | 2.790 | 192.3 | 594.1 |
| zstd | 1024 | synthetic | 2.794 | 192.3 | 600.0 |
| zstd.base | 1024 | silesia | 2.524 | 148.2 | 464.2 |
| zstd | 1024 | silesia | 2.525 | 148.2 | 467.6 |
| zstd.base | 4096 | synthetic | 3.023 | 300.0 | 1000.0 |
| zstd | 4096 | synthetic | 3.024 | 300.0 | 1010.1 |
| zstd.base | 4096 | silesia | 2.779 | 223.1 | 623.5 |
| zstd | 4096 | silesia | 2.779 | 223.1 | 636.0 |
| zstd.base | 16384 | synthetic | 3.131 | 350.0 | 1150.1 |
| zstd | 16384 | synthetic | 3.152 | 350.0 | 1630.3 |
| zstd.base | 16384 | silesia | 2.871 | 296.5 | 883.3 |
| zstd | 16384 | silesia | 2.872 | 294.4 | 898.3 |
2017-03-02 01:51:56 +00:00
/** HUF_compress1X_repeat() :
* Same as HUF_compress1X_wksp ( ) , but considers using hufTable if * repeat ! = HUF_repeat_none .
* If it uses hufTable it does not modify hufTable or repeat .
2017-03-03 20:30:24 +00:00
* If it doesn ' t , it sets * repeat = HUF_repeat_none , and it sets hufTable to the table used .
* If preferRepeat then the old table will always be used if valid . */
size_t HUF_compress1X_repeat ( void * dst , size_t dstSize , const void * src , size_t srcSize , unsigned maxSymbolValue , unsigned tableLog , void * workSpace , size_t wkspSize , HUF_CElt * hufTable , HUF_repeat * repeat , int preferRepeat ) ; /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */
2016-06-04 22:42:28 +00:00
size_t HUF_decompress1X2 ( void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /* single-symbol decoder */
size_t HUF_decompress1X4 ( void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /* double-symbol decoder */
2016-06-04 23:33:55 +00:00
2016-12-02 01:47:30 +00:00
size_t HUF_decompress1X_DCtx ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ;
size_t HUF_decompress1X2_DCtx ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< single-symbol decoder */
size_t HUF_decompress1X4_DCtx ( HUF_DTable * dctx , void * dst , size_t dstSize , const void * cSrc , size_t cSrcSize ) ; /**< double-symbols decoder */
2016-12-02 00:13:35 +00:00
size_t HUF_decompress1X_usingDTable ( void * dst , size_t maxDstSize , const void * cSrc , size_t cSrcSize , const HUF_DTable * DTable ) ; /**< automatic selection of sing or double symbol decoder, based on DTable */
2016-06-08 09:11:02 +00:00
size_t HUF_decompress1X2_usingDTable ( void * dst , size_t maxDstSize , const void * cSrc , size_t cSrcSize , const HUF_DTable * DTable ) ;
size_t HUF_decompress1X4_usingDTable ( void * dst , size_t maxDstSize , const void * cSrc , size_t cSrcSize , const HUF_DTable * DTable ) ;
2016-06-04 22:42:28 +00:00
# endif /* HUF_STATIC_LINKING_ONLY */
2015-10-18 21:18:32 +00:00
# if defined (__cplusplus)
}
# endif
2015-10-30 10:21:50 +00:00
2016-06-08 09:11:02 +00:00
# endif /* HUF_H_298734234 */