1/* Copyright 2013 Google Inc. All Rights Reserved.
2
3   Distributed under MIT license.
4   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5*/
6
7/* Block split point selection utilities. */
8
9#ifndef BROTLI_ENC_BLOCK_SPLITTER_H_
10#define BROTLI_ENC_BLOCK_SPLITTER_H_
11
12#include <brotli/types.h>
13#include "./command.h"
14#include "./memory.h"
15#include "./port.h"
16#include "./quality.h"
17
18#if defined(__cplusplus) || defined(c_plusplus)
19extern "C" {
20#endif
21
22typedef struct BlockSplit {
23  size_t num_types;  /* Amount of distinct types */
24  size_t num_blocks;  /* Amount of values in types and length */
25  uint8_t* types;
26  uint32_t* lengths;
27
28  size_t types_alloc_size;
29  size_t lengths_alloc_size;
30} BlockSplit;
31
32BROTLI_INTERNAL void BrotliInitBlockSplit(BlockSplit* self);
33BROTLI_INTERNAL void BrotliDestroyBlockSplit(MemoryManager* m,
34                                             BlockSplit* self);
35
36BROTLI_INTERNAL void BrotliSplitBlock(MemoryManager* m,
37                                      const Command* cmds,
38                                      const size_t num_commands,
39                                      const uint8_t* data,
40                                      const size_t offset,
41                                      const size_t mask,
42                                      const BrotliEncoderParams* params,
43                                      BlockSplit* literal_split,
44                                      BlockSplit* insert_and_copy_split,
45                                      BlockSplit* dist_split);
46
47#if defined(__cplusplus) || defined(c_plusplus)
48}  /* extern "C" */
49#endif
50
51#endif  /* BROTLI_ENC_BLOCK_SPLITTER_H_ */
52