diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-09-05 18:13:56 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-09-05 18:13:56 +0000 |
commit | f3c081dcee09466488226c8da73e30aad8dfe6f9 (patch) | |
tree | 51312d1ff3f502ade3bd7c049e4329cc3ad54654 | |
parent | d6164aa02221d31a0a175cb7b2c3968f31336a25 (diff) | |
parent | 184566507cb973cda503bcdd1b61bc5ca86ac3cd (diff) | |
download | webp-f3c081dcee09466488226c8da73e30aad8dfe6f9.tar.gz |
Merge "external/webp: cherry-pick alpha decoding fix"ndk-sysroot-r21
-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); |