Get the next LZW code and write its value(s) to output buffer.
- Parameters
-
| [in] | ctx | LZW reading context, updated. |
| [in] | write_fn | Function for writing pixels to output. |
| [in] | output_data | Array to write output values into. |
| [in] | output_length | Size of output array. |
| [in,out] | output_written | Number of values written. Updated on exit. |
- Returns
- LZW_OK on success, or appropriate error code otherwise.
Definition at line 389 of file lzw.cpp.hpp.
395{
397 fl::u16 code = 0;
398
399
402 return res;
403 }
404
405
407
409
411
413
417 return res;
418 }
419
425
426
430 }
431 }
432
433 *output_written += write_fn(ctx,
434 output_data, output_length, *output_written,
436
437
441
443}
#define LZW_TABLE_ENTRY_MAX
Maximum number of lzw table entries.
#define LZW_CODE_MAX
Maximum LZW code size in bits.
static lzw_result 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.
lzw_result
LZW decoding response codes.
@ LZW_EOI_CODE
Error: End of Information code.
@ LZW_BAD_CODE
Error: Bad LZW code.
static void lzw__table_add_entry(struct lzw_ctx *ctx, fl::u16 code) FL_NOEXCEPT
Create new table entry.
static lzw_result lzw__handle_clear(struct lzw_ctx *ctx, fl::u16 *code_out) FL_NOEXCEPT
Handle clear code.
fl::u8 first
First value in entry's entire record.
fl::u16 table_size
Next position in table to fill.
fl::u16 clear_code
Special Clear code value.
fl::u16 prev_code_first
First value of previous code.
struct lzw_table_entry table[LZW_TABLE_ENTRY_MAX]
LZW code table.
fl::u16 eoi_code
Special End of Information code value.
fl::u16 count
Count of values in this entry's record.
fl::u8 code_size
Current LZW code size.
fl::u16 prev_code
Code read from input previously.
struct lzw_read_ctx input
Input reading context.
fl::u16 code_max
Max code value for current code size.
fl::u16 prev_code_count
Total values for previous code.
References fl::third_party::lzw_ctx::clear_code, fl::third_party::lzw_ctx::code_max, fl::third_party::lzw_ctx::code_size, fl::third_party::lzw_table_entry::count, fl::third_party::lzw_ctx::eoi_code, fl::third_party::lzw_table_entry::first, FL_NOEXCEPT, fl::third_party::lzw_ctx::input, lzw__handle_clear(), lzw__read_code(), lzw__table_add_entry(), LZW_BAD_CODE, LZW_CODE_MAX, LZW_EOI_CODE, LZW_OK, LZW_TABLE_ENTRY_MAX, fl::third_party::lzw_ctx::prev_code, fl::third_party::lzw_ctx::prev_code_count, fl::third_party::lzw_ctx::prev_code_first, fl::third_party::lzw_ctx::table, and fl::third_party::lzw_ctx::table_size.
Referenced by lzw_decode(), and lzw_decode_map().