| Index: third_party/libwebp/dec/vp8l_dec.c
|
| diff --git a/third_party/libwebp/dec/vp8l.c b/third_party/libwebp/dec/vp8l_dec.c
|
| similarity index 98%
|
| rename from third_party/libwebp/dec/vp8l.c
|
| rename to third_party/libwebp/dec/vp8l_dec.c
|
| index cb2e3176b6346051f5250ea5fe5a265fc3731978..ef359a91f0a13d16b1ae11e8e60056fc8d12e61c 100644
|
| --- a/third_party/libwebp/dec/vp8l.c
|
| +++ b/third_party/libwebp/dec/vp8l_dec.c
|
| @@ -14,13 +14,14 @@
|
|
|
| #include <stdlib.h>
|
|
|
| -#include "./alphai.h"
|
| -#include "./vp8li.h"
|
| +#include "./alphai_dec.h"
|
| +#include "./vp8li_dec.h"
|
| #include "../dsp/dsp.h"
|
| #include "../dsp/lossless.h"
|
| +#include "../dsp/lossless_common.h"
|
| #include "../dsp/yuv.h"
|
| -#include "../utils/endian_inl.h"
|
| -#include "../utils/huffman.h"
|
| +#include "../utils/endian_inl_utils.h"
|
| +#include "../utils/huffman_utils.h"
|
| #include "../utils/utils.h"
|
|
|
| #define NUM_ARGB_CACHE_ROWS 16
|
| @@ -547,11 +548,14 @@ static int EmitRescaledRowsRGBA(const VP8LDecoder* const dec,
|
| uint8_t* const row_out = out + num_lines_out * out_stride;
|
| const int lines_left = mb_h - num_lines_in;
|
| const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left);
|
| + int lines_imported;
|
| assert(needed_lines > 0 && needed_lines <= lines_left);
|
| WebPMultARGBRows(row_in, in_stride,
|
| dec->rescaler->src_width, needed_lines, 0);
|
| - WebPRescalerImport(dec->rescaler, lines_left, row_in, in_stride);
|
| - num_lines_in += needed_lines;
|
| + lines_imported =
|
| + WebPRescalerImport(dec->rescaler, lines_left, row_in, in_stride);
|
| + assert(lines_imported == needed_lines);
|
| + num_lines_in += lines_imported;
|
| num_lines_out += Export(dec->rescaler, colorspace, out_stride, row_out);
|
| }
|
| return num_lines_out;
|
| @@ -623,9 +627,12 @@ static int EmitRescaledRowsYUVA(const VP8LDecoder* const dec,
|
| while (num_lines_in < mb_h) {
|
| const int lines_left = mb_h - num_lines_in;
|
| const int needed_lines = WebPRescaleNeededLines(dec->rescaler, lines_left);
|
| + int lines_imported;
|
| WebPMultARGBRows(in, in_stride, dec->rescaler->src_width, needed_lines, 0);
|
| - WebPRescalerImport(dec->rescaler, lines_left, in, in_stride);
|
| - num_lines_in += needed_lines;
|
| + lines_imported =
|
| + WebPRescalerImport(dec->rescaler, lines_left, in, in_stride);
|
| + assert(lines_imported == needed_lines);
|
| + num_lines_in += lines_imported;
|
| in += needed_lines * in_stride;
|
| y_pos += ExportYUVA(dec, y_pos);
|
| }
|
| @@ -705,13 +712,15 @@ static void ApplyInverseTransforms(VP8LDecoder* const dec, int num_rows,
|
| uint32_t* const rows_out = dec->argb_cache_;
|
|
|
| // Inverse transforms.
|
| - // TODO: most transforms only need to operate on the cropped region only.
|
| - memcpy(rows_out, rows_in, cache_pixs * sizeof(*rows_out));
|
| while (n-- > 0) {
|
| VP8LTransform* const transform = &dec->transforms_[n];
|
| VP8LInverseTransform(transform, start_row, end_row, rows_in, rows_out);
|
| rows_in = rows_out;
|
| }
|
| + if (rows_in != rows_out) {
|
| + // No transform called, hence just copy.
|
| + memcpy(rows_out, rows_in, cache_pixs * sizeof(*rows_out));
|
| + }
|
| }
|
|
|
| // Processes (transforms, scales & color-converts) the rows decoded after the
|
| @@ -1210,8 +1219,9 @@ static int ExpandColorMap(int num_colors, VP8LTransform* const transform) {
|
| // Equivalent to AddPixelEq(), on a byte-basis.
|
| new_data[i] = (data[i] + new_data[i - 4]) & 0xff;
|
| }
|
| - for (; i < 4 * final_num_colors; ++i)
|
| + for (; i < 4 * final_num_colors; ++i) {
|
| new_data[i] = 0; // black tail.
|
| + }
|
| WebPSafeFree(transform->data_);
|
| transform->data_ = new_color_map;
|
| }
|
| @@ -1482,9 +1492,8 @@ 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_;
|
| - int i;
|
| ApplyInverseTransforms(dec, num_rows_to_process, in);
|
| - for (i = 0; i < cache_pixs; ++i) dst[i] = (src[i] >> 8) & 0xff;
|
| + WebPExtractGreen(src, dst, cache_pixs);
|
| AlphaApplyFilter(alph_dec,
|
| cur_row, cur_row + num_rows_to_process, dst, width);
|
| num_rows -= num_rows_to_process;
|
| @@ -1552,6 +1561,8 @@ int VP8LDecodeAlphaImageStream(ALPHDecoder* const alph_dec, int last_row) {
|
| return 1; // done
|
| }
|
|
|
| + if (!alph_dec->use_8b_decode_) WebPInitAlphaProcessing();
|
| +
|
| // Decode (with special row processing).
|
| return alph_dec->use_8b_decode_ ?
|
| DecodeAlphaData(dec, (uint8_t*)dec->pixels_, dec->width_, dec->height_,
|
|
|