aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-09-07 23:19:33 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-09-07 23:19:33 +0000
commit9477a839f422f4e2ff4eb576aaef8c430b374c94 (patch)
tree51312d1ff3f502ade3bd7c049e4329cc3ad54654
parentab2ce30660f74e0fe762143cfb31350c84dd1e2e (diff)
parent9d9f69447bd6f3e311c695ac22ed07393208f934 (diff)
downloadwebp-9477a839f422f4e2ff4eb576aaef8c430b374c94.tar.gz
Snap for 5860386 from 9d9f69447bd6f3e311c695ac22ed07393208f934 to rvc-release
Change-Id: I33d011081dbbc653a015015f68eb5e51ad4a6208
-rw-r--r--README.android1
-rw-r--r--src/dec/vp8l_dec.c10
2 files changed, 6 insertions, 5 deletions
diff --git a/README.android b/README.android
index 0aaa2210..9c49f0f4 100644
--- a/README.android
+++ b/README.android
@@ -8,6 +8,7 @@ Local modifications:
(e.g. bits.h) to leak into
- Removed build files necessary for building via autoconf/automake tools
These files are not required to build via Android.bp
+- cherry-pick 0e48d889 bugfix: last alpha rows were incorrectly decoded
The Android.bp file creates WebP decoder and encoder static libraries which
can be added to any application by adding libwebp-decode and libwebp-encode to
diff --git a/src/dec/vp8l_dec.c b/src/dec/vp8l_dec.c
index d3e27119..93615d4e 100644
--- a/src/dec/vp8l_dec.c
+++ b/src/dec/vp8l_dec.c
@@ -754,11 +754,11 @@ static WEBP_INLINE HTreeGroup* GetHtreeGroupForPos(VP8LMetadata* const hdr,
typedef void (*ProcessRowsFunc)(VP8LDecoder* const dec, int row);
-static void ApplyInverseTransforms(VP8LDecoder* const dec, int num_rows,
+static void ApplyInverseTransforms(VP8LDecoder* const dec,
+ int start_row, int num_rows,
const uint32_t* const rows) {
int n = dec->next_transform_;
const int cache_pixs = dec->width_ * num_rows;
- const int start_row = dec->last_row_;
const int end_row = start_row + num_rows;
const uint32_t* rows_in = rows;
uint32_t* const rows_out = dec->argb_cache_;
@@ -789,8 +789,7 @@ static void ProcessRows(VP8LDecoder* const dec, int row) {
VP8Io* const io = dec->io_;
uint8_t* rows_data = (uint8_t*)dec->argb_cache_;
const int in_stride = io->width * sizeof(uint32_t); // in unit of RGBA
-
- ApplyInverseTransforms(dec, num_rows, rows);
+ ApplyInverseTransforms(dec, dec->last_row_, num_rows, rows);
if (!SetCropWindow(io, dec->last_row_, row, &rows_data, in_stride)) {
// Nothing to output (this time).
} else {
@@ -1193,6 +1192,7 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data,
VP8LFillBitWindow(br);
dist_code = GetCopyDistance(dist_symbol, br);
dist = PlaneCodeToDistance(width, dist_code);
+
if (VP8LIsEndOfStream(br)) break;
if (src - data < (ptrdiff_t)dist || src_end - src < (ptrdiff_t)length) {
goto Error;
@@ -1553,7 +1553,7 @@ static void ExtractAlphaRows(VP8LDecoder* const dec, int last_row) {
const int cache_pixs = width * num_rows_to_process;
uint8_t* const dst = output + width * cur_row;
const uint32_t* const src = dec->argb_cache_;
- ApplyInverseTransforms(dec, num_rows_to_process, in);
+ ApplyInverseTransforms(dec, cur_row, num_rows_to_process, in);
WebPExtractGreen(src, dst, cache_pixs);
AlphaApplyFilter(alph_dec,
cur_row, cur_row + num_rows_to_process, dst, width);