Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Unified Diff: third_party/brotli/enc/compress_fragment_two_pass.h

Issue 1956893002: Added brotli enc/ and tools/ directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to most recent build tools Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/brotli/enc/compress_fragment.cc ('k') | third_party/brotli/enc/compress_fragment_two_pass.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/brotli/enc/compress_fragment_two_pass.h
diff --git a/third_party/brotli/enc/compress_fragment_two_pass.h b/third_party/brotli/enc/compress_fragment_two_pass.h
new file mode 100644
index 0000000000000000000000000000000000000000..690ed081ec6652c739264c075a0284f3be6222f2
--- /dev/null
+++ b/third_party/brotli/enc/compress_fragment_two_pass.h
@@ -0,0 +1,40 @@
+/* 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_
« no previous file with comments | « third_party/brotli/enc/compress_fragment.cc ('k') | third_party/brotli/enc/compress_fragment_two_pass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698