|
XenevaOS
|
LZW decompression (implementation) More...

Classes | |
| struct | lzw_read_ctx |
| struct | lzw_table_entry |
| struct | lzw_ctx |
Macros | |
| #define | LZW_TABLE_ENTRY_MAX (1u << LZW_CODE_MAX) |
Typedefs | |
| typedef uint32_t(* | lzw_writer_fn) (struct lzw_ctx *ctx, void *restrict output_data, uint32_t output_length, uint32_t output_pos, uint16_t code, uint16_t left) |
Functions | |
| lzw_result | lzw_context_create (struct lzw_ctx **ctx) |
| void | lzw_context_destroy (struct lzw_ctx *ctx) |
| lzw_result | lzw_decode_init (struct lzw_ctx *ctx, uint8_t minimum_code_size, const uint8_t *input_data, size_t input_length, size_t input_pos) |
| lzw_result | lzw_decode_init_map (struct lzw_ctx *ctx, uint8_t minimum_code_size, uint32_t transparency_idx, const uint32_t *colour_table, const uint8_t *input_data, size_t input_length, size_t input_pos) |
| lzw_result | lzw_decode (struct lzw_ctx *ctx, const uint8_t *restrict *const restrict output_data, uint32_t *restrict output_written) |
| lzw_result | lzw_decode_map (struct lzw_ctx *ctx, uint32_t *restrict output_data, uint32_t output_length, uint32_t *restrict output_written) |
LZW decompression (implementation)
Decoder for GIF LZW data.
| #define LZW_TABLE_ENTRY_MAX (1u << LZW_CODE_MAX) |
Maximum number of lzw table entries.
| typedef uint32_t(* lzw_writer_fn) (struct lzw_ctx *ctx, void *restrict output_data, uint32_t output_length, uint32_t output_pos, uint16_t code, uint16_t left) |
| lzw_result lzw_context_create | ( | struct lzw_ctx ** | ctx | ) |
Create an LZW decompression context.
| [out] | ctx | Returns an LZW decompression context. Caller owned, free with lzw_context_destroy(). |
| void lzw_context_destroy | ( | struct lzw_ctx * | ctx | ) |
Destroy an LZW decompression context.
| [in] | ctx | The LZW decompression context to destroy. |
| lzw_result lzw_decode | ( | struct lzw_ctx * | ctx, |
| const uint8_t *restrict *const restrict | output_data, | ||
| uint32_t *restrict | output_written | ||
| ) |
Read input codes until end of LZW context owned output buffer.
Ensure anything in output is used before calling this, as anything there before this call will be trampled.
| [in] | ctx | LZW reading context, updated. |
| [out] | output_data | Returns pointer to array of output values. |
| [out] | output_written | Returns the number of values written to data. |
| lzw_result lzw_decode_init | ( | struct lzw_ctx * | ctx, |
| uint8_t | minimum_code_size, | ||
| const uint8_t * | input_data, | ||
| size_t | input_length, | ||
| size_t | input_pos | ||
| ) |
Initialise an LZW decompression context for decoding.
| [in] | ctx | The LZW decompression context to initialise. |
| [in] | minimum_code_size | The LZW Minimum Code Size. |
| [in] | input_data | The compressed data. |
| [in] | input_length | Byte length of compressed data. |
| [in] | input_pos | Start position in data. Must be position of a size byte at sub-block start. |
| lzw_result lzw_decode_init_map | ( | struct lzw_ctx * | ctx, |
| uint8_t | minimum_code_size, | ||
| uint32_t | transparency_idx, | ||
| const uint32_t * | colour_table, | ||
| const uint8_t * | input_data, | ||
| size_t | input_length, | ||
| size_t | input_pos | ||
| ) |
Initialise an LZW decompression context for decoding to colour map values.
For transparency to work correctly, the given client buffer must have the values from the previous frame. The transparency_idx should be a value of 256 or above, if the frame does not have transparency.
| [in] | ctx | The LZW decompression context to initialise. |
| [in] | minimum_code_size | The LZW Minimum Code Size. |
| [in] | transparency_idx | Index representing transparency. |
| [in] | colour_table | Index to pixel colour mapping. |
| [in] | input_data | The compressed data. |
| [in] | input_length | Byte length of compressed data. |
| [in] | input_pos | Start position in data. Must be position of a size byte at sub-block start. |
| lzw_result lzw_decode_map | ( | struct lzw_ctx * | ctx, |
| uint32_t *restrict | output_data, | ||
| uint32_t | output_length, | ||
| uint32_t *restrict | output_written | ||
| ) |
Read LZW codes into client buffer, mapping output to colours.
The context must have been initialised using lzw_decode_init_map before calling this function, in order to provide the colour mapping table and any transparency index.
Ensure anything in output is used before calling this, as anything there before this call will be trampled.
| [in] | ctx | LZW reading context, updated. |
| [in] | output_data | Client buffer to fill with colour mapped values. |
| [in] | output_length | Size of output array. |
| [out] | output_written | Returns the number of values written to data. |