| 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_cxx . . $ `c/enc/compound_dictionary.h:8:9`! |
| 9 | |
| 10 | #include "../common/platform.h"cxx . . $ `<file>/c/common/platform.h`/ |
| 11 | #include <brotli/shared_dictionary.h>cxx . . $ `<file>/c/include/brotli/shared_dictionary.h`/ |
| 12 | #include "memory.h"cxx . . $ `<file>/c/enc/memory.h`/ |
| 13 | |
| 14 | /* "Fat" prepared dictionary, could be cooked outside of C implementation, |
| 15 | * e.g. on Java side. LZ77 data is copied inside PreparedDictionary struct. */ |
| 16 | static const uint32_tcxx . . $ uint32_t# kPreparedDictionaryMagiccxx . . $ kPreparedDictionaryMagic. = 0xDEBCEDE0; |
| 17 | |
| 18 | static const uint32_tcxx . . $ uint32_t# kSharedDictionaryMagiccxx . . $ kSharedDictionaryMagic. = 0xDEBCEDE1; |
| 19 | |
| 20 | static const uint32_tcxx . . $ uint32_t# kManagedDictionaryMagiccxx . . $ kManagedDictionaryMagic. = 0xDEBCEDE2; |
| 21 | |
| 22 | /* "Lean" prepared dictionary. LZ77 data is referenced. It is the responsibility |
| 23 | * of caller of "prepare dictionary" to keep the LZ77 data while prepared |
| 24 | * dictionary is in use. */ |
| 25 | static const uint32_tcxx . . $ uint32_t# kLeanPreparedDictionaryMagiccxx . . $ kLeanPreparedDictionaryMagic. = 0xDEBCEDE3; |
| 26 | |
| 27 | static const uint64_tcxx . . $ uint64_t# kPreparedDictionaryHashMul64Longcxx . . $ kPreparedDictionaryHashMul64Long. = |
| 28 | BROTLI_MAKE_UINT64_Tcxx . . $ `c/include/brotli/types.h:57:9`!(0x1FE35A7Bu, 0xD3579BD3u); |
| 29 | |
| 30 | typedef struct PreparedDictionarycxx . . $ PreparedDictionary# { |
| 31 | uint32_tcxx . . $ uint32_t# magiccxx . . $ PreparedDictionary#magic.; |
| 32 | uint32_tcxx . . $ uint32_t# num_itemscxx . . $ PreparedDictionary#num_items.; |
| 33 | uint32_tcxx . . $ uint32_t# source_sizecxx . . $ PreparedDictionary#source_size.; |
| 34 | uint32_tcxx . . $ uint32_t# hash_bitscxx . . $ PreparedDictionary#hash_bits.; |
| 35 | uint32_tcxx . . $ uint32_t# bucket_bitscxx . . $ PreparedDictionary#bucket_bits.; |
| 36 | uint32_tcxx . . $ uint32_t# slot_bitscxx . . $ PreparedDictionary#slot_bits.; |
| 37 | |
| 38 | /* --- Dynamic size members --- */ |
| 39 | |
| 40 | /* uint32_t slot_offsets[1 << slot_bits]; */ |
| 41 | /* uint16_t heads[1 << bucket_bits]; */ |
| 42 | /* uint32_t items[variable]; */ |
| 43 | |
| 44 | /* [maybe] uint8_t* source_ref, depending on magic. */ |
| 45 | /* [maybe] uint8_t source[source_size], depending on magic. */ |
| 46 | } PreparedDictionarycxx . . $ PreparedDictionary#; |
| 47 | |
| 48 | BROTLI_INTERNALcxx . . $ `c/include/brotli/port.h:252:9`! PreparedDictionarycxx . . $ PreparedDictionary#* CreatePreparedDictionarycxx . . $ CreatePreparedDictionary(27baae329f958095).(MemoryManagercxx . . $ MemoryManager#* m, |
| 49 | const uint8_tcxx . . $ uint8_t#* source, size_t source_size); |
| 50 | |
| 51 | BROTLI_INTERNALcxx . . $ `c/include/brotli/port.h:252:9`! void DestroyPreparedDictionarycxx . . $ DestroyPreparedDictionary(1f924a578e1c6a26).(MemoryManagercxx . . $ MemoryManager#* m, |
| 52 | PreparedDictionarycxx . . $ PreparedDictionary#* dictionary); |
| 53 | |
| 54 | typedef struct CompoundDictionarycxx . . $ CompoundDictionary# { |
| 55 | /* LZ77 prefix, compound dictionary */ |
| 56 | size_t num_chunkscxx . . $ CompoundDictionary#num_chunks.; |
| 57 | size_t total_sizecxx . . $ CompoundDictionary#total_size.; |
| 58 | /* Client instances. */ |
| 59 | const PreparedDictionarycxx . . $ PreparedDictionary#* chunkscxx . . $ CompoundDictionary#chunks.[SHARED_BROTLI_MAX_COMPOUND_DICTScxx . . $ `c/include/brotli/shared_dictionary.h:22:9`! + 1]; |
| 60 | const uint8_tcxx . . $ uint8_t#* chunk_sourcecxx . . $ CompoundDictionary#chunk_source.[SHARED_BROTLI_MAX_COMPOUND_DICTScxx . . $ `c/include/brotli/shared_dictionary.h:22:9`! + 1]; |
| 61 | size_t chunk_offsetscxx . . $ CompoundDictionary#chunk_offsets.[SHARED_BROTLI_MAX_COMPOUND_DICTScxx . . $ `c/include/brotli/shared_dictionary.h:22:9`! + 1]; |
| 62 | |
| 63 | size_t num_prepared_instances_cxx . . $ CompoundDictionary#num_prepared_instances_.; |
| 64 | /* Owned instances. */ |
| 65 | PreparedDictionarycxx . . $ PreparedDictionary#* prepared_instances_cxx . . $ CompoundDictionary#prepared_instances_.[SHARED_BROTLI_MAX_COMPOUND_DICTScxx . . $ `c/include/brotli/shared_dictionary.h:22:9`! + 1]; |
| 66 | } CompoundDictionarycxx . . $ CompoundDictionary#; |
| 67 | |
| 68 | BROTLI_INTERNALcxx . . $ `c/include/brotli/port.h:252:9`! BROTLI_BOOLcxx . . $ `c/include/brotli/types.h:49:9`! AttachPreparedDictionarycxx . . $ AttachPreparedDictionary(8328b58aaec025ca).( |
| 69 | CompoundDictionarycxx . . $ CompoundDictionary#* compound, const PreparedDictionarycxx . . $ PreparedDictionary#* dictionary); |
| 70 | |
| 71 | #endif /* BROTLI_ENC_PREPARED_DICTIONARY */ |