summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2022-07-20 19:27:26 -0700
committerJames Zern <jzern@google.com>2022-08-03 23:57:12 +0000
commite626925cefacec8d943b9bdea6f3859b883d8c5e (patch)
tree92dae16600d69172f69241aca510f2fc82d67589
parentbfad7ab589a997a69ba568a7c5d9696474f917fc (diff)
downloadlibwebp-1.2.3.tar.gz
lossless: fix crunch mode w/WEBP_REDUCE_SIZE1.2.3
WEBP_REDUCE_SIZE was introduced to bring down the library size by removing cropping and scaling support. Previously WebPPictureView() was only used with these two, but in ec178f2c Add progress hook granularity in lossless an additional use was added in VP8LEncodeStream() when extra side configurations are used in crunch mode (-mt, quality == 100 & method == 6 or quality >= 75 & method == 5 with a palette present currently). WebPPictureView() and, for coherency, WebPPictureIsView() are restored in this configuration to avoid affecting the general encode path. Previously WebPPictureView() was assumed to always succeed in these cases which could result in crashes with WEBP_REDUCE_SIZE defined. Bug: chromium:1345547 Bug: chromium:1345595 Bug: chromium:1345772 Bug: chromium:1345804 Change-Id: Ifecde36a726a434510478a764514b1469942c684 (cherry picked from commit 84163d9d027e4acc51120f3136d251f8e8ee0acd)
-rw-r--r--src/enc/picture_rescale_enc.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/enc/picture_rescale_enc.c b/src/enc/picture_rescale_enc.c
index 21634f3d..839f91ca 100644
--- a/src/enc/picture_rescale_enc.c
+++ b/src/enc/picture_rescale_enc.c
@@ -13,14 +13,15 @@
#include "src/webp/encode.h"
-#if !defined(WEBP_REDUCE_SIZE)
-
#include <assert.h>
#include <stdlib.h>
#include "src/enc/vp8i_enc.h"
+
+#if !defined(WEBP_REDUCE_SIZE)
#include "src/utils/rescaler_utils.h"
#include "src/utils/utils.h"
+#endif // !defined(WEBP_REDUCE_SIZE)
#define HALVE(x) (((x) + 1) >> 1)
@@ -56,6 +57,7 @@ static int AdjustAndCheckRectangle(const WebPPicture* const pic,
return 1;
}
+#if !defined(WEBP_REDUCE_SIZE)
int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst) {
if (src == NULL || dst == NULL) return 0;
if (src == dst) return 1;
@@ -81,6 +83,7 @@ int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst) {
}
return 1;
}
+#endif // !defined(WEBP_REDUCE_SIZE)
int WebPPictureIsView(const WebPPicture* picture) {
if (picture == NULL) return 0;
@@ -120,6 +123,7 @@ int WebPPictureView(const WebPPicture* src,
return 1;
}
+#if !defined(WEBP_REDUCE_SIZE)
//------------------------------------------------------------------------------
// Picture cropping
@@ -277,23 +281,6 @@ int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst) {
return 0;
}
-int WebPPictureIsView(const WebPPicture* picture) {
- (void)picture;
- return 0;
-}
-
-int WebPPictureView(const WebPPicture* src,
- int left, int top, int width, int height,
- WebPPicture* dst) {
- (void)src;
- (void)left;
- (void)top;
- (void)width;
- (void)height;
- (void)dst;
- return 0;
-}
-
int WebPPictureCrop(WebPPicture* pic,
int left, int top, int width, int height) {
(void)pic;