restore encode API compatibility

protect WebPPictureSmartARGBToYUVA with an ABI check

Change-Id: Iaec4a9f8f590f27c4c72129b90068690efc84eb7
This commit is contained in:
James Zern
2014-10-13 16:52:01 +02:00
parent f17b95e992
commit 9129deb5b1
4 changed files with 10 additions and 0 deletions

View File

@ -111,7 +111,11 @@ int WebPValidateConfig(const WebPConfig* config) {
return 0;
if (config->show_compressed < 0 || config->show_compressed > 1)
return 0;
#if WEBP_ENCODER_ABI_VERSION > 0x0204
if (config->preprocessing < 0 || config->preprocessing > 7)
#else
if (config->preprocessing < 0 || config->preprocessing > 3)
#endif
return 0;
if (config->partitions < 0 || config->partitions > 3)
return 0;

View File

@ -978,9 +978,11 @@ int WebPPictureARGBToYUVA(WebPPicture* picture, WebPEncCSP colorspace) {
return PictureARGBToYUVA(picture, colorspace, 0.f, 0);
}
#if WEBP_ENCODER_ABI_VERSION > 0x0204
int WebPPictureSmartARGBToYUVA(WebPPicture* picture) {
return PictureARGBToYUVA(picture, WEBP_YUV420, 0.f, 1);
}
#endif
//------------------------------------------------------------------------------
// call for YUVA -> ARGB conversion

View File

@ -329,9 +329,11 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
if (pic->y == NULL || pic->u == NULL || pic->v == NULL) {
// Make sure we have YUVA samples.
if (config->preprocessing & 4) {
#if WEBP_ENCODER_ABI_VERSION > 0x0204
if (!WebPPictureSmartARGBToYUVA(pic)) {
return 0;
}
#endif
} else {
float dithering = 0.f;
if (config->preprocessing & 2) {