FFmpeg
Data Structures | Macros | Functions | Variables
lzw.c File Reference

LZW decoding routines. More...

#include "libavutil/attributes.h"
#include "bytestream.h"
#include "lzw.h"
#include "libavutil/mem.h"

Go to the source code of this file.

Data Structures

struct  LZWState
 

Macros

#define LZW_MAXBITS   12
 
#define LZW_SIZTABLE   (1<<LZW_MAXBITS)
 

Functions

static int lzw_get_code (struct LZWState *s)
 
int ff_lzw_decode_tail (LZWState *p)
 
av_cold void ff_lzw_decode_open (LZWState **p)
 
av_cold void ff_lzw_decode_close (LZWState **p)
 
int ff_lzw_decode_init (LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
 Initialize LZW decoder. More...
 
int ff_lzw_decode (LZWState *p, uint8_t *buf, int len)
 Decode given number of bytes NOTE: the algorithm here is inspired from the LZW GIF decoder written by Steven A. More...
 

Variables

static const uint16_t mask [17]
 

Detailed Description

LZW decoding routines.

Author
Fabrice Bellard
modified for use in TIFF by Konstantin Shishkov

Definition in file lzw.c.

Macro Definition Documentation

◆ LZW_MAXBITS

#define LZW_MAXBITS   12

Definition at line 35 of file lzw.c.

◆ LZW_SIZTABLE

#define LZW_SIZTABLE   (1<<LZW_MAXBITS)

Definition at line 36 of file lzw.c.

Function Documentation

◆ lzw_get_code()

static int lzw_get_code ( struct LZWState s)
static

Definition at line 70 of file lzw.c.

Referenced by ff_lzw_decode().

◆ ff_lzw_decode_tail()

int ff_lzw_decode_tail ( LZWState p)

Definition at line 99 of file lzw.c.

Referenced by gif_read_image().

◆ ff_lzw_decode_open()

av_cold void ff_lzw_decode_open ( LZWState **  p)

Definition at line 113 of file lzw.c.

Referenced by gif_decode_init(), and tiff_init().

◆ ff_lzw_decode_close()

av_cold void ff_lzw_decode_close ( LZWState **  p)

Definition at line 118 of file lzw.c.

Referenced by gif_decode_close(), and tiff_end().

◆ ff_lzw_decode_init()

int ff_lzw_decode_init ( LZWState p,
int  csize,
const uint8_t *  buf,
int  buf_size,
int  mode 
)

Initialize LZW decoder.

Parameters
pLZW context
csizeinitial code size in bits
bufinput data
buf_sizeinput data size
modedecoder working mode - either GIF or TIFF

Definition at line 131 of file lzw.c.

Referenced by gif_read_image(), and tiff_unpack_strip().

◆ ff_lzw_decode()

int ff_lzw_decode ( LZWState p,
uint8_t *  buf,
int  len 
)

Decode given number of bytes NOTE: the algorithm here is inspired from the LZW GIF decoder written by Steven A.

Bennett in 1987.

Parameters
pLZW context
bufoutput buffer
lennumber of bytes to decode
Returns
number of bytes decoded

Definition at line 169 of file lzw.c.

Referenced by gif_read_image(), and tiff_unpack_strip().

Variable Documentation

◆ mask

const uint16_t mask[17]
static
Initial value:
=
{
0x0000, 0x0001, 0x0003, 0x0007,
0x000F, 0x001F, 0x003F, 0x007F,
0x00FF, 0x01FF, 0x03FF, 0x07FF,
0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF
}

Definition at line 38 of file lzw.c.

Referenced by ac3_bit_alloc_calc_bap_c(), ac3_decode_frame(), add_hfyu_median_pred_int16_c(), add_int16_c(), add_left_pred_int16_c(), affine_merge_candidate(), affine_merge_const1(), affine_merge_const2(), affine_merge_const3(), affine_merge_const4(), affine_merge_const5(), affine_merge_const6(), apply_filter(), argo_brp_read_header(), av_channel_layout_describe_bprint(), av_channel_layout_from_mask(), av_channel_layout_from_string(), av_channel_layout_index_from_channel(), av_channel_layout_retype(), av_channel_layout_subset(), av_opt_set_defaults2(), av_read_image_line2(), av_write_image_line2(), avc_chroma_hv_2x2_msa(), avc_chroma_hv_2x4_msa(), avc_chroma_hv_4x2_msa(), avc_chroma_hv_4x4_msa(), avc_chroma_hv_4x8_msa(), avc_chroma_hv_8x4_msa(), avc_chroma_hv_8x8_msa(), avc_chroma_hv_and_aver_dst_2x2_msa(), avc_chroma_hv_and_aver_dst_2x4_msa(), avc_chroma_hv_and_aver_dst_4x2_msa(), avc_chroma_hv_and_aver_dst_4x4_msa(), avc_chroma_hv_and_aver_dst_4x8_msa(), avc_chroma_hv_and_aver_dst_8x4_msa(), avc_chroma_hv_and_aver_dst_8x8_msa(), avc_chroma_hz_2x2_msa(), avc_chroma_hz_2x4_msa(), avc_chroma_hz_4x2_msa(), avc_chroma_hz_4x4_msa(), avc_chroma_hz_4x8_msa(), avc_chroma_hz_8x4_msa(), avc_chroma_hz_8x8_msa(), avc_chroma_hz_and_aver_dst_2x2_msa(), avc_chroma_hz_and_aver_dst_2x4_msa(), avc_chroma_hz_and_aver_dst_4x2_msa(), avc_chroma_hz_and_aver_dst_4x4_msa(), avc_chroma_hz_and_aver_dst_4x8_msa(), avc_chroma_hz_and_aver_dst_8x4_msa(), avc_chroma_hz_and_aver_dst_8x8_msa(), avc_chroma_hz_nonmult_msa(), binkb_read_bundle(), bit_depth(), blend_line_hv(), blend_line_hv16(), blend_pixel(), blend_pixel16(), blur_image(), blur_pixel(), build_xlaw_table(), check_add_int16(), check_add_left_pred_16(), check_add_res(), check_loop_filter(), check_loop_filter_intra(), checkasm_check_vf_bwdif(), cinepak_decode_codebook(), cinepak_decode_vectors(), cmp_direct_inline(), codebook_bits_offset(), common_hv_2ht_2vt_4x4_msa(), common_hv_2ht_2vt_4x8_msa(), common_hv_2ht_2vt_8x4_msa(), common_hv_2ht_2vt_8x8mult_msa(), common_hv_2ht_2vt_and_aver_dst_4x4_msa(), common_hv_2ht_2vt_and_aver_dst_4x8_msa(), common_hv_2ht_2vt_and_aver_dst_8x4_msa(), common_hv_2ht_2vt_and_aver_dst_8x8mult_msa(), common_hz_2t_4x4_msa(), common_hz_2t_4x8_msa(), common_hz_2t_8x4_msa(), common_hz_2t_8x8mult_msa(), common_hz_2t_and_aver_dst_4x4_msa(), common_hz_2t_and_aver_dst_4x8_msa(), common_hz_2t_and_aver_dst_8x4_msa(), common_hz_2t_and_aver_dst_8x8mult_msa(), compare_add_res(), compare_mv_ref_idx(), compare_pf_ref_idx(), compress_alpha(), compress_color(), compute_bit_depth(), config_output(), copy_color_mask(), copy_src_mask(), cu_get_max_y(), decode_0(), decode_13(), decode_bmv_frame(), decode_channel_code_tab(), decode_clnpass(), decode_dds1(), decode_dsw1(), decode_init(), decode_inter(), decode_long_vertical_delta2(), decode_mvc1(), decode_mvc2(), decode_mvdv(), decode_region_masked(), decode_residual(), decode_residual_block(), decode_scaling_list(), decode_scaling_matrices(), decode_sigpass(), decode_tsw1(), decodeplane32(), diff_int16_c(), diff_pixels_mvi(), draw_htext(), draw_htext16(), draw_ihtext(), draw_ihtext16(), draw_rectangle(), draw_vtext(), draw_vtext16(), drawtext(), encode_alpha_plane(), encode_alpha_slice_data(), encode_clnpass(), encode_plane_bitstream(), encode_refpass(), encode_sigpass(), epic_jb_decode_tile(), escape124_decode_frame(), estimate_alpha_plane(), ff_ac3_bit_alloc_calc_mask(), ff_acelp_fc_pulse_per_track(), ff_avg_bilin_16h_msa(), ff_avg_bilin_16hv_msa(), ff_avg_bilin_32h_msa(), ff_avg_bilin_64h_msa(), ff_blend_mask(), ff_dca_count_chs_for_mask(), ff_decode_10_pulses_35bits(), ff_draw_pc_font(), ff_er_add_slice(), ff_h264_check_intra4x4_pred_mode(), ff_hevc_output_frame(), ff_hls_senc_parse_audio_setup_info(), ff_loop_filter_h_44_16_lsx(), ff_loop_filter_h_44_16_msa(), ff_loop_filter_h_48_16_lsx(), ff_loop_filter_h_48_16_msa(), ff_loop_filter_h_4_8_lsx(), ff_loop_filter_h_4_8_msa(), ff_loop_filter_h_84_16_lsx(), ff_loop_filter_h_84_16_msa(), ff_loop_filter_h_88_16_lsx(), ff_loop_filter_h_88_16_msa(), ff_loop_filter_h_8_8_lsx(), ff_loop_filter_h_8_8_msa(), ff_loop_filter_v_16_8_lsx(), ff_loop_filter_v_16_8_msa(), ff_loop_filter_v_44_16_lsx(), ff_loop_filter_v_44_16_msa(), ff_loop_filter_v_48_16_lsx(), ff_loop_filter_v_48_16_msa(), ff_loop_filter_v_4_8_lsx(), ff_loop_filter_v_4_8_msa(), ff_loop_filter_v_84_16_lsx(), ff_loop_filter_v_84_16_msa(), ff_loop_filter_v_88_16_lsx(), ff_loop_filter_v_88_16_msa(), ff_loop_filter_v_8_8_lsx(), ff_loop_filter_v_8_8_msa(), ff_lsb2full(), ff_lzw_decode(), ff_lzw_decode_init(), ff_mlp_rematrix_channel(), ff_opus_rc_enc_end(), ff_put_bilin_16h_msa(), ff_put_bilin_16hv_msa(), ff_put_bilin_32h_msa(), ff_put_bilin_64h_msa(), ff_put_no_rnd_pixels_l2_msa(), ff_put_vp8_bilinear16_h_msa(), ff_put_vp8_bilinear16_hv_msa(), ff_sbc_crc8(), ff_vk_extensions_to_mask(), ff_vp3_h_loop_filter_msa(), ff_vp3_idct_dc_add_msa(), ff_vp3_v_loop_filter_msa(), ff_vp8_h_loop_filter16_inner_lsx(), ff_vp8_h_loop_filter16_inner_msa(), ff_vp8_h_loop_filter16_lsx(), ff_vp8_h_loop_filter16_msa(), ff_vp8_h_loop_filter8uv_inner_msa(), ff_vp8_h_loop_filter8uv_lsx(), ff_vp8_h_loop_filter8uv_msa(), ff_vp8_h_loop_filter_simple_msa(), ff_vp8_idct_add_msa(), ff_vp8_idct_dc_add_msa(), ff_vp8_v_loop_filter16_inner_lsx(), ff_vp8_v_loop_filter16_inner_msa(), ff_vp8_v_loop_filter16_lsx(), ff_vp8_v_loop_filter16_msa(), ff_vp8_v_loop_filter8uv_inner_msa(), ff_vp8_v_loop_filter8uv_lsx(), ff_vp8_v_loop_filter8uv_msa(), ff_vp8_v_loop_filter_simple_msa(), ff_vvc_luma_mv_merge_gpm(), ff_vvc_store_mv(), ff_vvc_store_sb_mvs(), ff_yuv2planeX_8_lasx(), file_check(), fill_ltable(), fill_tile4(), fill_tileX(), filter_channel(), filter_frame(), filter_plane_cols(), filter_plane_rows(), filter_slice(), find_ref_idx(), flac_read_header(), FUNC(), get_cabac_bypass_sign(), get_len(), get_mb_score(), h263_dct_unquantize_msa(), hevc_sao_band_filter_4width_msa(), horiz_mc_qpel_16width_msa(), horiz_mc_qpel_aver_src0_16width_msa(), horiz_mc_qpel_aver_src1_16width_msa(), horiz_mc_qpel_avg_dst_16width_msa(), horiz_mc_qpel_avg_dst_aver_src0_16width_msa(), horiz_mc_qpel_avg_dst_aver_src1_16width_msa(), horiz_mc_qpel_no_rnd_16width_msa(), horiz_mc_qpel_no_rnd_aver_src0_16width_msa(), horiz_mc_qpel_no_rnd_aver_src1_16width_msa(), hv_mc_qpel_aver_horiz_16x16_msa(), hv_mc_qpel_aver_horiz_src0_16x16_msa(), hv_mc_qpel_aver_horiz_src1_16x16_msa(), hv_mc_qpel_no_rnd_horiz_16x16_msa(), hv_mc_qpel_no_rnd_horiz_src0_16x16_msa(), hv_mc_qpel_no_rnd_horiz_src1_16x16_msa(), idct_column_false_mmi(), idct_column_true_mmi(), idct_msa(), idct_row_mmi(), idraw_htext(), idraw_htext16(), idraw_vtext(), idraw_vtext16(), init(), init_cavlc_level_tab(), init_luts(), intra_predict_vert_dc_8x8_msa(), jpeg2000_bitbuf_get_bits_lsb(), jpeg2000_bitbuf_get_bits_lsb_forward(), jpeg2000_bitbuf_peek_bits_lsb(), jpg_decode_data(), linemask_matches(), ljpeg_decode_rgb_scan(), ljpeg_decode_yuv_scan(), LLVMFuzzerTestOneInput(), load_mask(), main(), mask_edges(), masked_description(), match_colors(), mlp_channel_layout_subset(), mlp_filter_channel(), mov_read_dac3(), mov_read_dec3(), mp3_write_xing(), mpc8_decode_frame(), mpc8_get_mask(), mpeg2_dct_unquantize_inter_msa(), mpegts_check_bitstream(), mss2_blit_wmv9_masked_c(), mss2_blit_wmv9_template(), mss2_gray_fill_masked_c(), mszh_decomp(), mv_compression(), mv_merge_pairwise_candidate(), mvf_to_mi(), mvp_add_difference(), mvp_history_candidates(), parse_coding_header(), parse_waveformatex(), parse_xxch_frame(), pchip_edge_case(), picmemset(), planar_rgb_to_uv_lasx(), planar_rgb_to_y_lasx(), png_get_interlaced_row(), png_put_interlaced_row(), pp_get_mode_by_name_and_quality(), pred_get_refs(), pred_mv(), pred_spatial_direct_motion(), print_stats(), process_float(), process_frame(), put_swf_line_edge(), put_swf_rect(), randomize_loopfilter_buffers(), read_residue(), refine_colors(), render_default_font(), rgb2yuv_fsb(), rv34_decode_cbp(), rv34_pred_mv_b(), sad_hv_bilinear_filter_8width_msa(), select_region(), set_bit(), set_channel_info(), set_metadata(), set_sr_golomb_flac(), setup_window(), store_slice16_c(), sub_hfyu_median_pred_int16_c(), subsampling_bounds(), try_describe_ambisonic(), twiddle(), ulti_pattern(), unpack_alpha(), vertClassify_altivec(), vlc_decode_u_suffix(), vp56_mc(), vp6_filter(), vp8_h_loop_filter8_mmi(), vp8_v_loop_filter8_mmi(), vp9_hz_lpf_t4_and_t8_16w(), vp9_vt_lpf_t4_and_t8_16w(), vp9_vt_lpf_t4_and_t8_8w(), write_element(), x8_get_ac_rlf(), and xan_unpack_luma().