FastLED 3.9.15
Loading...
Searching...
No Matches

◆ lzw_decode()

lzw_result fl::third_party::lzw_decode ( struct lzw_ctx * ctx,
const fl::u8 **const output_data,
fl::u32 * 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.

Parameters
[in]ctxLZW reading context, updated.
[out]output_dataReturns pointer to array of output values.
[out]output_writtenReturns the number of values written to data.
Returns
LZW_OK on success, or appropriate error code otherwise.

Definition at line 500 of file lzw.cpp.hpp.

503{
504 const fl::u32 output_length = sizeof(ctx->stack_base);
505
506 *output_written = 0;
507 *output_data = ctx->stack_base;
508
509 if (ctx->output_left != 0) {
510 *output_written += lzw__write_fn(ctx,
511 ctx->stack_base, output_length, *output_written,
512 ctx->output_code, ctx->output_left);
513 }
514
515 while (*output_written != output_length) {
517 ctx->stack_base, output_length, output_written);
518 if (res != LZW_OK) {
519 return res;
520 }
521 }
522
523 return LZW_OK;
524}
static lzw_result 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.
Definition lzw.cpp.hpp:389
lzw_result
LZW decoding response codes.
Definition lzw.h:33
@ LZW_OK
Success.
Definition lzw.h:34
static fl::u32 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.
Definition lzw.cpp.hpp:461
fl::u16 output_left
Number of values left for output_code.
Definition lzw.cpp.hpp:90
fl::u16 output_code
Code that has been partially output.
Definition lzw.cpp.hpp:89
fl::u8 stack_base[LZW_TABLE_ENTRY_MAX]
Output value stack.
Definition lzw.cpp.hpp:100

References FL_NOEXCEPT, lzw__decode(), lzw__write_fn(), LZW_OK, fl::third_party::lzw_ctx::output_code, fl::third_party::lzw_ctx::output_left, and fl::third_party::lzw_ctx::stack_base.

Referenced by nsgif__decode_complex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: