From ce3c824712c7375b882fd60679e02e6b73c196ad Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Wed, 8 Jun 2016 11:29:48 +0200 Subject: [PATCH] disable near-lossless quantization if palette is used Change-Id: I3335e8f97f99d6d786e953161adbf246e85d80d3 --- src/enc/vp8l.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/enc/vp8l.c b/src/enc/vp8l.c index d3afce6e..2bdbe094 100644 --- a/src/enc/vp8l.c +++ b/src/enc/vp8l.c @@ -1021,10 +1021,13 @@ static WebPEncodingError ApplyPredictFilter(const VP8LEncoder* const enc, const int pred_bits = enc->transform_bits_; const int transform_width = VP8LSubSampleSize(width, pred_bits); const int transform_height = VP8LSubSampleSize(height, pred_bits); + // we disable near-lossless quantization if palette is used. + const int near_lossless_strength = enc->use_palette_ ? 100 + : enc->config_->near_lossless; VP8LResidualImage(width, height, pred_bits, low_effort, enc->argb_, enc->argb_scratch_, enc->transform_data_, - enc->config_->near_lossless, enc->config_->exact, + near_lossless_strength, enc->config_->exact, used_subtract_green); VP8LPutBits(bw, TRANSFORM_PRESENT, 1); VP8LPutBits(bw, PREDICTOR_TRANSFORM, 2);