histogram.h 1.7 KB

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