]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/BrotliCompress/enc/compress_fragment.h
1 /* Copyright 2015 Google Inc. All Rights Reserved.
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
7 /* Function for fast encoding of an input fragment, independently from the input
8 history. This function uses one-pass processing: when we find a backward
9 match, we immediately emit the corresponding command and literal codes to
12 #ifndef BROTLI_ENC_COMPRESS_FRAGMENT_H_
13 #define BROTLI_ENC_COMPRESS_FRAGMENT_H_
15 #include "../common/types.h"
19 #if defined(__cplusplus) || defined(c_plusplus)
23 /* Compresses "input" string to the "*storage" buffer as one or more complete
24 meta-blocks, and updates the "*storage_ix" bit position.
26 If "is_last" is 1, emits an additional empty last meta-block.
28 "cmd_depth" and "cmd_bits" contain the command and distance prefix codes
29 (see comment in encode.h) used for the encoding of this input fragment.
30 If "is_last" is 0, they are updated to reflect the statistics
31 of this input fragment, to be used for the encoding of the next fragment.
33 "*cmd_code_numbits" is the number of bits of the compressed representation
34 of the command and distance prefix codes, and "cmd_code" is an array of
35 at least "(*cmd_code_numbits + 7) >> 3" size that contains the compressed
36 command and distance prefix codes. If "is_last" is 0, these are also
37 updated to represent the updated "cmd_depth" and "cmd_bits".
39 REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
40 REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
41 REQUIRES: "table_size" is a power of two */
42 BROTLI_INTERNAL
void BrotliCompressFragmentFast(MemoryManager
* m
,
46 int* table
, size_t table_size
,
47 uint8_t cmd_depth
[128],
48 uint16_t cmd_bits
[128],
49 size_t* cmd_code_numbits
,
54 #if defined(__cplusplus) || defined(c_plusplus)
58 #endif /* BROTLI_ENC_COMPRESS_FRAGMENT_H_ */