FastLED 3.9.15
Loading...
Searching...
No Matches
lzw.cpp.hpp File Reference

Detailed Description

LZW decompression (implementation)

Decoder for GIF LZW data.

Definition in file lzw.cpp.hpp.

#include "fl/stl/cstddef.h"
#include "fl/stl/assert.h"
#include "fl/stl/int.h"
#include "fl/stl/allocator.h"
#include "fl/stl/noexcept.h"
#include "lzw.h"
+ Include dependency graph for lzw.cpp.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::third_party::lzw_ctx
 LZW decompression context. More...
 
struct  fl::third_party::lzw_read_ctx
 Context for reading LZW data. More...
 
struct  fl::third_party::lzw_table_entry
 LZW table entry. More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::third_party
 

Macros

#define LZW_TABLE_ENTRY_MAX   (1u << LZW_CODE_MAX)
 Maximum number of lzw table entries.
 

Typedefs

typedef fl::u32(* fl::third_party::lzw_writer_fn) (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_pos, fl::u16 code, fl::u16 left)
 

Functions

static lzw_result fl::third_party::lzw__block_advance (struct lzw_read_ctx *ctx) FL_NOEXCEPT
 Advance the context to the next sub-block in the input data.
 
static lzw_result fl::third_party::lzw__decode (struct lzw_ctx *ctx, lzw_writer_fn write_fn, void *output_data, fl::u32 output_length, fl::u32 *output_written) FL_NOEXCEPT
 Get the next LZW code and write its value(s) to output buffer.
 
static lzw_result fl::third_party::lzw__handle_clear (struct lzw_ctx *ctx, fl::u16 *code_out) FL_NOEXCEPT
 Handle clear code.
 
static fl::u32 fl::third_party::lzw__map_write_fn (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_used, fl::u16 code, fl::u16 left) FL_NOEXCEPT
 Write colour mapped values for this code to the output.
 
static lzw_result fl::third_party::lzw__read_code (struct lzw_read_ctx *ctx, fl::u16 code_size, fl::u16 *code_out) FL_NOEXCEPT
 Get the next LZW code of given size from the raw input data.
 
static void fl::third_party::lzw__table_add_entry (struct lzw_ctx *ctx, fl::u16 code) FL_NOEXCEPT
 Create new table entry.
 
static fl::u32 fl::third_party::lzw__write_fn (struct lzw_ctx *ctx, void *output_data, fl::u32 output_length, fl::u32 output_used, fl::u16 code, fl::u16 left) FL_NOEXCEPT
 Write values for this code to the output stack.
 
lzw_result fl::third_party::lzw_context_create (struct lzw_ctx **ctx) FL_NOEXCEPT
 Create an LZW decompression context.
 
void fl::third_party::lzw_context_destroy (struct lzw_ctx *ctx) FL_NOEXCEPT
 Destroy an LZW decompression context.
 
lzw_result fl::third_party::lzw_decode (struct lzw_ctx *ctx, const fl::u8 **const output_data, fl::u32 *output_written) FL_NOEXCEPT
 Read input codes until end of LZW context owned output buffer.
 
lzw_result fl::third_party::lzw_decode_init (struct lzw_ctx *ctx, fl::u8 minimum_code_size, const fl::u8 *input_data, fl::size input_length, fl::size input_pos) FL_NOEXCEPT
 Initialise an LZW decompression context for decoding.
 
lzw_result fl::third_party::lzw_decode_init_map (struct lzw_ctx *ctx, fl::u8 minimum_code_size, fl::u32 transparency_idx, const fl::u32 *colour_table, const fl::u8 *input_data, fl::size input_length, fl::size input_pos) FL_NOEXCEPT
 Initialise an LZW decompression context for decoding to colour map values.
 
lzw_result fl::third_party::lzw_decode_map (struct lzw_ctx *ctx, fl::u32 *output_data, fl::u32 output_length, fl::u32 *output_written) FL_NOEXCEPT
 Read LZW codes into client buffer, mapping output to colours.
 

Class Documentation

◆ fl::third_party::lzw_ctx

struct fl::third_party::lzw_ctx
+ Collaboration diagram for fl::third_party::lzw_ctx:
Class Members
u16 clear_code Special Clear code value.
u16 code_max Max code value for current code size.
u8 code_size Current LZW code size.
const u32 * colour_map Index to colour mapping.
u16 eoi_code Special End of Information code value.
bool has_transparency Whether the image is opaque.
u8 initial_code_size Starting LZW code size.
struct lzw_read_ctx input Input reading context.
u16 output_code Code that has been partially output.
u16 output_left Number of values left for output_code.
u16 prev_code Code read from input previously.
u16 prev_code_count Total values for previous code.
u16 prev_code_first First value of previous code.
u8 stack_base[LZW_TABLE_ENTRY_MAX] Output value stack.
struct lzw_table_entry table[LZW_TABLE_ENTRY_MAX] LZW code table.

Generated during decode.

u16 table_size Next position in table to fill.
u8 transparency_idx Index representing transparency.

◆ fl::third_party::lzw_read_ctx

struct fl::third_party::lzw_read_ctx
Class Members
const u8 * data Pointer to start of input data.
size data_len Input data length.
size data_sb_next Offset to sub-block size.
size sb_bit Current bit offset in sub-block.
u32 sb_bit_count Bit count in sub-block.
const u8 * sb_data Pointer to current sub-block in data.

◆ fl::third_party::lzw_table_entry

struct fl::third_party::lzw_table_entry
Class Members
u16 count Count of values in this entry's record.
u16 extends Offset in table to previous entry.
u8 first First value in entry's entire record.
u8 value Last value for record ending at entry.