From c2d04f3eb2270545cf8ac989c1f9a799b52a8e6f Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Tue, 12 Dec 2017 15:00:45 +0100 Subject: [PATCH] enable DC error-diffusion always for multi-pass We can't predict if the quality is going to be below the threshold eventually, so we might as well enable it always. Change-Id: I30aedecc8c6d4daf159f6ef152697df0206d1e93 --- src/enc/webp_enc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/enc/webp_enc.c b/src/enc/webp_enc.c index 3fc895f9..9f4b10c2 100644 --- a/src/enc/webp_enc.c +++ b/src/enc/webp_enc.c @@ -159,8 +159,9 @@ static VP8Encoder* InitVP8Encoder(const WebPConfig* const config, + WEBP_ALIGN_CST; // align all const size_t lf_stats_size = config->autofilter ? sizeof(*enc->lf_stats_) + WEBP_ALIGN_CST : 0; - const size_t top_derr_size = (config->quality <= ERROR_DIFFUSION_QUALITY) ? - mb_w * sizeof(*enc->top_derr_) : 0; + const size_t top_derr_size = + (config->quality <= ERROR_DIFFUSION_QUALITY || config->pass > 1) ? + mb_w * sizeof(*enc->top_derr_) : 0; uint8_t* mem; const uint64_t size = (uint64_t)sizeof(*enc) // main struct + WEBP_ALIGN_CST // cache alignment