]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/BrotliCompress/enc/compress_fragment_two_pass.h
BaseTools: Update Brotli Compress to the latest one 1.0.6
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / enc / compress_fragment_two_pass.h
CommitLineData
11b7501a
SB
1/* Copyright 2015 Google Inc. All Rights Reserved.\r
2\r
3 Distributed under MIT license.\r
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT\r
5*/\r
6\r
7/* Function for fast encoding of an input fragment, independently from the input\r
8 history. This function uses two-pass processing: in the first pass we save\r
9 the found backward matches and literal bytes into a buffer, and in the\r
10 second pass we emit them into the bit stream using prefix codes built based\r
11 on the actual command and literal byte histograms. */\r
12\r
13#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_\r
14#define BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_\r
15\r
dd4f667e
LG
16#include "../common/platform.h"\r
17#include <brotli/types.h>\r
11b7501a 18#include "./memory.h"\r
11b7501a
SB
19\r
20#if defined(__cplusplus) || defined(c_plusplus)\r
21extern "C" {\r
22#endif\r
23\r
24static const size_t kCompressFragmentTwoPassBlockSize = 1 << 17;\r
25\r
26/* Compresses "input" string to the "*storage" buffer as one or more complete\r
27 meta-blocks, and updates the "*storage_ix" bit position.\r
28\r
29 If "is_last" is 1, emits an additional empty last meta-block.\r
30\r
31 REQUIRES: "input_size" is greater than zero, or "is_last" is 1.\r
dd4f667e 32 REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24).\r
11b7501a
SB
33 REQUIRES: "command_buf" and "literal_buf" point to at least\r
34 kCompressFragmentTwoPassBlockSize long arrays.\r
35 REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.\r
dd4f667e
LG
36 REQUIRES: "table_size" is a power of two\r
37 OUTPUT: maximal copy distance <= |input_size|\r
38 OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */\r
11b7501a
SB
39BROTLI_INTERNAL void BrotliCompressFragmentTwoPass(MemoryManager* m,\r
40 const uint8_t* input,\r
41 size_t input_size,\r
42 BROTLI_BOOL is_last,\r
43 uint32_t* command_buf,\r
44 uint8_t* literal_buf,\r
45 int* table,\r
46 size_t table_size,\r
47 size_t* storage_ix,\r
48 uint8_t* storage);\r
49\r
50#if defined(__cplusplus) || defined(c_plusplus)\r
51} /* extern "C" */\r
52#endif\r
53\r
54#endif /* BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_ */\r