Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
compress_fragment_two_pass.h
Go to the documentation of this file.
1/* Copyright 2015 Google Inc. All Rights Reserved.
2
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5*/
6
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. */
12
13#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
14#define BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_
15
16#include <brotli/types.h>
17
18#include "../common/constants.h"
19#include "../common/platform.h"
20#include "entropy_encode.h"
21
22#if defined(__cplusplus) || defined(c_plusplus)
23extern "C" {
24#endif
25
26/* TODO(eustas): turn to macro. */
27static const size_t kCompressFragmentTwoPassBlockSize = 1 << 17;
28
29typedef struct BrotliTwoPassArena {
30 uint32_t lit_histo[256];
31 uint8_t lit_depth[256];
32 uint16_t lit_bits[256];
33
34 uint32_t cmd_histo[128];
35 uint8_t cmd_depth[128];
36 uint16_t cmd_bits[128];
37
38 /* BuildAndStoreCommandPrefixCode */
41 uint16_t tmp_bits[64];
43
44/* Compresses "input" string to the "*storage" buffer as one or more complete
45 meta-blocks, and updates the "*storage_ix" bit position.
46
47 If "is_last" is 1, emits an additional empty last meta-block.
48
49 REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
50 REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24).
51 REQUIRES: "command_buf" and "literal_buf" point to at least
52 kCompressFragmentTwoPassBlockSize long arrays.
53 REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
54 REQUIRES: "table_size" is a power of two
55 OUTPUT: maximal copy distance <= |input_size|
56 OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */
58 const uint8_t* input,
59 size_t input_size,
60 BROTLI_BOOL is_last,
61 uint32_t* command_buf,
62 uint8_t* literal_buf,
63 int* table,
64 size_t table_size,
65 size_t* storage_ix,
66 uint8_t* storage);
67
68#if defined(__cplusplus) || defined(c_plusplus)
69} /* extern "C" */
70#endif
71
72#endif /* BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_ */
static const void size_t const UInt64 * table
Definition XzCrc64.c:50
#define BROTLI_NUM_LITERAL_SYMBOLS
Definition constants.h:26
#define BROTLI_NUM_COMMAND_SYMBOLS
Definition constants.h:27
BROTLI_INTERNAL void BrotliCompressFragmentTwoPass(MemoryManager *m, const uint8_t *input, size_t input_size, BROTLI_BOOL is_last, uint32_t *command_buf, uint8_t *literal_buf, int *table, size_t table_size, size_t *storage_ix, uint8_t *storage)
Definition compress_fragment_two_pass.c:610
struct BrotliTwoPassArena BrotliTwoPassArena
#define input(b, o, c, n, m)
Definition compress42.c:610
Definition compress_fragment_two_pass.h:29
uint8_t tmp_depth[BROTLI_NUM_COMMAND_SYMBOLS]
Definition compress_fragment_two_pass.h:40
HuffmanTree tmp_tree[2 *BROTLI_NUM_LITERAL_SYMBOLS+1]
Definition compress_fragment_two_pass.h:39
uint16_t lit_bits[256]
Definition compress_fragment_two_pass.h:32
uint16_t tmp_bits[64]
Definition compress_fragment_two_pass.h:41
uint8_t lit_depth[256]
Definition compress_fragment_two_pass.h:31
uint16_t cmd_bits[128]
Definition compress_fragment_two_pass.h:36
uint32_t lit_histo[256]
Definition compress_fragment_two_pass.h:30
uint32_t cmd_histo[128]
Definition compress_fragment_two_pass.h:34
uint8_t cmd_depth[128]
Definition compress_fragment_two_pass.h:35
Definition entropy_encode.h:20
#define BROTLI_INTERNAL
Definition platform.h:173
#define BROTLI_BOOL
Definition types.h:49