summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2014-10-13 16:52:01 +0200
committerJames Zern <jzern@google.com>2014-10-14 12:02:17 +0200
commit9129deb5b1d47d6708ddef267f0fddb447209ed6 (patch)
tree477b310d906d4cf74d404ef711152fd5689de6b1
parentf17b95e99228829d78e6c296929969fdb71f5a13 (diff)
downloadlibwebp-9129deb5b1d47d6708ddef267f0fddb447209ed6.tar.gz
restore encode API compatibility
protect WebPPictureSmartARGBToYUVA with an ABI check Change-Id: Iaec4a9f8f590f27c4c72129b90068690efc84eb7
-rw-r--r--src/enc/config.c4
-rw-r--r--src/enc/picture_csp.c2
-rw-r--r--src/enc/webpenc.c2
-rw-r--r--src/webp/encode.h2
4 files changed, 10 insertions, 0 deletions
diff --git a/src/enc/config.c b/src/enc/config.c
index f346b0e6..53a3bb2e 100644
--- a/src/enc/config.c
+++ b/src/enc/config.c
@@ -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;
diff --git a/src/enc/picture_csp.c b/src/enc/picture_csp.c
index e18f1096..7875f625 100644
--- a/src/enc/picture_csp.c
+++ b/src/enc/picture_csp.c
@@ -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
diff --git a/src/enc/webpenc.c b/src/enc/webpenc.c
index 090f14c5..0cb83f12 100644
--- a/src/enc/webpenc.c
+++ b/src/enc/webpenc.c
@@ -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) {
diff --git a/src/webp/encode.h b/src/webp/encode.h
index 59ce0d2b..3c263748 100644
--- a/src/webp/encode.h
+++ b/src/webp/encode.h
@@ -462,12 +462,14 @@ WEBP_EXTERN(int) WebPPictureARGBToYUVA(WebPPicture* picture,
WEBP_EXTERN(int) WebPPictureARGBToYUVADithered(
WebPPicture* picture, WebPEncCSP colorspace, float dithering);
+#if WEBP_ENCODER_ABI_VERSION > 0x0204
// Performs 'smart' RGBA->YUVA420 downsampling and colorspace conversion.
// Downsampling is handled with extra care in case of color clipping. This
// method is roughly 2x slower than WebPPictureARGBToYUVA() but produces better
// YUV representation.
// Returns false in case of error.
WEBP_EXTERN(int) WebPPictureSmartARGBToYUVA(WebPPicture* picture);
+#endif
// Converts picture->yuv to picture->argb and sets picture->use_argb to true.
// The input format must be YUV_420 or YUV_420A.