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.