mirror of
https://github.com/google/brotli.git
synced 2024-11-22 19:50:06 +00:00
417107b3dd
The new modes process the input data in independent blocks, using backward references only from within an input block. The new modes can be used by specifying quality 0 or quality 1, the old quality 1 and quality 2 modes are renamed quality 2 and quality 3, respectively, and the old quality 3 mode is removed.
41 lines
1.7 KiB
C++
41 lines
1.7 KiB
C++
/* Copyright 2015 Google Inc. All Rights Reserved.
|
|
|
|
Distributed under MIT license.
|
|
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
// Function for fast encoding of an input fragment, independently from the input
|
|
// history. This function uses two-pass processing: in the first pass we save
|
|
// the found backward matches and literal bytes into a buffer, and in the
|
|
// second pass we emit them into the bit stream using prefix codes built based
|
|
// on the actual command and literal byte histograms.
|
|
|
|
#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
|
|
#define BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
|
|
|
|
#include "./types.h"
|
|
|
|
namespace brotli {
|
|
|
|
static const size_t kCompressFragmentTwoPassBlockSize = 1 << 17;
|
|
|
|
// Compresses "input" string to the "*storage" buffer as one or more complete
|
|
// meta-blocks, and updates the "*storage_ix" bit position.
|
|
//
|
|
// If "is_last" is true, emits an additional empty last meta-block.
|
|
//
|
|
// REQUIRES: "input_size" is greater than zero, or "is_last" is true.
|
|
// REQUIRES: "command_buf" and "literal_buf" point to at least
|
|
// kCompressFragmentTwoPassBlockSize long arrays.
|
|
// REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
|
|
// REQUIRES: "table_size" is a power of two
|
|
void BrotliCompressFragmentTwoPass(const uint8_t* input, size_t input_size,
|
|
bool is_last,
|
|
uint32_t* command_buf, uint8_t* literal_buf,
|
|
int* table, size_t table_size,
|
|
size_t* storage_ix, uint8_t* storage);
|
|
|
|
} // namespace brotli
|
|
|
|
#endif // BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
|