summaryrefslogtreecommitdiffstats
path: root/modules/brotli/enc/compress_fragment.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-14 09:07:29 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-14 09:07:29 +0100
commit56de283899bc91f7110aba58a3ca174c10852683 (patch)
tree779e6501bbbe4f015509c423ab44f2f40ea97cc8 /modules/brotli/enc/compress_fragment.h
parentce0dd36a78814c59950fde6c19413c1f7ea85ee1 (diff)
downloadUXP-56de283899bc91f7110aba58a3ca174c10852683.tar
UXP-56de283899bc91f7110aba58a3ca174c10852683.tar.gz
UXP-56de283899bc91f7110aba58a3ca174c10852683.tar.lz
UXP-56de283899bc91f7110aba58a3ca174c10852683.tar.xz
UXP-56de283899bc91f7110aba58a3ca174c10852683.zip
Issue #1288 - Part 1a: Update brotli to 1.0.7
This also reorganizes the exports in the build system to use `brotli/` as include directory.
Diffstat (limited to 'modules/brotli/enc/compress_fragment.h')
-rw-r--r--modules/brotli/enc/compress_fragment.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/brotli/enc/compress_fragment.h b/modules/brotli/enc/compress_fragment.h
new file mode 100644
index 000000000..80007f5dc
--- /dev/null
+++ b/modules/brotli/enc/compress_fragment.h
@@ -0,0 +1,61 @@
+/* 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 one-pass processing: when we find a backward
+ match, we immediately emit the corresponding command and literal codes to
+ the bit stream. */
+
+#ifndef BROTLI_ENC_COMPRESS_FRAGMENT_H_
+#define BROTLI_ENC_COMPRESS_FRAGMENT_H_
+
+#include "../common/platform.h"
+#include <brotli/types.h>
+#include "./memory.h"
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* 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 1, emits an additional empty last meta-block.
+
+ "cmd_depth" and "cmd_bits" contain the command and distance prefix codes
+ (see comment in encode.h) used for the encoding of this input fragment.
+ If "is_last" is 0, they are updated to reflect the statistics
+ of this input fragment, to be used for the encoding of the next fragment.
+
+ "*cmd_code_numbits" is the number of bits of the compressed representation
+ of the command and distance prefix codes, and "cmd_code" is an array of
+ at least "(*cmd_code_numbits + 7) >> 3" size that contains the compressed
+ command and distance prefix codes. If "is_last" is 0, these are also
+ updated to represent the updated "cmd_depth" and "cmd_bits".
+
+ REQUIRES: "input_size" is greater than zero, or "is_last" is 1.
+ REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24).
+ REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero.
+ REQUIRES: "table_size" is an odd (9, 11, 13, 15) power of two
+ OUTPUT: maximal copy distance <= |input_size|
+ OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */
+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);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+} /* extern "C" */
+#endif
+
+#endif /* BROTLI_ENC_COMPRESS_FRAGMENT_H_ */