brotli 0.2.3 → 0.5.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +37 -0
- data/.github/workflows/publish.yml +24 -0
- data/.gitmodules +1 -1
- data/Gemfile +6 -3
- data/README.md +2 -2
- data/Rakefile +16 -9
- data/brotli.gemspec +7 -13
- data/ext/brotli/brotli.c +210 -31
- data/ext/brotli/buffer.c +1 -7
- data/ext/brotli/buffer.h +1 -1
- data/ext/brotli/extconf.rb +25 -17
- data/lib/brotli/version.rb +1 -1
- data/test/brotli_test.rb +107 -0
- data/test/brotli_writer_test.rb +36 -0
- data/test/test_helper.rb +8 -0
- data/vendor/brotli/c/common/constants.c +15 -0
- data/vendor/brotli/c/common/constants.h +137 -0
- data/vendor/brotli/c/common/context.c +156 -0
- data/vendor/brotli/c/common/context.h +4 -152
- data/vendor/brotli/c/common/dictionary.bin.br +0 -0
- data/vendor/brotli/c/common/dictionary.c +14 -3
- data/vendor/brotli/c/common/platform.c +23 -0
- data/vendor/brotli/c/common/platform.h +95 -122
- data/vendor/brotli/c/common/shared_dictionary.c +521 -0
- data/vendor/brotli/c/common/shared_dictionary_internal.h +75 -0
- data/vendor/brotli/c/common/transform.c +60 -4
- data/vendor/brotli/c/common/transform.h +5 -0
- data/vendor/brotli/c/common/version.h +31 -6
- data/vendor/brotli/c/dec/bit_reader.c +34 -4
- data/vendor/brotli/c/dec/bit_reader.h +221 -107
- data/vendor/brotli/c/dec/decode.c +772 -403
- data/vendor/brotli/c/dec/huffman.c +7 -4
- data/vendor/brotli/c/dec/huffman.h +8 -13
- data/vendor/brotli/c/dec/prefix.h +1 -18
- data/vendor/brotli/c/dec/state.c +40 -21
- data/vendor/brotli/c/dec/state.h +201 -59
- data/vendor/brotli/c/enc/backward_references.c +88 -25
- data/vendor/brotli/c/enc/backward_references.h +10 -8
- data/vendor/brotli/c/enc/backward_references_hq.c +194 -80
- data/vendor/brotli/c/enc/backward_references_hq.h +17 -13
- data/vendor/brotli/c/enc/backward_references_inc.h +52 -16
- data/vendor/brotli/c/enc/bit_cost.c +8 -7
- data/vendor/brotli/c/enc/bit_cost.h +5 -4
- data/vendor/brotli/c/enc/block_splitter.c +40 -17
- data/vendor/brotli/c/enc/block_splitter.h +5 -4
- data/vendor/brotli/c/enc/block_splitter_inc.h +99 -49
- data/vendor/brotli/c/enc/brotli_bit_stream.c +142 -137
- data/vendor/brotli/c/enc/brotli_bit_stream.h +11 -6
- data/vendor/brotli/c/enc/cluster.c +10 -9
- data/vendor/brotli/c/enc/cluster.h +7 -6
- data/vendor/brotli/c/enc/cluster_inc.h +30 -22
- data/vendor/brotli/c/enc/command.c +28 -0
- data/vendor/brotli/c/enc/command.h +17 -16
- data/vendor/brotli/c/enc/compound_dictionary.c +207 -0
- data/vendor/brotli/c/enc/compound_dictionary.h +74 -0
- data/vendor/brotli/c/enc/compress_fragment.c +93 -83
- data/vendor/brotli/c/enc/compress_fragment.h +32 -7
- data/vendor/brotli/c/enc/compress_fragment_two_pass.c +100 -88
- data/vendor/brotli/c/enc/compress_fragment_two_pass.h +21 -3
- data/vendor/brotli/c/enc/dictionary_hash.c +1829 -1101
- data/vendor/brotli/c/enc/dictionary_hash.h +2 -1
- data/vendor/brotli/c/enc/encode.c +550 -416
- data/vendor/brotli/c/enc/encoder_dict.c +613 -5
- data/vendor/brotli/c/enc/encoder_dict.h +120 -4
- data/vendor/brotli/c/enc/entropy_encode.c +5 -2
- data/vendor/brotli/c/enc/entropy_encode.h +4 -3
- data/vendor/brotli/c/enc/entropy_encode_static.h +5 -2
- data/vendor/brotli/c/enc/fast_log.c +105 -0
- data/vendor/brotli/c/enc/fast_log.h +21 -101
- data/vendor/brotli/c/enc/find_match_length.h +17 -25
- data/vendor/brotli/c/enc/hash.h +350 -120
- data/vendor/brotli/c/enc/hash_composite_inc.h +71 -67
- data/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +92 -51
- data/vendor/brotli/c/enc/hash_longest_match64_inc.h +79 -84
- data/vendor/brotli/c/enc/hash_longest_match_inc.h +53 -54
- data/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +93 -62
- data/vendor/brotli/c/enc/hash_rolling_inc.h +25 -29
- data/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +42 -40
- data/vendor/brotli/c/enc/histogram.c +4 -4
- data/vendor/brotli/c/enc/histogram.h +7 -6
- data/vendor/brotli/c/enc/literal_cost.c +20 -15
- data/vendor/brotli/c/enc/literal_cost.h +4 -2
- data/vendor/brotli/c/enc/memory.c +29 -5
- data/vendor/brotli/c/enc/memory.h +43 -14
- data/vendor/brotli/c/enc/metablock.c +95 -85
- data/vendor/brotli/c/enc/metablock.h +9 -8
- data/vendor/brotli/c/enc/metablock_inc.h +9 -7
- data/vendor/brotli/c/enc/params.h +7 -4
- data/vendor/brotli/c/enc/prefix.h +3 -2
- data/vendor/brotli/c/enc/quality.h +40 -3
- data/vendor/brotli/c/enc/ringbuffer.h +8 -4
- data/vendor/brotli/c/enc/state.h +104 -0
- data/vendor/brotli/c/enc/static_dict.c +60 -4
- data/vendor/brotli/c/enc/static_dict.h +3 -2
- data/vendor/brotli/c/enc/static_dict_lut.h +2 -0
- data/vendor/brotli/c/enc/utf8_util.c +2 -2
- data/vendor/brotli/c/enc/utf8_util.h +2 -1
- data/vendor/brotli/c/enc/write_bits.h +29 -26
- data/vendor/brotli/c/include/brotli/decode.h +67 -2
- data/vendor/brotli/c/include/brotli/encode.h +77 -3
- data/vendor/brotli/c/include/brotli/port.h +34 -3
- data/vendor/brotli/c/include/brotli/shared_dictionary.h +100 -0
- metadata +23 -97
- data/.travis.yml +0 -31
- data/docs/Brotli/Error.html +0 -124
- data/docs/Brotli.html +0 -485
- data/docs/_index.html +0 -122
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.README.html +0 -127
- data/docs/file_list.html +0 -56
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -127
- data/docs/js/app.js +0 -292
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -67
- data/docs/top-level-namespace.html +0 -110
- data/spec/brotli_spec.rb +0 -88
- data/spec/inflate_spec.rb +0 -75
- data/spec/spec_helper.rb +0 -4
@@ -6,16 +6,19 @@
|
|
6
6
|
|
7
7
|
/* Function to find backward reference copies. */
|
8
8
|
|
9
|
-
#include "
|
9
|
+
#include "backward_references.h"
|
10
|
+
|
11
|
+
#include <brotli/types.h>
|
10
12
|
|
11
13
|
#include "../common/constants.h"
|
12
14
|
#include "../common/dictionary.h"
|
13
15
|
#include "../common/platform.h"
|
14
|
-
#include
|
15
|
-
#include "
|
16
|
-
#include "
|
17
|
-
#include "
|
18
|
-
#include "
|
16
|
+
#include "command.h"
|
17
|
+
#include "compound_dictionary.h"
|
18
|
+
#include "dictionary_hash.h"
|
19
|
+
#include "encoder_dict.h"
|
20
|
+
#include "memory.h"
|
21
|
+
#include "quality.h"
|
19
22
|
|
20
23
|
#if defined(__cplusplus) || defined(c_plusplus)
|
21
24
|
extern "C" {
|
@@ -51,67 +54,103 @@ static BROTLI_INLINE size_t ComputeDistanceCode(size_t distance,
|
|
51
54
|
#define EXPORT_FN(X) EXPAND_CAT(X, EXPAND_CAT(PREFIX(), HASHER()))
|
52
55
|
|
53
56
|
#define PREFIX() N
|
57
|
+
#define ENABLE_COMPOUND_DICTIONARY 0
|
54
58
|
|
55
59
|
#define HASHER() H2
|
56
60
|
/* NOLINTNEXTLINE(build/include) */
|
57
|
-
#include "
|
61
|
+
#include "backward_references_inc.h"
|
58
62
|
#undef HASHER
|
59
63
|
|
60
64
|
#define HASHER() H3
|
61
65
|
/* NOLINTNEXTLINE(build/include) */
|
62
|
-
#include "
|
66
|
+
#include "backward_references_inc.h"
|
63
67
|
#undef HASHER
|
64
68
|
|
65
69
|
#define HASHER() H4
|
66
70
|
/* NOLINTNEXTLINE(build/include) */
|
67
|
-
#include "
|
71
|
+
#include "backward_references_inc.h"
|
68
72
|
#undef HASHER
|
69
73
|
|
70
74
|
#define HASHER() H5
|
71
75
|
/* NOLINTNEXTLINE(build/include) */
|
72
|
-
#include "
|
76
|
+
#include "backward_references_inc.h"
|
73
77
|
#undef HASHER
|
74
78
|
|
75
79
|
#define HASHER() H6
|
76
80
|
/* NOLINTNEXTLINE(build/include) */
|
77
|
-
#include "
|
81
|
+
#include "backward_references_inc.h"
|
78
82
|
#undef HASHER
|
79
83
|
|
80
84
|
#define HASHER() H40
|
81
85
|
/* NOLINTNEXTLINE(build/include) */
|
82
|
-
#include "
|
86
|
+
#include "backward_references_inc.h"
|
83
87
|
#undef HASHER
|
84
88
|
|
85
89
|
#define HASHER() H41
|
86
90
|
/* NOLINTNEXTLINE(build/include) */
|
87
|
-
#include "
|
91
|
+
#include "backward_references_inc.h"
|
88
92
|
#undef HASHER
|
89
93
|
|
90
94
|
#define HASHER() H42
|
91
95
|
/* NOLINTNEXTLINE(build/include) */
|
92
|
-
#include "
|
96
|
+
#include "backward_references_inc.h"
|
93
97
|
#undef HASHER
|
94
98
|
|
95
99
|
#define HASHER() H54
|
96
100
|
/* NOLINTNEXTLINE(build/include) */
|
97
|
-
#include "
|
101
|
+
#include "backward_references_inc.h"
|
98
102
|
#undef HASHER
|
99
103
|
|
100
104
|
#define HASHER() H35
|
101
105
|
/* NOLINTNEXTLINE(build/include) */
|
102
|
-
#include "
|
106
|
+
#include "backward_references_inc.h"
|
103
107
|
#undef HASHER
|
104
108
|
|
105
109
|
#define HASHER() H55
|
106
110
|
/* NOLINTNEXTLINE(build/include) */
|
107
|
-
#include "
|
111
|
+
#include "backward_references_inc.h"
|
108
112
|
#undef HASHER
|
109
113
|
|
110
114
|
#define HASHER() H65
|
111
115
|
/* NOLINTNEXTLINE(build/include) */
|
112
|
-
#include "
|
116
|
+
#include "backward_references_inc.h"
|
113
117
|
#undef HASHER
|
114
118
|
|
119
|
+
#undef ENABLE_COMPOUND_DICTIONARY
|
120
|
+
#undef PREFIX
|
121
|
+
#define PREFIX() D
|
122
|
+
#define ENABLE_COMPOUND_DICTIONARY 1
|
123
|
+
|
124
|
+
#define HASHER() H5
|
125
|
+
/* NOLINTNEXTLINE(build/include) */
|
126
|
+
#include "backward_references_inc.h"
|
127
|
+
#undef HASHER
|
128
|
+
#define HASHER() H6
|
129
|
+
/* NOLINTNEXTLINE(build/include) */
|
130
|
+
#include "backward_references_inc.h"
|
131
|
+
#undef HASHER
|
132
|
+
#define HASHER() H40
|
133
|
+
/* NOLINTNEXTLINE(build/include) */
|
134
|
+
#include "backward_references_inc.h"
|
135
|
+
#undef HASHER
|
136
|
+
#define HASHER() H41
|
137
|
+
/* NOLINTNEXTLINE(build/include) */
|
138
|
+
#include "backward_references_inc.h"
|
139
|
+
#undef HASHER
|
140
|
+
#define HASHER() H42
|
141
|
+
/* NOLINTNEXTLINE(build/include) */
|
142
|
+
#include "backward_references_inc.h"
|
143
|
+
#undef HASHER
|
144
|
+
#define HASHER() H55
|
145
|
+
/* NOLINTNEXTLINE(build/include) */
|
146
|
+
#include "backward_references_inc.h"
|
147
|
+
#undef HASHER
|
148
|
+
#define HASHER() H65
|
149
|
+
/* NOLINTNEXTLINE(build/include) */
|
150
|
+
#include "backward_references_inc.h"
|
151
|
+
#undef HASHER
|
152
|
+
|
153
|
+
#undef ENABLE_COMPOUND_DICTIONARY
|
115
154
|
#undef PREFIX
|
116
155
|
|
117
156
|
#undef EXPORT_FN
|
@@ -119,22 +158,46 @@ static BROTLI_INLINE size_t ComputeDistanceCode(size_t distance,
|
|
119
158
|
#undef CAT
|
120
159
|
#undef EXPAND_CAT
|
121
160
|
|
122
|
-
void BrotliCreateBackwardReferences(
|
123
|
-
size_t
|
124
|
-
|
125
|
-
|
161
|
+
void BrotliCreateBackwardReferences(size_t num_bytes,
|
162
|
+
size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
|
163
|
+
ContextLut literal_context_lut, const BrotliEncoderParams* params,
|
164
|
+
Hasher* hasher, int* dist_cache, size_t* last_insert_len,
|
126
165
|
Command* commands, size_t* num_commands, size_t* num_literals) {
|
166
|
+
if (params->dictionary.compound.num_chunks != 0) {
|
167
|
+
switch (params->hasher.type) {
|
168
|
+
#define CASE_(N) \
|
169
|
+
case N: \
|
170
|
+
CreateBackwardReferencesDH ## N(num_bytes, \
|
171
|
+
position, ringbuffer, ringbuffer_mask, \
|
172
|
+
literal_context_lut, params, hasher, dist_cache, \
|
173
|
+
last_insert_len, commands, num_commands, num_literals); \
|
174
|
+
return;
|
175
|
+
CASE_(5)
|
176
|
+
CASE_(6)
|
177
|
+
CASE_(40)
|
178
|
+
CASE_(41)
|
179
|
+
CASE_(42)
|
180
|
+
CASE_(55)
|
181
|
+
CASE_(65)
|
182
|
+
#undef CASE_
|
183
|
+
default:
|
184
|
+
BROTLI_DCHECK(false);
|
185
|
+
break;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
127
189
|
switch (params->hasher.type) {
|
128
190
|
#define CASE_(N) \
|
129
191
|
case N: \
|
130
|
-
CreateBackwardReferencesNH ## N(
|
131
|
-
|
132
|
-
|
192
|
+
CreateBackwardReferencesNH ## N(num_bytes, \
|
193
|
+
position, ringbuffer, ringbuffer_mask, \
|
194
|
+
literal_context_lut, params, hasher, dist_cache, \
|
133
195
|
last_insert_len, commands, num_commands, num_literals); \
|
134
196
|
return;
|
135
197
|
FOR_GENERIC_HASHERS(CASE_)
|
136
198
|
#undef CASE_
|
137
199
|
default:
|
200
|
+
BROTLI_DCHECK(false);
|
138
201
|
break;
|
139
202
|
}
|
140
203
|
}
|
@@ -9,13 +9,15 @@
|
|
9
9
|
#ifndef BROTLI_ENC_BACKWARD_REFERENCES_H_
|
10
10
|
#define BROTLI_ENC_BACKWARD_REFERENCES_H_
|
11
11
|
|
12
|
+
#include <brotli/types.h>
|
13
|
+
|
12
14
|
#include "../common/constants.h"
|
15
|
+
#include "../common/context.h"
|
13
16
|
#include "../common/dictionary.h"
|
14
17
|
#include "../common/platform.h"
|
15
|
-
#include
|
16
|
-
#include "
|
17
|
-
#include "
|
18
|
-
#include "./quality.h"
|
18
|
+
#include "command.h"
|
19
|
+
#include "hash.h"
|
20
|
+
#include "quality.h"
|
19
21
|
|
20
22
|
#if defined(__cplusplus) || defined(c_plusplus)
|
21
23
|
extern "C" {
|
@@ -25,10 +27,10 @@ extern "C" {
|
|
25
27
|
initially the total amount of commands output by previous
|
26
28
|
CreateBackwardReferences calls, and must be incremented by the amount written
|
27
29
|
by this call. */
|
28
|
-
BROTLI_INTERNAL void BrotliCreateBackwardReferences(
|
29
|
-
size_t
|
30
|
-
|
31
|
-
|
30
|
+
BROTLI_INTERNAL void BrotliCreateBackwardReferences(size_t num_bytes,
|
31
|
+
size_t position, const uint8_t* ringbuffer, size_t ringbuffer_mask,
|
32
|
+
ContextLut literal_context_lut, const BrotliEncoderParams* params,
|
33
|
+
Hasher* hasher, int* dist_cache, size_t* last_insert_len,
|
32
34
|
Command* commands, size_t* num_commands, size_t* num_literals);
|
33
35
|
|
34
36
|
#if defined(__cplusplus) || defined(c_plusplus)
|