]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/BrotliCompress/enc/histogram.h
c08a4cac2bfa298e1a43aaceef93b4d6977b563b
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / enc / histogram.h
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 "../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"
20
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24
25 /* The distance symbols effectively used by "Large Window Brotli" (32-bit). */
26 #define BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 544
27
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) */
32 #undef DataType
33 #undef DATA_SIZE
34 #undef FN
35
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) */
40 #undef DATA_SIZE
41 #undef FN
42
43 #define FN(X) X ## Distance
44 #define DATA_SIZE BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS
45 #include "./histogram_inc.h" /* NOLINT(build/include) */
46 #undef DataType
47 #undef DATA_SIZE
48 #undef FN
49
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);
58
59 #if defined(__cplusplus) || defined(c_plusplus)
60 } /* extern "C" */
61 #endif
62
63 #endif /* BROTLI_ENC_HISTOGRAM_H_ */