From a5e4e3aff17a08597fd5cff9a315222cb0a43eae Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 28 Feb 2017 11:43:13 +0100 Subject: [PATCH] Use palette only if we can in entropy analysis. Change-Id: I2be74b4d5fe48e059d5ced619d76fd030db79f74 --- src/enc/vp8l_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/enc/vp8l_enc.c b/src/enc/vp8l_enc.c index bd4a2e1b..ae9fe5ff 100644 --- a/src/enc/vp8l_enc.c +++ b/src/enc/vp8l_enc.c @@ -292,7 +292,7 @@ static int AnalyzeEntropy(const uint32_t* argb, // lower cost than sizeof(uint32_t)*8. entropy[kPalette] += palette_size * 8; - if (entropy[kDirect] == 0) { + if (use_palette && entropy[kDirect] == 0) { // If the entropy is null, there should only be one color, // and that case is handled at the very beginning of that function. // Unfortunately, we can also have a null entropy because we skip the @@ -308,6 +308,7 @@ static int AnalyzeEntropy(const uint32_t* argb, } } } + assert((int)*min_entropy_ix <= last_mode_to_analyze); *red_and_blue_always_zero = 1; // Let's check if the histogram of the chosen entropy mode has // non-zero red and blue values. If all are zero, we can later skip