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