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 two-pass processing: in the first pass we save
9 the found backward matches and literal bytes into a buffer, and in the
10 second pass we emit them into the bit stream using prefix codes built based
11 on the actual command and literal byte histograms. */
13 #ifndef BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
14 #define BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
16 #include "../common/types.h"
20 #if defined(__cplusplus) || defined(c_plusplus)
24 static const size_t kCompressFragmentTwoPassBlockSize
= 1 << 17;
26 /* Compresses "input" string to the "*storage" buffer as one or more complete
27 meta-blocks, and updates the "*storage_ix" bit position.
29 If "is_last" is 1, emits an additional empty last meta-block.
31 REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
32 REQUIRES: "command_buf" and "literal_buf" point to at least
33 kCompressFragmentTwoPassBlockSize long arrays.
34 REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
35 REQUIRES: "table_size" is a power of two */
36 BROTLI_INTERNAL
void BrotliCompressFragmentTwoPass(MemoryManager
* m
,
40 uint32_t* command_buf
,
47 #if defined(__cplusplus) || defined(c_plusplus)
51 #endif /* BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_ */