• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /* Models the histograms of literals, commands and distance codes. */
8 
9 #ifndef BROTLI_ENC_HISTOGRAM_H_
10 #define BROTLI_ENC_HISTOGRAM_H_
11 
12 #include <string.h>  /* memset */
13 
14 #include <brotli/types.h>
15 
16 #include "../common/constants.h"
17 #include "../common/context.h"
18 #include "../common/platform.h"
19 #include "block_splitter.h"
20 #include "command.h"
21 
22 #if defined(__cplusplus) || defined(c_plusplus)
23 extern "C" {
24 #endif
25 
26 /* The distance symbols effectively used by "Large Window Brotli" (32-bit). */
27 #define BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 544
28 
29 #define FN(X) X ## Literal
30 #define DATA_SIZE BROTLI_NUM_LITERAL_SYMBOLS
31 #define DataType uint8_t
32 #include "histogram_inc.h"  /* NOLINT(build/include) */
33 #undef DataType
34 #undef DATA_SIZE
35 #undef FN
36 
37 #define FN(X) X ## Command
38 #define DataType uint16_t
39 #define DATA_SIZE BROTLI_NUM_COMMAND_SYMBOLS
40 #include "histogram_inc.h"  /* NOLINT(build/include) */
41 #undef DATA_SIZE
42 #undef FN
43 
44 #define FN(X) X ## Distance
45 #define DATA_SIZE BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS
46 #include "histogram_inc.h"  /* NOLINT(build/include) */
47 #undef DataType
48 #undef DATA_SIZE
49 #undef FN
50 
51 BROTLI_INTERNAL void BrotliBuildHistogramsWithContext(
52     const Command* cmds, const size_t num_commands,
53     const BlockSplit* literal_split, const BlockSplit* insert_and_copy_split,
54     const BlockSplit* dist_split, const uint8_t* ringbuffer, size_t pos,
55     size_t mask, uint8_t prev_byte, uint8_t prev_byte2,
56     const ContextType* context_modes, HistogramLiteral* literal_histograms,
57     HistogramCommand* insert_and_copy_histograms,
58     HistogramDistance* copy_dist_histograms);
59 
60 #if defined(__cplusplus) || defined(c_plusplus)
61 }  /* extern "C" */
62 #endif
63 
64 #endif  /* BROTLI_ENC_HISTOGRAM_H_ */
65