#include <assert.h>
#include <stdlib.h>
#include "src/dec/alphai_dec.h"
#include "src/dec/vp8li_dec.h"
#include "src/dsp/dsp.h"
#include "src/dsp/lossless.h"
#include "src/dsp/lossless_common.h"
#include "src/dsp/yuv.h"
#include "src/utils/endian_inl_utils.h"
#include "src/utils/huffman_utils.h"
#include "src/utils/utils.h"
#define NUM_ARGB_CACHE_ROWS …
static const int kCodeLengthLiterals = …;
static const int kCodeLengthRepeatCode = …;
static const uint8_t kCodeLengthExtraBits[3] = …;
static const uint8_t kCodeLengthRepeatOffsets[3] = …;
HuffIndex;
static const uint16_t kAlphabetSize[HUFFMAN_CODES_PER_META_CODE] = …;
static const uint8_t kLiteralMap[HUFFMAN_CODES_PER_META_CODE] = …;
#define NUM_CODE_LENGTH_CODES …
static const uint8_t kCodeLengthCodeOrder[NUM_CODE_LENGTH_CODES] = …;
#define CODE_TO_PLANE_CODES …
static const uint8_t kCodeToPlane[CODE_TO_PLANE_CODES] = …;
#define FIXED_TABLE_SIZE …
static const uint16_t kTableSize[12] = …;
static int VP8LSetError(VP8LDecoder* const dec, VP8StatusCode error) { … }
static int DecodeImageStream(int xsize, int ysize,
int is_level0,
VP8LDecoder* const dec,
uint32_t** const decoded_data);
int VP8LCheckSignature(const uint8_t* const data, size_t size) { … }
static int ReadImageInfo(VP8LBitReader* const br,
int* const width, int* const height,
int* const has_alpha) { … }
int VP8LGetInfo(const uint8_t* data, size_t data_size,
int* const width, int* const height, int* const has_alpha) { … }
static WEBP_INLINE int GetCopyDistance(int distance_symbol,
VP8LBitReader* const br) { … }
static WEBP_INLINE int GetCopyLength(int length_symbol,
VP8LBitReader* const br) { … }
static WEBP_INLINE int PlaneCodeToDistance(int xsize, int plane_code) { … }
static WEBP_INLINE int ReadSymbol(const HuffmanCode* table,
VP8LBitReader* const br) { … }
#define BITS_SPECIAL_MARKER …
#define PACKED_NON_LITERAL_CODE …
static WEBP_INLINE int ReadPackedSymbols(const HTreeGroup* group,
VP8LBitReader* const br,
uint32_t* const dst) { … }
static int AccumulateHCode(HuffmanCode hcode, int shift,
HuffmanCode32* const huff) { … }
static void BuildPackedTable(HTreeGroup* const htree_group) { … }
static int ReadHuffmanCodeLengths(
VP8LDecoder* const dec, const int* const code_length_code_lengths,
int num_symbols, int* const code_lengths) { … }
static int ReadHuffmanCode(int alphabet_size, VP8LDecoder* const dec,
int* const code_lengths,
HuffmanTables* const table) { … }
static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
int color_cache_bits, int allow_recursion) { … }
int ReadHuffmanCodesHelper(int color_cache_bits, int num_htree_groups,
int num_htree_groups_max, const int* const mapping,
VP8LDecoder* const dec,
HuffmanTables* const huffman_tables,
HTreeGroup** const htree_groups) { … }
#if !defined(WEBP_REDUCE_SIZE)
static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) { … }
#endif
#if !defined(WEBP_REDUCE_SIZE)
static int Export(WebPRescaler* const rescaler, WEBP_CSP_MODE colorspace,
int rgba_stride, uint8_t* const rgba) { … }
static int EmitRescaledRowsRGBA(const VP8LDecoder* const dec,
uint8_t* in, int in_stride, int mb_h,
uint8_t* const out, int out_stride) { … }
#endif
static int EmitRows(WEBP_CSP_MODE colorspace,
const uint8_t* row_in, int in_stride,
int mb_w, int mb_h,
uint8_t* const out, int out_stride) { … }
static void ConvertToYUVA(const uint32_t* const src, int width, int y_pos,
const WebPDecBuffer* const output) { … }
static int ExportYUVA(const VP8LDecoder* const dec, int y_pos) { … }
static int EmitRescaledRowsYUVA(const VP8LDecoder* const dec,
uint8_t* in, int in_stride, int mb_h) { … }
static int EmitRowsYUVA(const VP8LDecoder* const dec,
const uint8_t* in, int in_stride,
int mb_w, int num_rows) { … }
static int SetCropWindow(VP8Io* const io, int y_start, int y_end,
uint8_t** const in_data, int pixel_stride) { … }
static WEBP_INLINE int GetMetaIndex(
const uint32_t* const image, int xsize, int bits, int x, int y) { … }
static WEBP_INLINE HTreeGroup* GetHtreeGroupForPos(VP8LMetadata* const hdr,
int x, int y) { … }
ProcessRowsFunc;
static void ApplyInverseTransforms(VP8LDecoder* const dec,
int start_row, int num_rows,
const uint32_t* const rows) { … }
static void ProcessRows(VP8LDecoder* const dec, int row) { … }
static int Is8bOptimizable(const VP8LMetadata* const hdr) { … }
static void AlphaApplyFilter(ALPHDecoder* const alph_dec,
int first_row, int last_row,
uint8_t* out, int stride) { … }
static void ExtractPalettedAlphaRows(VP8LDecoder* const dec, int last_row) { … }
static WEBP_INLINE uint32_t Rotate8b(uint32_t V) { … }
static WEBP_INLINE void CopySmallPattern8b(const uint8_t* src, uint8_t* dst,
int length, uint32_t pattern) { … }
static WEBP_INLINE void CopyBlock8b(uint8_t* const dst, int dist, int length) { … }
static WEBP_INLINE void CopySmallPattern32b(const uint32_t* src,
uint32_t* dst,
int length, uint64_t pattern) { … }
static WEBP_INLINE void CopyBlock32b(uint32_t* const dst,
int dist, int length) { … }
static int DecodeAlphaData(VP8LDecoder* const dec, uint8_t* const data,
int width, int height, int last_row) { … }
static void SaveState(VP8LDecoder* const dec, int last_pixel) { … }
static void RestoreState(VP8LDecoder* const dec) { … }
#define SYNC_EVERY_N_ROWS …
static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data,
int width, int height, int last_row,
ProcessRowsFunc process_func) { … }
static void ClearTransform(VP8LTransform* const transform) { … }
static int ExpandColorMap(int num_colors, VP8LTransform* const transform) { … }
static int ReadTransform(int* const xsize, int const* ysize,
VP8LDecoder* const dec) { … }
static void InitMetadata(VP8LMetadata* const hdr) { … }
static void ClearMetadata(VP8LMetadata* const hdr) { … }
VP8LDecoder* VP8LNew(void) { … }
void VP8LClear(VP8LDecoder* const dec) { … }
void VP8LDelete(VP8LDecoder* const dec) { … }
static void UpdateDecoder(VP8LDecoder* const dec, int width, int height) { … }
static int DecodeImageStream(int xsize, int ysize,
int is_level0,
VP8LDecoder* const dec,
uint32_t** const decoded_data) { … }
static int AllocateInternalBuffers32b(VP8LDecoder* const dec, int final_width) { … }
static int AllocateInternalBuffers8b(VP8LDecoder* const dec) { … }
static void ExtractAlphaRows(VP8LDecoder* const dec, int last_row) { … }
int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
const uint8_t* const data, size_t data_size) { … }
int VP8LDecodeAlphaImageStream(ALPHDecoder* const alph_dec, int last_row) { … }
int VP8LDecodeHeader(VP8LDecoder* const dec, VP8Io* const io) { … }
int VP8LDecodeImage(VP8LDecoder* const dec) { … }