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

◆ lzw_decode_map()

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

Parameters
[in]ctxLZW reading context, updated.
[in]output_dataClient buffer to fill with colour mapped values.
[in]output_lengthSize of output array.
[out]output_writtenReturns the number of values written to data.
Returns
LZW_OK on success, or appropriate error code otherwise.

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

595{
596 *output_written = 0;
597
598 if (ctx->colour_map == nullptr) {
599 return LZW_NO_COLOUR;
600 }
601
602 if (ctx->output_left != 0) {
603 *output_written += lzw__map_write_fn(ctx,
604 output_data, output_length, *output_written,
605 ctx->output_code, ctx->output_left);
606 }
607
608 while (*output_written != output_length) {
610 output_data, output_length, output_written);
611 if (res != LZW_OK) {
612 return res;
613 }
614 }
615
616 return LZW_OK;
617}
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
static fl::u32 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.
Definition lzw.cpp.hpp:542
lzw_result
LZW decoding response codes.
Definition lzw.h:33
@ LZW_OK
Success.
Definition lzw.h:34
@ LZW_NO_COLOUR
Error: No colour map provided.
Definition lzw.h:39
const fl::u32 * colour_map
Index to colour mapping.
Definition lzw.cpp.hpp:94
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

References fl::third_party::lzw_ctx::colour_map, FL_NOEXCEPT, lzw__decode(), lzw__map_write_fn(), LZW_NO_COLOUR, LZW_OK, fl::third_party::lzw_ctx::output_code, and fl::third_party::lzw_ctx::output_left.

Referenced by nsgif__decode_simple().

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