static_dict_lut.h (1588B)
1 /* Copyright 2015 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 /* Lookup table for static dictionary and transforms. */ 8 9 #ifndef BROTLI_ENC_STATIC_DICT_LUT_H_ 10 #define BROTLI_ENC_STATIC_DICT_LUT_H_ 11 12 #include "../common/dictionary.h" 13 #include "../common/platform.h" 14 #include "../common/static_init.h" 15 16 #if defined(__cplusplus) || defined(c_plusplus) 17 extern "C" { 18 #endif 19 20 typedef struct DictWord { 21 /* Highest bit is used to indicate end of bucket. */ 22 uint8_t len; 23 uint8_t transform; 24 uint16_t idx; 25 } DictWord; 26 27 /* Buckets are Hash15 results. */ 28 #define BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS 32768 29 #define BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS 31705 30 31 #if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) 32 BROTLI_INTERNAL BROTLI_BOOL BrotliEncoderInitStaticDictionaryLut( 33 const BrotliDictionary* dictionary, uint16_t* buckets, DictWord* words); 34 BROTLI_INTERNAL extern BROTLI_MODEL("small") uint16_t 35 kStaticDictionaryBuckets[BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS]; 36 BROTLI_INTERNAL extern BROTLI_MODEL("small") DictWord 37 kStaticDictionaryWords[BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS]; 38 #else 39 BROTLI_INTERNAL extern const BROTLI_MODEL("small") uint16_t 40 kStaticDictionaryBuckets[BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS]; 41 BROTLI_INTERNAL extern const BROTLI_MODEL("small") DictWord 42 kStaticDictionaryWords[BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS]; 43 #endif 44 45 #if defined(__cplusplus) || defined(c_plusplus) 46 } /* extern "C" */ 47 #endif 48 49 #endif /* BROTLI_ENC_STATIC_DICT_LUT_H_ */