11cb0ef41Sopenharmony_ci/* Copyright 2013 Google Inc. All Rights Reserved. 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci Distributed under MIT license. 41cb0ef41Sopenharmony_ci See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 51cb0ef41Sopenharmony_ci*/ 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci/* Class to model the static dictionary. */ 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci#ifndef BROTLI_ENC_STATIC_DICT_H_ 101cb0ef41Sopenharmony_ci#define BROTLI_ENC_STATIC_DICT_H_ 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci#include "../common/dictionary.h" 131cb0ef41Sopenharmony_ci#include "../common/platform.h" 141cb0ef41Sopenharmony_ci#include <brotli/types.h> 151cb0ef41Sopenharmony_ci#include "./encoder_dict.h" 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci#if defined(__cplusplus) || defined(c_plusplus) 181cb0ef41Sopenharmony_ciextern "C" { 191cb0ef41Sopenharmony_ci#endif 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci#define BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN 37 221cb0ef41Sopenharmony_cistatic const uint32_t kInvalidMatch = 0xFFFFFFF; 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci/* Matches data against static dictionary words, and for each length l, 251cb0ef41Sopenharmony_ci for which a match is found, updates matches[l] to be the minimum possible 261cb0ef41Sopenharmony_ci (distance << 5) + len_code. 271cb0ef41Sopenharmony_ci Returns 1 if matches have been found, otherwise 0. 281cb0ef41Sopenharmony_ci Prerequisites: 291cb0ef41Sopenharmony_ci matches array is at least BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN + 1 long 301cb0ef41Sopenharmony_ci all elements are initialized to kInvalidMatch */ 311cb0ef41Sopenharmony_ciBROTLI_INTERNAL BROTLI_BOOL BrotliFindAllStaticDictionaryMatches( 321cb0ef41Sopenharmony_ci const BrotliEncoderDictionary* dictionary, 331cb0ef41Sopenharmony_ci const uint8_t* data, size_t min_length, size_t max_length, 341cb0ef41Sopenharmony_ci uint32_t* matches); 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci#if defined(__cplusplus) || defined(c_plusplus) 371cb0ef41Sopenharmony_ci} /* extern "C" */ 381cb0ef41Sopenharmony_ci#endif 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci#endif /* BROTLI_ENC_STATIC_DICT_H_ */ 41