Revert "Do not use a palette for one color images."

This reverts commit b6513fbaa8.

This change can produce files that can cause decode failures in some
versions of chrome and safari/ios/macos.

https://chromium-review.googlesource.com/c/chromium/src/+/2876279

The chrome fix will be available in M92. This change can be revisited
after it and the mac updates are more widely deployed.

Bug: b/186640109,b/188702956
Change-Id: I296b8fe88c6c48219e3edf532226c4f972f1605b
This commit is contained in:
James Zern
2021-05-21 10:23:05 -07:00
parent 6fb4cddc93
commit b60869a18e
3 changed files with 1 additions and 39 deletions

View File

@ -550,25 +550,6 @@ static int BackwardReferencesLz77(int xsize, int ysize,
return ok;
}
static int BackwardReferencesNone(int xsize, int ysize,
const uint32_t* const argb, int cache_bits,
VP8LBackwardRefs* const refs) {
const int pix_count = xsize * ysize;
int i;
const int use_color_cache = (cache_bits > 0);
VP8LColorCache hashers;
if (use_color_cache && !VP8LColorCacheInit(&hashers, cache_bits)) {
return 0;
}
VP8LClearBackwardRefs(refs);
for (i = 0; i < pix_count; ++i) {
AddSingleLiteral(argb[i], use_color_cache, &hashers, refs);
}
if (use_color_cache) VP8LColorCacheClear(&hashers);
return !refs->error_;
}
// Compute an LZ77 by forcing matches to happen within a given distance cost.
// We therefore limit the algorithm to the lowest 32 values in the PlaneCode
// definition.
@ -938,9 +919,6 @@ static int GetBackwardReferences(int width, int height,
res = BackwardReferencesLz77Box(width, height, argb, 0, hash_chain,
&hash_chain_box, refs_tmp);
break;
case kLZ77None:
res = BackwardReferencesNone(width, height, argb, 0, refs_tmp);
break;
default:
assert(0);
}