multi_compress 0.1.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 +7 -0
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +116 -0
- data/ext/multi_compress/extconf.rb +171 -0
- data/ext/multi_compress/multi_compress.c +1534 -0
- data/ext/multi_compress/vendor/brotli/c/common/constants.c +15 -0
- data/ext/multi_compress/vendor/brotli/c/common/constants.h +201 -0
- data/ext/multi_compress/vendor/brotli/c/common/context.c +156 -0
- data/ext/multi_compress/vendor/brotli/c/common/context.h +113 -0
- data/ext/multi_compress/vendor/brotli/c/common/dictionary.c +5916 -0
- data/ext/multi_compress/vendor/brotli/c/common/dictionary.h +64 -0
- data/ext/multi_compress/vendor/brotli/c/common/platform.c +23 -0
- data/ext/multi_compress/vendor/brotli/c/common/platform.h +541 -0
- data/ext/multi_compress/vendor/brotli/c/common/shared_dictionary.c +521 -0
- data/ext/multi_compress/vendor/brotli/c/common/shared_dictionary_internal.h +75 -0
- data/ext/multi_compress/vendor/brotli/c/common/transform.c +291 -0
- data/ext/multi_compress/vendor/brotli/c/common/transform.h +85 -0
- data/ext/multi_compress/vendor/brotli/c/common/version.h +51 -0
- data/ext/multi_compress/vendor/brotli/c/dec/bit_reader.c +78 -0
- data/ext/multi_compress/vendor/brotli/c/dec/bit_reader.h +423 -0
- data/ext/multi_compress/vendor/brotli/c/dec/decode.c +2875 -0
- data/ext/multi_compress/vendor/brotli/c/dec/huffman.c +342 -0
- data/ext/multi_compress/vendor/brotli/c/dec/huffman.h +122 -0
- data/ext/multi_compress/vendor/brotli/c/dec/prefix.h +733 -0
- data/ext/multi_compress/vendor/brotli/c/dec/state.c +183 -0
- data/ext/multi_compress/vendor/brotli/c/dec/state.h +400 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references.c +207 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references.h +40 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_hq.c +939 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_hq.h +96 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_inc.h +189 -0
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost.c +36 -0
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost.h +64 -0
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost_inc.h +127 -0
- data/ext/multi_compress/vendor/brotli/c/enc/block_encoder_inc.h +34 -0
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter.c +217 -0
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter.h +52 -0
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter_inc.h +481 -0
- data/ext/multi_compress/vendor/brotli/c/enc/brotli_bit_stream.c +1336 -0
- data/ext/multi_compress/vendor/brotli/c/enc/brotli_bit_stream.h +89 -0
- data/ext/multi_compress/vendor/brotli/c/enc/cluster.c +57 -0
- data/ext/multi_compress/vendor/brotli/c/enc/cluster.h +49 -0
- data/ext/multi_compress/vendor/brotli/c/enc/cluster_inc.h +325 -0
- data/ext/multi_compress/vendor/brotli/c/enc/command.c +28 -0
- data/ext/multi_compress/vendor/brotli/c/enc/command.h +191 -0
- data/ext/multi_compress/vendor/brotli/c/enc/compound_dictionary.c +207 -0
- data/ext/multi_compress/vendor/brotli/c/enc/compound_dictionary.h +74 -0
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment.c +800 -0
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment.h +86 -0
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment_two_pass.c +657 -0
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment_two_pass.h +72 -0
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash.c +1848 -0
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash.h +25 -0
- data/ext/multi_compress/vendor/brotli/c/enc/encode.c +1996 -0
- data/ext/multi_compress/vendor/brotli/c/enc/encoder_dict.c +640 -0
- data/ext/multi_compress/vendor/brotli/c/enc/encoder_dict.h +157 -0
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode.c +504 -0
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode.h +123 -0
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode_static.h +542 -0
- data/ext/multi_compress/vendor/brotli/c/enc/fast_log.c +105 -0
- data/ext/multi_compress/vendor/brotli/c/enc/fast_log.h +67 -0
- data/ext/multi_compress/vendor/brotli/c/enc/find_match_length.h +72 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash.h +728 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_composite_inc.h +140 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +295 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match64_inc.h +262 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_inc.h +258 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +266 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_rolling_inc.h +212 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_to_binary_tree_inc.h +330 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram.c +100 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram.h +64 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram_inc.h +51 -0
- data/ext/multi_compress/vendor/brotli/c/enc/literal_cost.c +180 -0
- data/ext/multi_compress/vendor/brotli/c/enc/literal_cost.h +32 -0
- data/ext/multi_compress/vendor/brotli/c/enc/memory.c +194 -0
- data/ext/multi_compress/vendor/brotli/c/enc/memory.h +131 -0
- data/ext/multi_compress/vendor/brotli/c/enc/metablock.c +677 -0
- data/ext/multi_compress/vendor/brotli/c/enc/metablock.h +106 -0
- data/ext/multi_compress/vendor/brotli/c/enc/metablock_inc.h +185 -0
- data/ext/multi_compress/vendor/brotli/c/enc/params.h +47 -0
- data/ext/multi_compress/vendor/brotli/c/enc/prefix.h +54 -0
- data/ext/multi_compress/vendor/brotli/c/enc/quality.h +202 -0
- data/ext/multi_compress/vendor/brotli/c/enc/ringbuffer.h +168 -0
- data/ext/multi_compress/vendor/brotli/c/enc/state.h +104 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict.c +542 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict.h +41 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut.h +5866 -0
- data/ext/multi_compress/vendor/brotli/c/enc/utf8_util.c +85 -0
- data/ext/multi_compress/vendor/brotli/c/enc/utf8_util.h +33 -0
- data/ext/multi_compress/vendor/brotli/c/enc/write_bits.h +88 -0
- data/ext/multi_compress/vendor/brotli/c/include/brotli/decode.h +409 -0
- data/ext/multi_compress/vendor/brotli/c/include/brotli/encode.h +501 -0
- data/ext/multi_compress/vendor/brotli/c/include/brotli/port.h +305 -0
- data/ext/multi_compress/vendor/brotli/c/include/brotli/shared_dictionary.h +100 -0
- data/ext/multi_compress/vendor/brotli/c/include/brotli/types.h +83 -0
- data/ext/multi_compress/vendor/lz4/lib/LICENSE +24 -0
- data/ext/multi_compress/vendor/lz4/lib/Makefile +244 -0
- data/ext/multi_compress/vendor/lz4/lib/README.md +193 -0
- data/ext/multi_compress/vendor/lz4/lib/dll/example/Makefile +63 -0
- data/ext/multi_compress/vendor/lz4/lib/dll/example/README.md +69 -0
- data/ext/multi_compress/vendor/lz4/lib/dll/example/fullbench-dll.sln +25 -0
- data/ext/multi_compress/vendor/lz4/lib/dll/example/fullbench-dll.vcxproj +182 -0
- data/ext/multi_compress/vendor/lz4/lib/liblz4-dll.rc.in +35 -0
- data/ext/multi_compress/vendor/lz4/lib/liblz4.pc.in +14 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4.c +2829 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4.h +884 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4file.c +341 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4file.h +93 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4frame.c +2136 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4frame.h +751 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4frame_static.h +47 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4hc.c +2192 -0
- data/ext/multi_compress/vendor/lz4/lib/lz4hc.h +414 -0
- data/ext/multi_compress/vendor/lz4/lib/xxhash.c +1030 -0
- data/ext/multi_compress/vendor/lz4/lib/xxhash.h +328 -0
- data/ext/multi_compress/vendor/zstd/lib/BUCK +232 -0
- data/ext/multi_compress/vendor/zstd/lib/Makefile +369 -0
- data/ext/multi_compress/vendor/zstd/lib/README.md +237 -0
- data/ext/multi_compress/vendor/zstd/lib/common/allocations.h +55 -0
- data/ext/multi_compress/vendor/zstd/lib/common/bits.h +200 -0
- data/ext/multi_compress/vendor/zstd/lib/common/bitstream.h +457 -0
- data/ext/multi_compress/vendor/zstd/lib/common/compiler.h +450 -0
- data/ext/multi_compress/vendor/zstd/lib/common/cpu.h +249 -0
- data/ext/multi_compress/vendor/zstd/lib/common/debug.c +30 -0
- data/ext/multi_compress/vendor/zstd/lib/common/debug.h +116 -0
- data/ext/multi_compress/vendor/zstd/lib/common/entropy_common.c +340 -0
- data/ext/multi_compress/vendor/zstd/lib/common/error_private.c +63 -0
- data/ext/multi_compress/vendor/zstd/lib/common/error_private.h +168 -0
- data/ext/multi_compress/vendor/zstd/lib/common/fse.h +640 -0
- data/ext/multi_compress/vendor/zstd/lib/common/fse_decompress.c +313 -0
- data/ext/multi_compress/vendor/zstd/lib/common/huf.h +286 -0
- data/ext/multi_compress/vendor/zstd/lib/common/mem.h +426 -0
- data/ext/multi_compress/vendor/zstd/lib/common/pool.c +371 -0
- data/ext/multi_compress/vendor/zstd/lib/common/pool.h +90 -0
- data/ext/multi_compress/vendor/zstd/lib/common/portability_macros.h +158 -0
- data/ext/multi_compress/vendor/zstd/lib/common/threading.c +182 -0
- data/ext/multi_compress/vendor/zstd/lib/common/threading.h +150 -0
- data/ext/multi_compress/vendor/zstd/lib/common/xxhash.c +18 -0
- data/ext/multi_compress/vendor/zstd/lib/common/xxhash.h +7020 -0
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_common.c +48 -0
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_deps.h +111 -0
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_internal.h +392 -0
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_trace.h +163 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/clevels.h +134 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/fse_compress.c +625 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.c +181 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.h +75 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/huf_compress.c +1464 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress.c +7153 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_internal.h +1534 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_literals.c +235 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_literals.h +39 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.c +442 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.h +54 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.c +688 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.h +32 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_cwksp.h +748 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.c +770 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.h +50 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.c +968 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.h +38 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.c +2199 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.h +202 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.c +730 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.h +117 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm_geartab.h +106 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.c +1576 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.h +80 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.c +1882 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.h +113 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress.c +1944 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress_amd64.S +595 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.c +244 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.h +44 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress.c +2407 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.c +2215 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.h +73 -0
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_internal.h +240 -0
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff.h +214 -0
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_common.c +26 -0
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_compress.c +167 -0
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_decompress.c +77 -0
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.c +1261 -0
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.h +152 -0
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/divsufsort.c +1913 -0
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/divsufsort.h +67 -0
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/fastcover.c +766 -0
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/zdict.c +1133 -0
- data/ext/multi_compress/vendor/zstd/lib/dll/example/Makefile +48 -0
- data/ext/multi_compress/vendor/zstd/lib/dll/example/README.md +63 -0
- data/ext/multi_compress/vendor/zstd/lib/dll/example/build_package.bat +20 -0
- data/ext/multi_compress/vendor/zstd/lib/dll/example/fullbench-dll.sln +25 -0
- data/ext/multi_compress/vendor/zstd/lib/dll/example/fullbench-dll.vcxproj +181 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_legacy.h +452 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.c +2127 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.h +94 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.c +3465 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.h +93 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.c +3105 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.h +93 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.c +3598 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.h +142 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.c +4005 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.h +162 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.c +4106 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.h +172 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.c +4490 -0
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.h +187 -0
- data/ext/multi_compress/vendor/zstd/lib/libzstd.mk +237 -0
- data/ext/multi_compress/vendor/zstd/lib/libzstd.pc.in +16 -0
- data/ext/multi_compress/vendor/zstd/lib/module.modulemap +35 -0
- data/ext/multi_compress/vendor/zstd/lib/zdict.h +474 -0
- data/ext/multi_compress/vendor/zstd/lib/zstd.h +3089 -0
- data/ext/multi_compress/vendor/zstd/lib/zstd_errors.h +114 -0
- data/lib/multi_compress/version.rb +5 -0
- data/lib/multi_compress.rb +329 -0
- metadata +322 -0
|
@@ -0,0 +1,191 @@
|
|
|
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
|
+
/* This class models a sequence of literals and a backward reference copy. */
|
|
8
|
+
|
|
9
|
+
#ifndef BROTLI_ENC_COMMAND_H_
|
|
10
|
+
#define BROTLI_ENC_COMMAND_H_
|
|
11
|
+
|
|
12
|
+
#include <brotli/types.h>
|
|
13
|
+
|
|
14
|
+
#include "../common/constants.h"
|
|
15
|
+
#include "../common/platform.h"
|
|
16
|
+
#include "fast_log.h"
|
|
17
|
+
#include "params.h"
|
|
18
|
+
#include "prefix.h"
|
|
19
|
+
|
|
20
|
+
#if defined(__cplusplus) || defined(c_plusplus)
|
|
21
|
+
extern "C" {
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
BROTLI_INTERNAL extern const uint32_t
|
|
25
|
+
kBrotliInsBase[BROTLI_NUM_INS_COPY_CODES];
|
|
26
|
+
BROTLI_INTERNAL extern const uint32_t
|
|
27
|
+
kBrotliInsExtra[BROTLI_NUM_INS_COPY_CODES];
|
|
28
|
+
BROTLI_INTERNAL extern const uint32_t
|
|
29
|
+
kBrotliCopyBase[BROTLI_NUM_INS_COPY_CODES];
|
|
30
|
+
BROTLI_INTERNAL extern const uint32_t
|
|
31
|
+
kBrotliCopyExtra[BROTLI_NUM_INS_COPY_CODES];
|
|
32
|
+
|
|
33
|
+
static BROTLI_INLINE uint16_t GetInsertLengthCode(size_t insertlen) {
|
|
34
|
+
if (insertlen < 6) {
|
|
35
|
+
return (uint16_t)insertlen;
|
|
36
|
+
} else if (insertlen < 130) {
|
|
37
|
+
uint32_t nbits = Log2FloorNonZero(insertlen - 2) - 1u;
|
|
38
|
+
return (uint16_t)((nbits << 1) + ((insertlen - 2) >> nbits) + 2);
|
|
39
|
+
} else if (insertlen < 2114) {
|
|
40
|
+
return (uint16_t)(Log2FloorNonZero(insertlen - 66) + 10);
|
|
41
|
+
} else if (insertlen < 6210) {
|
|
42
|
+
return 21u;
|
|
43
|
+
} else if (insertlen < 22594) {
|
|
44
|
+
return 22u;
|
|
45
|
+
} else {
|
|
46
|
+
return 23u;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static BROTLI_INLINE uint16_t GetCopyLengthCode(size_t copylen) {
|
|
51
|
+
if (copylen < 10) {
|
|
52
|
+
return (uint16_t)(copylen - 2);
|
|
53
|
+
} else if (copylen < 134) {
|
|
54
|
+
uint32_t nbits = Log2FloorNonZero(copylen - 6) - 1u;
|
|
55
|
+
return (uint16_t)((nbits << 1) + ((copylen - 6) >> nbits) + 4);
|
|
56
|
+
} else if (copylen < 2118) {
|
|
57
|
+
return (uint16_t)(Log2FloorNonZero(copylen - 70) + 12);
|
|
58
|
+
} else {
|
|
59
|
+
return 23u;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static BROTLI_INLINE uint16_t CombineLengthCodes(
|
|
64
|
+
uint16_t inscode, uint16_t copycode, BROTLI_BOOL use_last_distance) {
|
|
65
|
+
uint16_t bits64 =
|
|
66
|
+
(uint16_t)((copycode & 0x7u) | ((inscode & 0x7u) << 3u));
|
|
67
|
+
if (use_last_distance && inscode < 8u && copycode < 16u) {
|
|
68
|
+
return (copycode < 8u) ? bits64 : (bits64 | 64u);
|
|
69
|
+
} else {
|
|
70
|
+
/* Specification: 5 Encoding of ... (last table) */
|
|
71
|
+
/* offset = 2 * index, where index is in range [0..8] */
|
|
72
|
+
uint32_t offset = 2u * ((copycode >> 3u) + 3u * (inscode >> 3u));
|
|
73
|
+
/* All values in specification are K * 64,
|
|
74
|
+
where K = [2, 3, 6, 4, 5, 8, 7, 9, 10],
|
|
75
|
+
i + 1 = [1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
76
|
+
K - i - 1 = [1, 1, 3, 0, 0, 2, 0, 1, 2] = D.
|
|
77
|
+
All values in D require only 2 bits to encode.
|
|
78
|
+
Magic constant is shifted 6 bits left, to avoid final multiplication. */
|
|
79
|
+
offset = (offset << 5u) + 0x40u + ((0x520D40u >> offset) & 0xC0u);
|
|
80
|
+
return (uint16_t)(offset | bits64);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static BROTLI_INLINE void GetLengthCode(size_t insertlen, size_t copylen,
|
|
85
|
+
BROTLI_BOOL use_last_distance,
|
|
86
|
+
uint16_t* code) {
|
|
87
|
+
uint16_t inscode = GetInsertLengthCode(insertlen);
|
|
88
|
+
uint16_t copycode = GetCopyLengthCode(copylen);
|
|
89
|
+
*code = CombineLengthCodes(inscode, copycode, use_last_distance);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static BROTLI_INLINE uint32_t GetInsertBase(uint16_t inscode) {
|
|
93
|
+
return kBrotliInsBase[inscode];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static BROTLI_INLINE uint32_t GetInsertExtra(uint16_t inscode) {
|
|
97
|
+
return kBrotliInsExtra[inscode];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static BROTLI_INLINE uint32_t GetCopyBase(uint16_t copycode) {
|
|
101
|
+
return kBrotliCopyBase[copycode];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static BROTLI_INLINE uint32_t GetCopyExtra(uint16_t copycode) {
|
|
105
|
+
return kBrotliCopyExtra[copycode];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
typedef struct Command {
|
|
109
|
+
uint32_t insert_len_;
|
|
110
|
+
/* Stores copy_len in low 25 bits and copy_code - copy_len in high 7 bit. */
|
|
111
|
+
uint32_t copy_len_;
|
|
112
|
+
/* Stores distance extra bits. */
|
|
113
|
+
uint32_t dist_extra_;
|
|
114
|
+
uint16_t cmd_prefix_;
|
|
115
|
+
/* Stores distance code in low 10 bits
|
|
116
|
+
and number of extra bits in high 6 bits. */
|
|
117
|
+
uint16_t dist_prefix_;
|
|
118
|
+
} Command;
|
|
119
|
+
|
|
120
|
+
/* distance_code is e.g. 0 for same-as-last short code, or 16 for offset 1. */
|
|
121
|
+
static BROTLI_INLINE void InitCommand(Command* self,
|
|
122
|
+
const BrotliDistanceParams* dist, size_t insertlen,
|
|
123
|
+
size_t copylen, int copylen_code_delta, size_t distance_code) {
|
|
124
|
+
/* Don't rely on signed int representation, use honest casts. */
|
|
125
|
+
uint32_t delta = (uint8_t)((int8_t)copylen_code_delta);
|
|
126
|
+
self->insert_len_ = (uint32_t)insertlen;
|
|
127
|
+
self->copy_len_ = (uint32_t)(copylen | (delta << 25));
|
|
128
|
+
/* The distance prefix and extra bits are stored in this Command as if
|
|
129
|
+
npostfix and ndirect were 0, they are only recomputed later after the
|
|
130
|
+
clustering if needed. */
|
|
131
|
+
PrefixEncodeCopyDistance(
|
|
132
|
+
distance_code, dist->num_direct_distance_codes,
|
|
133
|
+
dist->distance_postfix_bits, &self->dist_prefix_, &self->dist_extra_);
|
|
134
|
+
GetLengthCode(
|
|
135
|
+
insertlen, (size_t)((int)copylen + copylen_code_delta),
|
|
136
|
+
TO_BROTLI_BOOL((self->dist_prefix_ & 0x3FF) == 0), &self->cmd_prefix_);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
static BROTLI_INLINE void InitInsertCommand(Command* self, size_t insertlen) {
|
|
140
|
+
self->insert_len_ = (uint32_t)insertlen;
|
|
141
|
+
self->copy_len_ = 4 << 25;
|
|
142
|
+
self->dist_extra_ = 0;
|
|
143
|
+
self->dist_prefix_ = BROTLI_NUM_DISTANCE_SHORT_CODES;
|
|
144
|
+
GetLengthCode(insertlen, 4, BROTLI_FALSE, &self->cmd_prefix_);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static BROTLI_INLINE uint32_t CommandRestoreDistanceCode(
|
|
148
|
+
const Command* self, const BrotliDistanceParams* dist) {
|
|
149
|
+
if ((self->dist_prefix_ & 0x3FFu) <
|
|
150
|
+
BROTLI_NUM_DISTANCE_SHORT_CODES + dist->num_direct_distance_codes) {
|
|
151
|
+
return self->dist_prefix_ & 0x3FFu;
|
|
152
|
+
} else {
|
|
153
|
+
uint32_t dcode = self->dist_prefix_ & 0x3FFu;
|
|
154
|
+
uint32_t nbits = self->dist_prefix_ >> 10;
|
|
155
|
+
uint32_t extra = self->dist_extra_;
|
|
156
|
+
uint32_t postfix_mask = (1U << dist->distance_postfix_bits) - 1U;
|
|
157
|
+
uint32_t hcode = (dcode - dist->num_direct_distance_codes -
|
|
158
|
+
BROTLI_NUM_DISTANCE_SHORT_CODES) >>
|
|
159
|
+
dist->distance_postfix_bits;
|
|
160
|
+
uint32_t lcode = (dcode - dist->num_direct_distance_codes -
|
|
161
|
+
BROTLI_NUM_DISTANCE_SHORT_CODES) & postfix_mask;
|
|
162
|
+
uint32_t offset = ((2U + (hcode & 1U)) << nbits) - 4U;
|
|
163
|
+
return ((offset + extra) << dist->distance_postfix_bits) + lcode +
|
|
164
|
+
dist->num_direct_distance_codes + BROTLI_NUM_DISTANCE_SHORT_CODES;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static BROTLI_INLINE uint32_t CommandDistanceContext(const Command* self) {
|
|
169
|
+
uint32_t r = self->cmd_prefix_ >> 6;
|
|
170
|
+
uint32_t c = self->cmd_prefix_ & 7;
|
|
171
|
+
if ((r == 0 || r == 2 || r == 4 || r == 7) && (c <= 2)) {
|
|
172
|
+
return c;
|
|
173
|
+
}
|
|
174
|
+
return 3;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static BROTLI_INLINE uint32_t CommandCopyLen(const Command* self) {
|
|
178
|
+
return self->copy_len_ & 0x1FFFFFF;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static BROTLI_INLINE uint32_t CommandCopyLenCode(const Command* self) {
|
|
182
|
+
uint32_t modifier = self->copy_len_ >> 25;
|
|
183
|
+
int32_t delta = (int8_t)((uint8_t)(modifier | ((modifier & 0x40) << 1)));
|
|
184
|
+
return (uint32_t)((int32_t)(self->copy_len_ & 0x1FFFFFF) + delta);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
#if defined(__cplusplus) || defined(c_plusplus)
|
|
188
|
+
} /* extern "C" */
|
|
189
|
+
#endif
|
|
190
|
+
|
|
191
|
+
#endif /* BROTLI_ENC_COMMAND_H_ */
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/* Copyright 2017 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 "compound_dictionary.h"
|
|
8
|
+
|
|
9
|
+
#include <brotli/types.h>
|
|
10
|
+
|
|
11
|
+
#include "../common/platform.h"
|
|
12
|
+
#include "memory.h"
|
|
13
|
+
#include "quality.h"
|
|
14
|
+
|
|
15
|
+
static PreparedDictionary* CreatePreparedDictionaryWithParams(MemoryManager* m,
|
|
16
|
+
const uint8_t* source, size_t source_size, uint32_t bucket_bits,
|
|
17
|
+
uint32_t slot_bits, uint32_t hash_bits, uint16_t bucket_limit) {
|
|
18
|
+
/* Step 1: create "bloated" hasher. */
|
|
19
|
+
uint32_t num_slots = 1u << slot_bits;
|
|
20
|
+
uint32_t num_buckets = 1u << bucket_bits;
|
|
21
|
+
uint32_t hash_shift = 64u - bucket_bits;
|
|
22
|
+
uint64_t hash_mask = (~((uint64_t)0U)) >> (64 - hash_bits);
|
|
23
|
+
uint32_t slot_mask = num_slots - 1;
|
|
24
|
+
size_t alloc_size = (sizeof(uint32_t) << slot_bits) +
|
|
25
|
+
(sizeof(uint32_t) << slot_bits) +
|
|
26
|
+
(sizeof(uint16_t) << bucket_bits) +
|
|
27
|
+
(sizeof(uint32_t) << bucket_bits) +
|
|
28
|
+
(sizeof(uint32_t) * source_size);
|
|
29
|
+
uint8_t* flat = NULL;
|
|
30
|
+
PreparedDictionary* result = NULL;
|
|
31
|
+
uint16_t* num = NULL;
|
|
32
|
+
uint32_t* bucket_heads = NULL;
|
|
33
|
+
uint32_t* next_bucket = NULL;
|
|
34
|
+
uint32_t* slot_offsets = NULL;
|
|
35
|
+
uint16_t* heads = NULL;
|
|
36
|
+
uint32_t* items = NULL;
|
|
37
|
+
uint8_t** source_ref = NULL;
|
|
38
|
+
uint32_t i;
|
|
39
|
+
uint32_t* slot_size = NULL;
|
|
40
|
+
uint32_t* slot_limit = NULL;
|
|
41
|
+
uint32_t total_items = 0;
|
|
42
|
+
if (slot_bits > 16) return NULL;
|
|
43
|
+
if (slot_bits > bucket_bits) return NULL;
|
|
44
|
+
if (bucket_bits - slot_bits >= 16) return NULL;
|
|
45
|
+
|
|
46
|
+
flat = BROTLI_ALLOC(m, uint8_t, alloc_size);
|
|
47
|
+
if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(flat)) return NULL;
|
|
48
|
+
|
|
49
|
+
slot_size = (uint32_t*)flat;
|
|
50
|
+
slot_limit = (uint32_t*)(&slot_size[num_slots]);
|
|
51
|
+
num = (uint16_t*)(&slot_limit[num_slots]);
|
|
52
|
+
bucket_heads = (uint32_t*)(&num[num_buckets]);
|
|
53
|
+
next_bucket = (uint32_t*)(&bucket_heads[num_buckets]);
|
|
54
|
+
memset(num, 0, num_buckets * sizeof(num[0]));
|
|
55
|
+
|
|
56
|
+
/* TODO(eustas): apply custom "store" order. */
|
|
57
|
+
for (i = 0; i + 7 < source_size; ++i) {
|
|
58
|
+
const uint64_t h = (BROTLI_UNALIGNED_LOAD64LE(&source[i]) & hash_mask) *
|
|
59
|
+
kPreparedDictionaryHashMul64Long;
|
|
60
|
+
const uint32_t key = (uint32_t)(h >> hash_shift);
|
|
61
|
+
uint16_t count = num[key];
|
|
62
|
+
next_bucket[i] = (count == 0) ? ((uint32_t)(-1)) : bucket_heads[key];
|
|
63
|
+
bucket_heads[key] = i;
|
|
64
|
+
count++;
|
|
65
|
+
if (count > bucket_limit) count = bucket_limit;
|
|
66
|
+
num[key] = count;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Step 2: find slot limits. */
|
|
70
|
+
for (i = 0; i < num_slots; ++i) {
|
|
71
|
+
BROTLI_BOOL overflow = BROTLI_FALSE;
|
|
72
|
+
slot_limit[i] = bucket_limit;
|
|
73
|
+
while (BROTLI_TRUE) {
|
|
74
|
+
uint32_t limit = slot_limit[i];
|
|
75
|
+
size_t j;
|
|
76
|
+
uint32_t count = 0;
|
|
77
|
+
overflow = BROTLI_FALSE;
|
|
78
|
+
for (j = i; j < num_buckets; j += num_slots) {
|
|
79
|
+
uint32_t size = num[j];
|
|
80
|
+
/* Last chain may span behind 64K limit; overflow happens only if
|
|
81
|
+
we are about to use 0xFFFF+ as item offset. */
|
|
82
|
+
if (count >= 0xFFFF) {
|
|
83
|
+
overflow = BROTLI_TRUE;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (size > limit) size = limit;
|
|
87
|
+
count += size;
|
|
88
|
+
}
|
|
89
|
+
if (!overflow) {
|
|
90
|
+
slot_size[i] = count;
|
|
91
|
+
total_items += count;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
slot_limit[i]--;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Step 3: transfer data to "slim" hasher. */
|
|
99
|
+
alloc_size = sizeof(PreparedDictionary) + (sizeof(uint32_t) << slot_bits) +
|
|
100
|
+
(sizeof(uint16_t) << bucket_bits) + (sizeof(uint32_t) * total_items) +
|
|
101
|
+
sizeof(uint8_t*);
|
|
102
|
+
|
|
103
|
+
result = (PreparedDictionary*)BROTLI_ALLOC(m, uint8_t, alloc_size);
|
|
104
|
+
if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(result)) {
|
|
105
|
+
BROTLI_FREE(m, flat);
|
|
106
|
+
return NULL;
|
|
107
|
+
}
|
|
108
|
+
slot_offsets = (uint32_t*)(&result[1]);
|
|
109
|
+
heads = (uint16_t*)(&slot_offsets[num_slots]);
|
|
110
|
+
items = (uint32_t*)(&heads[num_buckets]);
|
|
111
|
+
source_ref = (uint8_t**)(&items[total_items]);
|
|
112
|
+
|
|
113
|
+
result->magic = kLeanPreparedDictionaryMagic;
|
|
114
|
+
result->num_items = total_items;
|
|
115
|
+
result->source_size = (uint32_t)source_size;
|
|
116
|
+
result->hash_bits = hash_bits;
|
|
117
|
+
result->bucket_bits = bucket_bits;
|
|
118
|
+
result->slot_bits = slot_bits;
|
|
119
|
+
BROTLI_UNALIGNED_STORE_PTR(source_ref, source);
|
|
120
|
+
|
|
121
|
+
total_items = 0;
|
|
122
|
+
for (i = 0; i < num_slots; ++i) {
|
|
123
|
+
slot_offsets[i] = total_items;
|
|
124
|
+
total_items += slot_size[i];
|
|
125
|
+
slot_size[i] = 0;
|
|
126
|
+
}
|
|
127
|
+
for (i = 0; i < num_buckets; ++i) {
|
|
128
|
+
uint32_t slot = i & slot_mask;
|
|
129
|
+
uint32_t count = num[i];
|
|
130
|
+
uint32_t pos;
|
|
131
|
+
size_t j;
|
|
132
|
+
size_t cursor = slot_size[slot];
|
|
133
|
+
if (count > slot_limit[slot]) count = slot_limit[slot];
|
|
134
|
+
if (count == 0) {
|
|
135
|
+
heads[i] = 0xFFFF;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
heads[i] = (uint16_t)cursor;
|
|
139
|
+
cursor += slot_offsets[slot];
|
|
140
|
+
slot_size[slot] += count;
|
|
141
|
+
pos = bucket_heads[i];
|
|
142
|
+
for (j = 0; j < count; j++) {
|
|
143
|
+
items[cursor++] = pos;
|
|
144
|
+
pos = next_bucket[pos];
|
|
145
|
+
}
|
|
146
|
+
items[cursor - 1] |= 0x80000000;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
BROTLI_FREE(m, flat);
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
PreparedDictionary* CreatePreparedDictionary(MemoryManager* m,
|
|
154
|
+
const uint8_t* source, size_t source_size) {
|
|
155
|
+
uint32_t bucket_bits = 17;
|
|
156
|
+
uint32_t slot_bits = 7;
|
|
157
|
+
uint32_t hash_bits = 40;
|
|
158
|
+
uint16_t bucket_limit = 32;
|
|
159
|
+
size_t volume = 16u << bucket_bits;
|
|
160
|
+
/* Tune parameters to fit dictionary size. */
|
|
161
|
+
while (volume < source_size && bucket_bits < 22) {
|
|
162
|
+
bucket_bits++;
|
|
163
|
+
slot_bits++;
|
|
164
|
+
volume <<= 1;
|
|
165
|
+
}
|
|
166
|
+
return CreatePreparedDictionaryWithParams(m,
|
|
167
|
+
source, source_size, bucket_bits, slot_bits, hash_bits, bucket_limit);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void DestroyPreparedDictionary(MemoryManager* m,
|
|
171
|
+
PreparedDictionary* dictionary) {
|
|
172
|
+
if (!dictionary) return;
|
|
173
|
+
BROTLI_FREE(m, dictionary);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
BROTLI_BOOL AttachPreparedDictionary(
|
|
177
|
+
CompoundDictionary* compound, const PreparedDictionary* dictionary) {
|
|
178
|
+
size_t length = 0;
|
|
179
|
+
size_t index = 0;
|
|
180
|
+
|
|
181
|
+
if (compound->num_chunks == SHARED_BROTLI_MAX_COMPOUND_DICTS) {
|
|
182
|
+
return BROTLI_FALSE;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!dictionary) return BROTLI_FALSE;
|
|
186
|
+
|
|
187
|
+
length = dictionary->source_size;
|
|
188
|
+
index = compound->num_chunks;
|
|
189
|
+
compound->total_size += length;
|
|
190
|
+
compound->chunks[index] = dictionary;
|
|
191
|
+
compound->chunk_offsets[index + 1] = compound->total_size;
|
|
192
|
+
{
|
|
193
|
+
uint32_t* slot_offsets = (uint32_t*)(&dictionary[1]);
|
|
194
|
+
uint16_t* heads = (uint16_t*)(&slot_offsets[1u << dictionary->slot_bits]);
|
|
195
|
+
uint32_t* items = (uint32_t*)(&heads[1u << dictionary->bucket_bits]);
|
|
196
|
+
const void* tail = (void*)&items[dictionary->num_items];
|
|
197
|
+
if (dictionary->magic == kPreparedDictionaryMagic) {
|
|
198
|
+
compound->chunk_source[index] = (const uint8_t*)tail;
|
|
199
|
+
} else {
|
|
200
|
+
/* dictionary->magic == kLeanPreparedDictionaryMagic */
|
|
201
|
+
compound->chunk_source[index] =
|
|
202
|
+
(const uint8_t*)BROTLI_UNALIGNED_LOAD_PTR((const uint8_t**)tail);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
compound->num_chunks++;
|
|
206
|
+
return BROTLI_TRUE;
|
|
207
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* Copyright 2017 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_ENC_PREPARED_DICTIONARY_H_
|
|
8
|
+
#define BROTLI_ENC_PREPARED_DICTIONARY_H_
|
|
9
|
+
|
|
10
|
+
#include <brotli/shared_dictionary.h>
|
|
11
|
+
#include <brotli/types.h>
|
|
12
|
+
|
|
13
|
+
#include "../common/platform.h"
|
|
14
|
+
#include "../common/constants.h"
|
|
15
|
+
#include "memory.h"
|
|
16
|
+
|
|
17
|
+
/* "Fat" prepared dictionary, could be cooked outside of C implementation,
|
|
18
|
+
* e.g. on Java side. LZ77 data is copied inside PreparedDictionary struct. */
|
|
19
|
+
static const uint32_t kPreparedDictionaryMagic = 0xDEBCEDE0;
|
|
20
|
+
|
|
21
|
+
static const uint32_t kSharedDictionaryMagic = 0xDEBCEDE1;
|
|
22
|
+
|
|
23
|
+
static const uint32_t kManagedDictionaryMagic = 0xDEBCEDE2;
|
|
24
|
+
|
|
25
|
+
/* "Lean" prepared dictionary. LZ77 data is referenced. It is the responsibility
|
|
26
|
+
* of caller of "prepare dictionary" to keep the LZ77 data while prepared
|
|
27
|
+
* dictionary is in use. */
|
|
28
|
+
static const uint32_t kLeanPreparedDictionaryMagic = 0xDEBCEDE3;
|
|
29
|
+
|
|
30
|
+
static const uint64_t kPreparedDictionaryHashMul64Long =
|
|
31
|
+
BROTLI_MAKE_UINT64_T(0x1FE35A7Bu, 0xD3579BD3u);
|
|
32
|
+
|
|
33
|
+
typedef struct PreparedDictionary {
|
|
34
|
+
uint32_t magic;
|
|
35
|
+
uint32_t num_items;
|
|
36
|
+
uint32_t source_size;
|
|
37
|
+
uint32_t hash_bits;
|
|
38
|
+
uint32_t bucket_bits;
|
|
39
|
+
uint32_t slot_bits;
|
|
40
|
+
|
|
41
|
+
/* --- Dynamic size members --- */
|
|
42
|
+
|
|
43
|
+
/* uint32_t slot_offsets[1 << slot_bits]; */
|
|
44
|
+
/* uint16_t heads[1 << bucket_bits]; */
|
|
45
|
+
/* uint32_t items[variable]; */
|
|
46
|
+
|
|
47
|
+
/* [maybe] uint8_t* source_ref, depending on magic. */
|
|
48
|
+
/* [maybe] uint8_t source[source_size], depending on magic. */
|
|
49
|
+
} PreparedDictionary;
|
|
50
|
+
|
|
51
|
+
BROTLI_INTERNAL PreparedDictionary* CreatePreparedDictionary(MemoryManager* m,
|
|
52
|
+
const uint8_t* source, size_t source_size);
|
|
53
|
+
|
|
54
|
+
BROTLI_INTERNAL void DestroyPreparedDictionary(MemoryManager* m,
|
|
55
|
+
PreparedDictionary* dictionary);
|
|
56
|
+
|
|
57
|
+
typedef struct CompoundDictionary {
|
|
58
|
+
/* LZ77 prefix, compound dictionary */
|
|
59
|
+
size_t num_chunks;
|
|
60
|
+
size_t total_size;
|
|
61
|
+
/* Client instances. */
|
|
62
|
+
const PreparedDictionary* chunks[SHARED_BROTLI_MAX_COMPOUND_DICTS + 1];
|
|
63
|
+
const uint8_t* chunk_source[SHARED_BROTLI_MAX_COMPOUND_DICTS + 1];
|
|
64
|
+
size_t chunk_offsets[SHARED_BROTLI_MAX_COMPOUND_DICTS + 1];
|
|
65
|
+
|
|
66
|
+
size_t num_prepared_instances_;
|
|
67
|
+
/* Owned instances. */
|
|
68
|
+
PreparedDictionary* prepared_instances_[SHARED_BROTLI_MAX_COMPOUND_DICTS + 1];
|
|
69
|
+
} CompoundDictionary;
|
|
70
|
+
|
|
71
|
+
BROTLI_INTERNAL BROTLI_BOOL AttachPreparedDictionary(
|
|
72
|
+
CompoundDictionary* compound, const PreparedDictionary* dictionary);
|
|
73
|
+
|
|
74
|
+
#endif /* BROTLI_ENC_PREPARED_DICTIONARY */
|