mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 05:08:21 +01:00
lossless: fix crunch mode w/WEBP_REDUCE_SIZE
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 inec178f2c
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 commit84163d9d02
)
This commit is contained in:
parent
bfad7ab589
commit
e626925cef
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user