mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-14 21:09:55 +02:00
Lossy encoding: smoothen transparent areas to improve compression
If "exact" is false, we can modify the luma samples in fully transparent areas to facilitate lossy compression. Experiments on some PNG images show compression improvement of more than 20%. Change-Id: I1a728cfa920a6652bc1f600d87c01f7f648c4942
This commit is contained in:
@ -336,10 +336,6 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
|
||||
if (!config->lossless) {
|
||||
VP8Encoder* enc = NULL;
|
||||
|
||||
if (!config->exact) {
|
||||
WebPCleanupTransparentArea(pic);
|
||||
}
|
||||
|
||||
if (pic->use_argb || pic->y == NULL || pic->u == NULL || pic->v == NULL) {
|
||||
// Make sure we have YUVA samples.
|
||||
if (config->use_sharp_yuv || (config->preprocessing & 4)) {
|
||||
@ -361,6 +357,10 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!config->exact) {
|
||||
WebPCleanupTransparentArea(pic);
|
||||
}
|
||||
|
||||
enc = InitVP8Encoder(config, pic);
|
||||
if (enc == NULL) return 0; // pic->error is already set.
|
||||
// Note: each of the tasks below account for 20% in the progress report.
|
||||
|
Reference in New Issue
Block a user