Lines Matching +full:quad +full:- +full:phase

5  * This source code is licensed under both the BSD-style license (found in the
8 * You may select, at your option, one of the above-listed licenses.
18 * Compiler-specific
29 low-level memory access routines
30 Copyright (C) 2013-2015, Yann Collet.
32 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
58 - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
59 - Public forum : https://groups.google.com/forum/#!forum/lz4c
76 * Compiler-specific
121 * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal.
129 * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details.
163 MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } in MEM_read16()
164 MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } in MEM_read32()
165 MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } in MEM_read64()
167 MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } in MEM_write16()
272 Copyright (C) 2013-2015, Yann Collet.
274 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
300 - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
301 - Public forum : https://groups.google.com/forum/#!forum/lz4c
313 * Since link-time-optimization is not available for all compilers,
394 bitD->start = (const char*)srcBuffer; in BIT_initDStream()
395 bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(size_t); in BIT_initDStream()
396 bitD->bitContainer = MEM_readLEST(bitD->ptr); in BIT_initDStream()
397 contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; in BIT_initDStream()
399 bitD->bitsConsumed = 8 - BIT_highbit32(contain32); in BIT_initDStream()
404 bitD->start = (const char*)srcBuffer; in BIT_initDStream()
405 bitD->ptr = bitD->start; in BIT_initDStream()
406 bitD->bitContainer = *(const BYTE*)(bitD->start); in BIT_initDStream()
409 …case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16); in BIT_initDStream()
411 …case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24); in BIT_initDStream()
413 …case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32); in BIT_initDStream()
415 case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; in BIT_initDStream()
417 case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; in BIT_initDStream()
419 case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) << 8; in BIT_initDStream()
423 contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; in BIT_initDStream()
425 bitD->bitsConsumed = 8 - BIT_highbit32(contain32); in BIT_initDStream()
426 bitD->bitsConsumed += (U32)(sizeof(size_t) - srcSize)*8; in BIT_initDStream()
433 const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; in BIT_lookBits()
434 …return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMas… in BIT_lookBits()
441 const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; in BIT_lookBitsFast()
442 … return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask); in BIT_lookBitsFast()
447 bitD->bitsConsumed += nbBits; in BIT_skipBits()
468 if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* should never happen */ in BIT_reloadDStream()
471 if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) in BIT_reloadDStream()
473 bitD->ptr -= bitD->bitsConsumed >> 3; in BIT_reloadDStream()
474 bitD->bitsConsumed &= 7; in BIT_reloadDStream()
475 bitD->bitContainer = MEM_readLEST(bitD->ptr); in BIT_reloadDStream()
478 if (bitD->ptr == bitD->start) in BIT_reloadDStream()
480 if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer; in BIT_reloadDStream()
484 U32 nbBytes = bitD->bitsConsumed >> 3; in BIT_reloadDStream()
486 if (bitD->ptr - nbBytes < bitD->start) in BIT_reloadDStream()
488 nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */ in BIT_reloadDStream()
491 bitD->ptr -= nbBytes; in BIT_reloadDStream()
492 bitD->bitsConsumed -= nbBytes*8; in BIT_reloadDStream()
493 bitD->bitContainer = MEM_readLEST(bitD->ptr); /* reminder : srcSize > sizeof(bitD) */ in BIT_reloadDStream()
503 …return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer… in BIT_endOfDStream()
513 Copyright (C) 2013-2015, Yann Collet
515 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
541 - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
542 - Public forum : https://groups.google.com/forum/#!forum/lz4c
553 * Compiler-specific
571 #define ERROR(name) (size_t)-PREFIX(name)
581 … /* enum is exposed, to detect & handle specific errors; compare function result to -enum value */
592 if (ERR_isError(code)) return ERR_strings[-(int)(code)]; in ERR_getErrorName()
612 Copyright (C) 2013-2015, Yann Collet
614 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
640 - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
641 - Public forum : https://groups.google.com/forum/#!forum/lz4c
657 #define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<(maxTableLog-1)) + ((maxSymbolV…
717 DStatePtr->state = BIT_readBits(bitD, DTableH.tableLog); in FSE_initDState()
719 DStatePtr->table = dt + 1; in FSE_initDState()
724 const FSE_decode_t DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; in FSE_decodeSymbol()
729 DStatePtr->state = DInfo.newState + lowBits; in FSE_decodeSymbol()
735 const FSE_decode_t DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; in FSE_decodeSymbolFast()
740 DStatePtr->state = DInfo.newState + lowBits; in FSE_decodeSymbolFast()
746 return DStatePtr->state == 0; in FSE_endOfDState()
756 Copyright (C) 2013-2015, Yann Collet
758 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
784 - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
785 - Public forum : https://groups.google.com/forum/#!forum/lz4c
797 #define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true if incompressible pre-filtered w…
813 …ss4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* single-symbol decoder */
814 …s4X4 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* double-symbols decoder */
822 zstd - standard compression library
824 Copyright (C) 2014-2015, Yann Collet.
826 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
850 - zstd source repository : https://github.com/Cyan4973/zstd
851 - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
868 #define ZSTD_VERSION_MINOR 2 /* for new (non-breaking) interface capabilities */
869 #define ZSTD_VERSION_RELEASE 2 /* for tweaks, bug-fixes, or development */
882 zstd - standard compression library
884 Copyright (C) 2014-2015, Yann Collet.
886 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
910 - zstd source repository : https://github.com/Cyan4973/zstd
911 - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
938 * Prefix - version detection
948 Copyright (C) 2013-2015, Yann Collet.
950 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
976 - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
977 - Public forum : https://groups.google.com/forum/#!forum/lz4c
986 * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; et…
1019 # pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
1043 #define FSE_MAX_TABLELOG (FSE_MAX_MEMORY_USAGE-2)
1045 #define FSE_MAXTABLESIZE_MASK (FSE_MAX_TABLESIZE-1)
1046 #define FSE_DEFAULT_TABLELOG (FSE_DEFAULT_MEMORY_USAGE-2)
1072 for type-specific functions (template emulation in C)
1103 const U32 tableMask = tableSize-1; in FSE_buildDTable()
1107 U32 highThreshold = tableSize-1; in FSE_buildDTable()
1108 const S16 largeLimit= (S16)(1 << (tableLog-1)); in FSE_buildDTable()
1120 if (normalizedCounter[s]==-1) in FSE_buildDTable()
1122 tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s; in FSE_buildDTable()
1153 tableDecode[i].nbBits = (BYTE) (tableLog - BIT_highbit32 ((U32)nextState) ); in FSE_buildDTable()
1154 tableDecode[i].newState = (U16) ( (nextState << tableDecode[i].nbBits) - tableSize); in FSE_buildDTable()
1172 * FSE NCount encoding-decoding
1176 return a<0 ? -a : a; in FSE_abs()
1212 if (ip < iend-5) in FSE_readNCount()
1233 if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) in FSE_readNCount()
1243 const short max = (short)((2*threshold-1)-remaining); in FSE_readNCount()
1246 if ((bitStream & (threshold-1)) < (U32)max) in FSE_readNCount()
1248 count = (short)(bitStream & (threshold-1)); in FSE_readNCount()
1249 bitCount += nbBits-1; in FSE_readNCount()
1253 count = (short)(bitStream & (2*threshold-1)); in FSE_readNCount()
1254 if (count >= threshold) count -= max; in FSE_readNCount()
1258 count--; /* extra accuracy */ in FSE_readNCount()
1259 remaining -= FSE_abs(count); in FSE_readNCount()
1264 nbBits--; in FSE_readNCount()
1269 if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) in FSE_readNCount()
1276 bitCount -= (int)(8 * (iend - 4 - ip)); in FSE_readNCount()
1277 ip = iend - 4; in FSE_readNCount()
1284 *maxSVPtr = charnum-1; in FSE_readNCount()
1287 if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); in FSE_readNCount()
1288 return ip-istart; in FSE_readNCount()
1301 DTableH->tableLog = 0; in FSE_buildDTable_rle()
1302 DTableH->fastMode = 0; in FSE_buildDTable_rle()
1304 cell->newState = 0; in FSE_buildDTable_rle()
1305 cell->symbol = symbolValue; in FSE_buildDTable_rle()
1306 cell->nbBits = 0; in FSE_buildDTable_rle()
1318 const unsigned tableMask = tableSize - 1; in FSE_buildDTable_raw()
1326 DTableH->tableLog = (U16)nbBits; in FSE_buildDTable_raw()
1327 DTableH->fastMode = 1; in FSE_buildDTable_raw()
1346 BYTE* const olimit = omax-3; in FSE_decompress_usingDTable_generic()
1400 return op-ostart; in FSE_decompress_usingDTable_generic()
1438 cSrcSize -= errorCode; in FSE_decompress()
1452 Copyright (C) 2013-2015, Yann Collet.
1454 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
1480 - FSE+Huff0 source repository : https://github.com/Cyan4973/FiniteStateEntropy
1481 - Public forum : https://groups.google.com/forum/#!forum/lz4c
1528 typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX2; /* single-symbol decoding */
1530 typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX4; /* double-symbols decoding …
1559 oSize = l[iSize-242]; in HUF_readStats()
1565 oSize = iSize - 127; in HUF_readStats()
1580 …oSize = FSE_decompress(huffWeight, hwSize-1, ip+1, iSize); /* max (hwSize-1) values decoded, as … in HUF_readStats()
1595 /* get last non-null symbol weight (implied, total must be 2^n) */ in HUF_readStats()
1600 U32 rest = total - weightTotal; in HUF_readStats()
1619 /* single-symbol decoding */
1643 … should separate sizeof DTable, as allocated, from used size of DTable, in case of DTable re-use */ in HUF_readDTableX2()
1650 nextRankStart += (rankVal[n] << (n-1)); in HUF_readDTableX2()
1661 D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w); in HUF_readDTableX2()
1694 while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-4)) in HUF_decodeStreamX2()
1710 return pEnd-pStart; in HUF_decodeStreamX2()
1754 length4 = cSrcSize - (length1 + length2 + length3 + 6); in HUF_decompress4X2_usingDTable()
1765 /* 16-32 symbols per loop (4-8 symbols per stream) */ in HUF_decompress4X2_usingDTable()
1767 for ( ; (endSignal==BIT_DStream_unfinished) && (op4<(oend-7)) ; ) in HUF_decompress4X2_usingDTable()
1821 cSrcSize -= errorCode; in HUF_decompress4X2()
1828 /* double-symbols decoding */
1840 /* get pre-calculated rankVal */ in HUF_fillDTableX4Level2()
1859 const U32 nbBits = nbBitsBaseline - weight; in HUF_fillDTableX4Level2()
1860 const U32 length = 1 << (sizeLog-nbBits); in HUF_fillDTableX4Level2()
1882 …const int scaleLog = nbBitsBaseline - targetLog; /* note : targetLog >= srcLog, hence scaleLog <… in HUF_fillDTableX4()
1883 const U32 minBits = nbBitsBaseline - maxWeight; in HUF_fillDTableX4()
1893 const U32 nbBits = nbBitsBaseline - weight; in HUF_fillDTableX4()
1895 const U32 length = 1 << (targetLog-nbBits); in HUF_fillDTableX4()
1897 if (targetLog-nbBits >= minBits) /* enough room for a second symbol */ in HUF_fillDTableX4()
1903 HUF_fillDTableX4Level2(DTable+start, targetLog-nbBits, nbBits, in HUF_fillDTableX4()
1905 sortedList+sortedRank, sortedListSize-sortedRank, in HUF_fillDTableX4()
1950 for (maxW = tableLog; rankStats[maxW]==0; maxW--) in HUF_readDTableX4()
1981 const U32 minBits = tableLog+1 - maxW; in HUF_readDTableX4()
1984 const int rescale = (memLog-tableLog) - 1; /* tableLog <= memLog */ in HUF_readDTableX4()
1992 for (consumed = minBits; consumed <= memLog - minBits; consumed++) in HUF_readDTableX4()
2026 if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) in HUF_decodeLastSymbolX4()
2029 if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8)) in HUF_decodeLastSymbolX4()
2030 …DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8); /* ugly hack; works only because it's… in HUF_decodeLastSymbolX4()
2053 while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p < pEnd-7)) in HUF_decodeStreamX4()
2062 while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-2)) in HUF_decodeStreamX4()
2065 while (p <= pEnd-2) in HUF_decodeStreamX4()
2071 return p-pStart; in HUF_decodeStreamX4()
2116 length4 = cSrcSize - (length1 + length2 + length3 + 6); in HUF_decompress4X4_usingDTable()
2127 /* 16-32 symbols per loop (4-8 symbols per stream) */ in HUF_decompress4X4_usingDTable()
2129 for ( ; (endSignal==BIT_DStream_unfinished) && (op4<(oend-7)) ; ) in HUF_decompress4X4_usingDTable()
2182 cSrcSize -= hSize; in HUF_decompress4X4()
2193 static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, quad */] =
2195 /* single, double, quad */
2198 {{ 38,130}, {1313, 74}, {2151, 38}}, /* Q == 2 : 12-18% */
2199 {{ 448,128}, {1353, 74}, {2238, 41}}, /* Q == 3 : 18-25% */
2200 {{ 556,128}, {1353, 74}, {2238, 47}}, /* Q == 4 : 25-32% */
2201 {{ 714,128}, {1418, 74}, {2436, 53}}, /* Q == 5 : 32-38% */
2202 {{ 883,128}, {1437, 74}, {2464, 61}}, /* Q == 6 : 38-44% */
2203 {{ 897,128}, {1515, 75}, {2622, 68}}, /* Q == 7 : 44-50% */
2204 {{ 926,128}, {1613, 75}, {2730, 75}}, /* Q == 8 : 50-56% */
2205 {{ 947,128}, {1729, 77}, {3359, 77}}, /* Q == 9 : 56-62% */
2206 {{1107,128}, {2083, 81}, {4006, 84}}, /* Q ==10 : 62-69% */
2207 {{1177,128}, {2379, 87}, {4785, 88}}, /* Q ==11 : 69-75% */
2208 {{1242,128}, {2415, 93}, {5155, 84}}, /* Q ==12 : 75-81% */
2209 {{1349,128}, {2644,106}, {5260,106}}, /* Q ==13 : 81-87% */
2210 {{1455,128}, {2422,124}, {4174,124}}, /* Q ==14 : 87-93% */
2211 {{ 722,128}, {1891,145}, {1936,146}}, /* Q ==15 : 93-99% */
2243 …//return HUF_decompress4X2(dst, dstSize, cSrc, cSrcSize); /* multi-streams single-symbol decodin… in HUF_decompress()
2244 …//return HUF_decompress4X4(dst, dstSize, cSrc, cSrcSize); /* multi-streams double-symbols decodi… in HUF_decompress()
2245 …//return HUF_decompress4X6(dst, dstSize, cSrc, cSrcSize); /* multi-streams quad-symbols decoding… in HUF_decompress()
2248 zstd - standard compression library
2249 Copyright (C) 2014-2015, Yann Collet.
2251 BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
2275 - zstd source repository : https://github.com/Cyan4973/zstd
2276 - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
2284 * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; et…
2336 #define HASH_LOG (ZSTD_MEMORY_USAGE - 2)
2338 #define HASH_MASK (HASH_TABLESIZE - 1)
2364 #define MaxML ((1<<MLbits )-1)
2365 #define MaxLL ((1<<LLbits )-1)
2377 #define ZSTD_CONTENTSIZE_ERROR (0ULL - 2)
2392 /*! ZSTD_wildcopy : custom version of memcpy(), can copy up to 7-8 bytes too many */
2451 U32 phase; member
2469 bpPtr->blockType = (blockType_t)(headerFlags >> 6); in ZSTD_getcBlockSize()
2470 bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0; in ZSTD_getcBlockSize()
2472 if (bpPtr->blockType == bt_end) return 0; in ZSTD_getcBlockSize()
2473 if (bpPtr->blockType == bt_rle) return 1; in ZSTD_getcBlockSize()
2524 … const size_t readSize = ZSTD_decompressLiterals(dctx->litBuffer, &litSize, src, srcSize); in ZSTD_decodeLiteralsBlock()
2525 dctx->litPtr = dctx->litBuffer; in ZSTD_decodeLiteralsBlock()
2526 dctx->litSize = litSize; in ZSTD_decodeLiteralsBlock()
2527 memset(dctx->litBuffer + dctx->litSize, 0, 8); in ZSTD_decodeLiteralsBlock()
2533 if (litSize > srcSize-11) /* risk of reading too far with wildcopy */ in ZSTD_decodeLiteralsBlock()
2536 if (litSize > srcSize-3) return ERROR(corruption_detected); in ZSTD_decodeLiteralsBlock()
2537 memcpy(dctx->litBuffer, istart, litSize); in ZSTD_decodeLiteralsBlock()
2538 dctx->litPtr = dctx->litBuffer; in ZSTD_decodeLiteralsBlock()
2539 dctx->litSize = litSize; in ZSTD_decodeLiteralsBlock()
2540 memset(dctx->litBuffer + dctx->litSize, 0, 8); in ZSTD_decodeLiteralsBlock()
2544 dctx->litPtr = istart+3; in ZSTD_decodeLiteralsBlock()
2545 dctx->litSize = litSize; in ZSTD_decodeLiteralsBlock()
2552 memset(dctx->litBuffer, istart[3], litSize + 8); in ZSTD_decodeLiteralsBlock()
2553 dctx->litPtr = dctx->litBuffer; in ZSTD_decodeLiteralsBlock()
2554 dctx->litSize = litSize; in ZSTD_decodeLiteralsBlock()
2597 …if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at le… in ZSTD_decodeSeqHeaders()
2615 headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip); in ZSTD_decodeSeqHeaders()
2626 …if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLo… in ZSTD_decodeSeqHeaders()
2634 headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip); in ZSTD_decodeSeqHeaders()
2645 …if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog … in ZSTD_decodeSeqHeaders()
2652 headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip); in ZSTD_decodeSeqHeaders()
2659 return ip-istart; in ZSTD_decodeSeqHeaders()
2686 const BYTE* dumps = seqState->dumps; in ZSTD_decodeSequence()
2687 const BYTE* const de = seqState->dumpsEnd; in ZSTD_decodeSequence()
2690 litLength = FSE_decodeSymbol(&(seqState->stateLL), &(seqState->DStream)); in ZSTD_decodeSequence()
2691 prevOffset = litLength ? seq->offset : seqState->prevOffset; in ZSTD_decodeSequence()
2692 seqState->prevOffset = seq->offset; in ZSTD_decodeSequence()
2702 …if (dumps >= de) dumps = de-1; /* late correction, to avoid read overflow (data is now corrupted… in ZSTD_decodeSequence()
2712 …offsetCode = FSE_decodeSymbol(&(seqState->stateOffb), &(seqState->DStream)); /* <= maxOff, by ta… in ZSTD_decodeSequence()
2713 if (MEM_32bits()) BIT_reloadDStream(&(seqState->DStream)); in ZSTD_decodeSequence()
2714 nbBits = offsetCode - 1; in ZSTD_decodeSequence()
2716 offset = offsetPrefix[offsetCode] + BIT_readBits(&(seqState->DStream), nbBits); in ZSTD_decodeSequence()
2717 if (MEM_32bits()) BIT_reloadDStream(&(seqState->DStream)); in ZSTD_decodeSequence()
2722 matchLength = FSE_decodeSymbol(&(seqState->stateML), &(seqState->DStream)); in ZSTD_decodeSequence()
2732 …if (dumps >= de) dumps = de-1; /* late correction, to avoid read overflow (data is now corrupted… in ZSTD_decodeSequence()
2737 seq->litLength = litLength; in ZSTD_decodeSequence()
2738 seq->offset = offset; in ZSTD_decodeSequence()
2739 seq->matchLength = matchLength; in ZSTD_decodeSequence()
2740 seqState->dumps = dumps; in ZSTD_decodeSequence()
2753 …d = op + sequence.litLength + sequence.matchLength; /* risk : address space overflow (32-bits) */ in ZSTD_execSequence()
2754 BYTE* const oend_8 = oend-8; in ZSTD_execSequence()
2763 …ZSTD_wildcopy(op, *litPtr, sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwri… in ZSTD_execSequence()
2769 const BYTE* match = op - sequence.offset; in ZSTD_execSequence()
2786 match -= dec64; in ZSTD_execSequence()
2794 if (oMatchEnd > oend-(16-MINMATCH)) in ZSTD_execSequence()
2798 ZSTD_wildcopy(op, match, oend_8 - op); in ZSTD_execSequence()
2799 match += oend_8 - op; in ZSTD_execSequence()
2806 … ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8); /* works even if matchLength < 8 */ in ZSTD_execSequence()
2810 return oMatchEnd - ostart; in ZSTD_execSequence()
2825 const BYTE* litPtr = dctx->litPtr; in ZSTD_decompressSequences()
2826 const BYTE* const litEnd = litPtr + dctx->litSize; in ZSTD_decompressSequences()
2829 U32* DTableLL = dctx->LLTable; in ZSTD_decompressSequences()
2830 U32* DTableML = dctx->MLTable; in ZSTD_decompressSequences()
2831 U32* DTableOffb = dctx->OffTable; in ZSTD_decompressSequences()
2832 BYTE* const base = (BYTE*) (dctx->base); in ZSTD_decompressSequences()
2837 ip, iend-ip); in ZSTD_decompressSequences()
2850 errorCode = BIT_initDStream(&(seqState.DStream), ip, iend-ip); in ZSTD_decompressSequences()
2859 nbSeq--; in ZSTD_decompressSequences()
2872 size_t lastLLSize = litEnd - litPtr; in ZSTD_decompressSequences()
2882 return op-ostart; in ZSTD_decompressSequences()
2894 /* Decode literals sub-block */ in ZSTD_decompressBlock()
2898 srcSize -= litCSize; in ZSTD_decompressBlock()
2919 ip += ZSTD_frameHeaderSize; remainingSize -= ZSTD_frameHeaderSize; in ZSTD_decompressDCtx()
2925 size_t cBlockSize = ZSTD_getcBlockSize(ip, iend-ip, &blockProperties); in ZSTD_decompressDCtx()
2929 remainingSize -= ZSTD_blockHeaderSize; in ZSTD_decompressDCtx()
2935 decodedSize = ZSTD_decompressBlock(ctx, op, oend-op, ip, cBlockSize); in ZSTD_decompressDCtx()
2938 decodedSize = ZSTD_copyUncompressedBlock(op, oend-op, ip, cBlockSize); in ZSTD_decompressDCtx()
2955 remainingSize -= cBlockSize; in ZSTD_decompressDCtx()
2958 return op-ostart; in ZSTD_decompressDCtx()
2994 ip += ZSTD_frameHeaderSize; remainingSize -= ZSTD_frameHeaderSize; in ZSTDv03_findFrameSizeInfoLegacy()
3006 remainingSize -= ZSTD_blockHeaderSize; in ZSTDv03_findFrameSizeInfoLegacy()
3015 remainingSize -= cBlockSize; in ZSTDv03_findFrameSizeInfoLegacy()
3019 *cSize = ip - (const BYTE*)src; in ZSTDv03_findFrameSizeInfoLegacy()
3030 dctx->expected = ZSTD_frameHeaderSize; in ZSTD_resetDCtx()
3031 dctx->phase = 0; in ZSTD_resetDCtx()
3032 dctx->previousDstEnd = NULL; in ZSTD_resetDCtx()
3033 dctx->base = NULL; in ZSTD_resetDCtx()
3053 return dctx->expected; in ZSTD_nextSrcSizeToDecompress()
3059 if (srcSize != ctx->expected) return ERROR(srcSize_wrong); in ZSTD_decompressContinue()
3060 if (dst != ctx->previousDstEnd) /* not contiguous */ in ZSTD_decompressContinue()
3061 ctx->base = dst; in ZSTD_decompressContinue()
3064 if (ctx->phase == 0) in ZSTD_decompressContinue()
3069 ctx->phase = 1; in ZSTD_decompressContinue()
3070 ctx->expected = ZSTD_blockHeaderSize; in ZSTD_decompressContinue()
3075 if (ctx->phase == 1) in ZSTD_decompressContinue()
3082 ctx->expected = 0; in ZSTD_decompressContinue()
3083 ctx->phase = 0; in ZSTD_decompressContinue()
3087 ctx->expected = blockSize; in ZSTD_decompressContinue()
3088 ctx->bType = bp.blockType; in ZSTD_decompressContinue()
3089 ctx->phase = 2; in ZSTD_decompressContinue()
3098 switch(ctx->bType) in ZSTD_decompressContinue()
3109 case bt_end : /* should never happen (filtered at phase 1) */ in ZSTD_decompressContinue()
3115 ctx->phase = 1; in ZSTD_decompressContinue()
3116 ctx->expected = ZSTD_blockHeaderSize; in ZSTD_decompressContinue()
3117 ctx->previousDstEnd = (void*)( ((char*)dst) + rSize); in ZSTD_decompressContinue()