From c9b340a2795aa5b0fa64c4bf7f11240a69559c1c Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 28 May 2014 10:44:05 +0200 Subject: [PATCH] fix missing WebPInitAlphaProcessing call for premultiplied colorspace output (lossless only) Change-Id: Ic2d01c8cf9bc1082f07f348733461eb2ee30288a --- src/dec/vp8l.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dec/vp8l.c b/src/dec/vp8l.c index f08631bc..81cf99fc 100644 --- a/src/dec/vp8l.c +++ b/src/dec/vp8l.c @@ -412,7 +412,6 @@ static int AllocateAndInitRescaler(VP8LDecoder* const dec, VP8Io* const io) { WebPRescalerInit(dec->rescaler, in_width, in_height, (uint8_t*)scaled_data, out_width, out_height, 0, num_channels, in_width, out_width, in_height, out_height, work); - WebPInitAlphaProcessing(); // needed for pre/post multiply with alpha return 1; } @@ -1372,6 +1371,11 @@ int VP8LDecodeImage(VP8LDecoder* const dec) { if (io->use_scaling && !AllocateAndInitRescaler(dec, io)) goto Err; + if (io->use_scaling || WebPIsPremultipliedMode(dec->output_->colorspace)) { + // need the alpha-multiply functions for premultiplied output or rescaling + WebPInitAlphaProcessing(); + } + // Decode. dec->action_ = READ_DATA; if (!DecodeImageData(dec, dec->pixels_, dec->width_, dec->height_, @@ -1391,4 +1395,3 @@ int VP8LDecodeImage(VP8LDecoder* const dec) { } //------------------------------------------------------------------------------ -