+++ /dev/null
-/* Copyright 2013 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
-/* Function to find backward reference copies. */\r
-\r
-#ifndef BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_\r
-#define BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_\r
-\r
-#include "../common/constants.h"\r
-#include "../common/dictionary.h"\r
-#include "../common/platform.h"\r
-#include <brotli/types.h>\r
-#include "./command.h"\r
-#include "./hash.h"\r
-#include "./memory.h"\r
-#include "./quality.h"\r
-\r
-#if defined(__cplusplus) || defined(c_plusplus)\r
-extern "C" {\r
-#endif\r
-\r
-BROTLI_INTERNAL void BrotliCreateZopfliBackwardReferences(MemoryManager* m,\r
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,\r
- size_t ringbuffer_mask, const BrotliEncoderParams* params,\r
- HasherHandle hasher, int* dist_cache, size_t* last_insert_len,\r
- Command* commands, size_t* num_commands, size_t* num_literals);\r
-\r
-BROTLI_INTERNAL void BrotliCreateHqZopfliBackwardReferences(MemoryManager* m,\r
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,\r
- size_t ringbuffer_mask, const BrotliEncoderParams* params,\r
- HasherHandle hasher, int* dist_cache, size_t* last_insert_len,\r
- Command* commands, size_t* num_commands, size_t* num_literals);\r
-\r
-typedef struct ZopfliNode {\r
- /* Best length to get up to this byte (not including this byte itself)\r
- highest 7 bit is used to reconstruct the length code. */\r
- uint32_t length;\r
- /* Distance associated with the length. */\r
- uint32_t distance;\r
- /* Number of literal inserts before this copy; highest 5 bits contain\r
- distance short code + 1 (or zero if no short code). */\r
- uint32_t dcode_insert_length;\r
-\r
- /* This union holds information used by dynamic-programming. During forward\r
- pass |cost| it used to store the goal function. When node is processed its\r
- |cost| is invalidated in favor of |shortcut|. On path back-tracing pass\r
- |next| is assigned the offset to next node on the path. */\r
- union {\r
- /* Smallest cost to get to this byte from the beginning, as found so far. */\r
- float cost;\r
- /* Offset to the next node on the path. Equals to command_length() of the\r
- next node on the path. For last node equals to BROTLI_UINT32_MAX */\r
- uint32_t next;\r
- /* Node position that provides next distance for distance cache. */\r
- uint32_t shortcut;\r
- } u;\r
-} ZopfliNode;\r
-\r
-BROTLI_INTERNAL void BrotliInitZopfliNodes(ZopfliNode* array, size_t length);\r
-\r
-/* Computes the shortest path of commands from position to at most\r
- position + num_bytes.\r
-\r
- On return, path->size() is the number of commands found and path[i] is the\r
- length of the i-th command (copy length plus insert length).\r
- Note that the sum of the lengths of all commands can be less than num_bytes.\r
-\r
- On return, the nodes[0..num_bytes] array will have the following\r
- "ZopfliNode array invariant":\r
- For each i in [1..num_bytes], if nodes[i].cost < kInfinity, then\r
- (1) nodes[i].copy_length() >= 2\r
- (2) nodes[i].command_length() <= i and\r
- (3) nodes[i - nodes[i].command_length()].cost < kInfinity */\r
-BROTLI_INTERNAL size_t BrotliZopfliComputeShortestPath(MemoryManager* m,\r
- size_t num_bytes, size_t position, const uint8_t* ringbuffer,\r
- size_t ringbuffer_mask, const BrotliEncoderParams* params,\r
- const size_t max_backward_limit, const int* dist_cache, HasherHandle hasher,\r
- ZopfliNode* nodes);\r
-\r
-BROTLI_INTERNAL void BrotliZopfliCreateCommands(\r
- const size_t num_bytes, const size_t block_start,\r
- const size_t max_backward_limit, const ZopfliNode* nodes,\r
- int* dist_cache, size_t* last_insert_len, const BrotliEncoderParams* params,\r
- Command* commands, size_t* num_literals);\r
-\r
-#if defined(__cplusplus) || defined(c_plusplus)\r
-} /* extern "C" */\r
-#endif\r
-\r
-#endif /* BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_ */\r