zstd_compress_sequences.c 20 KB

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