static_dict.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. /* Class to model the static dictionary. */
  6. #ifndef BROTLI_ENC_STATIC_DICT_H_
  7. #define BROTLI_ENC_STATIC_DICT_H_
  8. #include "../common/types.h"
  9. #include "./port.h"
  10. #if defined(__cplusplus) || defined(c_plusplus)
  11. extern "C" {
  12. #endif
  13. #define BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN 37
  14. static const uint32_t kInvalidMatch = 0xfffffff;
  15. /* Matches data against static dictionary words, and for each length l,
  16. for which a match is found, updates matches[l] to be the minimum possible
  17. (distance << 5) + len_code.
  18. Returns 1 if matches have been found, otherwise 0.
  19. Prerequisites:
  20. matches array is at least BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN + 1 long
  21. all elements are initialized to kInvalidMatch */
  22. BROTLI_INTERNAL int BrotliFindAllStaticDictionaryMatches(const uint8_t* data,
  23. size_t min_length,
  24. size_t max_length,
  25. uint32_t* matches);
  26. #if defined(__cplusplus) || defined(c_plusplus)
  27. } /* extern "C" */
  28. #endif
  29. #endif /* BROTLI_ENC_STATIC_DICT_H_ */