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