#define FSE_VERSION_NUMBER (FSE_VERSION_MAJOR *100*100 + FSE_VERSION_MINOR *100 + FSE_VERSION_RELEASE)
FSE_PUBLIC_API unsigned FSE_versionNumber(void); /*< library version number; to be used when checking dll version */
/*! FSE_normalizeCount(): normalizecountssothatsum(count[])==Power_of_2(2^tableLog) 'normalizedCounter'isatableofshort,ofminimumsize(maxSymbolValue+1). useLowProbCountisabooleanparameterwhichtradesoffcompressedsizefor fasterheaderdecoding.Whenitissetto1,thecompresseddatawillbeslightly smaller.Andwhenitissetto0,FSE_readNCount()andFSE_buildDTable()willbe faster.Ifyouarecompressingasmallamountofdata(<2KB)thenuseLowProbCount=0 isagooddefault,sinceheaderdeserializationmakesabigspeeddifference. Otherwise,useLowProbCount=1isagooddefault,sincethespeeddifferenceissmall. @return:tableLog,
or an errorCode, which can be tested using FSE_isError() */
FSE_PUBLIC_API size_t FSE_normalizeCount(short* normalizedCounter, unsigned tableLog, constunsigned* count, size_t srcSize, unsigned maxSymbolValue, unsigned useLowProbCount);
/*! FSE_NCountWriteBound(): ProvidesthemaximumpossiblesizeofanFSEnormalizedtable,given'maxSymbolValue'and'tableLog'.
Typically useful for allocation purpose. */
FSE_PUBLIC_API size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog);
/*! FSE_writeNCount(): Compactlysave'normalizedCounter'into'buffer'. @return:sizeofthecompressedtable,
or an errorCode, which can be tested using FSE_isError(). */
FSE_PUBLIC_API size_t FSE_writeNCount (void* buffer, size_t bufferSize, constshort* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
/*! Constructor and Destructor of FSE_CTable.
Note that FSE_CTable size depends on 'tableLog' and 'maxSymbolValue' */ typedefunsigned FSE_CTable; /* don't allocate that. It's only meant to be more restrictive than void* */
/*! FSE_buildCTable(): Builds`ct`,whichmustbealreadyallocated,usingFSE_createCTable().
@return : 0, or an errorCode, which can be tested using FSE_isError() */
FSE_PUBLIC_API size_t FSE_buildCTable(FSE_CTable* ct, constshort* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
/*! FSE_compress_usingCTable(): Compress`src`using`ct`into`dst`whichmustbealreadyallocated. @return:sizeofcompresseddata(<=`dstCapacity`), or0ifcompresseddatacouldnotfitinto`dst`,
or an errorCode, which can be tested using FSE_isError() */
FSE_PUBLIC_API size_t FSE_compress_usingCTable (void* dst, size_t dstCapacity, constvoid* src, size_t srcSize, const FSE_CTable* ct);
/*! FSE_readNCount(): Readcompactlysaved'normalizedCounter'from'rBuffer'. @return:sizereadfrom'rBuffer', oranerrorCode,whichcanbetestedusingFSE_isError().
maxSymbolValuePtr[0] and tableLogPtr[0] will also be updated with their respective values */
FSE_PUBLIC_API size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSymbolValuePtr, unsigned* tableLogPtr, constvoid* rBuffer, size_t rBuffSize);
/* It is possible to statically allocate FSE CTable/DTable as a table of FSE_CTable/FSE_DTable using below macros */ #define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<((maxTableLog)-1)) + (((maxSymbolValue)+1)*2)) #define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1<<(maxTableLog)))
/* or use the size to malloc() space directly. Pay attention to alignment restrictions though */ #define FSE_CTABLE_SIZE(maxTableLog, maxSymbolValue) (FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(FSE_CTable)) #define FSE_DTABLE_SIZE(maxTableLog) (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus); /*< same as FSE_optimalTableLog(), which used `minus==2` */
size_t FSE_buildCTable_rle (FSE_CTable* ct, unsignedchar symbolValue); /*< build a fake FSE_CTable, designed to compress always the same symbolValue */
#define FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) (sizeof(short) * (maxSymbolValue + 1) + (1ULL << maxTableLog) + 8) #define FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ((FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) + sizeof(unsigned) - 1) / sizeof(unsigned))
FSE_PUBLIC_API size_t FSE_buildDTable_wksp(FSE_DTable* dt, constshort* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); /*< Same as FSE_buildDTable(), using an externally allocated `workspace` produced with `FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxSymbolValue)` */
#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1) #define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, constvoid* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize, int bmi2); /*< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)`.
* Set bmi2 to 1 if your CPU supports BMI2 or 0 if it doesn't */
typedefenum {
FSE_repeat_none, /*< Cannot use the previous table */
FSE_repeat_check, /*< Can use the previous table but it must be checked */
FSE_repeat_valid /*< Can use the previous table and it is assumed to be valid */
} FSE_repeat;
FSE_CTablect;// Provided by FSE_buildCTable() BIT_CStream_tbitStream;// bitStream tracking structure FSE_CState_tstate;// State tracking structure (can have several)
BIT_DStream_tDStream;// Stream context FSE_DState_tDState;// State context. Multiple ones are possible FSE_DTable*DTablePtr;// Decoding table, provided by FSE_buildDTable()
Whenreachingendofbuffer(BIT_DStream_endOfBuffer),progressslowly,notablyifyoudecodemultiplesymbolsperloop,
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 Afterint) BIT_reloadDStream(&DStream)>=BIT_DStream_completed
Whenitjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 Checkingifp-java.lang.StringIndexOutOfBoundsException: Range [26, 19) out of bounds for length 33 (&DStream); Checkalso. beifjava.lang.StringIndexOutOfBoundsException: Range [92, 87) out of bounds for length 113 FSE_endOfDState(&DState);
*/
/* ***************************************** *FSEunsafeAPI
*******************************************/ staticunsignedchar FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD); /* faster, but works only if nbBits is always >= 1 (otherwise, result will be corrupted) */
/* ***************************************** *Implementationofinlinedfunctions
*******************************************/ typedefstruct { int deltaFindState;
U32 deltaNbBits;
} FSE_symbolCompressionTransform; /* total 8 bytes */
/*! FSE_decodeSymbolFast() :
unsafe, only works if no symbol has a probability > 50% */
MEM_STATIC BYTE FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD)
{
FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
U32 const nbBits = DInfo.nbBits;
BYTE const symbol = DInfo.symbol;
size_t const lowBits = BIT_readBitsFast(bitD, nbBits);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.