126fa459cSmrg/* Copyright 2013 Google Inc. All Rights Reserved. 226fa459cSmrg 326fa459cSmrg Distributed under MIT license. 426fa459cSmrg See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 526fa459cSmrg*/ 626fa459cSmrg 726fa459cSmrg/* Models the histograms of literals, commands and distance codes. */ 826fa459cSmrg 926fa459cSmrg#ifndef BROTLI_ENC_HISTOGRAM_H_ 1026fa459cSmrg#define BROTLI_ENC_HISTOGRAM_H_ 1126fa459cSmrg 1226fa459cSmrg#include <string.h> /* memset */ 1326fa459cSmrg 1426fa459cSmrg#include "../common/constants.h" 1526fa459cSmrg#include "../common/context.h" 1626fa459cSmrg#include "../common/platform.h" 1726fa459cSmrg#include <brotli/types.h> 1826fa459cSmrg#include "./block_splitter.h" 1926fa459cSmrg#include "./command.h" 2026fa459cSmrg 2126fa459cSmrg#if defined(__cplusplus) || defined(c_plusplus) 2226fa459cSmrgextern "C" { 2326fa459cSmrg#endif 2426fa459cSmrg 2526fa459cSmrg/* The distance symbols effectively used by "Large Window Brotli" (32-bit). */ 2626fa459cSmrg#define BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 544 2726fa459cSmrg 2826fa459cSmrg#define FN(X) X ## Literal 2926fa459cSmrg#define DATA_SIZE BROTLI_NUM_LITERAL_SYMBOLS 3026fa459cSmrg#define DataType uint8_t 3126fa459cSmrg#include "./histogram_inc.h" /* NOLINT(build/include) */ 3226fa459cSmrg#undef DataType 3326fa459cSmrg#undef DATA_SIZE 3426fa459cSmrg#undef FN 3526fa459cSmrg 3626fa459cSmrg#define FN(X) X ## Command 3726fa459cSmrg#define DataType uint16_t 3826fa459cSmrg#define DATA_SIZE BROTLI_NUM_COMMAND_SYMBOLS 3926fa459cSmrg#include "./histogram_inc.h" /* NOLINT(build/include) */ 4026fa459cSmrg#undef DATA_SIZE 4126fa459cSmrg#undef FN 4226fa459cSmrg 4326fa459cSmrg#define FN(X) X ## Distance 4426fa459cSmrg#define DATA_SIZE BROTLI_NUM_HISTOGRAM_DISTANCE_SYMBOLS 4526fa459cSmrg#include "./histogram_inc.h" /* NOLINT(build/include) */ 4626fa459cSmrg#undef DataType 4726fa459cSmrg#undef DATA_SIZE 4826fa459cSmrg#undef FN 4926fa459cSmrg 5026fa459cSmrgBROTLI_INTERNAL void BrotliBuildHistogramsWithContext( 5126fa459cSmrg const Command* cmds, const size_t num_commands, 5226fa459cSmrg const BlockSplit* literal_split, const BlockSplit* insert_and_copy_split, 5326fa459cSmrg const BlockSplit* dist_split, const uint8_t* ringbuffer, size_t pos, 5426fa459cSmrg size_t mask, uint8_t prev_byte, uint8_t prev_byte2, 5526fa459cSmrg const ContextType* context_modes, HistogramLiteral* literal_histograms, 5626fa459cSmrg HistogramCommand* insert_and_copy_histograms, 5726fa459cSmrg HistogramDistance* copy_dist_histograms); 5826fa459cSmrg 5926fa459cSmrg#if defined(__cplusplus) || defined(c_plusplus) 6026fa459cSmrg} /* extern "C" */ 6126fa459cSmrg#endif 6226fa459cSmrg 6326fa459cSmrg#endif /* BROTLI_ENC_HISTOGRAM_H_ */ 64