brotli 1.2.0__tar.gz

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 (200) hide show
  1. brotli-1.2.0/CONTRIBUTING.md +32 -0
  2. brotli-1.2.0/LICENSE +19 -0
  3. brotli-1.2.0/MANIFEST.in +19 -0
  4. brotli-1.2.0/PKG-INFO +158 -0
  5. brotli-1.2.0/README +15 -0
  6. brotli-1.2.0/README.md +114 -0
  7. brotli-1.2.0/c/common/constants.c +15 -0
  8. brotli-1.2.0/c/common/constants.h +198 -0
  9. brotli-1.2.0/c/common/context.c +156 -0
  10. brotli-1.2.0/c/common/context.h +112 -0
  11. brotli-1.2.0/c/common/dictionary.c +64 -0
  12. brotli-1.2.0/c/common/dictionary.h +63 -0
  13. brotli-1.2.0/c/common/dictionary_inc.h +5847 -0
  14. brotli-1.2.0/c/common/platform.c +19 -0
  15. brotli-1.2.0/c/common/platform.h +680 -0
  16. brotli-1.2.0/c/common/shared_dictionary.c +517 -0
  17. brotli-1.2.0/c/common/shared_dictionary_internal.h +75 -0
  18. brotli-1.2.0/c/common/static_init.h +56 -0
  19. brotli-1.2.0/c/common/transform.c +293 -0
  20. brotli-1.2.0/c/common/transform.h +84 -0
  21. brotli-1.2.0/c/common/version.h +51 -0
  22. brotli-1.2.0/c/dec/bit_reader.c +77 -0
  23. brotli-1.2.0/c/dec/bit_reader.h +419 -0
  24. brotli-1.2.0/c/dec/decode.c +2964 -0
  25. brotli-1.2.0/c/dec/huffman.c +339 -0
  26. brotli-1.2.0/c/dec/huffman.h +120 -0
  27. brotli-1.2.0/c/dec/prefix.c +67 -0
  28. brotli-1.2.0/c/dec/prefix.h +43 -0
  29. brotli-1.2.0/c/dec/prefix_inc.h +707 -0
  30. brotli-1.2.0/c/dec/state.c +186 -0
  31. brotli-1.2.0/c/dec/state.h +396 -0
  32. brotli-1.2.0/c/dec/static_init.c +53 -0
  33. brotli-1.2.0/c/dec/static_init.h +30 -0
  34. brotli-1.2.0/c/enc/backward_references.c +231 -0
  35. brotli-1.2.0/c/enc/backward_references.h +36 -0
  36. brotli-1.2.0/c/enc/backward_references_hq.c +939 -0
  37. brotli-1.2.0/c/enc/backward_references_hq.h +92 -0
  38. brotli-1.2.0/c/enc/backward_references_inc.h +189 -0
  39. brotli-1.2.0/c/enc/bit_cost.c +60 -0
  40. brotli-1.2.0/c/enc/bit_cost.h +32 -0
  41. brotli-1.2.0/c/enc/bit_cost_inc.h +127 -0
  42. brotli-1.2.0/c/enc/block_encoder_inc.h +34 -0
  43. brotli-1.2.0/c/enc/block_splitter.c +214 -0
  44. brotli-1.2.0/c/enc/block_splitter.h +49 -0
  45. brotli-1.2.0/c/enc/block_splitter_inc.h +487 -0
  46. brotli-1.2.0/c/enc/brotli_bit_stream.c +1337 -0
  47. brotli-1.2.0/c/enc/brotli_bit_stream.h +83 -0
  48. brotli-1.2.0/c/enc/cluster.c +55 -0
  49. brotli-1.2.0/c/enc/cluster.h +47 -0
  50. brotli-1.2.0/c/enc/cluster_inc.h +325 -0
  51. brotli-1.2.0/c/enc/command.c +28 -0
  52. brotli-1.2.0/c/enc/command.h +189 -0
  53. brotli-1.2.0/c/enc/compound_dictionary.c +205 -0
  54. brotli-1.2.0/c/enc/compound_dictionary.h +71 -0
  55. brotli-1.2.0/c/enc/compress_fragment.c +790 -0
  56. brotli-1.2.0/c/enc/compress_fragment.h +84 -0
  57. brotli-1.2.0/c/enc/compress_fragment_two_pass.c +647 -0
  58. brotli-1.2.0/c/enc/compress_fragment_two_pass.h +70 -0
  59. brotli-1.2.0/c/enc/dictionary_hash.c +145 -0
  60. brotli-1.2.0/c/enc/dictionary_hash.h +45 -0
  61. brotli-1.2.0/c/enc/dictionary_hash_inc.h +1829 -0
  62. brotli-1.2.0/c/enc/encode.c +2021 -0
  63. brotli-1.2.0/c/enc/encoder_dict.c +642 -0
  64. brotli-1.2.0/c/enc/encoder_dict.h +155 -0
  65. brotli-1.2.0/c/enc/entropy_encode.c +501 -0
  66. brotli-1.2.0/c/enc/entropy_encode.h +121 -0
  67. brotli-1.2.0/c/enc/entropy_encode_static.h +548 -0
  68. brotli-1.2.0/c/enc/fast_log.c +105 -0
  69. brotli-1.2.0/c/enc/fast_log.h +66 -0
  70. brotli-1.2.0/c/enc/find_match_length.h +70 -0
  71. brotli-1.2.0/c/enc/hash.h +735 -0
  72. brotli-1.2.0/c/enc/hash_base.h +38 -0
  73. brotli-1.2.0/c/enc/hash_composite_inc.h +140 -0
  74. brotli-1.2.0/c/enc/hash_forgetful_chain_inc.h +305 -0
  75. brotli-1.2.0/c/enc/hash_longest_match64_inc.h +279 -0
  76. brotli-1.2.0/c/enc/hash_longest_match64_simd_inc.h +304 -0
  77. brotli-1.2.0/c/enc/hash_longest_match_inc.h +277 -0
  78. brotli-1.2.0/c/enc/hash_longest_match_quickly_inc.h +270 -0
  79. brotli-1.2.0/c/enc/hash_longest_match_simd_inc.h +278 -0
  80. brotli-1.2.0/c/enc/hash_rolling_inc.h +212 -0
  81. brotli-1.2.0/c/enc/hash_to_binary_tree_inc.h +330 -0
  82. brotli-1.2.0/c/enc/histogram.c +101 -0
  83. brotli-1.2.0/c/enc/histogram.h +60 -0
  84. brotli-1.2.0/c/enc/histogram_inc.h +51 -0
  85. brotli-1.2.0/c/enc/literal_cost.c +178 -0
  86. brotli-1.2.0/c/enc/literal_cost.h +30 -0
  87. brotli-1.2.0/c/enc/matching_tag_mask.h +69 -0
  88. brotli-1.2.0/c/enc/memory.c +189 -0
  89. brotli-1.2.0/c/enc/memory.h +127 -0
  90. brotli-1.2.0/c/enc/metablock.c +675 -0
  91. brotli-1.2.0/c/enc/metablock.h +106 -0
  92. brotli-1.2.0/c/enc/metablock_inc.h +185 -0
  93. brotli-1.2.0/c/enc/params.h +46 -0
  94. brotli-1.2.0/c/enc/prefix.h +52 -0
  95. brotli-1.2.0/c/enc/quality.h +209 -0
  96. brotli-1.2.0/c/enc/ringbuffer.h +165 -0
  97. brotli-1.2.0/c/enc/state.h +104 -0
  98. brotli-1.2.0/c/enc/static_dict.c +536 -0
  99. brotli-1.2.0/c/enc/static_dict.h +39 -0
  100. brotli-1.2.0/c/enc/static_dict_lut.c +224 -0
  101. brotli-1.2.0/c/enc/static_dict_lut.h +49 -0
  102. brotli-1.2.0/c/enc/static_dict_lut_inc.h +5830 -0
  103. brotli-1.2.0/c/enc/static_init.c +59 -0
  104. brotli-1.2.0/c/enc/static_init.h +30 -0
  105. brotli-1.2.0/c/enc/utf8_util.c +85 -0
  106. brotli-1.2.0/c/enc/utf8_util.h +31 -0
  107. brotli-1.2.0/c/enc/write_bits.h +86 -0
  108. brotli-1.2.0/c/include/brotli/decode.h +409 -0
  109. brotli-1.2.0/c/include/brotli/encode.h +505 -0
  110. brotli-1.2.0/c/include/brotli/port.h +302 -0
  111. brotli-1.2.0/c/include/brotli/shared_dictionary.h +100 -0
  112. brotli-1.2.0/c/include/brotli/types.h +83 -0
  113. brotli-1.2.0/c/tools/brotli.c +1559 -0
  114. brotli-1.2.0/pyproject.toml +3 -0
  115. brotli-1.2.0/python/README.md +64 -0
  116. brotli-1.2.0/python/_brotli.c +1164 -0
  117. brotli-1.2.0/python/bro.py +194 -0
  118. brotli-1.2.0/python/brotli.egg-info/PKG-INFO +158 -0
  119. brotli-1.2.0/python/brotli.egg-info/SOURCES.txt +199 -0
  120. brotli-1.2.0/python/brotli.egg-info/dependency_links.txt +1 -0
  121. brotli-1.2.0/python/brotli.egg-info/top_level.txt +2 -0
  122. brotli-1.2.0/python/brotli.py +57 -0
  123. brotli-1.2.0/python/tests/__init__.py +0 -0
  124. brotli-1.2.0/python/tests/_test_utils.py +153 -0
  125. brotli-1.2.0/python/tests/bro_test.py +104 -0
  126. brotli-1.2.0/python/tests/compress_test.py +41 -0
  127. brotli-1.2.0/python/tests/compressor_test.py +100 -0
  128. brotli-1.2.0/python/tests/decompress_test.py +43 -0
  129. brotli-1.2.0/python/tests/decompressor_test.py +118 -0
  130. brotli-1.2.0/setup.cfg +10 -0
  131. brotli-1.2.0/setup.py +354 -0
  132. brotli-1.2.0/tests/testdata/10x10y +1 -0
  133. brotli-1.2.0/tests/testdata/10x10y.compressed +0 -0
  134. brotli-1.2.0/tests/testdata/64x +1 -0
  135. brotli-1.2.0/tests/testdata/64x.compressed +0 -0
  136. brotli-1.2.0/tests/testdata/alice29.txt +3609 -0
  137. brotli-1.2.0/tests/testdata/alice29.txt.compressed +0 -0
  138. brotli-1.2.0/tests/testdata/asyoulik.txt +4122 -0
  139. brotli-1.2.0/tests/testdata/asyoulik.txt.compressed +0 -0
  140. brotli-1.2.0/tests/testdata/backward65536 +0 -0
  141. brotli-1.2.0/tests/testdata/backward65536.compressed +0 -0
  142. brotli-1.2.0/tests/testdata/bb.binast +0 -0
  143. brotli-1.2.0/tests/testdata/compressed_file +0 -0
  144. brotli-1.2.0/tests/testdata/compressed_file.compressed +0 -0
  145. brotli-1.2.0/tests/testdata/compressed_repeated +0 -0
  146. brotli-1.2.0/tests/testdata/compressed_repeated.compressed +0 -0
  147. brotli-1.2.0/tests/testdata/cp1251-utf16le +0 -0
  148. brotli-1.2.0/tests/testdata/cp1251-utf16le.compressed +0 -0
  149. brotli-1.2.0/tests/testdata/cp852-utf8 +12 -0
  150. brotli-1.2.0/tests/testdata/cp852-utf8.compressed +0 -0
  151. brotli-1.2.0/tests/testdata/empty +0 -0
  152. brotli-1.2.0/tests/testdata/empty.compressed +1 -0
  153. brotli-1.2.0/tests/testdata/empty.compressed.00 +1 -0
  154. brotli-1.2.0/tests/testdata/empty.compressed.01 +1 -0
  155. brotli-1.2.0/tests/testdata/empty.compressed.02 +1 -0
  156. brotli-1.2.0/tests/testdata/empty.compressed.03 +1 -0
  157. brotli-1.2.0/tests/testdata/empty.compressed.04 +1 -0
  158. brotli-1.2.0/tests/testdata/empty.compressed.05 +1 -0
  159. brotli-1.2.0/tests/testdata/empty.compressed.06 +1 -0
  160. brotli-1.2.0/tests/testdata/empty.compressed.07 +1 -0
  161. brotli-1.2.0/tests/testdata/empty.compressed.08 +1 -0
  162. brotli-1.2.0/tests/testdata/empty.compressed.09 +1 -0
  163. brotli-1.2.0/tests/testdata/empty.compressed.10 +1 -0
  164. brotli-1.2.0/tests/testdata/empty.compressed.11 +1 -0
  165. brotli-1.2.0/tests/testdata/empty.compressed.12 +1 -0
  166. brotli-1.2.0/tests/testdata/empty.compressed.13 +1 -0
  167. brotli-1.2.0/tests/testdata/empty.compressed.14 +1 -0
  168. brotli-1.2.0/tests/testdata/empty.compressed.15 +1 -0
  169. brotli-1.2.0/tests/testdata/empty.compressed.16 +0 -0
  170. brotli-1.2.0/tests/testdata/empty.compressed.17 +1 -0
  171. brotli-1.2.0/tests/testdata/empty.compressed.18 +0 -0
  172. brotli-1.2.0/tests/testdata/lcet10.txt +7519 -0
  173. brotli-1.2.0/tests/testdata/lcet10.txt.compressed +0 -0
  174. brotli-1.2.0/tests/testdata/mapsdatazrh +0 -0
  175. brotli-1.2.0/tests/testdata/mapsdatazrh.compressed +0 -0
  176. brotli-1.2.0/tests/testdata/monkey +1 -0
  177. brotli-1.2.0/tests/testdata/monkey.compressed +0 -0
  178. brotli-1.2.0/tests/testdata/plrabn12.txt +10699 -0
  179. brotli-1.2.0/tests/testdata/plrabn12.txt.compressed +0 -0
  180. brotli-1.2.0/tests/testdata/quickfox +1 -0
  181. brotli-1.2.0/tests/testdata/quickfox.compressed +1 -0
  182. brotli-1.2.0/tests/testdata/quickfox_repeated +1 -0
  183. brotli-1.2.0/tests/testdata/quickfox_repeated.compressed +2 -0
  184. brotli-1.2.0/tests/testdata/random_chunks +0 -0
  185. brotli-1.2.0/tests/testdata/random_org_10k.bin +0 -0
  186. brotli-1.2.0/tests/testdata/random_org_10k.bin.compressed +0 -0
  187. brotli-1.2.0/tests/testdata/ukkonooa +1 -0
  188. brotli-1.2.0/tests/testdata/ukkonooa.compressed +0 -0
  189. brotli-1.2.0/tests/testdata/x +1 -0
  190. brotli-1.2.0/tests/testdata/x.compressed +0 -0
  191. brotli-1.2.0/tests/testdata/x.compressed.00 +0 -0
  192. brotli-1.2.0/tests/testdata/x.compressed.01 +0 -0
  193. brotli-1.2.0/tests/testdata/x.compressed.02 +0 -0
  194. brotli-1.2.0/tests/testdata/x.compressed.03 +0 -0
  195. brotli-1.2.0/tests/testdata/xyzzy +1 -0
  196. brotli-1.2.0/tests/testdata/xyzzy.compressed +1 -0
  197. brotli-1.2.0/tests/testdata/zeros +0 -0
  198. brotli-1.2.0/tests/testdata/zeros.compressed +0 -0
  199. brotli-1.2.0/tests/testdata/zerosukkanooa +0 -0
  200. brotli-1.2.0/tests/testdata/zerosukkanooa.compressed +0 -0
@@ -0,0 +1,32 @@
1
+ Want to contribute? Great! First, read this page (including the small print at
2
+ the end).
3
+
4
+ ### Before you contribute
5
+ Before we can use your code, you must sign the
6
+ [Google Individual Contributor License Agreement]
7
+ (https://cla.developers.google.com/about/google-individual)
8
+ (CLA), which you can do online. The CLA is necessary mainly because you own the
9
+ copyright to your changes, even after your contribution becomes part of our
10
+ codebase, so we need your permission to use and distribute your code. We also
11
+ need to be sure of various other things—for instance that you'll tell us if you
12
+ know that your code infringes on other people's patents. You don't have to sign
13
+ the CLA until after you've submitted your code for review and a member has
14
+ approved it, but you must do it before we can put your code into our codebase.
15
+ Before you start working on a larger contribution, you should get in touch with
16
+ us first through the issue tracker with your idea so that we can help out and
17
+ possibly guide you. Coordinating up front makes it much easier to avoid
18
+ frustration later on.
19
+
20
+ ### Code reviews
21
+ All submissions, including submissions by project members, require review. We
22
+ use Github pull requests for this purpose.
23
+
24
+ ### Code style
25
+ Code should follow applicable formatting and style guides described in
26
+ [Google Style Guides](https://google.github.io/styleguide/). C code should be
27
+ C89 compatible.
28
+
29
+ ### The small print
30
+ Contributions made by corporations are covered by a different agreement than
31
+ the one above, the [Software Grant and Corporate Contributor License Agreement]
32
+ (https://cla.developers.google.com/about/google-corporate).
brotli-1.2.0/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ include CONTRIBUTING.md
2
+ include c/common/*.c
3
+ include c/common/*.h
4
+ include c/dec/*.c
5
+ include c/dec/*.h
6
+ include c/enc/*.c
7
+ include c/enc/*.h
8
+ include c/include/brotli/*.h
9
+ include LICENSE
10
+ include MANIFEST.in
11
+ include python/_brotli.cc
12
+ include python/bro.py
13
+ include python/brotli.py
14
+ include python/README.md
15
+ include python/tests/*
16
+ include README.md
17
+ include setup.py
18
+ include tests/testdata/*
19
+ include c/tools/brotli.c
brotli-1.2.0/PKG-INFO ADDED
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.4
2
+ Name: brotli
3
+ Version: 1.2.0
4
+ Summary: Python bindings for the Brotli compression library
5
+ Home-page: https://github.com/google/brotli
6
+ Author: The Brotli Authors
7
+ License: MIT
8
+ Platform: Posix
9
+ Platform: MacOS X
10
+ Platform: Windows
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: C
18
+ Classifier: Programming Language :: C++
19
+ Classifier: Programming Language :: Python
20
+ Classifier: Programming Language :: Python :: 2
21
+ Classifier: Programming Language :: Python :: 2.7
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.3
24
+ Classifier: Programming Language :: Python :: 3.4
25
+ Classifier: Programming Language :: Python :: 3.5
26
+ Classifier: Programming Language :: Unix Shell
27
+ Classifier: Topic :: Software Development :: Libraries
28
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
29
+ Classifier: Topic :: System :: Archiving
30
+ Classifier: Topic :: System :: Archiving :: Compression
31
+ Classifier: Topic :: Text Processing :: Fonts
32
+ Classifier: Topic :: Utilities
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Dynamic: author
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: license
41
+ Dynamic: license-file
42
+ Dynamic: platform
43
+ Dynamic: summary
44
+
45
+ <p align="center">
46
+ <img src="https://github.com/google/brotli/actions/workflows/build_test.yml/badge.svg" alt="GitHub Actions Build Status" href="https://github.com/google/brotli/actions?query=branch%3Amaster">
47
+ <img src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/brotli.svg" alt="Fuzzing Status" href="https://oss-fuzz-build-logs.storage.googleapis.com/index.html#brotli">
48
+ </p>
49
+ <p align="center"><img src="https://brotli.org/brotli.svg" alt="Brotli" width="64"></p>
50
+
51
+ ### Introduction
52
+
53
+ Brotli is a generic-purpose lossless compression algorithm that compresses data
54
+ using a combination of a modern variant of the LZ77 algorithm, Huffman coding
55
+ and 2nd order context modeling, with a compression ratio comparable to the best
56
+ currently available general-purpose compression methods. It is similar in speed
57
+ with deflate but offers more dense compression.
58
+
59
+ The specification of the Brotli Compressed Data Format is defined in
60
+ [RFC 7932](https://datatracker.ietf.org/doc/html/rfc7932).
61
+
62
+ Brotli is open-sourced under the MIT License, see the LICENSE file.
63
+
64
+ > **Please note:** brotli is a "stream" format; it does not contain
65
+ > meta-information, like checksums or uncompressed data length. It is possible
66
+ > to modify "raw" ranges of the compressed stream and the decoder will not
67
+ > notice that.
68
+
69
+ ### Installation
70
+
71
+ In most Linux distributions, installing `brotli` is just a matter of using
72
+ the package management system. For example in Debian-based distributions:
73
+ `apt install brotli` will install `brotli`. On MacOS, you can use
74
+ [Homebrew](https://brew.sh/): `brew install brotli`.
75
+
76
+ [![brotli packaging status](https://repology.org/badge/vertical-allrepos/brotli.svg?exclude_unsupported=1&columns=3&exclude_sources=modules,site&header=brotli%20packaging%20status)](https://repology.org/project/brotli/versions)
77
+
78
+ Of course you can also build brotli from sources.
79
+
80
+ ### Build instructions
81
+
82
+ #### Vcpkg
83
+
84
+ You can download and install brotli using the
85
+ [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
86
+
87
+ git clone https://github.com/Microsoft/vcpkg.git
88
+ cd vcpkg
89
+ ./bootstrap-vcpkg.sh
90
+ ./vcpkg integrate install
91
+ ./vcpkg install brotli
92
+
93
+ The brotli port in vcpkg is kept up to date by Microsoft team members and
94
+ community contributors. If the version is out of date, please [create an issue
95
+ or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
96
+
97
+ #### Bazel
98
+
99
+ See [Bazel](https://www.bazel.build/)
100
+
101
+ #### CMake
102
+
103
+ The basic commands to build and install brotli are:
104
+
105
+ $ mkdir out && cd out
106
+ $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
107
+ $ cmake --build . --config Release --target install
108
+
109
+ You can use other [CMake](https://cmake.org/) configuration.
110
+
111
+ #### Python
112
+
113
+ To install the latest release of the Python module, run the following:
114
+
115
+ $ pip install brotli
116
+
117
+ To install the tip-of-the-tree version, run:
118
+
119
+ $ pip install --upgrade git+https://github.com/google/brotli
120
+
121
+ See the [Python readme](python/README.md) for more details on installing
122
+ from source, development, and testing.
123
+
124
+ ### Contributing
125
+
126
+ We glad to answer/library related questions in
127
+ [brotli mailing list](https://groups.google.com/g/brotli).
128
+
129
+ Regular issues / feature requests should be reported in
130
+ [issue tracker](https://github.com/google/brotli/issues).
131
+
132
+ For reporting vulnerability please read [SECURITY](SECURITY.md).
133
+
134
+ For contributing changes please read [CONTRIBUTING](CONTRIBUTING.md).
135
+
136
+ ### Benchmarks
137
+ * [Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/) / [Unstable Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/unstable/)
138
+ * [Large Text Compression Benchmark](https://mattmahoney.net/dc/text.html)
139
+ * [Lzturbo Benchmark](https://sites.google.com/site/powturbo/home/benchmark)
140
+
141
+ ### Related projects
142
+ > **Disclaimer:** Brotli authors take no responsibility for the third party projects mentioned in this section.
143
+
144
+ Independent [decoder](https://github.com/madler/brotli) implementation
145
+ by Mark Adler, based entirely on format specification.
146
+
147
+ JavaScript port of brotli [decoder](https://github.com/devongovett/brotli.js).
148
+ Could be used directly via `npm install brotli`
149
+
150
+ Hand ported [decoder / encoder](https://github.com/dominikhlbg/BrotliHaxe)
151
+ in haxe by Dominik Homberger.
152
+ Output source code: JavaScript, PHP, Python, Java and C#
153
+
154
+ 7Zip [plugin](https://github.com/mcmilk/7-Zip-Zstd)
155
+
156
+ Dart compression framework with
157
+ [fast FFI-based Brotli implementation](https://pub.dev/documentation/es_compression/latest/brotli/)
158
+ with ready-to-use prebuilt binaries for Win/Linux/Mac
brotli-1.2.0/README ADDED
@@ -0,0 +1,15 @@
1
+ BROTLI DATA COMPRESSION LIBRARY
2
+
3
+ Brotli is a generic-purpose lossless compression algorithm that compresses data
4
+ using a combination of a modern variant of the LZ77 algorithm, Huffman coding
5
+ and 2nd order context modeling, with a compression ratio comparable to the best
6
+ currently available general-purpose compression methods. It is similar in speed
7
+ with deflate but offers more dense compression.
8
+
9
+ The specification of the Brotli Compressed Data Format is defined in RFC 7932
10
+ https://datatracker.ietf.org/doc/html/rfc7932
11
+
12
+ Brotli is open-sourced under the MIT License, see the LICENSE file.
13
+
14
+ Brotli mailing list:
15
+ https://groups.google.com/g/brotli
brotli-1.2.0/README.md ADDED
@@ -0,0 +1,114 @@
1
+ <p align="center">
2
+ <img src="https://github.com/google/brotli/actions/workflows/build_test.yml/badge.svg" alt="GitHub Actions Build Status" href="https://github.com/google/brotli/actions?query=branch%3Amaster">
3
+ <img src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/brotli.svg" alt="Fuzzing Status" href="https://oss-fuzz-build-logs.storage.googleapis.com/index.html#brotli">
4
+ </p>
5
+ <p align="center"><img src="https://brotli.org/brotli.svg" alt="Brotli" width="64"></p>
6
+
7
+ ### Introduction
8
+
9
+ Brotli is a generic-purpose lossless compression algorithm that compresses data
10
+ using a combination of a modern variant of the LZ77 algorithm, Huffman coding
11
+ and 2nd order context modeling, with a compression ratio comparable to the best
12
+ currently available general-purpose compression methods. It is similar in speed
13
+ with deflate but offers more dense compression.
14
+
15
+ The specification of the Brotli Compressed Data Format is defined in
16
+ [RFC 7932](https://datatracker.ietf.org/doc/html/rfc7932).
17
+
18
+ Brotli is open-sourced under the MIT License, see the LICENSE file.
19
+
20
+ > **Please note:** brotli is a "stream" format; it does not contain
21
+ > meta-information, like checksums or uncompressed data length. It is possible
22
+ > to modify "raw" ranges of the compressed stream and the decoder will not
23
+ > notice that.
24
+
25
+ ### Installation
26
+
27
+ In most Linux distributions, installing `brotli` is just a matter of using
28
+ the package management system. For example in Debian-based distributions:
29
+ `apt install brotli` will install `brotli`. On MacOS, you can use
30
+ [Homebrew](https://brew.sh/): `brew install brotli`.
31
+
32
+ [![brotli packaging status](https://repology.org/badge/vertical-allrepos/brotli.svg?exclude_unsupported=1&columns=3&exclude_sources=modules,site&header=brotli%20packaging%20status)](https://repology.org/project/brotli/versions)
33
+
34
+ Of course you can also build brotli from sources.
35
+
36
+ ### Build instructions
37
+
38
+ #### Vcpkg
39
+
40
+ You can download and install brotli using the
41
+ [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
42
+
43
+ git clone https://github.com/Microsoft/vcpkg.git
44
+ cd vcpkg
45
+ ./bootstrap-vcpkg.sh
46
+ ./vcpkg integrate install
47
+ ./vcpkg install brotli
48
+
49
+ The brotli port in vcpkg is kept up to date by Microsoft team members and
50
+ community contributors. If the version is out of date, please [create an issue
51
+ or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
52
+
53
+ #### Bazel
54
+
55
+ See [Bazel](https://www.bazel.build/)
56
+
57
+ #### CMake
58
+
59
+ The basic commands to build and install brotli are:
60
+
61
+ $ mkdir out && cd out
62
+ $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
63
+ $ cmake --build . --config Release --target install
64
+
65
+ You can use other [CMake](https://cmake.org/) configuration.
66
+
67
+ #### Python
68
+
69
+ To install the latest release of the Python module, run the following:
70
+
71
+ $ pip install brotli
72
+
73
+ To install the tip-of-the-tree version, run:
74
+
75
+ $ pip install --upgrade git+https://github.com/google/brotli
76
+
77
+ See the [Python readme](python/README.md) for more details on installing
78
+ from source, development, and testing.
79
+
80
+ ### Contributing
81
+
82
+ We glad to answer/library related questions in
83
+ [brotli mailing list](https://groups.google.com/g/brotli).
84
+
85
+ Regular issues / feature requests should be reported in
86
+ [issue tracker](https://github.com/google/brotli/issues).
87
+
88
+ For reporting vulnerability please read [SECURITY](SECURITY.md).
89
+
90
+ For contributing changes please read [CONTRIBUTING](CONTRIBUTING.md).
91
+
92
+ ### Benchmarks
93
+ * [Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/) / [Unstable Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/unstable/)
94
+ * [Large Text Compression Benchmark](https://mattmahoney.net/dc/text.html)
95
+ * [Lzturbo Benchmark](https://sites.google.com/site/powturbo/home/benchmark)
96
+
97
+ ### Related projects
98
+ > **Disclaimer:** Brotli authors take no responsibility for the third party projects mentioned in this section.
99
+
100
+ Independent [decoder](https://github.com/madler/brotli) implementation
101
+ by Mark Adler, based entirely on format specification.
102
+
103
+ JavaScript port of brotli [decoder](https://github.com/devongovett/brotli.js).
104
+ Could be used directly via `npm install brotli`
105
+
106
+ Hand ported [decoder / encoder](https://github.com/dominikhlbg/BrotliHaxe)
107
+ in haxe by Dominik Homberger.
108
+ Output source code: JavaScript, PHP, Python, Java and C#
109
+
110
+ 7Zip [plugin](https://github.com/mcmilk/7-Zip-Zstd)
111
+
112
+ Dart compression framework with
113
+ [fast FFI-based Brotli implementation](https://pub.dev/documentation/es_compression/latest/brotli/)
114
+ with ready-to-use prebuilt binaries for Win/Linux/Mac
@@ -0,0 +1,15 @@
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 "constants.h"
8
+
9
+ const BROTLI_MODEL("small")
10
+ BrotliPrefixCodeRange _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = {
11
+ {1, 2}, {5, 2}, {9, 2}, {13, 2}, {17, 3}, {25, 3},
12
+ {33, 3}, {41, 3}, {49, 4}, {65, 4}, {81, 4}, {97, 4},
13
+ {113, 5}, {145, 5}, {177, 5}, {209, 5}, {241, 6}, {305, 6},
14
+ {369, 7}, {497, 8}, {753, 9}, {1265, 10}, {2289, 11}, {4337, 12},
15
+ {8433, 13}, {16625, 24}};
@@ -0,0 +1,198 @@
1
+ /* Copyright 2016 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
+ /**
8
+ * @file
9
+ * Common constants used in decoder and encoder API.
10
+ */
11
+
12
+ #ifndef BROTLI_COMMON_CONSTANTS_H_
13
+ #define BROTLI_COMMON_CONSTANTS_H_
14
+
15
+ #include "platform.h"
16
+
17
+ /* Specification: 7.3. Encoding of the context map */
18
+ #define BROTLI_CONTEXT_MAP_MAX_RLE 16
19
+
20
+ /* Specification: 2. Compressed representation overview */
21
+ #define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256
22
+
23
+ /* Specification: 3.3. Alphabet sizes: insert-and-copy length */
24
+ #define BROTLI_NUM_LITERAL_SYMBOLS 256
25
+ #define BROTLI_NUM_COMMAND_SYMBOLS 704
26
+ #define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
27
+ #define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \
28
+ BROTLI_CONTEXT_MAP_MAX_RLE)
29
+ #define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)
30
+
31
+ /* Specification: 3.5. Complex prefix codes */
32
+ #define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
33
+ #define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
34
+ #define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
35
+ /* "code length of 8 is repeated" */
36
+ #define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8
37
+
38
+ /* "Large Window Brotli" */
39
+
40
+ /**
41
+ * The theoretical maximum number of distance bits specified for large window
42
+ * brotli, for 64-bit encoders and decoders. Even when in practice 32-bit
43
+ * encoders and decoders only support up to 30 max distance bits, the value is
44
+ * set to 62 because it affects the large window brotli file format.
45
+ * Specifically, it affects the encoding of simple huffman tree for distances,
46
+ * see Specification RFC 7932 chapter 3.4.
47
+ */
48
+ #define BROTLI_LARGE_MAX_DISTANCE_BITS 62U
49
+ #define BROTLI_LARGE_MIN_WBITS 10
50
+ /**
51
+ * The maximum supported large brotli window bits by the encoder and decoder.
52
+ * Large window brotli allows up to 62 bits, however the current encoder and
53
+ * decoder, designed for 32-bit integers, only support up to 30 bits maximum.
54
+ */
55
+ #define BROTLI_LARGE_MAX_WBITS 30
56
+
57
+ /* Specification: 4. Encoding of distances */
58
+ #define BROTLI_NUM_DISTANCE_SHORT_CODES 16
59
+ /**
60
+ * Maximal number of "postfix" bits.
61
+ *
62
+ * Number of "postfix" bits is stored as 2 bits in meta-block header.
63
+ */
64
+ #define BROTLI_MAX_NPOSTFIX 3
65
+ #define BROTLI_MAX_NDIRECT 120
66
+ #define BROTLI_MAX_DISTANCE_BITS 24U
67
+ #define BROTLI_DISTANCE_ALPHABET_SIZE(NPOSTFIX, NDIRECT, MAXNBITS) ( \
68
+ BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) + \
69
+ ((MAXNBITS) << ((NPOSTFIX) + 1)))
70
+ /* BROTLI_NUM_DISTANCE_SYMBOLS == 1128 */
71
+ #define BROTLI_NUM_DISTANCE_SYMBOLS \
72
+ BROTLI_DISTANCE_ALPHABET_SIZE( \
73
+ BROTLI_MAX_NDIRECT, BROTLI_MAX_NPOSTFIX, BROTLI_LARGE_MAX_DISTANCE_BITS)
74
+
75
+ /* ((1 << 26) - 4) is the maximal distance that can be expressed in RFC 7932
76
+ brotli stream using NPOSTFIX = 0 and NDIRECT = 0. With other NPOSTFIX and
77
+ NDIRECT values distances up to ((1 << 29) + 88) could be expressed. */
78
+ #define BROTLI_MAX_DISTANCE 0x3FFFFFC
79
+
80
+ /* ((1 << 31) - 4) is the safe distance limit. Using this number as a limit
81
+ allows safe distance calculation without overflows, given the distance
82
+ alphabet size is limited to corresponding size
83
+ (see kLargeWindowDistanceCodeLimits). */
84
+ #define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC
85
+
86
+
87
+ /* Specification: 4. Encoding of Literal Insertion Lengths and Copy Lengths */
88
+ #define BROTLI_NUM_INS_COPY_CODES 24
89
+
90
+ /* 7.1. Context modes and context ID lookup for literals */
91
+ /* "context IDs for literals are in the range of 0..63" */
92
+ #define BROTLI_LITERAL_CONTEXT_BITS 6
93
+
94
+ /* 7.2. Context ID for distances */
95
+ #define BROTLI_DISTANCE_CONTEXT_BITS 2
96
+
97
+ /* 9.1. Format of the Stream Header */
98
+ /* Number of slack bytes for window size. Don't confuse
99
+ with BROTLI_NUM_DISTANCE_SHORT_CODES. */
100
+ #define BROTLI_WINDOW_GAP 16
101
+ #define BROTLI_MAX_BACKWARD_LIMIT(W) (((size_t)1 << (W)) - BROTLI_WINDOW_GAP)
102
+
103
+ typedef struct BrotliDistanceCodeLimit {
104
+ uint32_t max_alphabet_size;
105
+ uint32_t max_distance;
106
+ } BrotliDistanceCodeLimit;
107
+
108
+ /* This function calculates maximal size of distance alphabet, such that the
109
+ distances greater than the given values can not be represented.
110
+
111
+ This limits are designed to support fast and safe 32-bit decoders.
112
+ "32-bit" means that signed integer values up to ((1 << 31) - 1) could be
113
+ safely expressed.
114
+
115
+ Brotli distance alphabet symbols do not represent consecutive distance
116
+ ranges. Each distance alphabet symbol (excluding direct distances and short
117
+ codes), represent interleaved (for NPOSTFIX > 0) range of distances.
118
+ A "group" of consecutive (1 << NPOSTFIX) symbols represent non-interleaved
119
+ range. Two consecutive groups require the same amount of "extra bits".
120
+
121
+ It is important that distance alphabet represents complete "groups".
122
+ To avoid complex logic on encoder side about interleaved ranges
123
+ it was decided to restrict both sides to complete distance code "groups".
124
+ */
125
+ BROTLI_UNUSED_FUNCTION BrotliDistanceCodeLimit BrotliCalculateDistanceCodeLimit(
126
+ uint32_t max_distance, uint32_t npostfix, uint32_t ndirect) {
127
+ BrotliDistanceCodeLimit result;
128
+ /* Marking this function as unused, because not all files
129
+ including "constants.h" use it -> compiler warns about that. */
130
+ BROTLI_UNUSED(&BrotliCalculateDistanceCodeLimit);
131
+ if (max_distance <= ndirect) {
132
+ /* This case never happens / exists only for the sake of completeness. */
133
+ result.max_alphabet_size = max_distance + BROTLI_NUM_DISTANCE_SHORT_CODES;
134
+ result.max_distance = max_distance;
135
+ return result;
136
+ } else {
137
+ /* The first prohibited value. */
138
+ uint32_t forbidden_distance = max_distance + 1;
139
+ /* Subtract "directly" encoded region. */
140
+ uint32_t offset = forbidden_distance - ndirect - 1;
141
+ uint32_t ndistbits = 0;
142
+ uint32_t tmp;
143
+ uint32_t half;
144
+ uint32_t group;
145
+ /* Postfix for the last dcode in the group. */
146
+ uint32_t postfix = (1u << npostfix) - 1;
147
+ uint32_t extra;
148
+ uint32_t start;
149
+ /* Remove postfix and "head-start". */
150
+ offset = (offset >> npostfix) + 4;
151
+ /* Calculate the number of distance bits. */
152
+ tmp = offset / 2;
153
+ /* Poor-man's log2floor, to avoid extra dependencies. */
154
+ while (tmp != 0) {ndistbits++; tmp = tmp >> 1;}
155
+ /* One bit is covered with subrange addressing ("half"). */
156
+ ndistbits--;
157
+ /* Find subrange. */
158
+ half = (offset >> ndistbits) & 1;
159
+ /* Calculate the "group" part of dcode. */
160
+ group = ((ndistbits - 1) << 1) | half;
161
+ /* Calculated "group" covers the prohibited distance value. */
162
+ if (group == 0) {
163
+ /* This case is added for correctness; does not occur for limit > 128. */
164
+ result.max_alphabet_size = ndirect + BROTLI_NUM_DISTANCE_SHORT_CODES;
165
+ result.max_distance = ndirect;
166
+ return result;
167
+ }
168
+ /* Decrement "group", so it is the last permitted "group". */
169
+ group--;
170
+ /* After group was decremented, ndistbits and half must be recalculated. */
171
+ ndistbits = (group >> 1) + 1;
172
+ /* The last available distance in the subrange has all extra bits set. */
173
+ extra = (1u << ndistbits) - 1;
174
+ /* Calculate region start. NB: ndistbits >= 1. */
175
+ start = (1u << (ndistbits + 1)) - 4;
176
+ /* Move to subregion. */
177
+ start += (group & 1) << ndistbits;
178
+ /* Calculate the alphabet size. */
179
+ result.max_alphabet_size = ((group << npostfix) | postfix) + ndirect +
180
+ BROTLI_NUM_DISTANCE_SHORT_CODES + 1;
181
+ /* Calculate the maximal distance representable by alphabet. */
182
+ result.max_distance = ((start + extra) << npostfix) + postfix + ndirect + 1;
183
+ return result;
184
+ }
185
+ }
186
+
187
+ /* Represents the range of values belonging to a prefix code:
188
+ [offset, offset + 2^nbits) */
189
+ typedef struct {
190
+ uint16_t offset;
191
+ uint8_t nbits;
192
+ } BrotliPrefixCodeRange;
193
+
194
+ /* "Soft-private", it is exported, but not "advertised" as API. */
195
+ BROTLI_COMMON_API extern const BROTLI_MODEL("small")
196
+ BrotliPrefixCodeRange _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
197
+
198
+ #endif /* BROTLI_COMMON_CONSTANTS_H_ */