Skip to content
Permalink
Browse files

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>
  • Loading branch information...
Hackzzila authored and addaleax committed May 1, 2018
1 parent e534dcd commit 11c01a6a693b572c5e3caacda7860e1c1bd1244f
Showing with 34,434 additions and 0 deletions.
  1. +19 −0 deps/brotli/LICENSE
  2. +63 −0 deps/brotli/brotli.gyp
  3. +64 −0 deps/brotli/c/common/constants.h
  4. +261 −0 deps/brotli/c/common/context.h
  5. +432 −0 deps/brotli/c/common/dictionary.bin
  6. BIN deps/brotli/c/common/dictionary.bin.br
  7. +5,905 −0 deps/brotli/c/common/dictionary.c
  8. +64 −0 deps/brotli/c/common/dictionary.h
  9. +568 −0 deps/brotli/c/common/platform.h
  10. +235 −0 deps/brotli/c/common/transform.c
  11. +80 −0 deps/brotli/c/common/transform.h
  12. +26 −0 deps/brotli/c/common/version.h
  13. +48 −0 deps/brotli/c/dec/bit_reader.c
  14. +309 −0 deps/brotli/c/dec/bit_reader.h
  15. +2,506 −0 deps/brotli/c/dec/decode.c
  16. +339 −0 deps/brotli/c/dec/huffman.c
  17. +127 −0 deps/brotli/c/dec/huffman.h
  18. +750 −0 deps/brotli/c/dec/prefix.h
  19. +164 −0 deps/brotli/c/dec/state.c
  20. +258 −0 deps/brotli/c/dec/state.h
  21. +144 −0 deps/brotli/c/enc/backward_references.c
  22. +38 −0 deps/brotli/c/enc/backward_references.h
  23. +825 −0 deps/brotli/c/enc/backward_references_hq.c
  24. +92 −0 deps/brotli/c/enc/backward_references_hq.h
  25. +153 −0 deps/brotli/c/enc/backward_references_inc.h
  26. +35 −0 deps/brotli/c/enc/bit_cost.c
  27. +63 −0 deps/brotli/c/enc/bit_cost.h
  28. +127 −0 deps/brotli/c/enc/bit_cost_inc.h
  29. +34 −0 deps/brotli/c/enc/block_encoder_inc.h
  30. +194 −0 deps/brotli/c/enc/block_splitter.c
  31. +51 −0 deps/brotli/c/enc/block_splitter.h
  32. +431 −0 deps/brotli/c/enc/block_splitter_inc.h
  33. +1,331 −0 deps/brotli/c/enc/brotli_bit_stream.c
  34. +84 −0 deps/brotli/c/enc/brotli_bit_stream.h
  35. +56 −0 deps/brotli/c/enc/cluster.c
  36. +48 −0 deps/brotli/c/enc/cluster.h
  37. +317 −0 deps/brotli/c/enc/cluster_inc.h
  38. +190 −0 deps/brotli/c/enc/command.h
  39. +790 −0 deps/brotli/c/enc/compress_fragment.c
  40. +61 −0 deps/brotli/c/enc/compress_fragment.h
  41. +645 −0 deps/brotli/c/enc/compress_fragment_two_pass.c
  42. +54 −0 deps/brotli/c/enc/compress_fragment_two_pass.h
  43. +1,120 −0 deps/brotli/c/enc/dictionary_hash.c
  44. +24 −0 deps/brotli/c/enc/dictionary_hash.h
  45. +1,862 −0 deps/brotli/c/enc/encode.c
  46. +32 −0 deps/brotli/c/enc/encoder_dict.c
  47. +41 −0 deps/brotli/c/enc/encoder_dict.h
  48. +501 −0 deps/brotli/c/enc/entropy_encode.c
  49. +122 −0 deps/brotli/c/enc/entropy_encode.h
  50. +539 −0 deps/brotli/c/enc/entropy_encode_static.h
  51. +147 −0 deps/brotli/c/enc/fast_log.h
  52. +80 −0 deps/brotli/c/enc/find_match_length.h
  53. +498 −0 deps/brotli/c/enc/hash.h
  54. +136 −0 deps/brotli/c/enc/hash_composite_inc.h
  55. +254 −0 deps/brotli/c/enc/hash_forgetful_chain_inc.h
  56. +267 −0 deps/brotli/c/enc/hash_longest_match64_inc.h
  57. +259 −0 deps/brotli/c/enc/hash_longest_match_inc.h
  58. +235 −0 deps/brotli/c/enc/hash_longest_match_quickly_inc.h
  59. +216 −0 deps/brotli/c/enc/hash_rolling_inc.h
  60. +328 −0 deps/brotli/c/enc/hash_to_binary_tree_inc.h
  61. +100 −0 deps/brotli/c/enc/histogram.c
  62. +63 −0 deps/brotli/c/enc/histogram.h
  63. +51 −0 deps/brotli/c/enc/histogram_inc.h
  64. +175 −0 deps/brotli/c/enc/literal_cost.c
  65. +30 −0 deps/brotli/c/enc/literal_cost.h
  66. +170 −0 deps/brotli/c/enc/memory.c
  67. +102 −0 deps/brotli/c/enc/memory.h
  68. +667 −0 deps/brotli/c/enc/metablock.c
  69. +105 −0 deps/brotli/c/enc/metablock.h
  70. +183 −0 deps/brotli/c/enc/metablock_inc.h
  71. +44 −0 deps/brotli/c/enc/params.h
  72. +53 −0 deps/brotli/c/enc/prefix.h
  73. +165 −0 deps/brotli/c/enc/quality.h
  74. +164 −0 deps/brotli/c/enc/ringbuffer.h
  75. +486 −0 deps/brotli/c/enc/static_dict.c
  76. +40 −0 deps/brotli/c/enc/static_dict.h
  77. +5,864 −0 deps/brotli/c/enc/static_dict_lut.h
  78. +85 −0 deps/brotli/c/enc/utf8_util.c
  79. +32 −0 deps/brotli/c/enc/utf8_util.h
  80. +85 −0 deps/brotli/c/enc/write_bits.h
  81. +344 −0 deps/brotli/c/include/brotli/decode.h
  82. +427 −0 deps/brotli/c/include/brotli/encode.h
  83. +274 −0 deps/brotli/c/include/brotli/port.h
  84. +83 −0 deps/brotli/c/include/brotli/types.h
@@ -0,0 +1,19 @@
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,63 @@
{
'targets': [
{
'target_name': 'brotli',
'type': 'static_library',
'include_dirs': ['c/include'],
'conditions': [
['OS=="linux"', {
'defines': [
'OS_LINUX'
]
}],
['OS=="freebsd"', {
'defines': [
'OS_FREEBSD'
]
}],
['OS=="mac"', {
'defines': [
'OS_MACOSX'
]
}],
],
'direct_dependent_settings': {
'include_dirs': [ 'c/include' ]
},
'libraries': [
'-lm',
],
'sources': [
# Common
'c/common/dictionary.c',
'c/common/transform.c',

# Decoder
'c/dec/bit_reader.c',
'c/dec/decode.c',
'c/dec/huffman.c',
'c/dec/state.c',

# Encoder
'c/enc/backward_references.c',
'c/enc/backward_references_hq.c',
'c/enc/bit_cost.c',
'c/enc/block_splitter.c',
'c/enc/brotli_bit_stream.c',
'c/enc/cluster.c',
'c/enc/compress_fragment.c',
'c/enc/compress_fragment_two_pass.c',
'c/enc/dictionary_hash.c',
'c/enc/encode.c',
'c/enc/encoder_dict.c',
'c/enc/entropy_encode.c',
'c/enc/histogram.c',
'c/enc/literal_cost.c',
'c/enc/memory.c',
'c/enc/metablock.c',
'c/enc/static_dict.c',
'c/enc/utf8_util.c'
]
}
]
}
@@ -0,0 +1,64 @@
/* Copyright 2016 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/

#ifndef BROTLI_COMMON_CONSTANTS_H_
#define BROTLI_COMMON_CONSTANTS_H_

/* Specification: 7.3. Encoding of the context map */
#define BROTLI_CONTEXT_MAP_MAX_RLE 16

/* Specification: 2. Compressed representation overview */
#define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256

/* Specification: 3.3. Alphabet sizes: insert-and-copy length */
#define BROTLI_NUM_LITERAL_SYMBOLS 256
#define BROTLI_NUM_COMMAND_SYMBOLS 704
#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
#define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \
BROTLI_CONTEXT_MAP_MAX_RLE)
#define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)

/* Specification: 3.5. Complex prefix codes */
#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
/* "code length of 8 is repeated" */
#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8

/* "Large Window Brotli" */
#define BROTLI_LARGE_MAX_DISTANCE_BITS 62U
#define BROTLI_LARGE_MIN_WBITS 10
#define BROTLI_LARGE_MAX_WBITS 30

/* Specification: 4. Encoding of distances */
#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
#define BROTLI_MAX_NPOSTFIX 3
#define BROTLI_MAX_NDIRECT 120
#define BROTLI_MAX_DISTANCE_BITS 24U
#define BROTLI_DISTANCE_ALPHABET_SIZE(NPOSTFIX, NDIRECT, MAXNBITS) ( \
BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) + \
((MAXNBITS) << ((NPOSTFIX) + 1)))
/* BROTLI_NUM_DISTANCE_SYMBOLS == 1128 */
#define BROTLI_NUM_DISTANCE_SYMBOLS \
BROTLI_DISTANCE_ALPHABET_SIZE( \
BROTLI_MAX_NDIRECT, BROTLI_MAX_NPOSTFIX, BROTLI_LARGE_MAX_DISTANCE_BITS)
#define BROTLI_MAX_DISTANCE 0x3FFFFFC
#define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC

/* 7.1. Context modes and context ID lookup for literals */
/* "context IDs for literals are in the range of 0..63" */
#define BROTLI_LITERAL_CONTEXT_BITS 6

/* 7.2. Context ID for distances */
#define BROTLI_DISTANCE_CONTEXT_BITS 2

/* 9.1. Format of the Stream Header */
/* Number of slack bytes for window size. Don't confuse
with BROTLI_NUM_DISTANCE_SHORT_CODES. */
#define BROTLI_WINDOW_GAP 16
#define BROTLI_MAX_BACKWARD_LIMIT(W) (((size_t)1 << (W)) - BROTLI_WINDOW_GAP)

#endif /* BROTLI_COMMON_CONSTANTS_H_ */

0 comments on commit 11c01a6

Please sign in to comment.
You can’t perform that action at this time.