From 3ec11827688e26563deded9c0c376b4f7ab8a763 Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 17 Aug 2015 18:48:05 -0700 Subject: [PATCH] use the DispatchAlpha() call from dsp it's used in YUVA->RGBA case (quite frequent). Change-Id: Ie88f8c7f74cd274b3c6cbe81506f4425c164c7b3 --- src/dec/io.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/dec/io.c b/src/dec/io.c index 36d03ba7..099aa0b3 100644 --- a/src/dec/io.c +++ b/src/dec/io.c @@ -378,22 +378,17 @@ static int ExportAlpha(WebPDecParams* const p, int y_pos) { uint8_t* dst = base_rgba + (alpha_first ? 0 : 3); int num_lines_out = 0; const int is_premult_alpha = WebPIsPremultipliedMode(colorspace); - uint32_t alpha_mask = 0xff; + uint32_t non_opaque = 0; const int width = p->scaler_a.dst_width; while (WebPRescalerHasPendingOutput(&p->scaler_a)) { - int i; assert(p->last_y + y_pos + num_lines_out < p->output->height); WebPRescalerExportRow(&p->scaler_a, 0); - for (i = 0; i < width; ++i) { - const uint32_t alpha_value = p->scaler_a.dst[i]; - dst[4 * i] = alpha_value; - alpha_mask &= alpha_value; - } + non_opaque |= WebPDispatchAlpha(p->scaler_a.dst, 0, width, 1, dst, 0); dst += buf->stride; ++num_lines_out; } - if (is_premult_alpha && alpha_mask != 0xff) { + if (is_premult_alpha && non_opaque) { WebPApplyAlphaMultiply(base_rgba, alpha_first, width, num_lines_out, buf->stride); }