clevels.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. #ifndef ZSTD_CLEVELS_H
  11. #define ZSTD_CLEVELS_H
  12. #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */
  13. #include "../zstd.h"
  14. /*-===== Pre-defined compression levels =====-*/
  15. #define ZSTD_MAX_CLEVEL 22
  16. #ifdef __GNUC__
  17. __attribute__((__unused__))
  18. #endif
  19. static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
  20. { /* "default" - for any srcSize > 256 KB */
  21. /* W, C, H, S, L, TL, strat */
  22. { 19, 12, 13, 1, 6, 1, ZSTD_fast }, /* base for negative levels */
  23. { 19, 13, 14, 1, 7, 0, ZSTD_fast }, /* level 1 */
  24. { 20, 15, 16, 1, 6, 0, ZSTD_fast }, /* level 2 */
  25. { 21, 16, 17, 1, 5, 0, ZSTD_dfast }, /* level 3 */
  26. { 21, 18, 18, 1, 5, 0, ZSTD_dfast }, /* level 4 */
  27. { 21, 18, 19, 3, 5, 2, ZSTD_greedy }, /* level 5 */
  28. { 21, 18, 19, 3, 5, 4, ZSTD_lazy }, /* level 6 */
  29. { 21, 19, 20, 4, 5, 8, ZSTD_lazy }, /* level 7 */
  30. { 21, 19, 20, 4, 5, 16, ZSTD_lazy2 }, /* level 8 */
  31. { 22, 20, 21, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */
  32. { 22, 21, 22, 5, 5, 16, ZSTD_lazy2 }, /* level 10 */
  33. { 22, 21, 22, 6, 5, 16, ZSTD_lazy2 }, /* level 11 */
  34. { 22, 22, 23, 6, 5, 32, ZSTD_lazy2 }, /* level 12 */
  35. { 22, 22, 22, 4, 5, 32, ZSTD_btlazy2 }, /* level 13 */
  36. { 22, 22, 23, 5, 5, 32, ZSTD_btlazy2 }, /* level 14 */
  37. { 22, 23, 23, 6, 5, 32, ZSTD_btlazy2 }, /* level 15 */
  38. { 22, 22, 22, 5, 5, 48, ZSTD_btopt }, /* level 16 */
  39. { 23, 23, 22, 5, 4, 64, ZSTD_btopt }, /* level 17 */
  40. { 23, 23, 22, 6, 3, 64, ZSTD_btultra }, /* level 18 */
  41. { 23, 24, 22, 7, 3,256, ZSTD_btultra2}, /* level 19 */
  42. { 25, 25, 23, 7, 3,256, ZSTD_btultra2}, /* level 20 */
  43. { 26, 26, 24, 7, 3,512, ZSTD_btultra2}, /* level 21 */
  44. { 27, 27, 25, 9, 3,999, ZSTD_btultra2}, /* level 22 */
  45. },
  46. { /* for srcSize <= 256 KB */
  47. /* W, C, H, S, L, T, strat */
  48. { 18, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */
  49. { 18, 13, 14, 1, 6, 0, ZSTD_fast }, /* level 1 */
  50. { 18, 14, 14, 1, 5, 0, ZSTD_dfast }, /* level 2 */
  51. { 18, 16, 16, 1, 4, 0, ZSTD_dfast }, /* level 3 */
  52. { 18, 16, 17, 3, 5, 2, ZSTD_greedy }, /* level 4.*/
  53. { 18, 17, 18, 5, 5, 2, ZSTD_greedy }, /* level 5.*/
  54. { 18, 18, 19, 3, 5, 4, ZSTD_lazy }, /* level 6.*/
  55. { 18, 18, 19, 4, 4, 4, ZSTD_lazy }, /* level 7 */
  56. { 18, 18, 19, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */
  57. { 18, 18, 19, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
  58. { 18, 18, 19, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
  59. { 18, 18, 19, 5, 4, 12, ZSTD_btlazy2 }, /* level 11.*/
  60. { 18, 19, 19, 7, 4, 12, ZSTD_btlazy2 }, /* level 12.*/
  61. { 18, 18, 19, 4, 4, 16, ZSTD_btopt }, /* level 13 */
  62. { 18, 18, 19, 4, 3, 32, ZSTD_btopt }, /* level 14.*/
  63. { 18, 18, 19, 6, 3,128, ZSTD_btopt }, /* level 15.*/
  64. { 18, 19, 19, 6, 3,128, ZSTD_btultra }, /* level 16.*/
  65. { 18, 19, 19, 8, 3,256, ZSTD_btultra }, /* level 17.*/
  66. { 18, 19, 19, 6, 3,128, ZSTD_btultra2}, /* level 18.*/
  67. { 18, 19, 19, 8, 3,256, ZSTD_btultra2}, /* level 19.*/
  68. { 18, 19, 19, 10, 3,512, ZSTD_btultra2}, /* level 20.*/
  69. { 18, 19, 19, 12, 3,512, ZSTD_btultra2}, /* level 21.*/
  70. { 18, 19, 19, 13, 3,999, ZSTD_btultra2}, /* level 22.*/
  71. },
  72. { /* for srcSize <= 128 KB */
  73. /* W, C, H, S, L, T, strat */
  74. { 17, 12, 12, 1, 5, 1, ZSTD_fast }, /* base for negative levels */
  75. { 17, 12, 13, 1, 6, 0, ZSTD_fast }, /* level 1 */
  76. { 17, 13, 15, 1, 5, 0, ZSTD_fast }, /* level 2 */
  77. { 17, 15, 16, 2, 5, 0, ZSTD_dfast }, /* level 3 */
  78. { 17, 17, 17, 2, 4, 0, ZSTD_dfast }, /* level 4 */
  79. { 17, 16, 17, 3, 4, 2, ZSTD_greedy }, /* level 5 */
  80. { 17, 16, 17, 3, 4, 4, ZSTD_lazy }, /* level 6 */
  81. { 17, 16, 17, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */
  82. { 17, 16, 17, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */
  83. { 17, 16, 17, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
  84. { 17, 16, 17, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
  85. { 17, 17, 17, 5, 4, 8, ZSTD_btlazy2 }, /* level 11 */
  86. { 17, 18, 17, 7, 4, 12, ZSTD_btlazy2 }, /* level 12 */
  87. { 17, 18, 17, 3, 4, 12, ZSTD_btopt }, /* level 13.*/
  88. { 17, 18, 17, 4, 3, 32, ZSTD_btopt }, /* level 14.*/
  89. { 17, 18, 17, 6, 3,256, ZSTD_btopt }, /* level 15.*/
  90. { 17, 18, 17, 6, 3,128, ZSTD_btultra }, /* level 16.*/
  91. { 17, 18, 17, 8, 3,256, ZSTD_btultra }, /* level 17.*/
  92. { 17, 18, 17, 10, 3,512, ZSTD_btultra }, /* level 18.*/
  93. { 17, 18, 17, 5, 3,256, ZSTD_btultra2}, /* level 19.*/
  94. { 17, 18, 17, 7, 3,512, ZSTD_btultra2}, /* level 20.*/
  95. { 17, 18, 17, 9, 3,512, ZSTD_btultra2}, /* level 21.*/
  96. { 17, 18, 17, 11, 3,999, ZSTD_btultra2}, /* level 22.*/
  97. },
  98. { /* for srcSize <= 16 KB */
  99. /* W, C, H, S, L, T, strat */
  100. { 14, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */
  101. { 14, 14, 15, 1, 5, 0, ZSTD_fast }, /* level 1 */
  102. { 14, 14, 15, 1, 4, 0, ZSTD_fast }, /* level 2 */
  103. { 14, 14, 15, 2, 4, 0, ZSTD_dfast }, /* level 3 */
  104. { 14, 14, 14, 4, 4, 2, ZSTD_greedy }, /* level 4 */
  105. { 14, 14, 14, 3, 4, 4, ZSTD_lazy }, /* level 5.*/
  106. { 14, 14, 14, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */
  107. { 14, 14, 14, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */
  108. { 14, 14, 14, 8, 4, 8, ZSTD_lazy2 }, /* level 8.*/
  109. { 14, 15, 14, 5, 4, 8, ZSTD_btlazy2 }, /* level 9.*/
  110. { 14, 15, 14, 9, 4, 8, ZSTD_btlazy2 }, /* level 10.*/
  111. { 14, 15, 14, 3, 4, 12, ZSTD_btopt }, /* level 11.*/
  112. { 14, 15, 14, 4, 3, 24, ZSTD_btopt }, /* level 12.*/
  113. { 14, 15, 14, 5, 3, 32, ZSTD_btultra }, /* level 13.*/
  114. { 14, 15, 15, 6, 3, 64, ZSTD_btultra }, /* level 14.*/
  115. { 14, 15, 15, 7, 3,256, ZSTD_btultra }, /* level 15.*/
  116. { 14, 15, 15, 5, 3, 48, ZSTD_btultra2}, /* level 16.*/
  117. { 14, 15, 15, 6, 3,128, ZSTD_btultra2}, /* level 17.*/
  118. { 14, 15, 15, 7, 3,256, ZSTD_btultra2}, /* level 18.*/
  119. { 14, 15, 15, 8, 3,256, ZSTD_btultra2}, /* level 19.*/
  120. { 14, 15, 15, 8, 3,512, ZSTD_btultra2}, /* level 20.*/
  121. { 14, 15, 15, 9, 3,512, ZSTD_btultra2}, /* level 21.*/
  122. { 14, 15, 15, 10, 3,999, ZSTD_btultra2}, /* level 22.*/
  123. },
  124. };
  125. #endif /* ZSTD_CLEVELS_H */