From 9bc0f922aa703793a13631805281ab4e7a766021 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 12 Feb 2015 19:44:25 -0800 Subject: [PATCH] ApplyFiltersAndEncode: only copy lossless stats this avoids a race with multi-threaded lossy + alpha compression Change-Id: Ie437105f5a899ed28b9c8885b6ca5431092ce8f5 --- src/enc/alpha.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/enc/alpha.c b/src/enc/alpha.c index bfa55117..645a2956 100644 --- a/src/enc/alpha.c +++ b/src/enc/alpha.c @@ -271,7 +271,16 @@ static int ApplyFiltersAndEncode(const uint8_t* alpha, int width, int height, reduce_levels, effort_level, NULL, &best); } if (ok) { - if (stats != NULL) *stats = best.stats; + if (stats != NULL) { + stats->lossless_features = best.stats.lossless_features; + stats->histogram_bits = best.stats.histogram_bits; + stats->transform_bits = best.stats.transform_bits; + stats->cache_bits = best.stats.cache_bits; + stats->palette_size = best.stats.palette_size; + stats->lossless_size = best.stats.lossless_size; + stats->lossless_hdr_size = best.stats.lossless_hdr_size; + stats->lossless_data_size = best.stats.lossless_data_size; + } *output_size = VP8BitWriterSize(&best.bw); *output = VP8BitWriterBuf(&best.bw); } else {