1*6777b538SAndroid Build Coastguard Worker /* Copyright 2013 Google Inc. All Rights Reserved. 2*6777b538SAndroid Build Coastguard Worker 3*6777b538SAndroid Build Coastguard Worker Distributed under MIT license. 4*6777b538SAndroid Build Coastguard Worker See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 5*6777b538SAndroid Build Coastguard Worker */ 6*6777b538SAndroid Build Coastguard Worker 7*6777b538SAndroid Build Coastguard Worker /* Models the histograms of literals, commands and distance codes. */ 8*6777b538SAndroid Build Coastguard Worker 9*6777b538SAndroid Build Coastguard Worker #ifndef BROTLI_ENC_HISTOGRAM_H_ 10*6777b538SAndroid Build Coastguard Worker #define BROTLI_ENC_HISTOGRAM_H_ 11*6777b538SAndroid Build Coastguard Worker 12*6777b538SAndroid Build Coastguard Worker #include <string.h> /* memset */ 13*6777b538SAndroid Build Coastguard Worker 14*6777b538SAndroid Build Coastguard Worker #include "../common/constants.h" 15*6777b538SAndroid Build Coastguard Worker #include "../common/context.h" 16*6777b538SAndroid Build Coastguard Worker #include "../common/platform.h" 17*6777b538SAndroid Build Coastguard Worker #include <brotli/types.h> 18*6777b538SAndroid Build Coastguard Worker #include "block_splitter.h" 19*6777b538SAndroid Build Coastguard Worker #include "command.h" 20*6777b538SAndroid Build Coastguard Worker 21*6777b538SAndroid Build Coastguard Worker #if defined(__cplusplus) || defined(c_plusplus) 22*6777b538SAndroid Build Coastguard Worker extern "C" { 23*6777b538SAndroid Build Coastguard Worker #endif 24*6777b538SAndroid Build Coastguard Worker 25*6777b538SAndroid Build Coastguard Worker /* The distance symbols effectively used by "Large Window Brotli" (32-bit). */ 26*6777b538SAndroid Build Coastguard Worker #define BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 544 27*6777b538SAndroid Build Coastguard Worker 28*6777b538SAndroid Build Coastguard Worker #define FN(X) X ## Literal 29*6777b538SAndroid Build Coastguard Worker #define DATA_SIZE BROTLI_NUM_LITERAL_SYMBOLS 30*6777b538SAndroid Build Coastguard Worker #define DataType uint8_t 31*6777b538SAndroid Build Coastguard Worker #include "histogram_inc.h" /* NOLINT(build/include) */ 32*6777b538SAndroid Build Coastguard Worker #undef DataType 33*6777b538SAndroid Build Coastguard Worker #undef DATA_SIZE 34*6777b538SAndroid Build Coastguard Worker #undef FN 35*6777b538SAndroid Build Coastguard Worker 36*6777b538SAndroid Build Coastguard Worker #define FN(X) X ## Command 37*6777b538SAndroid Build Coastguard Worker #define DataType uint16_t 38*6777b538SAndroid Build Coastguard Worker #define DATA_SIZE BROTLI_NUM_COMMAND_SYMBOLS 39*6777b538SAndroid Build Coastguard Worker #include "histogram_inc.h" /* NOLINT(build/include) */ 40*6777b538SAndroid Build Coastguard Worker #undef DATA_SIZE 41*6777b538SAndroid Build Coastguard Worker #undef FN 42*6777b538SAndroid Build Coastguard Worker 43*6777b538SAndroid Build Coastguard Worker #define FN(X) X ## Distance 44*6777b538SAndroid Build Coastguard Worker #define DATA_SIZE BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 45*6777b538SAndroid Build Coastguard Worker #include "histogram_inc.h" /* NOLINT(build/include) */ 46*6777b538SAndroid Build Coastguard Worker #undef DataType 47*6777b538SAndroid Build Coastguard Worker #undef DATA_SIZE 48*6777b538SAndroid Build Coastguard Worker #undef FN 49*6777b538SAndroid Build Coastguard Worker 50*6777b538SAndroid Build Coastguard Worker BROTLI_INTERNAL void BrotliBuildHistogramsWithContext( 51*6777b538SAndroid Build Coastguard Worker const Command* cmds, const size_t num_commands, 52*6777b538SAndroid Build Coastguard Worker const BlockSplit* literal_split, const BlockSplit* insert_and_copy_split, 53*6777b538SAndroid Build Coastguard Worker const BlockSplit* dist_split, const uint8_t* ringbuffer, size_t pos, 54*6777b538SAndroid Build Coastguard Worker size_t mask, uint8_t prev_byte, uint8_t prev_byte2, 55*6777b538SAndroid Build Coastguard Worker const ContextType* context_modes, HistogramLiteral* literal_histograms, 56*6777b538SAndroid Build Coastguard Worker HistogramCommand* insert_and_copy_histograms, 57*6777b538SAndroid Build Coastguard Worker HistogramDistance* copy_dist_histograms); 58*6777b538SAndroid Build Coastguard Worker 59*6777b538SAndroid Build Coastguard Worker #if defined(__cplusplus) || defined(c_plusplus) 60*6777b538SAndroid Build Coastguard Worker } /* extern "C" */ 61*6777b538SAndroid Build Coastguard Worker #endif 62*6777b538SAndroid Build Coastguard Worker 63*6777b538SAndroid Build Coastguard Worker #endif /* BROTLI_ENC_HISTOGRAM_H_ */ 64