mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-17 14:26:48 +02:00
Lower the quality settings for Alpha encoding.
Evaluated the impact of this change over 1000 image corpus. The compression density is up (on average) by 1.2% and encoding time has gone down considerably from 716 ms (per file) to 146 ms (per file) (4.9X improvement in encoding time). Change-Id: Ida562cc0bfe18c9d6f5f00873c95f8396b480eab
This commit is contained in:
parent
fcc69923b9
commit
f864be3b2c
@ -82,9 +82,10 @@ static int EncodeLossless(const uint8_t* data, int width, int height,
|
|||||||
WebPConfigInit(&config);
|
WebPConfigInit(&config);
|
||||||
config.lossless = 1;
|
config.lossless = 1;
|
||||||
config.method = effort_level; // impact is very small
|
config.method = effort_level; // impact is very small
|
||||||
// quality below 50 doesn't change things much (in speed and size).
|
// Set moderate default quality setting for alpha. Higher qualities (80 and
|
||||||
// quality above 80 can be very very slow.
|
// above) could be very slow.
|
||||||
config.quality = 40 + 10.f * effort_level;
|
config.quality = 10 + 15.f * effort_level;
|
||||||
|
if (config.quality > 100.f) config.quality = 100.f;
|
||||||
|
|
||||||
VP8LBitWriterInit(&tmp_bw, (width * height) >> 3);
|
VP8LBitWriterInit(&tmp_bw, (width * height) >> 3);
|
||||||
ok = (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK);
|
ok = (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user