use the DispatchAlpha() call from dsp

it's used in YUVA->RGBA case (quite frequent).

Change-Id: Ie88f8c7f74cd274b3c6cbe81506f4425c164c7b3
This commit is contained in:
skal 2015-08-17 18:48:05 -07:00
parent c5f00621c7
commit 3ec1182768

View File

@ -378,22 +378,17 @@ static int ExportAlpha(WebPDecParams* const p, int y_pos) {
uint8_t* dst = base_rgba + (alpha_first ? 0 : 3); uint8_t* dst = base_rgba + (alpha_first ? 0 : 3);
int num_lines_out = 0; int num_lines_out = 0;
const int is_premult_alpha = WebPIsPremultipliedMode(colorspace); 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; const int width = p->scaler_a.dst_width;
while (WebPRescalerHasPendingOutput(&p->scaler_a)) { while (WebPRescalerHasPendingOutput(&p->scaler_a)) {
int i;
assert(p->last_y + y_pos + num_lines_out < p->output->height); assert(p->last_y + y_pos + num_lines_out < p->output->height);
WebPRescalerExportRow(&p->scaler_a, 0); WebPRescalerExportRow(&p->scaler_a, 0);
for (i = 0; i < width; ++i) { non_opaque |= WebPDispatchAlpha(p->scaler_a.dst, 0, width, 1, dst, 0);
const uint32_t alpha_value = p->scaler_a.dst[i];
dst[4 * i] = alpha_value;
alpha_mask &= alpha_value;
}
dst += buf->stride; dst += buf->stride;
++num_lines_out; ++num_lines_out;
} }
if (is_premult_alpha && alpha_mask != 0xff) { if (is_premult_alpha && non_opaque) {
WebPApplyAlphaMultiply(base_rgba, alpha_first, WebPApplyAlphaMultiply(base_rgba, alpha_first,
width, num_lines_out, buf->stride); width, num_lines_out, buf->stride);
} }