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:
hui su
2017-07-05 10:03:01 -07:00
parent e50650c77f
commit 7d67a1646d
3 changed files with 86 additions and 39 deletions

View File

@ -508,8 +508,8 @@ WEBP_EXTERN(int) WebPPictureSmartARGBToYUVA(WebPPicture* picture);
WEBP_EXTERN(int) WebPPictureYUVAToARGB(WebPPicture* picture);
// Helper function: given a width x height plane of RGBA or YUV(A) samples
// clean-up the YUV or RGB samples under fully transparent area, to help
// compressibility (no guarantee, though).
// clean-up or smoothen the YUV or RGB samples under fully transparent area,
// to help compressibility (no guarantee, though).
WEBP_EXTERN(void) WebPCleanupTransparentArea(WebPPicture* picture);
// Scan the picture 'picture' for the presence of non fully opaque alpha values.