zstd_compress_sequences.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under both the BSD-style license (found in the
  6. * LICENSE file in the root directory of this source tree) and the GPLv2 (found
  7. * in the COPYING file in the root directory of this source tree).
  8. * You may select, at your option, one of the above-listed licenses.
  9. */
  10. /*-*************************************
  11. * Dependencies
  12. ***************************************/
  13. #include "zstd_compress_sequences.h"
  14. /**
  15. * -log2(x / 256) lookup table for x in [0, 256).
  16. * If x == 0: Return 0
  17. * Else: Return floor(-log2(x / 256) * 256)
  18. */
  19. static unsigned const kInverseProbabilityLog256[256] = {
  20. 0, 2048, 1792, 1642, 1536, 1453, 1386, 1329, 1280, 1236, 1197, 1162,
  21. 1130, 1100, 1073, 1047, 1024, 1001, 980, 960, 941, 923, 906, 889,
  22. 874, 859, 844, 830, 817, 804, 791, 779, 768, 756, 745, 734,
  23. 724, 714, 704, 694, 685, 676, 667, 658, 650, 642, 633, 626,
  24. 618, 610, 603, 595, 588, 581, 574, 567, 561, 554, 548, 542,
  25. 535, 529, 523, 517, 512, 506, 500, 495, 489, 484, 478, 473,
  26. 468, 463, 458, 453, 448, 443, 438, 434, 429, 424, 420, 415,
  27. 411, 407, 402, 398, 394, 390, 386, 382, 377, 373, 370, 366,
  28. 362, 358, 354, 350, 347, 343, 339, 336, 332, 329, 325, 322,
  29. 318, 315, 311, 308, 305, 302, 298, 295, 292, 289, 286, 282,
  30. 279, 276, 273, 270, 267, 264, 261, 258, 256, 253, 250, 247,
  31. 244, 241, 239, 236, 233, 230, 228, 225, 222, 220, 217, 215,
  32. 212, 209, 207, 204, 202, 199, 197, 194, 192, 190, 187, 185,
  33. 182, 180, 178, 175, 173, 171, 168, 166, 164, 162, 159, 157,
  34. 155, 153, 151, 149, 146, 144, 142, 140, 138, 136, 134, 132,
  35. 130, 128, 126, 123, 121, 119, 117, 115, 114, 112, 110, 108,
  36. 106, 104, 102, 100, 98, 96, 94, 93, 91, 89, 87, 85,
  37. 83, 82, 80, 78, 76, 74, 73, 71, 69, 67, 66, 64,
  38. 62, 61, 59, 57, 55, 54, 52, 50, 49, 47, 46, 44,
  39. 42, 41, 39, 37, 36, 34, 33, 31, 30, 28, 26, 25,
  40. 23, 22, 20, 19, 17, 16, 14, 13, 11, 10, 8, 7,
  41. 5, 4, 2, 1,
  42. };
  43. static unsigned ZSTD_getFSEMaxSymbolValue(FSE_CTable const* ctable) {
  44. void const* ptr = ctable;
  45. U16 const* u16ptr = (U16 const*)ptr;
  46. U32 const maxSymbolValue = MEM_read16(u16ptr + 1);
  47. return maxSymbolValue;
  48. }
  49. /**
  50. * Returns true if we should use ncount=-1 else we should
  51. * use ncount=1 for low probability symbols instead.
  52. */
  53. static unsigned ZSTD_useLowProbCount(size_t const nbSeq)
  54. {
  55. /* Heuristic: This should cover most blocks <= 16K and
  56. * start to fade out after 16K to about 32K depending on
  57. * compressibility.
  58. */
  59. return nbSeq >= 2048;
  60. }
  61. /**
  62. * Returns the cost in bytes of encoding the normalized count header.
  63. * Returns an error if any of the helper functions return an error.
  64. */
  65. static size_t ZSTD_NCountCost(unsigned const* count, unsigned const max,
  66. size_t const nbSeq, unsigned const FSELog)
  67. {
  68. BYTE wksp[FSE_NCOUNTBOUND];
  69. S16 norm[MaxSeq + 1];
  70. const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max);
  71. FORWARD_IF_ERROR(FSE_normalizeCount(norm, tableLog, count, nbSeq, max, ZSTD_useLowProbCount(nbSeq)), "");
  72. return FSE_writeNCount(wksp, sizeof(wksp), norm, max, tableLog);
  73. }
  74. /**
  75. * Returns the cost in bits of encoding the distribution described by count
  76. * using the entropy bound.
  77. */
  78. static size_t ZSTD_entropyCost(unsigned const* count, unsigned const max, size_t const total)
  79. {
  80. unsigned cost = 0;
  81. unsigned s;
  82. assert(total > 0);
  83. for (s = 0; s <= max; ++s) {
  84. unsigned norm = (unsigned)((256 * count[s]) / total);
  85. if (count[s] != 0 && norm == 0)
  86. norm = 1;
  87. assert(count[s] < total);
  88. cost += count[s] * kInverseProbabilityLog256[norm];
  89. }
  90. return cost >> 8;
  91. }
  92. /**
  93. * Returns the cost in bits of encoding the distribution in count using ctable.
  94. * Returns an error if ctable cannot represent all the symbols in count.
  95. */
  96. size_t ZSTD_fseBitCost(
  97. FSE_CTable const* ctable,
  98. unsigned const* count,
  99. unsigned const max)
  100. {
  101. unsigned const kAccuracyLog = 8;
  102. size_t cost = 0;
  103. unsigned s;
  104. FSE_CState_t cstate;
  105. FSE_initCState(&cstate, ctable);
  106. if (ZSTD_getFSEMaxSymbolValue(ctable) < max) {
  107. DEBUGLOG(5, "Repeat FSE_CTable has maxSymbolValue %u < %u",
  108. ZSTD_getFSEMaxSymbolValue(ctable), max);
  109. return ERROR(GENERIC);
  110. }
  111. for (s = 0; s <= max; ++s) {
  112. unsigned const tableLog = cstate.stateLog;
  113. unsigned const badCost = (tableLog + 1) << kAccuracyLog;
  114. unsigned const bitCost = FSE_bitCost(cstate.symbolTT, tableLog, s, kAccuracyLog);
  115. if (count[s] == 0)
  116. continue;
  117. if (bitCost >= badCost) {
  118. DEBUGLOG(5, "Repeat FSE_CTable has Prob[%u] == 0", s);
  119. return ERROR(GENERIC);
  120. }
  121. cost += (size_t)count[s] * bitCost;
  122. }
  123. return cost >> kAccuracyLog;
  124. }
  125. /**
  126. * Returns the cost in bits of encoding the distribution in count using the
  127. * table described by norm. The max symbol support by norm is assumed >= max.
  128. * norm must be valid for every symbol with non-zero probability in count.
  129. */
  130. size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog,
  131. unsigned const* count, unsigned const max)
  132. {
  133. unsigned const shift = 8 - accuracyLog;
  134. size_t cost = 0;
  135. unsigned s;
  136. assert(accuracyLog <= 8);
  137. for (s = 0; s <= max; ++s) {
  138. unsigned const normAcc = (norm[s] != -1) ? (unsigned)norm[s] : 1;
  139. unsigned const norm256 = normAcc << shift;
  140. assert(norm256 > 0);
  141. assert(norm256 < 256);
  142. cost += count[s] * kInverseProbabilityLog256[norm256];
  143. }
  144. return cost >> 8;
  145. }
  146. symbolEncodingType_e
  147. ZSTD_selectEncodingType(
  148. FSE_repeat* repeatMode, unsigned const* count, unsigned const max,
  149. size_t const mostFrequent, size_t nbSeq, unsigned const FSELog,
  150. FSE_CTable const* prevCTable,
  151. short const* defaultNorm, U32 defaultNormLog,
  152. ZSTD_defaultPolicy_e const isDefaultAllowed,
  153. ZSTD_strategy const strategy)
  154. {
  155. ZSTD_STATIC_ASSERT(ZSTD_defaultDisallowed == 0 && ZSTD_defaultAllowed != 0);
  156. if (mostFrequent == nbSeq) {
  157. *repeatMode = FSE_repeat_none;
  158. if (isDefaultAllowed && nbSeq <= 2) {
  159. /* Prefer set_basic over set_rle when there are 2 or fewer symbols,
  160. * since RLE uses 1 byte, but set_basic uses 5-6 bits per symbol.
  161. * If basic encoding isn't possible, always choose RLE.
  162. */
  163. DEBUGLOG(5, "Selected set_basic");
  164. return set_basic;
  165. }
  166. DEBUGLOG(5, "Selected set_rle");
  167. return set_rle;
  168. }
  169. if (strategy < ZSTD_lazy) {
  170. if (isDefaultAllowed) {
  171. size_t const staticFse_nbSeq_max = 1000;
  172. size_t const mult = 10 - strategy;
  173. size_t const baseLog = 3;
  174. size_t const dynamicFse_nbSeq_min = (((size_t)1 << defaultNormLog) * mult) >> baseLog; /* 28-36 for offset, 56-72 for lengths */
  175. assert(defaultNormLog >= 5 && defaultNormLog <= 6); /* xx_DEFAULTNORMLOG */
  176. assert(mult <= 9 && mult >= 7);
  177. if ( (*repeatMode == FSE_repeat_valid)
  178. && (nbSeq < staticFse_nbSeq_max) ) {
  179. DEBUGLOG(5, "Selected set_repeat");
  180. return set_repeat;
  181. }
  182. if ( (nbSeq < dynamicFse_nbSeq_min)
  183. || (mostFrequent < (nbSeq >> (defaultNormLog-1))) ) {
  184. DEBUGLOG(5, "Selected set_basic");
  185. /* The format allows default tables to be repeated, but it isn't useful.
  186. * When using simple heuristics to select encoding type, we don't want
  187. * to confuse these tables with dictionaries. When running more careful
  188. * analysis, we don't need to waste time checking both repeating tables
  189. * and default tables.
  190. */
  191. *repeatMode = FSE_repeat_none;
  192. return set_basic;
  193. }
  194. }
  195. } else {
  196. size_t const basicCost = isDefaultAllowed ? ZSTD_crossEntropyCost(defaultNorm, defaultNormLog, count, max) : ERROR(GENERIC);
  197. size_t const repeatCost = *repeatMode != FSE_repeat_none ? ZSTD_fseBitCost(prevCTable, count, max) : ERROR(GENERIC);
  198. size_t const NCountCost = ZSTD_NCountCost(count, max, nbSeq, FSELog);
  199. size_t const compressedCost = (NCountCost << 3) + ZSTD_entropyCost(count, max, nbSeq);
  200. if (isDefaultAllowed) {
  201. assert(!ZSTD_isError(basicCost));
  202. assert(!(*repeatMode == FSE_repeat_valid && ZSTD_isError(repeatCost)));
  203. }
  204. assert(!ZSTD_isError(NCountCost));
  205. assert(compressedCost < ERROR(maxCode));
  206. DEBUGLOG(5, "Estimated bit costs: basic=%u\trepeat=%u\tcompressed=%u",
  207. (unsigned)basicCost, (unsigned)repeatCost, (unsigned)compressedCost);
  208. if (basicCost <= repeatCost && basicCost <= compressedCost) {
  209. DEBUGLOG(5, "Selected set_basic");
  210. assert(isDefaultAllowed);
  211. *repeatMode = FSE_repeat_none;
  212. return set_basic;
  213. }
  214. if (repeatCost <= compressedCost) {
  215. DEBUGLOG(5, "Selected set_repeat");
  216. assert(!ZSTD_isError(repeatCost));
  217. return set_repeat;
  218. }
  219. assert(compressedCost < basicCost && compressedCost < repeatCost);
  220. }
  221. DEBUGLOG(5, "Selected set_compressed");
  222. *repeatMode = FSE_repeat_check;
  223. return set_compressed;
  224. }
  225. typedef struct {
  226. S16 norm[MaxSeq + 1];
  227. U32 wksp[FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(MaxSeq, MaxFSELog)];
  228. } ZSTD_BuildCTableWksp;
  229. size_t
  230. ZSTD_buildCTable(void* dst, size_t dstCapacity,
  231. FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type,
  232. unsigned* count, U32 max,
  233. const BYTE* codeTable, size_t nbSeq,
  234. const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax,
  235. const FSE_CTable* prevCTable, size_t prevCTableSize,
  236. void* entropyWorkspace, size_t entropyWorkspaceSize)
  237. {
  238. BYTE* op = (BYTE*)dst;
  239. const BYTE* const oend = op + dstCapacity;
  240. DEBUGLOG(6, "ZSTD_buildCTable (dstCapacity=%u)", (unsigned)dstCapacity);
  241. switch (type) {
  242. case set_rle:
  243. FORWARD_IF_ERROR(FSE_buildCTable_rle(nextCTable, (BYTE)max), "");
  244. RETURN_ERROR_IF(dstCapacity==0, dstSize_tooSmall, "not enough space");
  245. *op = codeTable[0];
  246. return 1;
  247. case set_repeat:
  248. ZSTD_memcpy(nextCTable, prevCTable, prevCTableSize);
  249. return 0;
  250. case set_basic:
  251. FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, defaultNorm, defaultMax, defaultNormLog, entropyWorkspace, entropyWorkspaceSize), ""); /* note : could be pre-calculated */
  252. return 0;
  253. case set_compressed: {
  254. ZSTD_BuildCTableWksp* wksp = (ZSTD_BuildCTableWksp*)entropyWorkspace;
  255. size_t nbSeq_1 = nbSeq;
  256. const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max);
  257. if (count[codeTable[nbSeq-1]] > 1) {
  258. count[codeTable[nbSeq-1]]--;
  259. nbSeq_1--;
  260. }
  261. assert(nbSeq_1 > 1);
  262. assert(entropyWorkspaceSize >= sizeof(ZSTD_BuildCTableWksp));
  263. (void)entropyWorkspaceSize;
  264. FORWARD_IF_ERROR(FSE_normalizeCount(wksp->norm, tableLog, count, nbSeq_1, max, ZSTD_useLowProbCount(nbSeq_1)), "FSE_normalizeCount failed");
  265. assert(oend >= op);
  266. { size_t const NCountSize = FSE_writeNCount(op, (size_t)(oend - op), wksp->norm, max, tableLog); /* overflow protected */
  267. FORWARD_IF_ERROR(NCountSize, "FSE_writeNCount failed");
  268. FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, wksp->norm, max, tableLog, wksp->wksp, sizeof(wksp->wksp)), "FSE_buildCTable_wksp failed");
  269. return NCountSize;
  270. }
  271. }
  272. default: assert(0); RETURN_ERROR(GENERIC, "impossible to reach");
  273. }
  274. }
  275. FORCE_INLINE_TEMPLATE size_t
  276. ZSTD_encodeSequences_body(
  277. void* dst, size_t dstCapacity,
  278. FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
  279. FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
  280. FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
  281. seqDef const* sequences, size_t nbSeq, int longOffsets)
  282. {
  283. BIT_CStream_t blockStream;
  284. FSE_CState_t stateMatchLength;
  285. FSE_CState_t stateOffsetBits;
  286. FSE_CState_t stateLitLength;
  287. RETURN_ERROR_IF(
  288. ERR_isError(BIT_initCStream(&blockStream, dst, dstCapacity)),
  289. dstSize_tooSmall, "not enough space remaining");
  290. DEBUGLOG(6, "available space for bitstream : %i (dstCapacity=%u)",
  291. (int)(blockStream.endPtr - blockStream.startPtr),
  292. (unsigned)dstCapacity);
  293. /* first symbols */
  294. FSE_initCState2(&stateMatchLength, CTable_MatchLength, mlCodeTable[nbSeq-1]);
  295. FSE_initCState2(&stateOffsetBits, CTable_OffsetBits, ofCodeTable[nbSeq-1]);
  296. FSE_initCState2(&stateLitLength, CTable_LitLength, llCodeTable[nbSeq-1]);
  297. BIT_addBits(&blockStream, sequences[nbSeq-1].litLength, LL_bits[llCodeTable[nbSeq-1]]);
  298. if (MEM_32bits()) BIT_flushBits(&blockStream);
  299. BIT_addBits(&blockStream, sequences[nbSeq-1].mlBase, ML_bits[mlCodeTable[nbSeq-1]]);
  300. if (MEM_32bits()) BIT_flushBits(&blockStream);
  301. if (longOffsets) {
  302. U32 const ofBits = ofCodeTable[nbSeq-1];
  303. unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1);
  304. if (extraBits) {
  305. BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, extraBits);
  306. BIT_flushBits(&blockStream);
  307. }
  308. BIT_addBits(&blockStream, sequences[nbSeq-1].offBase >> extraBits,
  309. ofBits - extraBits);
  310. } else {
  311. BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, ofCodeTable[nbSeq-1]);
  312. }
  313. BIT_flushBits(&blockStream);
  314. { size_t n;
  315. for (n=nbSeq-2 ; n<nbSeq ; n--) { /* intentional underflow */
  316. BYTE const llCode = llCodeTable[n];
  317. BYTE const ofCode = ofCodeTable[n];
  318. BYTE const mlCode = mlCodeTable[n];
  319. U32 const llBits = LL_bits[llCode];
  320. U32 const ofBits = ofCode;
  321. U32 const mlBits = ML_bits[mlCode];
  322. DEBUGLOG(6, "encoding: litlen:%2u - matchlen:%2u - offCode:%7u",
  323. (unsigned)sequences[n].litLength,
  324. (unsigned)sequences[n].mlBase + MINMATCH,
  325. (unsigned)sequences[n].offBase);
  326. /* 32b*/ /* 64b*/
  327. /* (7)*/ /* (7)*/
  328. FSE_encodeSymbol(&blockStream, &stateOffsetBits, ofCode); /* 15 */ /* 15 */
  329. FSE_encodeSymbol(&blockStream, &stateMatchLength, mlCode); /* 24 */ /* 24 */
  330. if (MEM_32bits()) BIT_flushBits(&blockStream); /* (7)*/
  331. FSE_encodeSymbol(&blockStream, &stateLitLength, llCode); /* 16 */ /* 33 */
  332. if (MEM_32bits() || (ofBits+mlBits+llBits >= 64-7-(LLFSELog+MLFSELog+OffFSELog)))
  333. BIT_flushBits(&blockStream); /* (7)*/
  334. BIT_addBits(&blockStream, sequences[n].litLength, llBits);
  335. if (MEM_32bits() && ((llBits+mlBits)>24)) BIT_flushBits(&blockStream);
  336. BIT_addBits(&blockStream, sequences[n].mlBase, mlBits);
  337. if (MEM_32bits() || (ofBits+mlBits+llBits > 56)) BIT_flushBits(&blockStream);
  338. if (longOffsets) {
  339. unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1);
  340. if (extraBits) {
  341. BIT_addBits(&blockStream, sequences[n].offBase, extraBits);
  342. BIT_flushBits(&blockStream); /* (7)*/
  343. }
  344. BIT_addBits(&blockStream, sequences[n].offBase >> extraBits,
  345. ofBits - extraBits); /* 31 */
  346. } else {
  347. BIT_addBits(&blockStream, sequences[n].offBase, ofBits); /* 31 */
  348. }
  349. BIT_flushBits(&blockStream); /* (7)*/
  350. DEBUGLOG(7, "remaining space : %i", (int)(blockStream.endPtr - blockStream.ptr));
  351. } }
  352. DEBUGLOG(6, "ZSTD_encodeSequences: flushing ML state with %u bits", stateMatchLength.stateLog);
  353. FSE_flushCState(&blockStream, &stateMatchLength);
  354. DEBUGLOG(6, "ZSTD_encodeSequences: flushing Off state with %u bits", stateOffsetBits.stateLog);
  355. FSE_flushCState(&blockStream, &stateOffsetBits);
  356. DEBUGLOG(6, "ZSTD_encodeSequences: flushing LL state with %u bits", stateLitLength.stateLog);
  357. FSE_flushCState(&blockStream, &stateLitLength);
  358. { size_t const streamSize = BIT_closeCStream(&blockStream);
  359. RETURN_ERROR_IF(streamSize==0, dstSize_tooSmall, "not enough space");
  360. return streamSize;
  361. }
  362. }
  363. static size_t
  364. ZSTD_encodeSequences_default(
  365. void* dst, size_t dstCapacity,
  366. FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
  367. FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
  368. FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
  369. seqDef const* sequences, size_t nbSeq, int longOffsets)
  370. {
  371. return ZSTD_encodeSequences_body(dst, dstCapacity,
  372. CTable_MatchLength, mlCodeTable,
  373. CTable_OffsetBits, ofCodeTable,
  374. CTable_LitLength, llCodeTable,
  375. sequences, nbSeq, longOffsets);
  376. }
  377. #if DYNAMIC_BMI2
  378. static BMI2_TARGET_ATTRIBUTE size_t
  379. ZSTD_encodeSequences_bmi2(
  380. void* dst, size_t dstCapacity,
  381. FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
  382. FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
  383. FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
  384. seqDef const* sequences, size_t nbSeq, int longOffsets)
  385. {
  386. return ZSTD_encodeSequences_body(dst, dstCapacity,
  387. CTable_MatchLength, mlCodeTable,
  388. CTable_OffsetBits, ofCodeTable,
  389. CTable_LitLength, llCodeTable,
  390. sequences, nbSeq, longOffsets);
  391. }
  392. #endif
  393. size_t ZSTD_encodeSequences(
  394. void* dst, size_t dstCapacity,
  395. FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable,
  396. FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable,
  397. FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable,
  398. seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2)
  399. {
  400. DEBUGLOG(5, "ZSTD_encodeSequences: dstCapacity = %u", (unsigned)dstCapacity);
  401. #if DYNAMIC_BMI2
  402. if (bmi2) {
  403. return ZSTD_encodeSequences_bmi2(dst, dstCapacity,
  404. CTable_MatchLength, mlCodeTable,
  405. CTable_OffsetBits, ofCodeTable,
  406. CTable_LitLength, llCodeTable,
  407. sequences, nbSeq, longOffsets);
  408. }
  409. #endif
  410. (void)bmi2;
  411. return ZSTD_encodeSequences_default(dst, dstCapacity,
  412. CTable_MatchLength, mlCodeTable,
  413. CTable_OffsetBits, ofCodeTable,
  414. CTable_LitLength, llCodeTable,
  415. sequences, nbSeq, longOffsets);
  416. }