Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
compress_fragment.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 one-pass processing: when we find a backward
9 match, we immediately emit the corresponding command and literal codes to
10 the bit stream. */
11
12#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_H_
13#define BROTLI_ENC_COMPRESS_FRAGMENT_H_
14
15#include <brotli/types.h>
16
17#include "../common/constants.h"
18#include "../common/platform.h"
19#include "entropy_encode.h"
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25typedef struct BrotliOnePassArena {
26 uint8_t lit_depth[256];
27 uint16_t lit_bits[256];
28
29 /* Command and distance prefix codes (each 64 symbols, stored back-to-back)
30 used for the next block. The command prefix code is over a smaller alphabet
31 with the following 64 symbols:
32 0 - 15: insert length code 0, copy length code 0 - 15, same distance
33 16 - 39: insert length code 0, copy length code 0 - 23
34 40 - 63: insert length code 0 - 23, copy length code 0
35 Note that symbols 16 and 40 represent the same code in the full alphabet,
36 but we do not use either of them. */
37 uint8_t cmd_depth[128];
38 uint16_t cmd_bits[128];
39 uint32_t cmd_histo[128];
40
41 /* The compressed form of the command and distance prefix codes for the next
42 block. */
43 uint8_t cmd_code[512];
44 size_t cmd_code_numbits;
45
47 uint32_t histogram[256];
49 uint16_t tmp_bits[64];
51
52/* Compresses "input" string to the "*storage" buffer as one or more complete
53 meta-blocks, and updates the "*storage_ix" bit position.
54
55 If "is_last" is 1, emits an additional empty last meta-block.
56
57 "cmd_depth" and "cmd_bits" contain the command and distance prefix codes
58 (see comment in encode.h) used for the encoding of this input fragment.
59 If "is_last" is 0, they are updated to reflect the statistics
60 of this input fragment, to be used for the encoding of the next fragment.
61
62 "*cmd_code_numbits" is the number of bits of the compressed representation
63 of the command and distance prefix codes, and "cmd_code" is an array of
64 at least "(*cmd_code_numbits + 7) >> 3" size that contains the compressed
65 command and distance prefix codes. If "is_last" is 0, these are also
66 updated to represent the updated "cmd_depth" and "cmd_bits".
67
68 REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
69 REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24).
70 REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
71 REQUIRES: "table_size" is an odd (9, 11, 13, 15) power of two
72 OUTPUT: maximal copy distance <= |input_size|
73 OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */
75 const uint8_t* input,
76 size_t input_size,
77 BROTLI_BOOL is_last,
78 int* table, size_t table_size,
79 size_t* storage_ix,
80 uint8_t* storage);
81
82#if defined(__cplusplus) || defined(c_plusplus)
83} /* extern "C" */
84#endif
85
86#endif /* BROTLI_ENC_COMPRESS_FRAGMENT_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 BrotliCompressFragmentFast(MemoryManager *m, const uint8_t *input, size_t input_size, BROTLI_BOOL is_last, int *table, size_t table_size, uint8_t cmd_depth[128], uint16_t cmd_bits[128], size_t *cmd_code_numbits, uint8_t *cmd_code, size_t *storage_ix, uint8_t *storage)
Definition compress_fragment.c:745
struct BrotliOnePassArena BrotliOnePassArena
#define input(b, o, c, n, m)
Definition compress42.c:610
Definition compress_fragment.h:25
uint8_t tmp_depth[BROTLI_NUM_COMMAND_SYMBOLS]
Definition compress_fragment.h:48
uint16_t lit_bits[256]
Definition compress_fragment.h:27
uint16_t tmp_bits[64]
Definition compress_fragment.h:49
uint8_t lit_depth[256]
Definition compress_fragment.h:26
HuffmanTree tree[2 *BROTLI_NUM_LITERAL_SYMBOLS+1]
Definition compress_fragment.h:46
uint16_t cmd_bits[128]
Definition compress_fragment.h:38
uint32_t histogram[256]
Definition compress_fragment.h:47
size_t cmd_code_numbits
Definition compress_fragment.h:44
uint32_t cmd_histo[128]
Definition compress_fragment.h:39
uint8_t cmd_depth[128]
Definition compress_fragment.h:37
uint8_t cmd_code[512]
Definition compress_fragment.h:43
Definition entropy_encode.h:20
#define BROTLI_INTERNAL
Definition platform.h:173
#define BROTLI_BOOL
Definition types.h:49