2011-03-09 04:23:16 +01:00
|
|
|
// Copyright 2011 Google Inc.
|
|
|
|
//
|
|
|
|
// This code is licensed under the same terms as WebM:
|
|
|
|
// Software License Agreement: http://www.webmproject.org/license/software/
|
|
|
|
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Internal header: WebP decoding parameters and custom IO on buffer
|
|
|
|
//
|
|
|
|
// Author: somnath@google.com (Somnath Banerjee)
|
|
|
|
|
|
|
|
#ifndef WEBP_DEC_WEBPI_H
|
|
|
|
#define WEBP_DEC_WEBPI_H
|
|
|
|
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "webp/decode_vp8.h"
|
|
|
|
|
2011-03-24 02:03:53 +01:00
|
|
|
// Decoding output parameters.
|
2011-03-09 04:23:16 +01:00
|
|
|
typedef struct {
|
|
|
|
uint8_t* output; // rgb(a) or luma
|
2011-03-24 02:03:53 +01:00
|
|
|
uint8_t *u, *v; // chroma u/v
|
|
|
|
uint8_t *top_y, *top_u, *top_v; // cache for the fancy upscaler
|
2011-03-09 04:23:16 +01:00
|
|
|
int stride; // rgb(a) stride or luma stride
|
2011-03-24 02:03:53 +01:00
|
|
|
int u_stride; // chroma-u stride
|
|
|
|
int v_stride; // chroma-v stride
|
|
|
|
WEBP_CSP_MODE mode; // rgb(a) or yuv
|
2011-03-24 01:24:31 +01:00
|
|
|
int last_y; // coordinate of the line that was last output
|
2011-03-24 02:03:53 +01:00
|
|
|
int output_size; // size of 'output' buffer
|
|
|
|
int output_u_size; // size of 'u' buffer
|
|
|
|
int output_v_size; // size of 'v' buffer
|
|
|
|
int external_buffer; // If true, the output buffers are externally owned
|
2011-03-09 04:23:16 +01:00
|
|
|
} WebPDecParams;
|
|
|
|
|
|
|
|
// If a RIFF container is detected, validate it and skip over it. Returns
|
|
|
|
// VP8 bit-stream size if RIFF header is valid else returns 0
|
|
|
|
uint32_t WebPCheckRIFFHeader(const uint8_t** data_ptr,
|
|
|
|
uint32_t *data_size_ptr);
|
|
|
|
|
|
|
|
// Initializes VP8Io with custom setup, io and teardown functions
|
|
|
|
void WebPInitCustomIo(VP8Io* const io);
|
|
|
|
|
|
|
|
// Initializes params_out by allocating output buffer and setting the
|
|
|
|
// stride information. It also outputs width and height information of
|
|
|
|
// the WebP image. Returns 1 if succeeds.
|
|
|
|
int WebPInitDecParams(const uint8_t* data, uint32_t data_size, int* width,
|
|
|
|
int* height, WebPDecParams* const params_out);
|
|
|
|
|
|
|
|
// Verifies various size configurations (e.g stride >= width, specified
|
|
|
|
// output size <= stride * height etc.). Returns 0 if checks fail.
|
2011-03-24 02:03:53 +01:00
|
|
|
int WebPCheckDecParams(const VP8Io* io, const WebPDecParams* params);
|
2011-03-09 04:23:16 +01:00
|
|
|
|
2011-03-13 09:22:57 +01:00
|
|
|
// Deallocate memory allocated by WebPInitDecParams() and reset the
|
|
|
|
// WebPDecParams object.
|
|
|
|
void WebPClearDecParams(WebPDecParams* params);
|
|
|
|
|
2011-03-09 04:23:16 +01:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // WEBP_DEC_WEBPI_H
|