Skip to content

Commit 11c01a6

Browse files
Hackzzilaaddaleax
authored andcommitted
deps: add brotli
Co-authored-by: Anna Henningsen <anna@addaleax.net> PR-URL: #24938 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent e534dcd commit 11c01a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+34434
-0
lines changed

deps/brotli/LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -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.

deps/brotli/brotli.gyp

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'brotli',
5+
'type': 'static_library',
6+
'include_dirs': ['c/include'],
7+
'conditions': [
8+
['OS=="linux"', {
9+
'defines': [
10+
'OS_LINUX'
11+
]
12+
}],
13+
['OS=="freebsd"', {
14+
'defines': [
15+
'OS_FREEBSD'
16+
]
17+
}],
18+
['OS=="mac"', {
19+
'defines': [
20+
'OS_MACOSX'
21+
]
22+
}],
23+
],
24+
'direct_dependent_settings': {
25+
'include_dirs': [ 'c/include' ]
26+
},
27+
'libraries': [
28+
'-lm',
29+
],
30+
'sources': [
31+
# Common
32+
'c/common/dictionary.c',
33+
'c/common/transform.c',
34+
35+
# Decoder
36+
'c/dec/bit_reader.c',
37+
'c/dec/decode.c',
38+
'c/dec/huffman.c',
39+
'c/dec/state.c',
40+
41+
# Encoder
42+
'c/enc/backward_references.c',
43+
'c/enc/backward_references_hq.c',
44+
'c/enc/bit_cost.c',
45+
'c/enc/block_splitter.c',
46+
'c/enc/brotli_bit_stream.c',
47+
'c/enc/cluster.c',
48+
'c/enc/compress_fragment.c',
49+
'c/enc/compress_fragment_two_pass.c',
50+
'c/enc/dictionary_hash.c',
51+
'c/enc/encode.c',
52+
'c/enc/encoder_dict.c',
53+
'c/enc/entropy_encode.c',
54+
'c/enc/histogram.c',
55+
'c/enc/literal_cost.c',
56+
'c/enc/memory.c',
57+
'c/enc/metablock.c',
58+
'c/enc/static_dict.c',
59+
'c/enc/utf8_util.c'
60+
]
61+
}
62+
]
63+
}

deps/brotli/c/common/constants.h

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
#ifndef BROTLI_COMMON_CONSTANTS_H_
8+
#define BROTLI_COMMON_CONSTANTS_H_
9+
10+
/* Specification: 7.3. Encoding of the context map */
11+
#define BROTLI_CONTEXT_MAP_MAX_RLE 16
12+
13+
/* Specification: 2. Compressed representation overview */
14+
#define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256
15+
16+
/* Specification: 3.3. Alphabet sizes: insert-and-copy length */
17+
#define BROTLI_NUM_LITERAL_SYMBOLS 256
18+
#define BROTLI_NUM_COMMAND_SYMBOLS 704
19+
#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
20+
#define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \
21+
BROTLI_CONTEXT_MAP_MAX_RLE)
22+
#define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)
23+
24+
/* Specification: 3.5. Complex prefix codes */
25+
#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
26+
#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
27+
#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
28+
/* "code length of 8 is repeated" */
29+
#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8
30+
31+
/* "Large Window Brotli" */
32+
#define BROTLI_LARGE_MAX_DISTANCE_BITS 62U
33+
#define BROTLI_LARGE_MIN_WBITS 10
34+
#define BROTLI_LARGE_MAX_WBITS 30
35+
36+
/* Specification: 4. Encoding of distances */
37+
#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
38+
#define BROTLI_MAX_NPOSTFIX 3
39+
#define BROTLI_MAX_NDIRECT 120
40+
#define BROTLI_MAX_DISTANCE_BITS 24U
41+
#define BROTLI_DISTANCE_ALPHABET_SIZE(NPOSTFIX, NDIRECT, MAXNBITS) ( \
42+
BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) + \
43+
((MAXNBITS) << ((NPOSTFIX) + 1)))
44+
/* BROTLI_NUM_DISTANCE_SYMBOLS == 1128 */
45+
#define BROTLI_NUM_DISTANCE_SYMBOLS \
46+
BROTLI_DISTANCE_ALPHABET_SIZE( \
47+
BROTLI_MAX_NDIRECT, BROTLI_MAX_NPOSTFIX, BROTLI_LARGE_MAX_DISTANCE_BITS)
48+
#define BROTLI_MAX_DISTANCE 0x3FFFFFC
49+
#define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC
50+
51+
/* 7.1. Context modes and context ID lookup for literals */
52+
/* "context IDs for literals are in the range of 0..63" */
53+
#define BROTLI_LITERAL_CONTEXT_BITS 6
54+
55+
/* 7.2. Context ID for distances */
56+
#define BROTLI_DISTANCE_CONTEXT_BITS 2
57+
58+
/* 9.1. Format of the Stream Header */
59+
/* Number of slack bytes for window size. Don't confuse
60+
with BROTLI_NUM_DISTANCE_SHORT_CODES. */
61+
#define BROTLI_WINDOW_GAP 16
62+
#define BROTLI_MAX_BACKWARD_LIMIT(W) (((size_t)1 << (W)) - BROTLI_WINDOW_GAP)
63+
64+
#endif /* BROTLI_COMMON_CONSTANTS_H_ */

0 commit comments

Comments
 (0)