From f864be3b2cc9de64380ceffa81827228633d8d16 Mon Sep 17 00:00:00 2001 From: Vikas Arora Date: Fri, 29 Jun 2012 16:18:04 +0530 Subject: [PATCH] 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 --- src/enc/alpha.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/enc/alpha.c b/src/enc/alpha.c index 9841bdf2..4716b926 100644 --- a/src/enc/alpha.c +++ b/src/enc/alpha.c @@ -82,9 +82,10 @@ static int EncodeLossless(const uint8_t* data, int width, int height, WebPConfigInit(&config); config.lossless = 1; config.method = effort_level; // impact is very small - // quality below 50 doesn't change things much (in speed and size). - // quality above 80 can be very very slow. - config.quality = 40 + 10.f * effort_level; + // Set moderate default quality setting for alpha. Higher qualities (80 and + // above) could be very slow. + config.quality = 10 + 15.f * effort_level; + if (config.quality > 100.f) config.quality = 100.f; VP8LBitWriterInit(&tmp_bw, (width * height) >> 3); ok = (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK);