22#define HUF_STATIC_LINKING_ONLY
34#if defined(HUF_FORCE_DECOMPRESS_X1) && \
35 defined(HUF_FORCE_DECOMPRESS_X2)
36#error "Cannot force the use of the X1 and X2 decoders at the same time!"
43#define HUF_isError ERR_isError
49#define HUF_ALIGN(x, a) HUF_ALIGN_MASK((x), (a) - 1)
50#define HUF_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
60 static size_t fn##_default( \
61 void* dst, size_t dstSize, \
62 const void* cSrc, size_t cSrcSize, \
63 const HUF_DTable* DTable) \
65 return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \
68 static TARGET_ATTRIBUTE("bmi2") size_t fn##_bmi2( \
69 void* dst, size_t dstSize, \
70 const void* cSrc, size_t cSrcSize, \
71 const HUF_DTable* DTable) \
73 return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \
76 static size_t fn(void* dst, size_t dstSize, void const* cSrc, \
77 size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \
80 return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); \
82 return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable); \
88 static size_t fn(void* dst, size_t dstSize, void const* cSrc, \
89 size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \
92 return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \
111#ifndef HUF_FORCE_DECOMPRESS_X2
123 void*
const dtPtr = DTable + 1;
128 size_t spaceUsed32 = 0;
130 rankVal = (
U32 *)workSpace + spaceUsed32;
131 spaceUsed32 += HUF_TABLELOG_ABSOLUTEMAX + 1;
132 huffWeight = (
BYTE *)((
U32 *)workSpace + spaceUsed32);
133 spaceUsed32 +=
HUF_ALIGN(HUF_SYMBOLVALUE_MAX + 1,
sizeof(
U32)) >> 2;
135 if ((spaceUsed32 << 2) > wkspSize)
return ERROR(tableLog_tooLarge);
140 iSize =
HUF_readStats(huffWeight, HUF_SYMBOLVALUE_MAX + 1, rankVal, &nbSymbols, &tableLog,
src, srcSize);
148 memcpy(DTable, &dtd,
sizeof(dtd));
152 {
U32 n, nextRankStart = 0;
153 for (
n=1;
n<tableLog+1;
n++) {
155 nextRankStart += (rankVal[
n] << (
n-1));
161 size_t const nEnd = nbSymbols;
162 for (
n=0;
n<nEnd;
n++) {
163 size_t const w = huffWeight[
n];
164 size_t const length = (1 <<
w) >> 1;
165 size_t const uStart = rankVal[
w];
166 size_t const uEnd = uStart +
length;
170 D.nbBits = (
BYTE)(tableLog + 1 -
w);
171 rankVal[
w] = (
U32)uEnd;
178 for (
u = uStart;
u < uEnd;
u += 4) {
189 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
191 workSpace,
sizeof(workSpace));
203#define HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) \
204 *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog)
206#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr) \
207 if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
208 HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr)
210#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr) \
212 HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr)
217 BYTE*
const pStart =
p;
241 void*
dst,
size_t dstSize,
242 const void* cSrc,
size_t cSrcSize,
243 const HUF_DTable* DTable)
246 BYTE*
const oend =
op + dstSize;
247 const void* dtPtr = DTable + 1;
264 void*
dst,
size_t dstSize,
265 const void* cSrc,
size_t cSrcSize,
266 const HUF_DTable* DTable)
269 if (cSrcSize < 10)
return ERROR(corruption_detected);
271 {
const BYTE*
const istart = (
const BYTE*) cSrc;
273 BYTE*
const oend = ostart + dstSize;
274 BYTE*
const olimit = oend - 3;
275 const void*
const dtPtr = DTable + 1;
286 size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
287 const BYTE*
const istart1 = istart + 6;
288 const BYTE*
const istart2 = istart1 + length1;
289 const BYTE*
const istart3 = istart2 + length2;
290 const BYTE*
const istart4 = istart3 + length3;
291 const size_t segmentSize = (dstSize+3) / 4;
292 BYTE*
const opStart2 = ostart + segmentSize;
293 BYTE*
const opStart3 = opStart2 + segmentSize;
294 BYTE*
const opStart4 = opStart3 + segmentSize;
296 BYTE* op2 = opStart2;
297 BYTE* op3 = opStart3;
298 BYTE* op4 = opStart4;
303 if (length4 > cSrcSize)
return ERROR(corruption_detected);
310 for ( ; (endSignal) & (op4 < olimit) ; ) {
336 if (op1 > opStart2)
return ERROR(corruption_detected);
337 if (op2 > opStart3)
return ERROR(corruption_detected);
338 if (op3 > opStart4)
return ERROR(corruption_detected);
349 if (!endCheck)
return ERROR(corruption_detected); }
360 const HUF_DTable *DTable);
362HUF_DGEN(HUF_decompress1X1_usingDTable_internal)
363HUF_DGEN(HUF_decompress4X1_usingDTable_internal)
368 void*
dst,
size_t dstSize,
369 const void* cSrc,
size_t cSrcSize,
370 const HUF_DTable* DTable)
374 return HUF_decompress1X1_usingDTable_internal(
dst, dstSize, cSrc, cSrcSize, DTable, 0);
378 const void* cSrc,
size_t cSrcSize,
379 void* workSpace,
size_t wkspSize)
385 if (hSize >= cSrcSize)
return ERROR(srcSize_wrong);
386 ip += hSize; cSrcSize -= hSize;
388 return HUF_decompress1X1_usingDTable_internal(
dst, dstSize,
ip, cSrcSize, DCtx, 0);
393 const void* cSrc,
size_t cSrcSize)
395 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
397 workSpace,
sizeof(workSpace));
402 HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX);
407 void*
dst,
size_t dstSize,
408 const void* cSrc,
size_t cSrcSize,
409 const HUF_DTable* DTable)
413 return HUF_decompress4X1_usingDTable_internal(
dst, dstSize, cSrc, cSrcSize, DTable, 0);
417 const void* cSrc,
size_t cSrcSize,
418 void* workSpace,
size_t wkspSize,
int bmi2)
423 workSpace, wkspSize);
425 if (hSize >= cSrcSize)
return ERROR(srcSize_wrong);
426 ip += hSize; cSrcSize -= hSize;
428 return HUF_decompress4X1_usingDTable_internal(
dst, dstSize,
ip, cSrcSize, dctx, bmi2);
432 const void* cSrc,
size_t cSrcSize,
433 void* workSpace,
size_t wkspSize)
441 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
443 workSpace,
sizeof(workSpace));
447 HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX);
454#ifndef HUF_FORCE_DECOMPRESS_X1
469 const U32* rankValOrigin,
const int minWeight,
471 U32 nbBitsBaseline,
U16 baseSeq)
474 U32 rankVal[HUF_TABLELOG_MAX + 1];
477 memcpy(rankVal, rankValOrigin,
sizeof(rankVal));
481 U32 i, skipSize = rankVal[minWeight];
485 for (
i = 0;
i < skipSize;
i++)
490 {
U32 s;
for (
s=0;
s<sortedListSize;
s++) {
493 const U32 nbBits = nbBitsBaseline -
weight;
494 const U32 length = 1 << (sizeLog-nbBits);
502 do { DTable[
i++] = DElt; }
while (
i<
end);
512 const U32 nbBitsBaseline)
514 U32 rankVal[HUF_TABLELOG_MAX + 1];
515 const int scaleLog = nbBitsBaseline - targetLog;
516 const U32 minBits = nbBitsBaseline - maxWeight;
519 memcpy(rankVal, rankValOrigin,
sizeof(rankVal));
522 for (
s=0;
s<sortedListSize;
s++) {
525 const U32 nbBits = nbBitsBaseline -
weight;
527 const U32 length = 1 << (targetLog-nbBits);
529 if (targetLog-nbBits >= minBits) {
531 int minWeight = nbBits + scaleLog;
532 if (minWeight < 1) minWeight = 1;
533 sortedRank = rankStart[minWeight];
535 rankValOrigin[nbBits], minWeight,
536 sortedList+sortedRank, sortedListSize-sortedRank,
537 nbBitsBaseline, symbol);
552 const void*
src,
size_t srcSize,
553 void* workSpace,
size_t wkspSize)
555 U32 tableLog,
maxW, sizeOfSort, nbSymbols;
559 void* dtPtr = DTable+1;
568 size_t spaceUsed32 = 0;
571 spaceUsed32 += (
sizeof(
rankValCol_t) * HUF_TABLELOG_MAX) >> 2;
572 rankStats = (
U32 *)workSpace + spaceUsed32;
573 spaceUsed32 += HUF_TABLELOG_MAX + 1;
574 rankStart0 = (
U32 *)workSpace + spaceUsed32;
575 spaceUsed32 += HUF_TABLELOG_MAX + 2;
578 weightList = (
BYTE *)((
U32 *)workSpace + spaceUsed32);
579 spaceUsed32 +=
HUF_ALIGN(HUF_SYMBOLVALUE_MAX + 1,
sizeof(
U32)) >> 2;
581 if ((spaceUsed32 << 2) > wkspSize)
return ERROR(tableLog_tooLarge);
583 rankStart = rankStart0 + 1;
584 memset(rankStats, 0,
sizeof(
U32) * (2 * HUF_TABLELOG_MAX + 2 + 1));
587 if (maxTableLog > HUF_TABLELOG_MAX)
return ERROR(tableLog_tooLarge);
590 iSize =
HUF_readStats(weightList, HUF_SYMBOLVALUE_MAX + 1, rankStats, &nbSymbols, &tableLog,
src, srcSize);
594 if (tableLog > maxTableLog)
return ERROR(tableLog_tooLarge);
600 {
U32 w, nextRankStart = 0;
603 nextRankStart += rankStats[
w];
606 rankStart[0] = nextRankStart;
607 sizeOfSort = nextRankStart;
612 for (
s=0;
s<nbSymbols;
s++) {
613 U32 const w = weightList[
s];
614 U32 const r = rankStart[
w]++;
622 {
U32*
const rankVal0 = rankVal[0];
623 {
int const rescale = (maxTableLog-tableLog) - 1;
628 nextRankVal += rankStats[
w] << (
w+rescale);
631 {
U32 const minBits = tableLog+1 -
maxW;
641 sortedSymbol, sizeOfSort,
642 rankStart0, rankVal,
maxW,
647 memcpy(DTable, &dtd,
sizeof(dtd));
653 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
655 workSpace,
sizeof(workSpace));
684#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \
685 ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog)
687#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \
688 if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
689 ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog)
691#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \
693 ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog)
699 BYTE*
const pStart =
p;
724 void*
dst,
size_t dstSize,
725 const void* cSrc,
size_t cSrcSize,
726 const HUF_DTable* DTable)
735 BYTE*
const oend = ostart + dstSize;
736 const void*
const dtPtr = DTable+1;
751 void*
dst,
size_t dstSize,
752 const void* cSrc,
size_t cSrcSize,
753 const HUF_DTable* DTable)
755 if (cSrcSize < 10)
return ERROR(corruption_detected);
757 {
const BYTE*
const istart = (
const BYTE*) cSrc;
759 BYTE*
const oend = ostart + dstSize;
760 BYTE*
const olimit = oend - (
sizeof(
size_t)-1);
761 const void*
const dtPtr = DTable+1;
772 size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
773 const BYTE*
const istart1 = istart + 6;
774 const BYTE*
const istart2 = istart1 + length1;
775 const BYTE*
const istart3 = istart2 + length2;
776 const BYTE*
const istart4 = istart3 + length3;
777 size_t const segmentSize = (dstSize+3) / 4;
778 BYTE*
const opStart2 = ostart + segmentSize;
779 BYTE*
const opStart3 = opStart2 + segmentSize;
780 BYTE*
const opStart4 = opStart3 + segmentSize;
782 BYTE* op2 = opStart2;
783 BYTE* op3 = opStart3;
784 BYTE* op4 = opStart4;
789 if (length4 > cSrcSize)
return ERROR(corruption_detected);
796 for ( ; (endSignal) & (op4 < olimit); ) {
797#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
844 if (op1 > opStart2)
return ERROR(corruption_detected);
845 if (op2 > opStart3)
return ERROR(corruption_detected);
846 if (op3 > opStart4)
return ERROR(corruption_detected);
857 if (!endCheck)
return ERROR(corruption_detected); }
864HUF_DGEN(HUF_decompress1X2_usingDTable_internal)
865HUF_DGEN(HUF_decompress4X2_usingDTable_internal)
868 void*
dst,
size_t dstSize,
869 const void* cSrc,
size_t cSrcSize,
870 const HUF_DTable* DTable)
874 return HUF_decompress1X2_usingDTable_internal(
dst, dstSize, cSrc, cSrcSize, DTable, 0);
878 const void* cSrc,
size_t cSrcSize,
879 void* workSpace,
size_t wkspSize)
884 workSpace, wkspSize);
886 if (hSize >= cSrcSize)
return ERROR(srcSize_wrong);
887 ip += hSize; cSrcSize -= hSize;
889 return HUF_decompress1X2_usingDTable_internal(
dst, dstSize,
ip, cSrcSize, DCtx, 0);
894 const void* cSrc,
size_t cSrcSize)
896 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
898 workSpace,
sizeof(workSpace));
903 HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX);
908 void*
dst,
size_t dstSize,
909 const void* cSrc,
size_t cSrcSize,
910 const HUF_DTable* DTable)
914 return HUF_decompress4X2_usingDTable_internal(
dst, dstSize, cSrc, cSrcSize, DTable, 0);
918 const void* cSrc,
size_t cSrcSize,
919 void* workSpace,
size_t wkspSize,
int bmi2)
924 workSpace, wkspSize);
926 if (hSize >= cSrcSize)
return ERROR(srcSize_wrong);
927 ip += hSize; cSrcSize -= hSize;
929 return HUF_decompress4X2_usingDTable_internal(
dst, dstSize,
ip, cSrcSize, dctx, bmi2);
933 const void* cSrc,
size_t cSrcSize,
934 void* workSpace,
size_t wkspSize)
941 const void* cSrc,
size_t cSrcSize)
943 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
945 workSpace,
sizeof(workSpace));
950 HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX);
962 const void* cSrc,
size_t cSrcSize,
963 const HUF_DTable* DTable)
966#if defined(HUF_FORCE_DECOMPRESS_X1)
969 return HUF_decompress1X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0);
970#elif defined(HUF_FORCE_DECOMPRESS_X2)
973 return HUF_decompress1X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0);
975 return dtd.
tableType ? HUF_decompress1X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0) :
976 HUF_decompress1X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0);
981 const void* cSrc,
size_t cSrcSize,
982 const HUF_DTable* DTable)
985#if defined(HUF_FORCE_DECOMPRESS_X1)
988 return HUF_decompress4X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0);
989#elif defined(HUF_FORCE_DECOMPRESS_X2)
992 return HUF_decompress4X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0);
994 return dtd.
tableType ? HUF_decompress4X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0) :
995 HUF_decompress4X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, 0);
1000#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2)
1005 {{0,0}, {1,1}, {2,2}},
1006 {{0,0}, {1,1}, {2,2}},
1007 {{ 38,130}, {1313, 74}, {2151, 38}},
1008 {{ 448,128}, {1353, 74}, {2238, 41}},
1009 {{ 556,128}, {1353, 74}, {2238, 47}},
1010 {{ 714,128}, {1418, 74}, {2436, 53}},
1011 {{ 883,128}, {1437, 74}, {2464, 61}},
1012 {{ 897,128}, {1515, 75}, {2622, 68}},
1013 {{ 926,128}, {1613, 75}, {2730, 75}},
1014 {{ 947,128}, {1729, 77}, {3359, 77}},
1015 {{1107,128}, {2083, 81}, {4006, 84}},
1016 {{1177,128}, {2379, 87}, {4785, 88}},
1017 {{1242,128}, {2415, 93}, {5155, 84}},
1018 {{1349,128}, {2644,106}, {5260,106}},
1019 {{1455,128}, {2422,124}, {4174,124}},
1020 {{ 722,128}, {1891,145}, {1936,146}},
1032 assert(dstSize <= 128*1024);
1033#if defined(HUF_FORCE_DECOMPRESS_X1)
1037#elif defined(HUF_FORCE_DECOMPRESS_X2)
1043 {
U32 const Q = (cSrcSize >= dstSize) ? 15 : (
U32)(cSrcSize * 16 / dstSize);
1044 U32 const D256 = (
U32)(dstSize >> 8);
1047 DTime1 += DTime1 >> 3;
1048 return DTime1 < DTime0;
1058#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2)
1063 if (dstSize == 0)
return ERROR(dstSize_tooSmall);
1064 if (cSrcSize > dstSize)
return ERROR(corruption_detected);
1065 if (cSrcSize == dstSize) {
memcpy(
dst, cSrc, dstSize);
return dstSize; }
1066 if (cSrcSize == 1) {
memset(
dst, *(
const BYTE*)cSrc, dstSize);
return dstSize; }
1069#if defined(HUF_FORCE_DECOMPRESS_X1)
1073#elif defined(HUF_FORCE_DECOMPRESS_X2)
1078 return decompress[algoNb](
dst, dstSize, cSrc, cSrcSize);
1086 if (dstSize == 0)
return ERROR(dstSize_tooSmall);
1087 if (cSrcSize > dstSize)
return ERROR(corruption_detected);
1088 if (cSrcSize == dstSize) {
memcpy(
dst, cSrc, dstSize);
return dstSize; }
1089 if (cSrcSize == 1) {
memset(
dst, *(
const BYTE*)cSrc, dstSize);
return dstSize; }
1092#if defined(HUF_FORCE_DECOMPRESS_X1)
1096#elif defined(HUF_FORCE_DECOMPRESS_X2)
1109 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
1111 workSpace,
sizeof(workSpace));
1116 size_t dstSize,
const void* cSrc,
1117 size_t cSrcSize,
void* workSpace,
1121 if (dstSize == 0)
return ERROR(dstSize_tooSmall);
1122 if (cSrcSize == 0)
return ERROR(corruption_detected);
1125#if defined(HUF_FORCE_DECOMPRESS_X1)
1129#elif defined(HUF_FORCE_DECOMPRESS_X2)
1135 cSrcSize, workSpace, wkspSize):
1142 const void* cSrc,
size_t cSrcSize,
1143 void* workSpace,
size_t wkspSize)
1146 if (dstSize == 0)
return ERROR(dstSize_tooSmall);
1147 if (cSrcSize > dstSize)
return ERROR(corruption_detected);
1148 if (cSrcSize == dstSize) {
memcpy(
dst, cSrc, dstSize);
return dstSize; }
1149 if (cSrcSize == 1) {
memset(
dst, *(
const BYTE*)cSrc, dstSize);
return dstSize; }
1152#if defined(HUF_FORCE_DECOMPRESS_X1)
1156 cSrcSize, workSpace, wkspSize);
1157#elif defined(HUF_FORCE_DECOMPRESS_X2)
1161 cSrcSize, workSpace, wkspSize);
1164 cSrcSize, workSpace, wkspSize):
1166 cSrcSize, workSpace, wkspSize);
1172 const void* cSrc,
size_t cSrcSize)
1174 U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32];
1176 workSpace,
sizeof(workSpace));
1183#if defined(HUF_FORCE_DECOMPRESS_X1)
1186 return HUF_decompress1X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
1187#elif defined(HUF_FORCE_DECOMPRESS_X2)
1190 return HUF_decompress1X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
1192 return dtd.
tableType ? HUF_decompress1X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) :
1193 HUF_decompress1X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
1197#ifndef HUF_FORCE_DECOMPRESS_X2
1204 if (hSize >= cSrcSize)
return ERROR(srcSize_wrong);
1205 ip += hSize; cSrcSize -= hSize;
1207 return HUF_decompress1X1_usingDTable_internal(
dst, dstSize,
ip, cSrcSize, dctx, bmi2);
1214#if defined(HUF_FORCE_DECOMPRESS_X1)
1217 return HUF_decompress4X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
1218#elif defined(HUF_FORCE_DECOMPRESS_X2)
1221 return HUF_decompress4X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
1223 return dtd.
tableType ? HUF_decompress4X2_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) :
1224 HUF_decompress4X1_usingDTable_internal(
dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2);
1231 if (dstSize == 0)
return ERROR(dstSize_tooSmall);
1232 if (cSrcSize == 0)
return ERROR(corruption_detected);
1235#if defined(HUF_FORCE_DECOMPRESS_X1)
1239#elif defined(HUF_FORCE_DECOMPRESS_X2)
MEM_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, size_t srcSize)
MEM_STATIC void BIT_skipBits(BIT_DStream_t *bitD, U32 nbBits)
MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t *bitD)
MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t *bitD)
MEM_STATIC size_t BIT_lookBitsFast(const BIT_DStream_t *bitD, U32 nbBits)
MEM_STATIC BIT_DStream_status BIT_reloadDStreamFast(BIT_DStream_t *bitD)
static const WCHAR maxW[]
#define DEBUG_STATIC_ASSERT(c)
MEM_STATIC unsigned MEM_32bits(void)
MEM_STATIC void MEM_writeLE16(void *memPtr, U16 val)
MEM_STATIC U16 MEM_readLE16(const void *memPtr)
size_t HUF_readStats(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize)
GLdouble GLdouble GLdouble r
GLuint GLsizei GLsizei * length
GLubyte GLubyte GLubyte GLubyte w
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
size_t HUF_decompress(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
U32 rankValCol_t[HUF_TABLELOG_MAX+1]
HINT_INLINE size_t HUF_decodeStreamX2(BYTE *p, BIT_DStream_t *bitDPtr, BYTE *const pEnd, const HUF_DEltX2 *const dt, const U32 dtLog)
size_t HUF_decompress1X_usingDTable_bmi2(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable, int bmi2)
#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr)
size_t HUF_decompress4X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_readDTableX1_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workSpace, size_t wkspSize)
HINT_INLINE size_t HUF_decodeStreamX1(BYTE *p, BIT_DStream_t *const bitDPtr, BYTE *const pEnd, const HUF_DEltX1 *const dt, const U32 dtLog)
size_t HUF_readDTableX2(HUF_DTable *DTable, const void *src, size_t srcSize)
static DTableDesc HUF_getDTableDesc(const HUF_DTable *table)
size_t HUF_decompress1X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize)
size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize)
size_t HUF_decompress4X_DCtx(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
rankValCol_t rankVal_t[HUF_TABLELOG_MAX]
size_t HUF_decompress1X_DCtx(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
U32 HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize)
static size_t HUF_decompress4X2_DCtx_wksp_bmi2(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize, int bmi2)
size_t HUF_decompress4X_usingDTable_bmi2(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable, int bmi2)
size_t HUF_decompress1X1(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
FORCE_INLINE_TEMPLATE BYTE HUF_decodeSymbolX1(BIT_DStream_t *Dstream, const HUF_DEltX1 *dt, const U32 dtLog)
FORCE_INLINE_TEMPLATE size_t HUF_decompress4X2_usingDTable_internal_body(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_decompress1X2_DCtx(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
size_t HUF_decompress4X2(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
FORCE_INLINE_TEMPLATE size_t HUF_decompress1X2_usingDTable_internal_body(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize)
size_t HUF_decompress4X1(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
size_t HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_decompress4X2_DCtx(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
size_t HUF_decompress1X1_DCtx(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
static size_t HUF_decompress4X1_DCtx_wksp_bmi2(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize, int bmi2)
size_t HUF_decompress1X2(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
size_t HUF_decompress1X1_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workSpace, size_t wkspSize)
size_t HUF_decompress4X1_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
FORCE_INLINE_TEMPLATE size_t HUF_decompress4X1_usingDTable_internal_body(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize, int bmi2)
#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr)
size_t HUF_decompress4X1_DCtx(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
size_t(* decompressionAlgo)(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
static void HUF_fillDTableX2Level2(HUF_DEltX2 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight, const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq)
size_t HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr)
#define HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr)
#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
FORCE_INLINE_TEMPLATE size_t HUF_decompress1X1_usingDTable_internal_body(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize)
FORCE_INLINE_TEMPLATE U32 HUF_decodeSymbolX2(void *op, BIT_DStream_t *DStream, const HUF_DEltX2 *dt, const U32 dtLog)
#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr)
static const algo_time_t algoTime[16][3]
size_t(* HUF_decompress_usingDTable_t)(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
static void HUF_fillDTableX2(HUF_DEltX2 *DTable, const U32 targetLog, const sortedSymbol_t *sortedList, const U32 sortedListSize, const U32 *rankStart, rankVal_t rankValOrigin, const U32 maxWeight, const U32 nbBitsBaseline)
size_t HUF_decompress4X_hufOnly(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize)
size_t HUF_readDTableX1(HUF_DTable *DTable, const void *src, size_t srcSize)
size_t HUF_decompress1X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
FORCE_INLINE_TEMPLATE U32 HUF_decodeLastSymbolX2(void *op, BIT_DStream_t *DStream, const HUF_DEltX2 *dt, const U32 dtLog)
size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize)
size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workSpace, size_t wkspSize, int bmi2)
#define memcpy(s1, s2, n)
struct task_struct * current
#define FORCE_INLINE_TEMPLATE