mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
WebPDecodeYUV: check u/v/stride/uv_stride ptrs
The buffers are made mandatory to match WebPDecodeYUVInto(), though this conflicts with WebPIDecGetYUVA(). spotted by Oliver Kunz (okunz at google dot com) Change-Id: Ic4740c53b75da6b93d4f3462303fb9be0ebfbd48
This commit is contained in:
parent
8e965ccb0f
commit
59a2b1f9e3
@ -658,6 +658,12 @@ uint8_t* WebPDecodeBGRA(const uint8_t* data, size_t data_size,
|
|||||||
uint8_t* WebPDecodeYUV(const uint8_t* data, size_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* width, int* height, uint8_t** u, uint8_t** v,
|
||||||
int* stride, int* uv_stride) {
|
int* stride, int* uv_stride) {
|
||||||
|
// data, width and height are checked by Decode().
|
||||||
|
if (u == NULL || v == NULL || stride == NULL || uv_stride == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
WebPDecBuffer output; // only to preserve the side-infos
|
WebPDecBuffer output; // only to preserve the side-infos
|
||||||
uint8_t* const out = Decode(MODE_YUV, data, data_size,
|
uint8_t* const out = Decode(MODE_YUV, data, data_size,
|
||||||
width, height, &output);
|
width, height, &output);
|
||||||
@ -672,6 +678,7 @@ uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void DefaultFeatures(WebPBitstreamFeatures* const features) {
|
static void DefaultFeatures(WebPBitstreamFeatures* const features) {
|
||||||
assert(features != NULL);
|
assert(features != NULL);
|
||||||
|
@ -84,7 +84,8 @@ WEBP_EXTERN uint8_t* WebPDecodeBGR(const uint8_t* data, size_t data_size,
|
|||||||
// planes are both (*width + 1) / 2 and (*height + 1) / 2.
|
// planes are both (*width + 1) / 2 and (*height + 1) / 2.
|
||||||
// Upon return, the Y buffer has a stride returned as '*stride', while U and V
|
// Upon return, the Y buffer has a stride returned as '*stride', while U and V
|
||||||
// have a common stride returned as '*uv_stride'.
|
// have a common stride returned as '*uv_stride'.
|
||||||
// Return NULL in case of error.
|
// 'width' and 'height' may be NULL, the other pointers must not be.
|
||||||
|
// Returns NULL in case of error.
|
||||||
// (*) Also named Y'CbCr. See: https://en.wikipedia.org/wiki/YCbCr
|
// (*) Also named Y'CbCr. See: https://en.wikipedia.org/wiki/YCbCr
|
||||||
WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
|
WEBP_EXTERN uint8_t* WebPDecodeYUV(const uint8_t* data, size_t data_size,
|
||||||
int* width, int* height,
|
int* width, int* height,
|
||||||
|
Loading…
Reference in New Issue
Block a user