WebPAnimEncoder: If 'minimize_size' and 'allow_mixed' on, try lossy + lossless.

This improves compression by ~5% at default quality.

If only 'allow_mixed' is on (but 'minimize_size' isn't), we continue to
use a heuristic to try one of the two or both.

Change-Id: Ia573a73ea26ad25f9debff759eed69d2b0449e82
(cherry picked from commit 3f4042b52a)
This commit is contained in:
Urvang Joshi 2016-06-08 19:26:41 +00:00 committed by James Zern
parent df780e0eac
commit f29bf582df

View File

@ -845,6 +845,9 @@ static WebPEncodingError GenerateCandidates(
if (!enc->options_.allow_mixed) { if (!enc->options_.allow_mixed) {
candidate_ll->evaluate_ = is_lossless; candidate_ll->evaluate_ = is_lossless;
candidate_lossy->evaluate_ = !is_lossless; candidate_lossy->evaluate_ = !is_lossless;
} else if (enc->options_.minimize_size) {
candidate_ll->evaluate_ = 1;
candidate_lossy->evaluate_ = 1;
} else { // Use a heuristic for trying lossless and/or lossy compression. } else { // Use a heuristic for trying lossless and/or lossy compression.
const int num_colors = WebPGetColorPalette(&params->sub_frame_ll_, NULL); const int num_colors = WebPGetColorPalette(&params->sub_frame_ll_, NULL);
candidate_ll->evaluate_ = (num_colors < MAX_COLORS_LOSSLESS); candidate_ll->evaluate_ = (num_colors < MAX_COLORS_LOSSLESS);