ReactOS 0.4.16-dev-297-gc569aee
|
Go to the source code of this file.
Macros | |
#define | FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */ |
#define | HUF_STATIC_LINKING_ONLY /* HUF_TABLELOG_ABSOLUTEMAX */ |
Functions | |
unsigned | FSE_versionNumber (void) |
unsigned | FSE_isError (size_t code) |
const char * | FSE_getErrorName (size_t code) |
unsigned | HUF_isError (size_t code) |
const char * | HUF_getErrorName (size_t code) |
size_t | FSE_readNCount (short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize) |
size_t | HUF_readStats (BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize) |
#define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */ |
Definition at line 20 of file entropy_common.c.
#define HUF_STATIC_LINKING_ONLY /* HUF_TABLELOG_ABSOLUTEMAX */ |
Definition at line 22 of file entropy_common.c.
Definition at line 32 of file entropy_common.c.
Definition at line 31 of file entropy_common.c.
size_t FSE_readNCount | ( | short * | normalizedCounter, |
unsigned * | maxSymbolValuePtr, | ||
unsigned * | tableLogPtr, | ||
const void * | rBuffer, | ||
size_t | rBuffSize | ||
) |
The first step is to count all symbols. FSE_count() does this job very fast. Result will be saved into 'count', a table of unsigned int, which must be already allocated, and have 'maxSymbolValuePtr[0]+1' cells. 'src' is a table of bytes of size 'srcSize'. All values within 'src' MUST be <= maxSymbolValuePtr[0] maxSymbolValuePtr[0] will be updated, with its real value (necessarily <= original value) FSE_count() will return the number of occurrence of the most frequent symbol. This can be used to know if there is a single symbol within 'src', and to quickly evaluate its compressibility. If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError()).
The next step is to normalize the frequencies. FSE_normalizeCount() will ensure that sum of frequencies is == 2 ^'tableLog'. It also guarantees a minimum of 1 to any Symbol with frequency >= 1. You can use 'tableLog'==0 to mean "use default tableLog value". If you are unsure of which tableLog value to use, you can ask FSE_optimalTableLog(), which will provide the optimal valid tableLog given sourceSize, maxSymbolValue, and a user-defined maximum (0 means "default").
The result of FSE_normalizeCount() will be saved into a table, called 'normalizedCounter', which is a table of signed short. 'normalizedCounter' must be already allocated, and have at least 'maxSymbolValue+1' cells. The return value is tableLog if everything proceeded as expected. It is 0 if there is a single symbol within distribution. If there is an error (ex: invalid tableLog value), the function will return an ErrorCode (which can be tested using FSE_isError()).
'normalizedCounter' can be saved in a compact manner to a memory area using FSE_writeNCount(). 'buffer' must be already allocated. For guaranteed success, buffer size must be at least FSE_headerBound(). The result of the function is the number of bytes written into 'buffer'. If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError(); ex : buffer size too small).
'normalizedCounter' can then be used to create the compression table 'CTable'. The space required by 'CTable' must be already allocated, using FSE_createCTable(). You can then use FSE_buildCTable() to fill 'CTable'. If there is an error, both functions will return an ErrorCode (which can be tested using FSE_isError()).
'CTable' can then be used to compress 'src', with FSE_compress_usingCTable(). Similar to FSE_count(), the convention is that 'src' is assumed to be a table of char of size 'srcSize' The function returns the size of compressed data (without header), necessarily <= dstCapacity
. If it returns '0', compressed data could not fit into 'dst'. If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError()).
FSE_readNCount(): Read compactly saved 'normalizedCounter' from 'rBuffer'.
Definition at line 41 of file entropy_common.c.
Referenced by FSE_decompress_wksp(), FSE_readNCount(), ZSTD_loadCEntropy(), and ZSTD_loadDEntropy().
library version number; to be used when checking dll version
Definition at line 27 of file entropy_common.c.
size_t HUF_readStats | ( | BYTE * | huffWeight, |
size_t | hwSize, | ||
U32 * | rankStats, | ||
U32 * | nbSymbolsPtr, | ||
U32 * | tableLogPtr, | ||
const void * | src, | ||
size_t | srcSize | ||
) |
HUF_readStats() : Read compact Huffman tree, saved by HUF_writeCTable(). huffWeight
is destination buffer. rankStats
is assumed to be a table of at least HUF_TABLELOG_MAX U32.
src
, or an error Code . Note : Needed by HUF_readCTable() and HUF_readDTableX?() . Definition at line 155 of file entropy_common.c.
Referenced by HUF_readCTable(), HUF_readDTableX1_wksp(), and HUF_readDTableX2_wksp().