#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include "src/dec/alphai_dec.h"
#include "src/dec/webpi_dec.h"
#include "src/dec/vp8_dec.h"
#include "src/dec/vp8i_dec.h"
#include "src/utils/utils.h"
#include "src/webp/decode.h"
#define CHUNK_SIZE …
#define MAX_MB_SIZE …
DecState;
MemBufferMode;
MemBuffer;
struct WebPIDecoder { … };
MBContext;
static WEBP_INLINE size_t MemDataSize(const MemBuffer* mem) { … }
static int NeedCompressedAlpha(const WebPIDecoder* const idec) { … }
static void DoRemap(WebPIDecoder* const idec, ptrdiff_t offset) { … }
WEBP_NODISCARD static int AppendToMemBuffer(WebPIDecoder* const idec,
const uint8_t* const data,
size_t data_size) { … }
WEBP_NODISCARD static int RemapMemBuffer(WebPIDecoder* const idec,
const uint8_t* const data,
size_t data_size) { … }
static void InitMemBuffer(MemBuffer* const mem) { … }
static void ClearMemBuffer(MemBuffer* const mem) { … }
WEBP_NODISCARD static int CheckMemBufferMode(MemBuffer* const mem,
MemBufferMode expected) { … }
WEBP_NODISCARD static VP8StatusCode FinishDecoding(WebPIDecoder* const idec) { … }
static void SaveContext(const VP8Decoder* dec, const VP8BitReader* token_br,
MBContext* const context) { … }
static void RestoreContext(const MBContext* context, VP8Decoder* const dec,
VP8BitReader* const token_br) { … }
static VP8StatusCode IDecError(WebPIDecoder* const idec, VP8StatusCode error) { … }
static void ChangeState(WebPIDecoder* const idec, DecState new_state,
size_t consumed_bytes) { … }
static VP8StatusCode DecodeWebPHeaders(WebPIDecoder* const idec) { … }
static VP8StatusCode DecodeVP8FrameHeader(WebPIDecoder* const idec) { … }
static VP8StatusCode CopyParts0Data(WebPIDecoder* const idec) { … }
static VP8StatusCode DecodePartition0(WebPIDecoder* const idec) { … }
static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) { … }
static VP8StatusCode ErrorStatusLossless(WebPIDecoder* const idec,
VP8StatusCode status) { … }
static VP8StatusCode DecodeVP8LHeader(WebPIDecoder* const idec) { … }
static VP8StatusCode DecodeVP8LData(WebPIDecoder* const idec) { … }
static VP8StatusCode IDecode(WebPIDecoder* idec) { … }
WEBP_NODISCARD static WebPIDecoder* NewDecoder(
WebPDecBuffer* const output_buffer,
const WebPBitstreamFeatures* const features) { … }
WebPIDecoder* WebPINewDecoder(WebPDecBuffer* output_buffer) { … }
WebPIDecoder* WebPIDecode(const uint8_t* data, size_t data_size,
WebPDecoderConfig* config) { … }
void WebPIDelete(WebPIDecoder* idec) { … }
WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE csp, uint8_t* output_buffer,
size_t output_buffer_size, int output_stride) { … }
WebPIDecoder* WebPINewYUVA(uint8_t* luma, size_t luma_size, int luma_stride,
uint8_t* u, size_t u_size, int u_stride,
uint8_t* v, size_t v_size, int v_stride,
uint8_t* a, size_t a_size, int a_stride) { … }
WebPIDecoder* WebPINewYUV(uint8_t* luma, size_t luma_size, int luma_stride,
uint8_t* u, size_t u_size, int u_stride,
uint8_t* v, size_t v_size, int v_stride) { … }
static VP8StatusCode IDecCheckStatus(const WebPIDecoder* const idec) { … }
VP8StatusCode WebPIAppend(WebPIDecoder* idec,
const uint8_t* data, size_t data_size) { … }
VP8StatusCode WebPIUpdate(WebPIDecoder* idec,
const uint8_t* data, size_t data_size) { … }
static const WebPDecBuffer* GetOutputBuffer(const WebPIDecoder* const idec) { … }
const WebPDecBuffer* WebPIDecodedArea(const WebPIDecoder* idec,
int* left, int* top,
int* width, int* height) { … }
WEBP_NODISCARD uint8_t* WebPIDecGetRGB(const WebPIDecoder* idec, int* last_y,
int* width, int* height, int* stride) { … }
WEBP_NODISCARD uint8_t* WebPIDecGetYUVA(const WebPIDecoder* idec, int* last_y,
uint8_t** u, uint8_t** v, uint8_t** a,
int* width, int* height, int* stride,
int* uv_stride, int* a_stride) { … }
int WebPISetIOHooks(WebPIDecoder* const idec,
VP8IoPutHook put,
VP8IoSetupHook setup,
VP8IoTeardownHook teardown,
void* user_data) { … }