fix bug with lossy-alpha output stride
dec->width_ != final_width in case of Bundle transform! thanks to Pepijn for spotting the problem Change-Id: I08b451a32097dcbf23b73deabc8cc6a2d59f0119
This commit is contained in:
		| @@ -945,16 +945,16 @@ static int AllocateARGBBuffers(VP8LDecoder* const dec, int final_width) { | |||||||
|  |  | ||||||
| static void ExtractAlphaRows(VP8LDecoder* const dec, int row) { | static void ExtractAlphaRows(VP8LDecoder* const dec, int row) { | ||||||
|   const int num_rows = row - dec->last_row_; |   const int num_rows = row - dec->last_row_; | ||||||
|   const int cache_pixs = dec->width_ * num_rows; |   const uint32_t* const in = dec->argb_ + dec->width_ * dec->last_row_; | ||||||
|   const int argb_offset = dec->width_ * dec->last_row_; |  | ||||||
|   const uint32_t* const in = dec->argb_ + argb_offset; |  | ||||||
|  |  | ||||||
|   if (num_rows <= 0) return;  // Nothing to be done. |   if (num_rows <= 0) return;  // Nothing to be done. | ||||||
|   ApplyTransforms(dec, num_rows, in); |   ApplyTransforms(dec, num_rows, in); | ||||||
|  |  | ||||||
|   // Extract alpha (which is stored in the green plane). |   // Extract alpha (which is stored in the green plane). | ||||||
|   { |   { | ||||||
|     uint8_t* const dst = (uint8_t*)dec->io_->opaque + argb_offset; |     const int width = dec->io_->width;      // the final width (!= dec->width_) | ||||||
|  |     const int cache_pixs = width * num_rows; | ||||||
|  |     uint8_t* const dst = (uint8_t*)dec->io_->opaque + width * dec->last_row_; | ||||||
|     const uint32_t* const src = dec->argb_cache_; |     const uint32_t* const src = dec->argb_cache_; | ||||||
|     int i; |     int i; | ||||||
|     for (i = 0; i < cache_pixs; ++i) dst[i] = (src[i] >> 8) & 0xff; |     for (i = 0; i < cache_pixs; ++i) dst[i] = (src[i] >> 8) & 0xff; | ||||||
| @@ -977,6 +977,8 @@ int VP8LDecodeAlphaImageStream(int width, int height, const uint8_t* const data, | |||||||
|   VP8InitIo(&io); |   VP8InitIo(&io); | ||||||
|   WebPInitCustomIo(NULL, &io);    // Just a sanity Init. io won't be used. |   WebPInitCustomIo(NULL, &io);    // Just a sanity Init. io won't be used. | ||||||
|   io.opaque = output; |   io.opaque = output; | ||||||
|  |   io.width = width; | ||||||
|  |   io.height = height; | ||||||
|  |  | ||||||
|   dec->status_ = VP8_STATUS_OK; |   dec->status_ = VP8_STATUS_OK; | ||||||
|   VP8LInitBitReader(&dec->br_, data, data_size); |   VP8LInitBitReader(&dec->br_, data, data_size); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Pascal Massimino
					Pascal Massimino