diff options
author | James Zern <jzern@google.com> | 2019-09-05 14:40:08 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-09-05 14:40:08 -0700 |
commit | 022db77a3834683c405db8df43459cb320d9fb08 (patch) | |
tree | 51312d1ff3f502ade3bd7c049e4329cc3ad54654 | |
parent | 938ab8d865a55c851a0032e0a813ef18ded8ed2b (diff) | |
parent | ed6274e4268e40502abdbbb5043d03650a3d1cf4 (diff) | |
download | webp-022db77a3834683c405db8df43459cb320d9fb08.tar.gz |
Merge "external/webp: cherry-pick alpha decoding fix" am: f3c081dcee
am: ed6274e426
Change-Id: I4b5f4cb0908d3db95518bab156b816f4c1fbd4b1
-rw-r--r-- | README.android | 1 | ||||
-rw-r--r-- | src/dec/vp8l_dec.c | 10 |
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); |