--- /dev/null
+/* Copyright 2014 Google Inc. All Rights Reserved.\r
+\r
+ Distributed under MIT license.\r
+ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT\r
+*/\r
+\r
+/* Functions to convert brotli-related data structures into the\r
+ brotli bit stream. The functions here operate under\r
+ assumption that there is enough space in the storage, i.e., there are\r
+ no out-of-range checks anywhere.\r
+\r
+ These functions do bit addressing into a byte array. The byte array\r
+ is called "storage" and the index to the bit is called storage_ix\r
+ in function arguments. */\r
+\r
+#ifndef BROTLI_ENC_BROTLI_BIT_STREAM_H_\r
+#define BROTLI_ENC_BROTLI_BIT_STREAM_H_\r
+\r
+#include "../common/types.h"\r
+#include "./command.h"\r
+#include "./context.h"\r
+#include "./entropy_encode.h"\r
+#include "./memory.h"\r
+#include "./metablock.h"\r
+#include "./port.h"\r
+\r
+#if defined(__cplusplus) || defined(c_plusplus)\r
+extern "C" {\r
+#endif\r
+\r
+/* All Store functions here will use a storage_ix, which is always the bit\r
+ position for the current storage. */\r
+\r
+BROTLI_INTERNAL void BrotliStoreHuffmanTree(const uint8_t* depths, size_t num,\r
+ HuffmanTree* tree, size_t *storage_ix, uint8_t *storage);\r
+\r
+BROTLI_INTERNAL void BrotliBuildAndStoreHuffmanTreeFast(\r
+ MemoryManager* m, const uint32_t* histogram, const size_t histogram_total,\r
+ const size_t max_bits, uint8_t* depth, uint16_t* bits, size_t* storage_ix,\r
+ uint8_t* storage);\r
+\r
+/* REQUIRES: length > 0 */\r
+/* REQUIRES: length <= (1 << 24) */\r
+BROTLI_INTERNAL void BrotliStoreMetaBlock(MemoryManager* m,\r
+ const uint8_t* input,\r
+ size_t start_pos,\r
+ size_t length,\r
+ size_t mask,\r
+ uint8_t prev_byte,\r
+ uint8_t prev_byte2,\r
+ BROTLI_BOOL is_final_block,\r
+ uint32_t num_direct_distance_codes,\r
+ uint32_t distance_postfix_bits,\r
+ ContextType literal_context_mode,\r
+ const Command* commands,\r
+ size_t n_commands,\r
+ const MetaBlockSplit* mb,\r
+ size_t* storage_ix,\r
+ uint8_t* storage);\r
+\r
+/* Stores the meta-block without doing any block splitting, just collects\r
+ one histogram per block category and uses that for entropy coding.\r
+ REQUIRES: length > 0\r
+ REQUIRES: length <= (1 << 24) */\r
+BROTLI_INTERNAL void BrotliStoreMetaBlockTrivial(MemoryManager* m,\r
+ const uint8_t* input,\r
+ size_t start_pos,\r
+ size_t length,\r
+ size_t mask,\r
+ BROTLI_BOOL is_last,\r
+ const Command *commands,\r
+ size_t n_commands,\r
+ size_t* storage_ix,\r
+ uint8_t* storage);\r
+\r
+/* Same as above, but uses static prefix codes for histograms with a only a few\r
+ symbols, and uses static code length prefix codes for all other histograms.\r
+ REQUIRES: length > 0\r
+ REQUIRES: length <= (1 << 24) */\r
+BROTLI_INTERNAL void BrotliStoreMetaBlockFast(MemoryManager* m,\r
+ const uint8_t* input,\r
+ size_t start_pos,\r
+ size_t length,\r
+ size_t mask,\r
+ BROTLI_BOOL is_last,\r
+ const Command *commands,\r
+ size_t n_commands,\r
+ size_t* storage_ix,\r
+ uint8_t* storage);\r
+\r
+/* This is for storing uncompressed blocks (simple raw storage of\r
+ bytes-as-bytes).\r
+ REQUIRES: length > 0\r
+ REQUIRES: length <= (1 << 24) */\r
+BROTLI_INTERNAL void BrotliStoreUncompressedMetaBlock(\r
+ BROTLI_BOOL is_final_block, const uint8_t* input, size_t position,\r
+ size_t mask, size_t len, size_t* storage_ix, uint8_t* storage);\r
+\r
+/* Stores an empty metadata meta-block and syncs to a byte boundary. */\r
+BROTLI_INTERNAL void BrotliStoreSyncMetaBlock(size_t* storage_ix,\r
+ uint8_t* storage);\r
+\r
+#if defined(__cplusplus) || defined(c_plusplus)\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* BROTLI_ENC_BROTLI_BIT_STREAM_H_ */\r