Go to the documentation of this file.
53 # pragma GCC diagnostic ignored "-Wunused-function"
56 #if defined (__clang__)
57 # pragma clang diagnostic ignored "-Wunused-function"
64 #define LZ4_COMMONDEFS_ONLY
71 #define DICTIONARY_LOGSIZE 16
72 #define MAXD (1<<DICTIONARY_LOGSIZE)
73 #define MAXD_MASK (MAXD - 1)
75 #define HASH_LOG (DICTIONARY_LOGSIZE-1)
76 #define HASHTABLESIZE (1 << HASH_LOG)
77 #define HASH_MASK (HASHTABLESIZE - 1)
79 #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
105 #define HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASH_LOG))
107 #define DELTANEXTU16(p) chainTable[(U16)(p)]
121 hc4->
base = start - 64
KB;
141 size_t delta = idx - HashTable[
h];
153 const BYTE* ip,
const BYTE*
const iLimit,
154 const BYTE** matchpos,
155 const int maxNbAttempts)
165 int nbAttempts=maxNbAttempts;
172 while ((matchIndex>=lowLimit) && (nbAttempts))
175 if (matchIndex >= dictLimit)
178 if (*(
match+ml) == *(ip+ml)
182 if (mlt > ml) { ml = mlt; *matchpos =
match; }
187 match = dictBase + matchIndex;
191 const BYTE* vLimit = ip + (dictLimit - matchIndex);
192 if (vLimit > iLimit) vLimit = iLimit;
194 if ((ip+mlt == vLimit) && (vLimit < iLimit))
196 if (mlt > ml) { ml = mlt; *matchpos =
base + matchIndex; }
208 const BYTE*
const ip,
209 const BYTE*
const iLowLimit,
210 const BYTE*
const iHighLimit,
212 const BYTE** matchpos,
213 const BYTE** startpos,
214 const int maxNbAttempts)
220 const BYTE*
const lowPrefixPtr =
base + dictLimit;
224 int nbAttempts = maxNbAttempts;
232 while ((matchIndex>=lowLimit) && (nbAttempts))
235 if (matchIndex >= dictLimit)
237 const BYTE* matchPtr =
base + matchIndex;
238 if (*(iLowLimit + longest) == *(matchPtr -
delta + longest))
244 while ((ip+back>iLowLimit)
245 && (matchPtr+back > lowPrefixPtr)
246 && (ip[back-1] == matchPtr[back-1]))
254 *matchpos = matchPtr+back;
261 const BYTE* matchPtr = dictBase + matchIndex;
266 const BYTE* vLimit = ip + (dictLimit - matchIndex);
267 if (vLimit > iHighLimit) vLimit = iHighLimit;
269 if ((ip+mlt == vLimit) && (vLimit < iHighLimit))
271 while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--;
273 if ((
int)mlt > longest) { longest = (
int)mlt; *matchpos =
base + matchIndex + back; *startpos = ip+back; }
285 #define LZ4HC_DEBUG 0
287 static unsigned debug = 0;
295 const BYTE*
const match,
303 if (debug) printf(
"literal : %u -- match : %u -- offset : %u\n", (
U32)(*ip - *anchor), (
U32)matchLength, (
U32)(*ip-
match));
346 const BYTE* anchor = ip;
354 unsigned maxNbAttempts;
355 int ml, ml2, ml3, ml0;
377 if (!ml) { ip++;
continue; }
397 if (start2 < ip + ml0)
406 if ((start2 - ip) < 3)
426 correction = new_ml - (
int)(start2 - ip);
429 start2 += correction;
436 if (start2 + ml2 < mflimit)
443 if (start2 < ip+ml) ml = (
int)(start2 - ip);
451 if (start3 < ip+ml+3)
453 if (start3 >= (ip+ml))
457 int correction = (
int)(ip+ml - start2);
458 start2 += correction;
497 correction = ml - (
int)(start2 - ip);
500 start2 += correction;
507 ml = (
int)(start2 - ip);
525 int lastRun = (
int)(iend - anchor);
529 memcpy(
op, anchor, iend - anchor);
534 return (
int) (((
char*)
op)-
dest);
542 if (((
size_t)(
state)&(
sizeof(
void*)-1)) != 0)
return 0;
577 if (dictSize > 64
KB)
579 dictionary += dictSize - 64
KB;
583 if (dictSize >= 4)
LZ4HC_Insert (ctxPtr, (
const BYTE*)dictionary +(dictSize-3));
584 ctxPtr->
end = (
const BYTE*)dictionary + dictSize;
593 if (ctxPtr->
end >= ctxPtr->
base + 4)
600 ctxPtr->
end = newBlock;
613 if ((
size_t)(ctxPtr->
end - ctxPtr->
base) > 2
GB)
616 if (dictSize > 64
KB) dictSize = 64
KB;
630 if ((sourceEnd > dictBegin) && ((
const BYTE*)
source < dictEnd))
632 if (sourceEnd > dictEnd) sourceEnd = dictEnd;
656 if (dictSize > 64
KB) dictSize = 64
KB;
657 if (dictSize < 4) dictSize = 0;
658 if (dictSize > prefixSize) dictSize = prefixSize;
659 memmove(safeBuffer, streamPtr->
end - dictSize, dictSize);
662 streamPtr->
end = (
const BYTE*)safeBuffer + dictSize;
663 streamPtr->
base = streamPtr->
end - endIndex;
664 streamPtr->
dictLimit = endIndex - dictSize;
665 streamPtr->
lowLimit = endIndex - dictSize;
684 int LZ4_compressHC2_limitedOutput_withStateHC (
void*
state,
const char* src,
char*
dst,
int srcSize,
int maxDstSize,
int cLevel) {
return LZ4_compress_HC_extStateHC(
state, src,
dst, srcSize,
maxDstSize, cLevel); }
695 if ((((
size_t)
state) & (
sizeof(
void*)-1)) != 0)
return 1;
int LZ4_compressHC(const char *src, char *dst, int srcSize)
int LZ4_sizeofStreamStateHC(void)
int LZ4_compressHC2_limitedOutput_continue(void *LZ4HC_Data, const char *source, char *dest, int inputSize, int maxOutputSize, int compressionLevel)
int LZ4_compressHC2_limitedOutput(const char *src, char *dst, int srcSize, int maxDstSize, int cLevel)
int LZ4_compressHC_limitedOutput_continue(LZ4_streamHC_t *ctx, const char *src, char *dst, int srcSize, int maxDstSize)
U32 hashTable[HASHTABLESIZE]
static void LZ4HC_setExternalDict(LZ4HC_Data_Structure *ctxPtr, const BYTE *newBlock)
static void LZ4HC_init(LZ4HC_Data_Structure *hc4, const BYTE *start)
GLM_FUNC_DECL genType::value_type length(genType const &x)
int LZ4_compressHC2_withStateHC(void *state, const char *src, char *dst, int srcSize, int cLevel)
char * LZ4_slideInputBufferHC(void *LZ4HC_Data)
int LZ4_compress_HC(const char *src, char *dst, int srcSize, int maxDstSize, int compressionLevel)
int LZ4_compressHC_withStateHC(void *state, const char *src, char *dst, int srcSize)
int LZ4_compressHC2_limitedOutput_withStateHC(void *state, const char *src, char *dst, int srcSize, int maxDstSize, int cLevel)
int LZ4_saveDictHC(LZ4_streamHC_t *LZ4_streamHCPtr, char *safeBuffer, int dictSize)
FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch(LZ4HC_Data_Structure *hc4, const BYTE *const ip, const BYTE *const iLowLimit, const BYTE *const iHighLimit, int longest, const BYTE **matchpos, const BYTE **startpos, const int maxNbAttempts)
const char char int int maxOutputSize
int LZ4_resetStreamStateHC(void *state, char *inputBuffer)
FORCE_INLINE void LZ4HC_Insert(LZ4HC_Data_Structure *hc4, const BYTE *ip)
RecoveryProgressState state
static int LZ4HC_compress_generic(void *ctxvoid, const char *source, char *dest, int inputSize, int maxOutputSize, int compressionLevel, limitedOutput_directive limit)
static U32 LZ4HC_hashPtr(const void *ptr)
int LZ4_compressHC2_continue(void *LZ4HC_Data, const char *source, char *dest, int inputSize, int compressionLevel)
int LZ4_loadDictHC(LZ4_streamHC_t *LZ4_streamHCPtr, const char *dictionary, int dictSize)
void * LZ4_createHC(char *inputBuffer)
int LZ4_compressHC_limitedOutput(const char *src, char *dst, int srcSize, int maxDstSize)
static U32 LZ4_read32(const void *memPtr)
int LZ4_compressHC_limitedOutput_withStateHC(void *state, const char *src, char *dst, int srcSize, int maxDstSize)
static void LZ4_writeLE16(void *memPtr, U16 value)
bool match(const T &xpr, std::string ref, std::string str_xpr="")
static void LZ4_wildCopy(void *dstPtr, const void *srcPtr, void *dstEnd)
LZ4_streamHC_t * LZ4_createStreamHC(void)
int LZ4_compressHC_continue(LZ4_streamHC_t *ctx, const char *src, char *dst, int srcSize)
int LZ4_compress_HC_extStateHC(void *state, const char *src, char *dst, int srcSize, int maxDstSize, int compressionLevel)
int LZ4_freeStreamHC(LZ4_streamHC_t *LZ4_streamHCPtr)
int LZ4_compress_HC_continue(LZ4_streamHC_t *LZ4_streamHCPtr, const char *source, char *dest, int inputSize, int maxOutputSize)
int LZ4_sizeofStateHC(void)
#define LZ4_STATIC_ASSERT(c)
int LZ4_compressHC2(const char *src, char *dst, int srcSize, int cLevel)
static const int g_maxCompressionLevel
static unsigned LZ4_count(const BYTE *pIn, const BYTE *pMatch, const BYTE *pInLimit)
const char char int int compressionLevel
void LZ4_resetStreamHC(LZ4_streamHC_t *LZ4_streamHCPtr, int compressionLevel)
int LZ4_compressBound(int isize)
FORCE_INLINE int LZ4HC_encodeSequence(const BYTE **ip, BYTE **op, const BYTE **anchor, int matchLength, const BYTE *const match, limitedOutput_directive limitedOutputBuffer, BYTE *oend)
static int LZ4_compressHC_continue_generic(LZ4HC_Data_Structure *ctxPtr, const char *source, char *dest, int inputSize, int maxOutputSize, limitedOutput_directive limit)
FORCE_INLINE int LZ4HC_InsertAndFindBestMatch(LZ4HC_Data_Structure *hc4, const BYTE *ip, const BYTE *const iLimit, const BYTE **matchpos, const int maxNbAttempts)
int LZ4_freeHC(void *LZ4HC_Data)
static const int LZ4HC_compressionLevel_default
const char char int inputSize
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:11