Re-enable encoding of alpha plane with color cache for next release.
This is a revert of: https://chromium-review.googlesource.com/#/c/73607/
Change-Id: I7ec45277d73608d77d5e873290c6c185caa30c32
diff --git a/src/enc/alpha.c b/src/enc/alpha.c
index 645a295..fa48837 100644
--- a/src/enc/alpha.c
+++ b/src/enc/alpha.c
@@ -74,11 +74,7 @@
config.quality = 8.f * effort_level;
assert(config.quality >= 0 && config.quality <= 100.f);
- // TODO(urvang): Temporary fix to avoid generating images that trigger
- // a decoder bug related to alpha with color cache.
- // See: https://code.google.com/p/webp/issues/detail?id=239
- // Need to re-enable this later.
- ok = (VP8LEncodeStream(&config, &picture, bw, 0 /*use_cache*/) == VP8_ENC_OK);
+ ok = (VP8LEncodeStream(&config, &picture, bw) == VP8_ENC_OK);
WebPPictureFree(&picture);
ok = ok && !bw->error_;
if (!ok) {
diff --git a/src/enc/vp8l.c b/src/enc/vp8l.c
index bff7c5a..895fbeb 100644
--- a/src/enc/vp8l.c
+++ b/src/enc/vp8l.c
@@ -823,8 +823,7 @@
VP8LHashChain* const hash_chain,
VP8LBackwardRefs refs_array[2],
int width, int height, int quality,
- int low_effort,
- int use_cache, int* cache_bits,
+ int low_effort, int* cache_bits,
int histogram_bits,
size_t init_byte_position,
int* const hdr_size,
@@ -856,7 +855,7 @@
goto Error;
}
- *cache_bits = use_cache ? MAX_COLOR_CACHE_BITS : 0;
+ *cache_bits = MAX_COLOR_CACHE_BITS;
// 'best_refs' is the reference to the best backward refs and points to one
// of refs_array[0] or refs_array[1].
// Calculate backward references from ARGB image.
@@ -1375,7 +1374,7 @@
WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
const WebPPicture* const picture,
- VP8LBitWriter* const bw, int use_cache) {
+ VP8LBitWriter* const bw) {
WebPEncodingError err = VP8_ENC_OK;
const int quality = (int)config->quality;
const int low_effort = (config->method == 0);
@@ -1471,8 +1470,8 @@
// Encode and write the transformed image.
err = EncodeImageInternal(bw, enc->argb_, &enc->hash_chain_, enc->refs_,
enc->current_width_, height, quality, low_effort,
- use_cache, &enc->cache_bits_, enc->histo_bits_,
- byte_position, &hdr_size, &data_size);
+ &enc->cache_bits_, enc->histo_bits_, byte_position,
+ &hdr_size, &data_size);
if (err != VP8_ENC_OK) goto Error;
if (picture->stats != NULL) {
@@ -1557,7 +1556,7 @@
if (!WebPReportProgress(picture, 5, &percent)) goto UserAbort;
// Encode main image stream.
- err = VP8LEncodeStream(config, picture, &bw, 1 /*use_cache*/);
+ err = VP8LEncodeStream(config, picture, &bw);
if (err != VP8_ENC_OK) goto Error;
// TODO(skal): have a fine-grained progress report in VP8LEncodeStream().
diff --git a/src/enc/vp8li.h b/src/enc/vp8li.h
index 995a794..6b6db12 100644
--- a/src/enc/vp8li.h
+++ b/src/enc/vp8li.h
@@ -64,10 +64,9 @@
const WebPPicture* const picture);
// Encodes the main image stream using the supplied bit writer.
-// If 'use_cache' is false, disables the use of color cache.
WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
const WebPPicture* const picture,
- VP8LBitWriter* const bw, int use_cache);
+ VP8LBitWriter* const bw);
//------------------------------------------------------------------------------