]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.h
MdeModulePkg: Update Brotli DecompressLib to the latest v1.0.6
[mirror_edk2.git] / MdeModulePkg / Library / BrotliCustomDecompressLib / dec / decode.h
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.h b/MdeModulePkg/Library/BrotliCustomDecompressLib/dec/decode.h
deleted file mode 100644 (file)
index 4a2fa2e..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/* 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
-/* API for Brotli decompression */\r
-\r
-#ifndef BROTLI_DEC_DECODE_H_\r
-#define BROTLI_DEC_DECODE_H_\r
-\r
-#include "../common/types.h"\r
-\r
-#if defined(__cplusplus) || defined(c_plusplus)\r
-extern "C" {\r
-#endif\r
-\r
-typedef struct BrotliDecoderStateStruct BrotliDecoderState;\r
-\r
-typedef enum {\r
-  /* Decoding error, e.g. corrupt input or memory allocation problem */\r
-  BROTLI_DECODER_RESULT_ERROR = 0,\r
-  /* Decoding successfully completed */\r
-  BROTLI_DECODER_RESULT_SUCCESS = 1,\r
-  /* Partially done; should be called again with more input */\r
-  BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT = 2,\r
-  /* Partially done; should be called again with more output */\r
-  BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT = 3\r
-} BrotliDecoderResult;\r
-\r
-#define BROTLI_DECODER_ERROR_CODES_LIST(BROTLI_ERROR_CODE, SEPARATOR)      \\r
-  BROTLI_ERROR_CODE(_, NO_ERROR, 0) SEPARATOR                              \\r
-  /* Same as BrotliDecoderResult values */                                 \\r
-  BROTLI_ERROR_CODE(_, SUCCESS, 1) SEPARATOR                               \\r
-  BROTLI_ERROR_CODE(_, NEEDS_MORE_INPUT, 2) SEPARATOR                      \\r
-  BROTLI_ERROR_CODE(_, NEEDS_MORE_OUTPUT, 3) SEPARATOR                     \\r
-                                                                           \\r
-  /* Errors caused by invalid input */                                     \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, EXUBERANT_NIBBLE, -1) SEPARATOR        \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, RESERVED, -2) SEPARATOR                \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, EXUBERANT_META_NIBBLE, -3) SEPARATOR   \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, SIMPLE_HUFFMAN_ALPHABET, -4) SEPARATOR \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, SIMPLE_HUFFMAN_SAME, -5) SEPARATOR     \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, CL_SPACE, -6) SEPARATOR                \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, HUFFMAN_SPACE, -7) SEPARATOR           \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, CONTEXT_MAP_REPEAT, -8) SEPARATOR      \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_LENGTH_1, -9) SEPARATOR          \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_LENGTH_2, -10) SEPARATOR         \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, TRANSFORM, -11) SEPARATOR              \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, DICTIONARY, -12) SEPARATOR             \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, WINDOW_BITS, -13) SEPARATOR            \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_1, -14) SEPARATOR              \\r
-  BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_2, -15) SEPARATOR              \\r
-                                                                           \\r
-  /* -16..-20 codes are reserved */                                        \\r
-                                                                           \\r
-  /* Memory allocation problems */                                         \\r
-  BROTLI_ERROR_CODE(_ERROR_ALLOC_, CONTEXT_MODES, -21) SEPARATOR           \\r
-  /* Literal, insert and distance trees together */                        \\r
-  BROTLI_ERROR_CODE(_ERROR_ALLOC_, TREE_GROUPS, -22) SEPARATOR             \\r
-  /* -23..-24 codes are reserved for distinct tree groups */               \\r
-  BROTLI_ERROR_CODE(_ERROR_ALLOC_, CONTEXT_MAP, -25) SEPARATOR             \\r
-  BROTLI_ERROR_CODE(_ERROR_ALLOC_, RING_BUFFER_1, -26) SEPARATOR           \\r
-  BROTLI_ERROR_CODE(_ERROR_ALLOC_, RING_BUFFER_2, -27) SEPARATOR           \\r
-  /* -28..-29 codes are reserved for dynamic ringbuffer allocation */      \\r
-  BROTLI_ERROR_CODE(_ERROR_ALLOC_, BLOCK_TYPE_TREES, -30) SEPARATOR        \\r
-                                                                           \\r
-  /* "Impossible" states */                                                \\r
-  BROTLI_ERROR_CODE(_ERROR_, UNREACHABLE, -31)\r
-\r
-typedef enum {\r
-#define _BROTLI_COMMA ,\r
-#define _BROTLI_ERROR_CODE_ENUM_ITEM(PREFIX, NAME, CODE) \\r
-    BROTLI_DECODER ## PREFIX ## NAME = CODE\r
-  BROTLI_DECODER_ERROR_CODES_LIST(_BROTLI_ERROR_CODE_ENUM_ITEM, _BROTLI_COMMA)\r
-#undef _BROTLI_ERROR_CODE_ENUM_ITEM\r
-#undef _BROTLI_COMMA\r
-} BrotliDecoderErrorCode;\r
-\r
-#define BROTLI_LAST_ERROR_CODE BROTLI_DECODER_ERROR_UNREACHABLE\r
-\r
-/* Creates the instance of BrotliDecoderState and initializes it. |alloc_func|\r
-   and |free_func| MUST be both zero or both non-zero. In the case they are both\r
-   zero, default memory allocators are used. |opaque| is passed to |alloc_func|\r
-   and |free_func| when they are called. */\r
-BrotliDecoderState* BrotliDecoderCreateInstance(\r
-    brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque);\r
-\r
-/* Deinitializes and frees BrotliDecoderState instance. */\r
-void BrotliDecoderDestroyInstance(BrotliDecoderState* state);\r
-\r
-/* Decompresses the data in |encoded_buffer| into |decoded_buffer|, and sets\r
-   |*decoded_size| to the decompressed length. */\r
-BrotliDecoderResult BrotliDecoderDecompress(\r
-    size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,\r
-    uint8_t* decoded_buffer);\r
-\r
-/* Decompresses the data. Supports partial input and output.\r
-\r
-   Must be called with an allocated input buffer in |*next_in| and an allocated\r
-   output buffer in |*next_out|. The values |*available_in| and |*available_out|\r
-   must specify the allocated size in |*next_in| and |*next_out| respectively.\r
-\r
-   After each call, |*available_in| will be decremented by the amount of input\r
-   bytes consumed, and the |*next_in| pointer will be incremented by that\r
-   amount. Similarly, |*available_out| will be decremented by the amount of\r
-   output bytes written, and the |*next_out| pointer will be incremented by that\r
-   amount. |total_out|, if it is not a null-pointer, will be set to the number\r
-   of bytes decompressed since the last state initialization.\r
-\r
-   Input is never overconsumed, so |next_in| and |available_in| could be passed\r
-   to the next consumer after decoding is complete. */\r
-BrotliDecoderResult BrotliDecoderDecompressStream(\r
-  BrotliDecoderState* s, size_t* available_in, const uint8_t** next_in,\r
-  size_t* available_out, uint8_t** next_out, size_t* total_out);\r
-\r
-/* Fills the new state with a dictionary for LZ77, warming up the ringbuffer,\r
-   e.g. for custom static dictionaries for data formats.\r
-   Not to be confused with the built-in transformable dictionary of Brotli.\r
-   |size| should be less or equal to 2^24 (16MiB), otherwise the dictionary will\r
-   be ignored. The dictionary must exist in memory until decoding is done and\r
-   is owned by the caller. To use:\r
-    1) Allocate and initialize state with BrotliCreateInstance\r
-    2) Use BrotliSetCustomDictionary\r
-    3) Use BrotliDecompressStream\r
-    4) Clean up and free state with BrotliDestroyState\r
-*/\r
-void BrotliDecoderSetCustomDictionary(\r
-    BrotliDecoderState* s, size_t size, const uint8_t* dict);\r
-\r
-/* Returns true, if decoder has some unconsumed output.\r
-   Otherwise returns false. */\r
-BROTLI_BOOL BrotliDecoderHasMoreOutput(const BrotliDecoderState* s);\r
-\r
-/* Returns true, if decoder has already received some input bytes.\r
-   Otherwise returns false. */\r
-BROTLI_BOOL BrotliDecoderIsUsed(const BrotliDecoderState* s);\r
-\r
-/* Returns true, if decoder is in a state where we reached the end of the input\r
-   and produced all of the output; returns false otherwise. */\r
-BROTLI_BOOL BrotliDecoderIsFinished(const BrotliDecoderState* s);\r
-\r
-/* Returns detailed error code after BrotliDecompressStream returns\r
-   BROTLI_DECODER_RESULT_ERROR. */\r
-BrotliDecoderErrorCode BrotliDecoderGetErrorCode(const BrotliDecoderState* s);\r
-\r
-const char* BrotliDecoderErrorString(BrotliDecoderErrorCode c);\r
-\r
-/* DEPRECATED >>> */\r
-typedef enum {\r
-  BROTLI_RESULT_ERROR = 0,\r
-  BROTLI_RESULT_SUCCESS = 1,\r
-  BROTLI_RESULT_NEEDS_MORE_INPUT = 2,\r
-  BROTLI_RESULT_NEEDS_MORE_OUTPUT = 3\r
-} BrotliResult;\r
-typedef enum {\r
-#define _BROTLI_COMMA ,\r
-#define _BROTLI_ERROR_CODE_ENUM_ITEM(PREFIX, NAME, CODE) \\r
-    BROTLI ## PREFIX ## NAME = CODE\r
-  BROTLI_DECODER_ERROR_CODES_LIST(_BROTLI_ERROR_CODE_ENUM_ITEM, _BROTLI_COMMA)\r
-#undef _BROTLI_ERROR_CODE_ENUM_ITEM\r
-#undef _BROTLI_COMMA\r
-} BrotliErrorCode;\r
-typedef struct BrotliStateStruct BrotliState;\r
-BrotliState* BrotliCreateState(\r
-    brotli_alloc_func alloc, brotli_free_func free, void* opaque);\r
-void BrotliDestroyState(BrotliState* state);\r
-BROTLI_BOOL BrotliDecompressedSize(\r
-    size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size);\r
-BrotliResult BrotliDecompressBuffer(\r
-    size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,\r
-    uint8_t* decoded_buffer);\r
-BrotliResult BrotliDecompressStream(\r
-    size_t* available_in, const uint8_t** next_in, size_t* available_out,\r
-    uint8_t** next_out, size_t* total_out, BrotliState* s);\r
-void BrotliSetCustomDictionary(\r
-    size_t size, const uint8_t* dict, BrotliState* s);\r
-BROTLI_BOOL BrotliStateIsStreamStart(const BrotliState* s);\r
-BROTLI_BOOL BrotliStateIsStreamEnd(const BrotliState* s);\r
-BrotliErrorCode BrotliGetErrorCode(const BrotliState* s);\r
-const char* BrotliErrorString(BrotliErrorCode c);\r
-/* <<< DEPRECATED */\r
-\r
-#if defined(__cplusplus) || defined(c_plusplus)\r
-} /* extern "C" */\r
-#endif\r
-\r
-#endif  /* BROTLI_DEC_DECODE_H_ */\r