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/* Block split point selection utilities. */
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci#ifndef BROTLI_ENC_BLOCK_SPLITTER_H_
101cb0ef41Sopenharmony_ci#define BROTLI_ENC_BLOCK_SPLITTER_H_
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci#include "../common/platform.h"
131cb0ef41Sopenharmony_ci#include <brotli/types.h>
141cb0ef41Sopenharmony_ci#include "./command.h"
151cb0ef41Sopenharmony_ci#include "./memory.h"
161cb0ef41Sopenharmony_ci#include "./quality.h"
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci#if defined(__cplusplus) || defined(c_plusplus)
191cb0ef41Sopenharmony_ciextern "C" {
201cb0ef41Sopenharmony_ci#endif
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_citypedef struct BlockSplit {
231cb0ef41Sopenharmony_ci  size_t num_types;  /* Amount of distinct types */
241cb0ef41Sopenharmony_ci  size_t num_blocks;  /* Amount of values in types and length */
251cb0ef41Sopenharmony_ci  uint8_t* types;
261cb0ef41Sopenharmony_ci  uint32_t* lengths;
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci  size_t types_alloc_size;
291cb0ef41Sopenharmony_ci  size_t lengths_alloc_size;
301cb0ef41Sopenharmony_ci} BlockSplit;
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciBROTLI_INTERNAL void BrotliInitBlockSplit(BlockSplit* self);
331cb0ef41Sopenharmony_ciBROTLI_INTERNAL void BrotliDestroyBlockSplit(MemoryManager* m,
341cb0ef41Sopenharmony_ci                                             BlockSplit* self);
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ciBROTLI_INTERNAL void BrotliSplitBlock(MemoryManager* m,
371cb0ef41Sopenharmony_ci                                      const Command* cmds,
381cb0ef41Sopenharmony_ci                                      const size_t num_commands,
391cb0ef41Sopenharmony_ci                                      const uint8_t* data,
401cb0ef41Sopenharmony_ci                                      const size_t offset,
411cb0ef41Sopenharmony_ci                                      const size_t mask,
421cb0ef41Sopenharmony_ci                                      const BrotliEncoderParams* params,
431cb0ef41Sopenharmony_ci                                      BlockSplit* literal_split,
441cb0ef41Sopenharmony_ci                                      BlockSplit* insert_and_copy_split,
451cb0ef41Sopenharmony_ci                                      BlockSplit* dist_split);
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci#if defined(__cplusplus) || defined(c_plusplus)
481cb0ef41Sopenharmony_ci}  /* extern "C" */
491cb0ef41Sopenharmony_ci#endif
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ci#endif  /* BROTLI_ENC_BLOCK_SPLITTER_H_ */
52