mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 23:32:05 +02:00
Merge "decode.h: use size_t consistently"
This commit is contained in:
@@ -40,10 +40,10 @@ static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) {
|
||||
ok = 0;
|
||||
} else if (mode >= MODE_YUV) { // YUV checks
|
||||
const WebPYUVABuffer* const buf = &buffer->u.YUVA;
|
||||
const int size = buf->y_stride * height;
|
||||
const int u_size = buf->u_stride * ((height + 1) / 2);
|
||||
const int v_size = buf->v_stride * ((height + 1) / 2);
|
||||
const int a_size = buf->a_stride * height;
|
||||
const size_t size = buf->y_stride * height;
|
||||
const size_t u_size = buf->u_stride * ((height + 1) / 2);
|
||||
const size_t v_size = buf->v_stride * ((height + 1) / 2);
|
||||
const size_t a_size = buf->a_stride * height;
|
||||
ok &= (size <= buf->y_size);
|
||||
ok &= (u_size <= buf->u_size);
|
||||
ok &= (v_size <= buf->v_size);
|
||||
@@ -56,7 +56,8 @@ static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) {
|
||||
}
|
||||
} else { // RGB checks
|
||||
const WebPRGBABuffer* const buf = &buffer->u.RGBA;
|
||||
ok &= (buf->stride * height <= buf->size);
|
||||
const size_t size = buf->stride * height;
|
||||
ok &= (size <= buf->size);
|
||||
ok &= (buf->stride >= width * kModeBpp[mode]);
|
||||
}
|
||||
return ok ? VP8_STATUS_OK : VP8_STATUS_INVALID_PARAM;
|
||||
|
@@ -548,7 +548,7 @@ WebPIDecoder* WebPINewDecoder(WebPDecBuffer* const output_buffer) {
|
||||
return idec;
|
||||
}
|
||||
|
||||
WebPIDecoder* WebPIDecode(const uint8_t* data, uint32_t data_size,
|
||||
WebPIDecoder* WebPIDecode(const uint8_t* data, size_t data_size,
|
||||
WebPDecoderConfig* const config) {
|
||||
WebPIDecoder* idec;
|
||||
|
||||
@@ -595,7 +595,7 @@ WebPIDecoder* WebPINew(WEBP_CSP_MODE mode) {
|
||||
}
|
||||
|
||||
WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer,
|
||||
int output_buffer_size, int output_stride) {
|
||||
size_t output_buffer_size, int output_stride) {
|
||||
WebPIDecoder* idec;
|
||||
if (mode >= MODE_YUV) return NULL;
|
||||
idec = WebPINewDecoder(NULL);
|
||||
@@ -608,9 +608,9 @@ WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer,
|
||||
return idec;
|
||||
}
|
||||
|
||||
WebPIDecoder* WebPINewYUV(uint8_t* luma, int luma_size, int luma_stride,
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_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) {
|
||||
WebPIDecoder* const idec = WebPINewDecoder(NULL);
|
||||
if (!idec) return NULL;
|
||||
idec->output_.colorspace = MODE_YUV;
|
||||
@@ -641,7 +641,7 @@ static VP8StatusCode IDecCheckStatus(const WebPIDecoder* const idec) {
|
||||
}
|
||||
|
||||
VP8StatusCode WebPIAppend(WebPIDecoder* const idec,
|
||||
const uint8_t* const data, uint32_t data_size) {
|
||||
const uint8_t* const data, size_t data_size) {
|
||||
VP8StatusCode status;
|
||||
if (idec == NULL || data == NULL) {
|
||||
return VP8_STATUS_INVALID_PARAM;
|
||||
@@ -662,7 +662,7 @@ VP8StatusCode WebPIAppend(WebPIDecoder* const idec,
|
||||
}
|
||||
|
||||
VP8StatusCode WebPIUpdate(WebPIDecoder* const idec,
|
||||
const uint8_t* const data, uint32_t data_size) {
|
||||
const uint8_t* const data, size_t data_size) {
|
||||
VP8StatusCode status;
|
||||
if (idec == NULL || data == NULL) {
|
||||
return VP8_STATUS_INVALID_PARAM;
|
||||
|
@@ -275,7 +275,7 @@ struct VP8Decoder {
|
||||
|
||||
// extensions
|
||||
const uint8_t* alpha_data_; // compressed alpha data (if present)
|
||||
uint32_t alpha_data_size_;
|
||||
size_t alpha_data_size_;
|
||||
uint8_t* alpha_plane_; // output
|
||||
|
||||
int layer_colorspace_;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static const int kHeaderBytes = 5;
|
||||
static const size_t kHeaderBytes = 5;
|
||||
static const uint32_t kImageSizeBits = 14;
|
||||
|
||||
static const int kCodeLengthLiterals = 16;
|
||||
@@ -94,7 +94,7 @@ static int ReadImageSize(VP8LBitReader* const br,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int VP8LGetInfo(const uint8_t* data, int data_size,
|
||||
int VP8LGetInfo(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
if (data_size < kHeaderBytes) {
|
||||
return 0; // not enough data
|
||||
|
@@ -102,7 +102,7 @@ typedef struct {
|
||||
// width and height. Returns 0 in case of formatting error. width/height
|
||||
// can be passed NULL.
|
||||
int VP8LGetInfo(const uint8_t* data,
|
||||
int data_size, // data available so far
|
||||
size_t data_size, // data available so far
|
||||
int *width, int *height);
|
||||
|
||||
// Allocates and initialize a new lossless decoder instance.
|
||||
|
@@ -56,7 +56,7 @@ static WEBP_INLINE uint32_t get_le32(const uint8_t* const data) {
|
||||
// VP8_STATUS_OK otherwise.
|
||||
// In case there are not enough bytes (partial RIFF container), return 0 for
|
||||
// riff_size. Else return the riff_size extracted from the header.
|
||||
static VP8StatusCode ParseRIFF(const uint8_t** data, uint32_t* data_size,
|
||||
static VP8StatusCode ParseRIFF(const uint8_t** data, size_t* data_size,
|
||||
size_t* riff_size) {
|
||||
assert(data);
|
||||
assert(data_size);
|
||||
@@ -87,7 +87,7 @@ static VP8StatusCode ParseRIFF(const uint8_t** data, uint32_t* data_size,
|
||||
// VP8_STATUS_OK otherwise.
|
||||
// If a VP8X chunk is found, found_vp8x is set to true and *width, *height and
|
||||
// *flags are set to the corresponding values extracted from the VP8X chunk.
|
||||
static VP8StatusCode ParseVP8X(const uint8_t** data, uint32_t* data_size,
|
||||
static VP8StatusCode ParseVP8X(const uint8_t** data, size_t* data_size,
|
||||
int* found_vp8x,
|
||||
int* width, int* height, uint32_t* flags) {
|
||||
const uint32_t vp8x_size = CHUNK_HEADER_SIZE + VP8X_CHUNK_SIZE;
|
||||
@@ -130,12 +130,12 @@ static VP8StatusCode ParseVP8X(const uint8_t** data, uint32_t* data_size,
|
||||
// VP8_STATUS_OK otherwise.
|
||||
// If an alpha chunk is found, alpha_data and alpha_size are set appropriately.
|
||||
static VP8StatusCode ParseOptionalChunks(const uint8_t** data,
|
||||
uint32_t* data_size,
|
||||
uint32_t riff_size,
|
||||
size_t* data_size,
|
||||
size_t riff_size,
|
||||
const uint8_t** alpha_data,
|
||||
uint32_t* alpha_size) {
|
||||
size_t* alpha_size) {
|
||||
const uint8_t* buf;
|
||||
uint32_t buf_size;
|
||||
size_t buf_size;
|
||||
uint32_t total_size = TAG_SIZE + // "WEBP".
|
||||
CHUNK_HEADER_SIZE + // "VP8Xnnnn".
|
||||
VP8X_CHUNK_SIZE; // data.
|
||||
@@ -195,7 +195,7 @@ static VP8StatusCode ParseOptionalChunks(const uint8_t** data,
|
||||
// If a VP8/VP8L chunk is found, chunk_size is set to the total number of bytes
|
||||
// extracted from the VP8/VP8L chunk header.
|
||||
// The flag 'is_lossless' is set to 1 in case of VP8L chunk.
|
||||
static VP8StatusCode ParseVP8Header(const uint8_t** data, uint32_t* data_size,
|
||||
static VP8StatusCode ParseVP8Header(const uint8_t** data, size_t* data_size,
|
||||
size_t riff_size,
|
||||
size_t* chunk_size, int* is_lossless) {
|
||||
const int is_vp8 = !memcmp(*data, "VP8 ", TAG_SIZE);
|
||||
@@ -231,7 +231,7 @@ static VP8StatusCode ParseVP8Header(const uint8_t** data, uint32_t* data_size,
|
||||
|
||||
VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers) {
|
||||
const uint8_t* buf;
|
||||
uint32_t buf_size;
|
||||
size_t buf_size;
|
||||
int found_vp8x;
|
||||
VP8StatusCode status;
|
||||
|
||||
@@ -296,7 +296,7 @@ void WebPResetDecParams(WebPDecParams* const params) {
|
||||
// "Into" decoding variants
|
||||
|
||||
// Main flow
|
||||
static VP8StatusCode DecodeInto(const uint8_t* data, uint32_t data_size,
|
||||
static VP8StatusCode DecodeInto(const uint8_t* data, size_t data_size,
|
||||
WebPDecParams* const params) {
|
||||
VP8StatusCode status;
|
||||
VP8Io io;
|
||||
@@ -370,8 +370,8 @@ static VP8StatusCode DecodeInto(const uint8_t* data, uint32_t data_size,
|
||||
|
||||
// Helpers
|
||||
static uint8_t* DecodeIntoRGBABuffer(WEBP_CSP_MODE colorspace,
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* rgba, int stride, int size) {
|
||||
const uint8_t* data, size_t data_size,
|
||||
uint8_t* rgba, int stride, size_t size) {
|
||||
WebPDecParams params;
|
||||
WebPDecBuffer buf;
|
||||
if (rgba == NULL) {
|
||||
@@ -391,35 +391,35 @@ static uint8_t* DecodeIntoRGBABuffer(WEBP_CSP_MODE colorspace,
|
||||
return rgba;
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeRGBInto(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output, int size, int stride) {
|
||||
uint8_t* WebPDecodeRGBInto(const uint8_t* data, size_t data_size,
|
||||
uint8_t* output, size_t size, int stride) {
|
||||
return DecodeIntoRGBABuffer(MODE_RGB, data, data_size, output, stride, size);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeRGBAInto(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output, int size, int stride) {
|
||||
uint8_t* WebPDecodeRGBAInto(const uint8_t* data, size_t data_size,
|
||||
uint8_t* output, size_t size, int stride) {
|
||||
return DecodeIntoRGBABuffer(MODE_RGBA, data, data_size, output, stride, size);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeARGBInto(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output, int size, int stride) {
|
||||
uint8_t* WebPDecodeARGBInto(const uint8_t* data, size_t data_size,
|
||||
uint8_t* output, size_t size, int stride) {
|
||||
return DecodeIntoRGBABuffer(MODE_ARGB, data, data_size, output, stride, size);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeBGRInto(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output, int size, int stride) {
|
||||
uint8_t* WebPDecodeBGRInto(const uint8_t* data, size_t data_size,
|
||||
uint8_t* output, size_t size, int stride) {
|
||||
return DecodeIntoRGBABuffer(MODE_BGR, data, data_size, output, stride, size);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeBGRAInto(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output, int size, int stride) {
|
||||
uint8_t* WebPDecodeBGRAInto(const uint8_t* data, size_t data_size,
|
||||
uint8_t* output, size_t size, int stride) {
|
||||
return DecodeIntoRGBABuffer(MODE_BGRA, data, data_size, output, stride, size);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeYUVInto(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* luma, int luma_size, int luma_stride,
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_stride) {
|
||||
uint8_t* WebPDecodeYUVInto(const uint8_t* data, size_t data_size,
|
||||
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) {
|
||||
WebPDecParams params;
|
||||
WebPDecBuffer output;
|
||||
if (luma == NULL) return NULL;
|
||||
@@ -446,7 +446,7 @@ uint8_t* WebPDecodeYUVInto(const uint8_t* data, uint32_t data_size,
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static uint8_t* Decode(WEBP_CSP_MODE mode, const uint8_t* data,
|
||||
uint32_t data_size, int* width, int* height,
|
||||
size_t data_size, int* width, int* height,
|
||||
WebPDecBuffer* keep_info) {
|
||||
WebPDecParams params;
|
||||
WebPDecBuffer output;
|
||||
@@ -474,32 +474,32 @@ static uint8_t* Decode(WEBP_CSP_MODE mode, const uint8_t* data,
|
||||
return (mode >= MODE_YUV) ? output.u.YUVA.y : output.u.RGBA.rgba;
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeRGB(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* WebPDecodeRGB(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
return Decode(MODE_RGB, data, data_size, width, height, NULL);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeRGBA(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* WebPDecodeRGBA(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
return Decode(MODE_RGBA, data, data_size, width, height, NULL);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeARGB(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* WebPDecodeARGB(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
return Decode(MODE_ARGB, data, data_size, width, height, NULL);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeBGR(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
return Decode(MODE_BGR, data, data_size, width, height, NULL);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeBGRA(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* WebPDecodeBGRA(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
return Decode(MODE_BGRA, data, data_size, width, height, NULL);
|
||||
}
|
||||
|
||||
uint8_t* WebPDecodeYUV(const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height, uint8_t** u, uint8_t** v,
|
||||
int* stride, int* uv_stride) {
|
||||
WebPDecBuffer output; // only to preserve the side-infos
|
||||
@@ -523,7 +523,7 @@ static void DefaultFeatures(WebPBitstreamFeatures* const features) {
|
||||
features->bitstream_version = 0;
|
||||
}
|
||||
|
||||
static VP8StatusCode GetFeatures(const uint8_t* data, uint32_t data_size,
|
||||
static VP8StatusCode GetFeatures(const uint8_t* data, size_t data_size,
|
||||
WebPBitstreamFeatures* const features) {
|
||||
size_t chunk_size = 0;
|
||||
size_t riff_size = 0;
|
||||
@@ -584,7 +584,7 @@ static VP8StatusCode GetFeatures(const uint8_t* data, uint32_t data_size,
|
||||
//------------------------------------------------------------------------------
|
||||
// WebPGetInfo()
|
||||
|
||||
int WebPGetInfo(const uint8_t* data, uint32_t data_size,
|
||||
int WebPGetInfo(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height) {
|
||||
WebPBitstreamFeatures features;
|
||||
|
||||
@@ -619,7 +619,7 @@ int WebPInitDecoderConfigInternal(WebPDecoderConfig* const config,
|
||||
return 1;
|
||||
}
|
||||
|
||||
VP8StatusCode WebPGetFeaturesInternal(const uint8_t* data, uint32_t data_size,
|
||||
VP8StatusCode WebPGetFeaturesInternal(const uint8_t* data, size_t data_size,
|
||||
WebPBitstreamFeatures* const features,
|
||||
int version) {
|
||||
VP8StatusCode status;
|
||||
@@ -637,7 +637,7 @@ VP8StatusCode WebPGetFeaturesInternal(const uint8_t* data, uint32_t data_size,
|
||||
return status;
|
||||
}
|
||||
|
||||
VP8StatusCode WebPDecode(const uint8_t* data, uint32_t data_size,
|
||||
VP8StatusCode WebPDecode(const uint8_t* data, size_t data_size,
|
||||
WebPDecoderConfig* const config) {
|
||||
WebPDecParams params;
|
||||
VP8StatusCode status;
|
||||
|
@@ -60,7 +60,7 @@ typedef struct {
|
||||
size_t data_size; // input buffer size
|
||||
size_t offset; // offset to main data chunk (VP8 or VP8L)
|
||||
const uint8_t* alpha_data; // points to alpha chunk (if present)
|
||||
uint32_t alpha_data_size; // alpha chunk size
|
||||
size_t alpha_data_size; // alpha chunk size
|
||||
size_t compressed_size; // VP8/VP8L compressed data size
|
||||
size_t riff_size; // size of the riff payload (or 0 if absent)
|
||||
int is_lossless; // true if a VP8L chunk is present
|
||||
|
@@ -28,29 +28,29 @@ WEBP_EXTERN(int) WebPGetDecoderVersion(void);
|
||||
// This function will also validate the header and return 0 in
|
||||
// case of formatting error.
|
||||
// Pointers *width/*height can be passed NULL if deemed irrelevant.
|
||||
WEBP_EXTERN(int) WebPGetInfo(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(int) WebPGetInfo(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Decodes WEBP images pointed to by *data and returns RGB samples, along
|
||||
// with the dimensions in *width and *height.
|
||||
// The returned pointer should be deleted calling free().
|
||||
// Returns NULL in case of error.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGB(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGB(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Same as WebPDecodeRGB, but returning RGBA data.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBA(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBA(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Same as WebPDecodeRGBA, but returning ARGB data.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeARGB(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeARGB(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// This variant decode to BGR instead of RGB.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height);
|
||||
// This variant decodes to BGRA instead of RGBA.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRA(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRA(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height);
|
||||
|
||||
// Decode WEBP images stored in *data in Y'UV format(*). The pointer returned is
|
||||
@@ -62,7 +62,7 @@ WEBP_EXTERN(uint8_t*) WebPDecodeBGRA(const uint8_t* data, uint32_t data_size,
|
||||
// have a common stride returned as '*uv_stride'.
|
||||
// Return NULL in case of error.
|
||||
// (*) Also named Y'CbCr. See: http://en.wikipedia.org/wiki/YCbCr
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, size_t data_size,
|
||||
int* width, int* height,
|
||||
uint8_t** u, uint8_t** v,
|
||||
int* stride, int* uv_stride);
|
||||
@@ -76,21 +76,21 @@ WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, uint32_t data_size,
|
||||
// between scanlines. Hence, output_buffer_size is expected to be at least
|
||||
// output_stride x picture-height.
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
const uint8_t* data, size_t data_size,
|
||||
uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeRGBAInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
const uint8_t* data, size_t data_size,
|
||||
uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeARGBInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
const uint8_t* data, size_t data_size,
|
||||
uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
// BGR variants
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
const uint8_t* data, size_t data_size,
|
||||
uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeBGRAInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
const uint8_t* data, size_t data_size,
|
||||
uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
|
||||
// WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly
|
||||
// into pre-allocated luma/chroma plane buffers. This function requires the
|
||||
@@ -100,10 +100,10 @@ WEBP_EXTERN(uint8_t*) WebPDecodeBGRAInto(
|
||||
// Pointer to the luma plane ('*luma') is returned or NULL if an error occurred
|
||||
// during decoding (or because some buffers were found to be too small).
|
||||
WEBP_EXTERN(uint8_t*) WebPDecodeYUVInto(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
uint8_t* luma, int luma_size, int luma_stride,
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_stride);
|
||||
const uint8_t* data, size_t data_size,
|
||||
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);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Output colorspaces and buffer
|
||||
@@ -122,7 +122,7 @@ typedef enum { MODE_RGB = 0, MODE_RGBA = 1,
|
||||
typedef struct { // view as RGBA
|
||||
uint8_t* rgba; // pointer to RGBA samples
|
||||
int stride; // stride in bytes from one scanline to the next.
|
||||
int size; // total size of the *rgba buffer.
|
||||
size_t size; // total size of the *rgba buffer.
|
||||
} WebPRGBABuffer;
|
||||
|
||||
typedef struct { // view as YUVA
|
||||
@@ -130,9 +130,9 @@ typedef struct { // view as YUVA
|
||||
int y_stride; // luma stride
|
||||
int u_stride, v_stride; // chroma strides
|
||||
int a_stride; // alpha stride
|
||||
int y_size; // luma plane size
|
||||
int u_size, v_size; // chroma planes size
|
||||
int a_size; // alpha-plane size
|
||||
size_t y_size; // luma plane size
|
||||
size_t u_size, v_size; // chroma planes size
|
||||
size_t a_size; // alpha-plane size
|
||||
} WebPYUVABuffer;
|
||||
|
||||
// Output buffer
|
||||
@@ -220,7 +220,7 @@ WEBP_EXTERN(WebPIDecoder*) WebPINew(WEBP_CSP_MODE mode);
|
||||
// is specified by 'output_stride'. Returns NULL if the allocation failed.
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPINewRGB(
|
||||
WEBP_CSP_MODE mode,
|
||||
uint8_t* output_buffer, int output_buffer_size, int output_stride);
|
||||
uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
|
||||
|
||||
// This function allocates and initializes an incremental-decoder object, which
|
||||
// will output the raw luma/chroma samples into a preallocated planes. The luma
|
||||
@@ -230,9 +230,9 @@ WEBP_EXTERN(WebPIDecoder*) WebPINewRGB(
|
||||
// and 'v_size'.
|
||||
// Returns NULL if the allocation failed.
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPINewYUV(
|
||||
uint8_t* luma, int luma_size, int luma_stride,
|
||||
uint8_t* u, int u_size, int u_stride,
|
||||
uint8_t* v, int v_size, int v_stride);
|
||||
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);
|
||||
|
||||
// Deletes the WebPIDecoder object and associated memory. Must always be called
|
||||
// if WebPINew, WebPINewRGB or WebPINewYUV succeeded.
|
||||
@@ -242,7 +242,7 @@ WEBP_EXTERN(void) WebPIDelete(WebPIDecoder* const idec);
|
||||
// the image is successfully decoded. Returns VP8_STATUS_SUSPENDED when more
|
||||
// data is expected. Returns error in other cases.
|
||||
WEBP_EXTERN(VP8StatusCode) WebPIAppend(
|
||||
WebPIDecoder* const idec, const uint8_t* const data, uint32_t data_size);
|
||||
WebPIDecoder* const idec, const uint8_t* const data, size_t data_size);
|
||||
|
||||
// A variant of the above function to be used when data buffer contains
|
||||
// partial data from the beginning. In this case data buffer is not copied
|
||||
@@ -250,7 +250,7 @@ WEBP_EXTERN(VP8StatusCode) WebPIAppend(
|
||||
// Note that the value of the 'data' pointer can change between calls to
|
||||
// WebPIUpdate, for instance when the data buffer is resized to fit larger data.
|
||||
WEBP_EXTERN(VP8StatusCode) WebPIUpdate(
|
||||
WebPIDecoder* const idec, const uint8_t* const data, uint32_t data_size);
|
||||
WebPIDecoder* const idec, const uint8_t* const data, size_t data_size);
|
||||
|
||||
// Returns the r/g/b/(a) image decoded so far. Returns NULL if output params
|
||||
// are not initialized yet. The r/g/b/(a) output type corresponds to the mode
|
||||
@@ -326,14 +326,14 @@ typedef struct {
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal(
|
||||
const uint8_t*, uint32_t, WebPBitstreamFeatures* const, int);
|
||||
const uint8_t*, size_t, WebPBitstreamFeatures* const, int);
|
||||
|
||||
// Retrieve features from the bitstream. The *features structure is filled
|
||||
// with information gathered from the bitstream.
|
||||
// Returns false in case of error or version mismatch.
|
||||
// In case of error, features->bitstream_status will reflect the error code.
|
||||
static WEBP_INLINE VP8StatusCode WebPGetFeatures(
|
||||
const uint8_t* data, uint32_t data_size,
|
||||
const uint8_t* data, size_t data_size,
|
||||
WebPBitstreamFeatures* const features) {
|
||||
return WebPGetFeaturesInternal(data, data_size, features,
|
||||
WEBP_DECODER_ABI_VERSION);
|
||||
@@ -380,13 +380,13 @@ static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* const config) {
|
||||
// The return WebPIDecoder object must always be deleted calling WebPIDelete().
|
||||
// Returns NULL in case of error (and config->status will then reflect
|
||||
// the error condition).
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, size_t data_size,
|
||||
WebPDecoderConfig* const config);
|
||||
|
||||
// Non-incremental version. This version decodes the full data at once, taking
|
||||
// 'config' into account. Return decoding status (VP8_STATUS_OK if decoding
|
||||
// was successful).
|
||||
WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, uint32_t data_size,
|
||||
WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, size_t data_size,
|
||||
WebPDecoderConfig* const config);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
Reference in New Issue
Block a user