koffi 2.3.6 → 2.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +2 -2
  3. package/src/cnoke/cnoke.js +3 -7
  4. package/src/cnoke/src/builder.js +7 -4
  5. package/src/cnoke/src/index.js +2 -2
  6. package/src/koffi/build/2.3.8/koffi_darwin_arm64/koffi.node +0 -0
  7. package/src/koffi/build/2.3.8/koffi_darwin_x64/koffi.node +0 -0
  8. package/src/koffi/build/2.3.8/koffi_freebsd_arm64/koffi.node +0 -0
  9. package/src/koffi/build/2.3.8/koffi_freebsd_ia32/koffi.node +0 -0
  10. package/src/koffi/build/2.3.8/koffi_freebsd_x64/koffi.node +0 -0
  11. package/src/koffi/build/2.3.8/koffi_linux_arm32hf/koffi.node +0 -0
  12. package/src/koffi/build/2.3.8/koffi_linux_arm64/koffi.node +0 -0
  13. package/src/koffi/build/2.3.8/koffi_linux_ia32/koffi.node +0 -0
  14. package/src/koffi/build/2.3.8/koffi_linux_riscv64hf64/koffi.node +0 -0
  15. package/src/koffi/build/2.3.8/koffi_linux_x64/koffi.node +0 -0
  16. package/src/koffi/build/2.3.8/koffi_openbsd_ia32/koffi.node +0 -0
  17. package/src/koffi/build/2.3.8/koffi_openbsd_x64/koffi.node +0 -0
  18. package/src/koffi/build/2.3.8/koffi_win32_arm64/koffi.node +0 -0
  19. package/src/koffi/build/2.3.8/koffi_win32_ia32/koffi.node +0 -0
  20. package/src/koffi/build/2.3.8/koffi_win32_x64/koffi.node +0 -0
  21. package/src/koffi/src/abi_arm64.cc +8 -2
  22. package/src/koffi/src/abi_x64_win.cc +8 -2
  23. package/src/koffi/src/abi_x86.cc +8 -2
  24. package/src/koffi/src/ffi.cc +3 -22
  25. package/src/koffi/src/index.d.ts +1 -1
  26. package/src/koffi/src/index.js +1 -0
  27. package/src/koffi/src/win32.hh +10 -4
  28. package/src/koffi/build/2.3.6/koffi_darwin_arm64/koffi.node +0 -0
  29. package/src/koffi/build/2.3.6/koffi_darwin_x64/koffi.node +0 -0
  30. package/src/koffi/build/2.3.6/koffi_freebsd_arm64/koffi.node +0 -0
  31. package/src/koffi/build/2.3.6/koffi_freebsd_ia32/koffi.node +0 -0
  32. package/src/koffi/build/2.3.6/koffi_freebsd_x64/koffi.node +0 -0
  33. package/src/koffi/build/2.3.6/koffi_linux_arm32hf/koffi.node +0 -0
  34. package/src/koffi/build/2.3.6/koffi_linux_arm64/koffi.node +0 -0
  35. package/src/koffi/build/2.3.6/koffi_linux_ia32/koffi.node +0 -0
  36. package/src/koffi/build/2.3.6/koffi_linux_riscv64hf64/koffi.node +0 -0
  37. package/src/koffi/build/2.3.6/koffi_linux_x64/koffi.node +0 -0
  38. package/src/koffi/build/2.3.6/koffi_openbsd_ia32/koffi.node +0 -0
  39. package/src/koffi/build/2.3.6/koffi_openbsd_x64/koffi.node +0 -0
  40. package/src/koffi/build/2.3.6/koffi_win32_arm64/koffi.node +0 -0
  41. package/src/koffi/build/2.3.6/koffi_win32_arm64/koffi.pdb +0 -0
  42. package/src/koffi/build/2.3.6/koffi_win32_ia32/koffi.node +0 -0
  43. package/src/koffi/build/2.3.6/koffi_win32_ia32/koffi.pdb +0 -0
  44. package/src/koffi/build/2.3.6/koffi_win32_x64/koffi.node +0 -0
  45. package/src/koffi/build/2.3.6/koffi_win32_x64/koffi.pdb +0 -0
  46. package/vendor/brotli/BUILD +0 -144
  47. package/vendor/brotli/CMakeLists.txt +0 -421
  48. package/vendor/brotli/CONTRIBUTING.md +0 -27
  49. package/vendor/brotli/LICENSE +0 -19
  50. package/vendor/brotli/MANIFEST.in +0 -17
  51. package/vendor/brotli/Makefile +0 -55
  52. package/vendor/brotli/Makefile.am +0 -38
  53. package/vendor/brotli/README +0 -15
  54. package/vendor/brotli/README.md +0 -104
  55. package/vendor/brotli/WORKSPACE +0 -21
  56. package/vendor/brotli/bootstrap +0 -35
  57. package/vendor/brotli/c/common/constants.c +0 -15
  58. package/vendor/brotli/c/common/constants.h +0 -200
  59. package/vendor/brotli/c/common/context.c +0 -156
  60. package/vendor/brotli/c/common/context.h +0 -113
  61. package/vendor/brotli/c/common/dictionary.c +0 -5914
  62. package/vendor/brotli/c/common/dictionary.h +0 -64
  63. package/vendor/brotli/c/common/platform.c +0 -22
  64. package/vendor/brotli/c/common/platform.h +0 -596
  65. package/vendor/brotli/c/common/transform.c +0 -291
  66. package/vendor/brotli/c/common/transform.h +0 -85
  67. package/vendor/brotli/c/common/version.h +0 -26
  68. package/vendor/brotli/c/dec/bit_reader.c +0 -76
  69. package/vendor/brotli/c/dec/bit_reader.h +0 -351
  70. package/vendor/brotli/c/dec/decode.c +0 -2608
  71. package/vendor/brotli/c/dec/huffman.c +0 -339
  72. package/vendor/brotli/c/dec/huffman.h +0 -121
  73. package/vendor/brotli/c/dec/prefix.h +0 -732
  74. package/vendor/brotli/c/dec/state.c +0 -159
  75. package/vendor/brotli/c/dec/state.h +0 -365
  76. package/vendor/brotli/c/enc/backward_references.c +0 -145
  77. package/vendor/brotli/c/enc/backward_references.h +0 -39
  78. package/vendor/brotli/c/enc/backward_references_hq.c +0 -843
  79. package/vendor/brotli/c/enc/backward_references_hq.h +0 -95
  80. package/vendor/brotli/c/enc/backward_references_inc.h +0 -163
  81. package/vendor/brotli/c/enc/bit_cost.c +0 -35
  82. package/vendor/brotli/c/enc/bit_cost.h +0 -63
  83. package/vendor/brotli/c/enc/bit_cost_inc.h +0 -127
  84. package/vendor/brotli/c/enc/block_encoder_inc.h +0 -34
  85. package/vendor/brotli/c/enc/block_splitter.c +0 -194
  86. package/vendor/brotli/c/enc/block_splitter.h +0 -51
  87. package/vendor/brotli/c/enc/block_splitter_inc.h +0 -440
  88. package/vendor/brotli/c/enc/brotli_bit_stream.c +0 -1314
  89. package/vendor/brotli/c/enc/brotli_bit_stream.h +0 -84
  90. package/vendor/brotli/c/enc/cluster.c +0 -56
  91. package/vendor/brotli/c/enc/cluster.h +0 -48
  92. package/vendor/brotli/c/enc/cluster_inc.h +0 -320
  93. package/vendor/brotli/c/enc/command.c +0 -28
  94. package/vendor/brotli/c/enc/command.h +0 -190
  95. package/vendor/brotli/c/enc/compress_fragment.c +0 -790
  96. package/vendor/brotli/c/enc/compress_fragment.h +0 -61
  97. package/vendor/brotli/c/enc/compress_fragment_two_pass.c +0 -645
  98. package/vendor/brotli/c/enc/compress_fragment_two_pass.h +0 -54
  99. package/vendor/brotli/c/enc/dictionary_hash.c +0 -1846
  100. package/vendor/brotli/c/enc/dictionary_hash.h +0 -25
  101. package/vendor/brotli/c/enc/encode.c +0 -1927
  102. package/vendor/brotli/c/enc/encoder_dict.c +0 -33
  103. package/vendor/brotli/c/enc/encoder_dict.h +0 -43
  104. package/vendor/brotli/c/enc/entropy_encode.c +0 -503
  105. package/vendor/brotli/c/enc/entropy_encode.h +0 -122
  106. package/vendor/brotli/c/enc/entropy_encode_static.h +0 -539
  107. package/vendor/brotli/c/enc/fast_log.c +0 -105
  108. package/vendor/brotli/c/enc/fast_log.h +0 -66
  109. package/vendor/brotli/c/enc/find_match_length.h +0 -79
  110. package/vendor/brotli/c/enc/hash.h +0 -488
  111. package/vendor/brotli/c/enc/hash_composite_inc.h +0 -125
  112. package/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +0 -293
  113. package/vendor/brotli/c/enc/hash_longest_match64_inc.h +0 -267
  114. package/vendor/brotli/c/enc/hash_longest_match_inc.h +0 -262
  115. package/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +0 -266
  116. package/vendor/brotli/c/enc/hash_rolling_inc.h +0 -212
  117. package/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +0 -329
  118. package/vendor/brotli/c/enc/histogram.c +0 -100
  119. package/vendor/brotli/c/enc/histogram.h +0 -63
  120. package/vendor/brotli/c/enc/histogram_inc.h +0 -51
  121. package/vendor/brotli/c/enc/literal_cost.c +0 -175
  122. package/vendor/brotli/c/enc/literal_cost.h +0 -30
  123. package/vendor/brotli/c/enc/memory.c +0 -170
  124. package/vendor/brotli/c/enc/memory.h +0 -114
  125. package/vendor/brotli/c/enc/metablock.c +0 -663
  126. package/vendor/brotli/c/enc/metablock.h +0 -105
  127. package/vendor/brotli/c/enc/metablock_inc.h +0 -183
  128. package/vendor/brotli/c/enc/params.h +0 -46
  129. package/vendor/brotli/c/enc/prefix.h +0 -53
  130. package/vendor/brotli/c/enc/quality.h +0 -165
  131. package/vendor/brotli/c/enc/ringbuffer.h +0 -167
  132. package/vendor/brotli/c/enc/static_dict.c +0 -486
  133. package/vendor/brotli/c/enc/static_dict.h +0 -40
  134. package/vendor/brotli/c/enc/static_dict_lut.h +0 -5864
  135. package/vendor/brotli/c/enc/utf8_util.c +0 -85
  136. package/vendor/brotli/c/enc/utf8_util.h +0 -32
  137. package/vendor/brotli/c/enc/write_bits.h +0 -87
  138. package/vendor/brotli/c/include/brotli/decode.h +0 -344
  139. package/vendor/brotli/c/include/brotli/encode.h +0 -448
  140. package/vendor/brotli/c/include/brotli/port.h +0 -288
  141. package/vendor/brotli/c/include/brotli/types.h +0 -83
  142. package/vendor/brotli/c/tools/brotli.c +0 -1116
  143. package/vendor/brotli/c/tools/brotli.md +0 -107
  144. package/vendor/brotli/compiler_config_setting.bzl +0 -28
  145. package/vendor/brotli/configure +0 -8
  146. package/vendor/brotli/configure-cmake +0 -318
  147. package/vendor/brotli/configure.ac +0 -14
  148. package/vendor/brotli/docs/brotli.1 +0 -132
  149. package/vendor/brotli/docs/constants.h.3 +0 -47
  150. package/vendor/brotli/docs/decode.h.3 +0 -415
  151. package/vendor/brotli/docs/encode.h.3 +0 -586
  152. package/vendor/brotli/docs/types.h.3 +0 -117
  153. package/vendor/brotli/premake5.lua +0 -78
  154. package/vendor/brotli/python/Makefile +0 -57
  155. package/vendor/brotli/python/README.md +0 -54
  156. package/vendor/brotli/python/_brotli.cc +0 -753
  157. package/vendor/brotli/python/bro.py +0 -160
  158. package/vendor/brotli/python/brotli.py +0 -56
  159. package/vendor/brotli/python/tests/__init__.py +0 -0
  160. package/vendor/brotli/python/tests/_test_utils.py +0 -112
  161. package/vendor/brotli/python/tests/bro_test.py +0 -102
  162. package/vendor/brotli/python/tests/compress_test.py +0 -41
  163. package/vendor/brotli/python/tests/compressor_test.py +0 -94
  164. package/vendor/brotli/python/tests/decompress_test.py +0 -42
  165. package/vendor/brotli/python/tests/decompressor_test.py +0 -59
  166. package/vendor/brotli/scripts/libbrotlicommon.pc.in +0 -11
  167. package/vendor/brotli/scripts/libbrotlidec.pc.in +0 -12
  168. package/vendor/brotli/scripts/libbrotlienc.pc.in +0 -12
  169. package/vendor/brotli/scripts/sources.lst +0 -104
  170. package/vendor/brotli/setup.cfg +0 -5
  171. package/vendor/brotli/setup.py +0 -293
  172. package/vendor/brotli/tests/Makefile +0 -17
  173. package/vendor/brotli/tests/compatibility_test.sh +0 -25
  174. package/vendor/brotli/tests/roundtrip_test.sh +0 -36
  175. package/vendor/brotli/tests/run-compatibility-test.cmake +0 -31
  176. package/vendor/brotli/tests/run-roundtrip-test.cmake +0 -36
  177. package/vendor/brotli/tests/testdata/empty +0 -0
  178. package/vendor/brotli/tests/testdata/empty.compressed +0 -1
  179. package/vendor/brotli/tests/testdata/ukkonooa +0 -1
  180. package/vendor/brotli/tests/testdata/ukkonooa.compressed +0 -0
  181. package/vendor/dragonbox/CMakeLists.txt +0 -123
  182. package/vendor/dragonbox/LICENSE-Apache2-LLVM +0 -218
  183. package/vendor/dragonbox/LICENSE-Boost +0 -23
  184. package/vendor/dragonbox/README.md +0 -277
  185. package/vendor/dragonbox/cmake/dragonboxConfig.cmake +0 -1
  186. package/vendor/dragonbox/include/dragonbox/dragonbox.h +0 -2674
  187. package/vendor/dragonbox/include/dragonbox/dragonbox_to_chars.h +0 -108
  188. package/vendor/dragonbox/other_files/Dragonbox.pdf +0 -0
  189. package/vendor/dragonbox/other_files/Dragonbox_old.pdf +0 -0
  190. package/vendor/dragonbox/other_files/milo_benchmark.png +0 -0
  191. package/vendor/dragonbox/other_files/unknown_win64_vc2019.html +0 -540
  192. package/vendor/dragonbox/other_files/unknown_win64_vc2019_randomdigit_time.png +0 -0
  193. package/vendor/dragonbox/source/dragonbox_to_chars.cpp +0 -303
  194. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/CMakeLists.txt +0 -24
  195. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.cpp +0 -238
  196. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.h +0 -95
  197. package/vendor/dragonbox/subproject/3rdparty/grisu_exact/grisu_exact.h +0 -2666
  198. package/vendor/dragonbox/subproject/3rdparty/ryu/CMakeLists.txt +0 -16
  199. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/common.h +0 -114
  200. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s.c +0 -509
  201. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_full_table.h +0 -367
  202. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_intrinsics.h +0 -357
  203. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/digit_table.h +0 -35
  204. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s.c +0 -345
  205. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_full_table.h +0 -55
  206. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_intrinsics.h +0 -128
  207. package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/ryu.h +0 -46
  208. package/vendor/dragonbox/subproject/3rdparty/schubfach/CMakeLists.txt +0 -22
  209. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.cc +0 -699
  210. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.h +0 -31
  211. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.cc +0 -1354
  212. package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.h +0 -31
  213. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/example_shaded_plots.m +0 -68
  214. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/license.txt +0 -25
  215. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution.m +0 -92
  216. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution_prctile.m +0 -121
  217. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_histogram_shaded.m +0 -99
  218. package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_shaded.m +0 -93
  219. package/vendor/dragonbox/subproject/benchmark/CMakeLists.txt +0 -65
  220. package/vendor/dragonbox/subproject/benchmark/include/benchmark.h +0 -40
  221. package/vendor/dragonbox/subproject/benchmark/matlab/plot_benchmarks.m +0 -22
  222. package/vendor/dragonbox/subproject/benchmark/matlab/plot_digit_benchmark.m +0 -78
  223. package/vendor/dragonbox/subproject/benchmark/matlab/plot_uniform_benchmark.m +0 -95
  224. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_clang.png +0 -0
  225. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_msvc.png +0 -0
  226. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_clang.png +0 -0
  227. package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_msvc.png +0 -0
  228. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_clang.png +0 -0
  229. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_msvc.png +0 -0
  230. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_clang.png +0 -0
  231. package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_msvc.png +0 -0
  232. package/vendor/dragonbox/subproject/benchmark/source/benchmark.cpp +0 -238
  233. package/vendor/dragonbox/subproject/benchmark/source/dragonbox.cpp +0 -30
  234. package/vendor/dragonbox/subproject/benchmark/source/grisu_exact.cpp +0 -36
  235. package/vendor/dragonbox/subproject/benchmark/source/ryu.cpp +0 -27
  236. package/vendor/dragonbox/subproject/benchmark/source/schubfach.cpp +0 -31
  237. package/vendor/dragonbox/subproject/common/CMakeLists.txt +0 -42
  238. package/vendor/dragonbox/subproject/common/include/best_rational_approx.h +0 -97
  239. package/vendor/dragonbox/subproject/common/include/big_uint.h +0 -218
  240. package/vendor/dragonbox/subproject/common/include/continued_fractions.h +0 -174
  241. package/vendor/dragonbox/subproject/common/include/good_rational_approx.h +0 -267
  242. package/vendor/dragonbox/subproject/common/include/random_float.h +0 -182
  243. package/vendor/dragonbox/subproject/common/include/rational_continued_fractions.h +0 -57
  244. package/vendor/dragonbox/subproject/common/source/big_uint.cpp +0 -602
  245. package/vendor/dragonbox/subproject/meta/CMakeLists.txt +0 -41
  246. package/vendor/dragonbox/subproject/meta/results/binary32_generated_cache.txt +0 -82
  247. package/vendor/dragonbox/subproject/meta/results/binary64_compressed_cache_error_table.txt +0 -10
  248. package/vendor/dragonbox/subproject/meta/results/binary64_generated_cache.txt +0 -623
  249. package/vendor/dragonbox/subproject/meta/source/generate_cache.cpp +0 -126
  250. package/vendor/dragonbox/subproject/meta/source/live_test.cpp +0 -81
  251. package/vendor/dragonbox/subproject/meta/source/perf_test.cpp +0 -104
  252. package/vendor/dragonbox/subproject/meta/source/sandbox.cpp +0 -20
  253. package/vendor/dragonbox/subproject/test/CMakeLists.txt +0 -70
  254. package/vendor/dragonbox/subproject/test/results/binary32.csv +0 -255
  255. package/vendor/dragonbox/subproject/test/results/binary64.csv +0 -2047
  256. package/vendor/dragonbox/subproject/test/results/plot_required_bits.m +0 -18
  257. package/vendor/dragonbox/subproject/test/source/test_all_shorter_interval_cases.cpp +0 -88
  258. package/vendor/dragonbox/subproject/test/source/uniform_random_test.cpp +0 -95
  259. package/vendor/dragonbox/subproject/test/source/verify_cache_precision.cpp +0 -338
  260. package/vendor/dragonbox/subproject/test/source/verify_compressed_cache.cpp +0 -154
  261. package/vendor/dragonbox/subproject/test/source/verify_fast_multiplication.cpp +0 -168
  262. package/vendor/dragonbox/subproject/test/source/verify_log_computation.cpp +0 -251
  263. package/vendor/dragonbox/subproject/test/source/verify_magic_division.cpp +0 -113
  264. package/vendor/miniz/ChangeLog.md +0 -239
  265. package/vendor/miniz/LICENSE +0 -22
  266. package/vendor/miniz/examples/example1.c +0 -105
  267. package/vendor/miniz/examples/example2.c +0 -164
  268. package/vendor/miniz/examples/example3.c +0 -269
  269. package/vendor/miniz/examples/example4.c +0 -102
  270. package/vendor/miniz/examples/example5.c +0 -327
  271. package/vendor/miniz/examples/example6.c +0 -166
  272. package/vendor/miniz/miniz.c +0 -7835
  273. package/vendor/miniz/miniz.h +0 -1422
  274. package/vendor/miniz/readme.md +0 -46
  275. /package/src/koffi/build/{2.3.6 → 2.3.8}/koffi_win32_arm64/koffi.exp +0 -0
  276. /package/src/koffi/build/{2.3.6 → 2.3.8}/koffi_win32_arm64/koffi.lib +0 -0
  277. /package/src/koffi/build/{2.3.6 → 2.3.8}/koffi_win32_ia32/koffi.exp +0 -0
  278. /package/src/koffi/build/{2.3.6 → 2.3.8}/koffi_win32_ia32/koffi.lib +0 -0
  279. /package/src/koffi/build/{2.3.6 → 2.3.8}/koffi_win32_x64/koffi.exp +0 -0
  280. /package/src/koffi/build/{2.3.6 → 2.3.8}/koffi_win32_x64/koffi.lib +0 -0
@@ -1,84 +0,0 @@
1
- /* Copyright 2014 Google Inc. All Rights Reserved.
2
-
3
- Distributed under MIT license.
4
- See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
- */
6
-
7
- /* Functions to convert brotli-related data structures into the
8
- brotli bit stream. The functions here operate under
9
- assumption that there is enough space in the storage, i.e., there are
10
- no out-of-range checks anywhere.
11
-
12
- These functions do bit addressing into a byte array. The byte array
13
- is called "storage" and the index to the bit is called storage_ix
14
- in function arguments. */
15
-
16
- #ifndef BROTLI_ENC_BROTLI_BIT_STREAM_H_
17
- #define BROTLI_ENC_BROTLI_BIT_STREAM_H_
18
-
19
- #include "../common/context.h"
20
- #include "../common/platform.h"
21
- #include <brotli/types.h>
22
- #include "./command.h"
23
- #include "./entropy_encode.h"
24
- #include "./memory.h"
25
- #include "./metablock.h"
26
-
27
- #if defined(__cplusplus) || defined(c_plusplus)
28
- extern "C" {
29
- #endif
30
-
31
- /* All Store functions here will use a storage_ix, which is always the bit
32
- position for the current storage. */
33
-
34
- BROTLI_INTERNAL void BrotliStoreHuffmanTree(const uint8_t* depths, size_t num,
35
- HuffmanTree* tree, size_t* storage_ix, uint8_t* storage);
36
-
37
- BROTLI_INTERNAL void BrotliBuildAndStoreHuffmanTreeFast(
38
- MemoryManager* m, const uint32_t* histogram, const size_t histogram_total,
39
- const size_t max_bits, uint8_t* depth, uint16_t* bits, size_t* storage_ix,
40
- uint8_t* storage);
41
-
42
- /* REQUIRES: length > 0 */
43
- /* REQUIRES: length <= (1 << 24) */
44
- BROTLI_INTERNAL void BrotliStoreMetaBlock(MemoryManager* m,
45
- const uint8_t* input, size_t start_pos, size_t length, size_t mask,
46
- uint8_t prev_byte, uint8_t prev_byte2, BROTLI_BOOL is_last,
47
- const BrotliEncoderParams* params, ContextType literal_context_mode,
48
- const Command* commands, size_t n_commands, const MetaBlockSplit* mb,
49
- size_t* storage_ix, uint8_t* storage);
50
-
51
- /* Stores the meta-block without doing any block splitting, just collects
52
- one histogram per block category and uses that for entropy coding.
53
- REQUIRES: length > 0
54
- REQUIRES: length <= (1 << 24) */
55
- BROTLI_INTERNAL void BrotliStoreMetaBlockTrivial(MemoryManager* m,
56
- const uint8_t* input, size_t start_pos, size_t length, size_t mask,
57
- BROTLI_BOOL is_last, const BrotliEncoderParams* params,
58
- const Command* commands, size_t n_commands,
59
- size_t* storage_ix, uint8_t* storage);
60
-
61
- /* Same as above, but uses static prefix codes for histograms with a only a few
62
- symbols, and uses static code length prefix codes for all other histograms.
63
- REQUIRES: length > 0
64
- REQUIRES: length <= (1 << 24) */
65
- BROTLI_INTERNAL void BrotliStoreMetaBlockFast(MemoryManager* m,
66
- const uint8_t* input, size_t start_pos, size_t length, size_t mask,
67
- BROTLI_BOOL is_last, const BrotliEncoderParams* params,
68
- const Command* commands, size_t n_commands,
69
- size_t* storage_ix, uint8_t* storage);
70
-
71
- /* This is for storing uncompressed blocks (simple raw storage of
72
- bytes-as-bytes).
73
- REQUIRES: length > 0
74
- REQUIRES: length <= (1 << 24) */
75
- BROTLI_INTERNAL void BrotliStoreUncompressedMetaBlock(
76
- BROTLI_BOOL is_final_block, const uint8_t* BROTLI_RESTRICT input,
77
- size_t position, size_t mask, size_t len,
78
- size_t* BROTLI_RESTRICT storage_ix, uint8_t* BROTLI_RESTRICT storage);
79
-
80
- #if defined(__cplusplus) || defined(c_plusplus)
81
- } /* extern "C" */
82
- #endif
83
-
84
- #endif /* BROTLI_ENC_BROTLI_BIT_STREAM_H_ */
@@ -1,56 +0,0 @@
1
- /* Copyright 2013 Google Inc. All Rights Reserved.
2
-
3
- Distributed under MIT license.
4
- See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
- */
6
-
7
- /* Functions for clustering similar histograms together. */
8
-
9
- #include "./cluster.h"
10
-
11
- #include "../common/platform.h"
12
- #include <brotli/types.h>
13
- #include "./bit_cost.h" /* BrotliPopulationCost */
14
- #include "./fast_log.h"
15
- #include "./histogram.h"
16
- #include "./memory.h"
17
-
18
- #if defined(__cplusplus) || defined(c_plusplus)
19
- extern "C" {
20
- #endif
21
-
22
- static BROTLI_INLINE BROTLI_BOOL HistogramPairIsLess(
23
- const HistogramPair* p1, const HistogramPair* p2) {
24
- if (p1->cost_diff != p2->cost_diff) {
25
- return TO_BROTLI_BOOL(p1->cost_diff > p2->cost_diff);
26
- }
27
- return TO_BROTLI_BOOL((p1->idx2 - p1->idx1) > (p2->idx2 - p2->idx1));
28
- }
29
-
30
- /* Returns entropy reduction of the context map when we combine two clusters. */
31
- static BROTLI_INLINE double ClusterCostDiff(size_t size_a, size_t size_b) {
32
- size_t size_c = size_a + size_b;
33
- return (double)size_a * FastLog2(size_a) +
34
- (double)size_b * FastLog2(size_b) -
35
- (double)size_c * FastLog2(size_c);
36
- }
37
-
38
- #define CODE(X) X
39
-
40
- #define FN(X) X ## Literal
41
- #include "./cluster_inc.h" /* NOLINT(build/include) */
42
- #undef FN
43
-
44
- #define FN(X) X ## Command
45
- #include "./cluster_inc.h" /* NOLINT(build/include) */
46
- #undef FN
47
-
48
- #define FN(X) X ## Distance
49
- #include "./cluster_inc.h" /* NOLINT(build/include) */
50
- #undef FN
51
-
52
- #undef CODE
53
-
54
- #if defined(__cplusplus) || defined(c_plusplus)
55
- } /* extern "C" */
56
- #endif
@@ -1,48 +0,0 @@
1
- /* Copyright 2013 Google Inc. All Rights Reserved.
2
-
3
- Distributed under MIT license.
4
- See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
- */
6
-
7
- /* Functions for clustering similar histograms together. */
8
-
9
- #ifndef BROTLI_ENC_CLUSTER_H_
10
- #define BROTLI_ENC_CLUSTER_H_
11
-
12
- #include "../common/platform.h"
13
- #include <brotli/types.h>
14
- #include "./histogram.h"
15
- #include "./memory.h"
16
-
17
- #if defined(__cplusplus) || defined(c_plusplus)
18
- extern "C" {
19
- #endif
20
-
21
- typedef struct HistogramPair {
22
- uint32_t idx1;
23
- uint32_t idx2;
24
- double cost_combo;
25
- double cost_diff;
26
- } HistogramPair;
27
-
28
- #define CODE(X) /* Declaration */;
29
-
30
- #define FN(X) X ## Literal
31
- #include "./cluster_inc.h" /* NOLINT(build/include) */
32
- #undef FN
33
-
34
- #define FN(X) X ## Command
35
- #include "./cluster_inc.h" /* NOLINT(build/include) */
36
- #undef FN
37
-
38
- #define FN(X) X ## Distance
39
- #include "./cluster_inc.h" /* NOLINT(build/include) */
40
- #undef FN
41
-
42
- #undef CODE
43
-
44
- #if defined(__cplusplus) || defined(c_plusplus)
45
- } /* extern "C" */
46
- #endif
47
-
48
- #endif /* BROTLI_ENC_CLUSTER_H_ */
@@ -1,320 +0,0 @@
1
- /* NOLINT(build/header_guard) */
2
- /* Copyright 2013 Google Inc. All Rights Reserved.
3
-
4
- Distributed under MIT license.
5
- See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
6
- */
7
-
8
- /* template parameters: FN, CODE */
9
-
10
- #define HistogramType FN(Histogram)
11
-
12
- /* Computes the bit cost reduction by combining out[idx1] and out[idx2] and if
13
- it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. */
14
- BROTLI_INTERNAL void FN(BrotliCompareAndPushToQueue)(
15
- const HistogramType* out, const uint32_t* cluster_size, uint32_t idx1,
16
- uint32_t idx2, size_t max_num_pairs, HistogramPair* pairs,
17
- size_t* num_pairs) CODE({
18
- BROTLI_BOOL is_good_pair = BROTLI_FALSE;
19
- HistogramPair p;
20
- p.idx1 = p.idx2 = 0;
21
- p.cost_diff = p.cost_combo = 0;
22
- if (idx1 == idx2) {
23
- return;
24
- }
25
- if (idx2 < idx1) {
26
- uint32_t t = idx2;
27
- idx2 = idx1;
28
- idx1 = t;
29
- }
30
- p.idx1 = idx1;
31
- p.idx2 = idx2;
32
- p.cost_diff = 0.5 * ClusterCostDiff(cluster_size[idx1], cluster_size[idx2]);
33
- p.cost_diff -= out[idx1].bit_cost_;
34
- p.cost_diff -= out[idx2].bit_cost_;
35
-
36
- if (out[idx1].total_count_ == 0) {
37
- p.cost_combo = out[idx2].bit_cost_;
38
- is_good_pair = BROTLI_TRUE;
39
- } else if (out[idx2].total_count_ == 0) {
40
- p.cost_combo = out[idx1].bit_cost_;
41
- is_good_pair = BROTLI_TRUE;
42
- } else {
43
- double threshold = *num_pairs == 0 ? 1e99 :
44
- BROTLI_MAX(double, 0.0, pairs[0].cost_diff);
45
- HistogramType combo = out[idx1];
46
- double cost_combo;
47
- FN(HistogramAddHistogram)(&combo, &out[idx2]);
48
- cost_combo = FN(BrotliPopulationCost)(&combo);
49
- if (cost_combo < threshold - p.cost_diff) {
50
- p.cost_combo = cost_combo;
51
- is_good_pair = BROTLI_TRUE;
52
- }
53
- }
54
- if (is_good_pair) {
55
- p.cost_diff += p.cost_combo;
56
- if (*num_pairs > 0 && HistogramPairIsLess(&pairs[0], &p)) {
57
- /* Replace the top of the queue if needed. */
58
- if (*num_pairs < max_num_pairs) {
59
- pairs[*num_pairs] = pairs[0];
60
- ++(*num_pairs);
61
- }
62
- pairs[0] = p;
63
- } else if (*num_pairs < max_num_pairs) {
64
- pairs[*num_pairs] = p;
65
- ++(*num_pairs);
66
- }
67
- }
68
- })
69
-
70
- BROTLI_INTERNAL size_t FN(BrotliHistogramCombine)(HistogramType* out,
71
- uint32_t* cluster_size,
72
- uint32_t* symbols,
73
- uint32_t* clusters,
74
- HistogramPair* pairs,
75
- size_t num_clusters,
76
- size_t symbols_size,
77
- size_t max_clusters,
78
- size_t max_num_pairs) CODE({
79
- double cost_diff_threshold = 0.0;
80
- size_t min_cluster_size = 1;
81
- size_t num_pairs = 0;
82
-
83
- {
84
- /* We maintain a vector of histogram pairs, with the property that the pair
85
- with the maximum bit cost reduction is the first. */
86
- size_t idx1;
87
- for (idx1 = 0; idx1 < num_clusters; ++idx1) {
88
- size_t idx2;
89
- for (idx2 = idx1 + 1; idx2 < num_clusters; ++idx2) {
90
- FN(BrotliCompareAndPushToQueue)(out, cluster_size, clusters[idx1],
91
- clusters[idx2], max_num_pairs, &pairs[0], &num_pairs);
92
- }
93
- }
94
- }
95
-
96
- while (num_clusters > min_cluster_size) {
97
- uint32_t best_idx1;
98
- uint32_t best_idx2;
99
- size_t i;
100
- if (pairs[0].cost_diff >= cost_diff_threshold) {
101
- cost_diff_threshold = 1e99;
102
- min_cluster_size = max_clusters;
103
- continue;
104
- }
105
- /* Take the best pair from the top of heap. */
106
- best_idx1 = pairs[0].idx1;
107
- best_idx2 = pairs[0].idx2;
108
- FN(HistogramAddHistogram)(&out[best_idx1], &out[best_idx2]);
109
- out[best_idx1].bit_cost_ = pairs[0].cost_combo;
110
- cluster_size[best_idx1] += cluster_size[best_idx2];
111
- for (i = 0; i < symbols_size; ++i) {
112
- if (symbols[i] == best_idx2) {
113
- symbols[i] = best_idx1;
114
- }
115
- }
116
- for (i = 0; i < num_clusters; ++i) {
117
- if (clusters[i] == best_idx2) {
118
- memmove(&clusters[i], &clusters[i + 1],
119
- (num_clusters - i - 1) * sizeof(clusters[0]));
120
- break;
121
- }
122
- }
123
- --num_clusters;
124
- {
125
- /* Remove pairs intersecting the just combined best pair. */
126
- size_t copy_to_idx = 0;
127
- for (i = 0; i < num_pairs; ++i) {
128
- HistogramPair* p = &pairs[i];
129
- if (p->idx1 == best_idx1 || p->idx2 == best_idx1 ||
130
- p->idx1 == best_idx2 || p->idx2 == best_idx2) {
131
- /* Remove invalid pair from the queue. */
132
- continue;
133
- }
134
- if (HistogramPairIsLess(&pairs[0], p)) {
135
- /* Replace the top of the queue if needed. */
136
- HistogramPair front = pairs[0];
137
- pairs[0] = *p;
138
- pairs[copy_to_idx] = front;
139
- } else {
140
- pairs[copy_to_idx] = *p;
141
- }
142
- ++copy_to_idx;
143
- }
144
- num_pairs = copy_to_idx;
145
- }
146
-
147
- /* Push new pairs formed with the combined histogram to the heap. */
148
- for (i = 0; i < num_clusters; ++i) {
149
- FN(BrotliCompareAndPushToQueue)(out, cluster_size, best_idx1, clusters[i],
150
- max_num_pairs, &pairs[0], &num_pairs);
151
- }
152
- }
153
- return num_clusters;
154
- })
155
-
156
- /* What is the bit cost of moving histogram from cur_symbol to candidate. */
157
- BROTLI_INTERNAL double FN(BrotliHistogramBitCostDistance)(
158
- const HistogramType* histogram, const HistogramType* candidate) CODE({
159
- if (histogram->total_count_ == 0) {
160
- return 0.0;
161
- } else {
162
- HistogramType tmp = *histogram;
163
- FN(HistogramAddHistogram)(&tmp, candidate);
164
- return FN(BrotliPopulationCost)(&tmp) - candidate->bit_cost_;
165
- }
166
- })
167
-
168
- /* Find the best 'out' histogram for each of the 'in' histograms.
169
- When called, clusters[0..num_clusters) contains the unique values from
170
- symbols[0..in_size), but this property is not preserved in this function.
171
- Note: we assume that out[]->bit_cost_ is already up-to-date. */
172
- BROTLI_INTERNAL void FN(BrotliHistogramRemap)(const HistogramType* in,
173
- size_t in_size, const uint32_t* clusters, size_t num_clusters,
174
- HistogramType* out, uint32_t* symbols) CODE({
175
- size_t i;
176
- for (i = 0; i < in_size; ++i) {
177
- uint32_t best_out = i == 0 ? symbols[0] : symbols[i - 1];
178
- double best_bits =
179
- FN(BrotliHistogramBitCostDistance)(&in[i], &out[best_out]);
180
- size_t j;
181
- for (j = 0; j < num_clusters; ++j) {
182
- const double cur_bits =
183
- FN(BrotliHistogramBitCostDistance)(&in[i], &out[clusters[j]]);
184
- if (cur_bits < best_bits) {
185
- best_bits = cur_bits;
186
- best_out = clusters[j];
187
- }
188
- }
189
- symbols[i] = best_out;
190
- }
191
-
192
- /* Recompute each out based on raw and symbols. */
193
- for (i = 0; i < num_clusters; ++i) {
194
- FN(HistogramClear)(&out[clusters[i]]);
195
- }
196
- for (i = 0; i < in_size; ++i) {
197
- FN(HistogramAddHistogram)(&out[symbols[i]], &in[i]);
198
- }
199
- })
200
-
201
- /* Reorders elements of the out[0..length) array and changes values in
202
- symbols[0..length) array in the following way:
203
- * when called, symbols[] contains indexes into out[], and has N unique
204
- values (possibly N < length)
205
- * on return, symbols'[i] = f(symbols[i]) and
206
- out'[symbols'[i]] = out[symbols[i]], for each 0 <= i < length,
207
- where f is a bijection between the range of symbols[] and [0..N), and
208
- the first occurrences of values in symbols'[i] come in consecutive
209
- increasing order.
210
- Returns N, the number of unique values in symbols[]. */
211
- BROTLI_INTERNAL size_t FN(BrotliHistogramReindex)(MemoryManager* m,
212
- HistogramType* out, uint32_t* symbols, size_t length) CODE({
213
- static const uint32_t kInvalidIndex = BROTLI_UINT32_MAX;
214
- uint32_t* new_index = BROTLI_ALLOC(m, uint32_t, length);
215
- uint32_t next_index;
216
- HistogramType* tmp;
217
- size_t i;
218
- if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_index)) return 0;
219
- for (i = 0; i < length; ++i) {
220
- new_index[i] = kInvalidIndex;
221
- }
222
- next_index = 0;
223
- for (i = 0; i < length; ++i) {
224
- if (new_index[symbols[i]] == kInvalidIndex) {
225
- new_index[symbols[i]] = next_index;
226
- ++next_index;
227
- }
228
- }
229
- /* TODO: by using idea of "cycle-sort" we can avoid allocation of
230
- tmp and reduce the number of copying by the factor of 2. */
231
- tmp = BROTLI_ALLOC(m, HistogramType, next_index);
232
- if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(tmp)) return 0;
233
- next_index = 0;
234
- for (i = 0; i < length; ++i) {
235
- if (new_index[symbols[i]] == next_index) {
236
- tmp[next_index] = out[symbols[i]];
237
- ++next_index;
238
- }
239
- symbols[i] = new_index[symbols[i]];
240
- }
241
- BROTLI_FREE(m, new_index);
242
- for (i = 0; i < next_index; ++i) {
243
- out[i] = tmp[i];
244
- }
245
- BROTLI_FREE(m, tmp);
246
- return next_index;
247
- })
248
-
249
- BROTLI_INTERNAL void FN(BrotliClusterHistograms)(
250
- MemoryManager* m, const HistogramType* in, const size_t in_size,
251
- size_t max_histograms, HistogramType* out, size_t* out_size,
252
- uint32_t* histogram_symbols) CODE({
253
- uint32_t* cluster_size = BROTLI_ALLOC(m, uint32_t, in_size);
254
- uint32_t* clusters = BROTLI_ALLOC(m, uint32_t, in_size);
255
- size_t num_clusters = 0;
256
- const size_t max_input_histograms = 64;
257
- size_t pairs_capacity = max_input_histograms * max_input_histograms / 2;
258
- /* For the first pass of clustering, we allow all pairs. */
259
- HistogramPair* pairs = BROTLI_ALLOC(m, HistogramPair, pairs_capacity + 1);
260
- size_t i;
261
-
262
- if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(cluster_size) ||
263
- BROTLI_IS_NULL(clusters) || BROTLI_IS_NULL(pairs)) {
264
- return;
265
- }
266
-
267
- for (i = 0; i < in_size; ++i) {
268
- cluster_size[i] = 1;
269
- }
270
-
271
- for (i = 0; i < in_size; ++i) {
272
- out[i] = in[i];
273
- out[i].bit_cost_ = FN(BrotliPopulationCost)(&in[i]);
274
- histogram_symbols[i] = (uint32_t)i;
275
- }
276
-
277
- for (i = 0; i < in_size; i += max_input_histograms) {
278
- size_t num_to_combine =
279
- BROTLI_MIN(size_t, in_size - i, max_input_histograms);
280
- size_t num_new_clusters;
281
- size_t j;
282
- for (j = 0; j < num_to_combine; ++j) {
283
- clusters[num_clusters + j] = (uint32_t)(i + j);
284
- }
285
- num_new_clusters =
286
- FN(BrotliHistogramCombine)(out, cluster_size,
287
- &histogram_symbols[i],
288
- &clusters[num_clusters], pairs,
289
- num_to_combine, num_to_combine,
290
- max_histograms, pairs_capacity);
291
- num_clusters += num_new_clusters;
292
- }
293
-
294
- {
295
- /* For the second pass, we limit the total number of histogram pairs.
296
- After this limit is reached, we only keep searching for the best pair. */
297
- size_t max_num_pairs = BROTLI_MIN(size_t,
298
- 64 * num_clusters, (num_clusters / 2) * num_clusters);
299
- BROTLI_ENSURE_CAPACITY(
300
- m, HistogramPair, pairs, pairs_capacity, max_num_pairs + 1);
301
- if (BROTLI_IS_OOM(m)) return;
302
-
303
- /* Collapse similar histograms. */
304
- num_clusters = FN(BrotliHistogramCombine)(out, cluster_size,
305
- histogram_symbols, clusters,
306
- pairs, num_clusters, in_size,
307
- max_histograms, max_num_pairs);
308
- }
309
- BROTLI_FREE(m, pairs);
310
- BROTLI_FREE(m, cluster_size);
311
- /* Find the optimal map from original histograms to the final ones. */
312
- FN(BrotliHistogramRemap)(in, in_size, clusters, num_clusters,
313
- out, histogram_symbols);
314
- BROTLI_FREE(m, clusters);
315
- /* Convert the context map to a canonical form. */
316
- *out_size = FN(BrotliHistogramReindex)(m, out, histogram_symbols, in_size);
317
- if (BROTLI_IS_OOM(m)) return;
318
- })
319
-
320
- #undef HistogramType
@@ -1,28 +0,0 @@
1
- /* Copyright 2013 Google Inc. All Rights Reserved.
2
-
3
- Distributed under MIT license.
4
- See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
- */
6
-
7
- #include "./command.h"
8
-
9
- #include <brotli/types.h>
10
-
11
- #if defined(__cplusplus) || defined(c_plusplus)
12
- extern "C" {
13
- #endif
14
-
15
- const uint32_t kBrotliInsBase[BROTLI_NUM_INS_COPY_CODES] = {
16
- 0, 1, 2, 3, 4, 5, 6, 8, 10, 14, 18, 26,
17
- 34, 50, 66, 98, 130, 194, 322, 578, 1090, 2114, 6210, 22594};
18
- const uint32_t kBrotliInsExtra[BROTLI_NUM_INS_COPY_CODES] = {
19
- 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 12, 14, 24};
20
- const uint32_t kBrotliCopyBase[BROTLI_NUM_INS_COPY_CODES] = {
21
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 18,
22
- 22, 30, 38, 54, 70, 102, 134, 198, 326, 582, 1094, 2118};
23
- const uint32_t kBrotliCopyExtra[BROTLI_NUM_INS_COPY_CODES] = {
24
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 24};
25
-
26
- #if defined(__cplusplus) || defined(c_plusplus)
27
- } /* extern "C" */
28
- #endif