mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
Only call WebPDequantizeLevels() on cropped area
this might change some crc slightly, since WebPDequantizeLevels() performs an analysis pass, counting levels, which impacts the smoothing. Now, the cropping area is not the same, so minor diffs are expected here and there. Change-Id: I3cce1e40c6f11c25b7c841044d637685c5740352
This commit is contained in:
parent
cf6c713a0b
commit
238cdcdbe1
@ -129,7 +129,7 @@ static int ALPHDecode(VP8Decoder* const dec, int row, int num_rows) {
|
||||
unfilter_func(width, height, width, row, num_rows, output);
|
||||
}
|
||||
|
||||
if (row + num_rows == dec->pic_hdr_.height_) {
|
||||
if (row + num_rows >= alph_dec->io_.crop_bottom) {
|
||||
dec->is_alpha_decoded_ = 1;
|
||||
}
|
||||
return 1;
|
||||
@ -167,7 +167,7 @@ const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
|
||||
|
||||
assert(dec != NULL && io != NULL);
|
||||
|
||||
if (row < 0 || num_rows <= 0 || row + num_rows > io->height) {
|
||||
if (row < 0 || num_rows <= 0 || row + num_rows > height) {
|
||||
return NULL; // sanity check.
|
||||
}
|
||||
|
||||
@ -182,22 +182,26 @@ const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
|
||||
}
|
||||
// if we allowed use of alpha dithering, check whether it's needed at all
|
||||
if (dec->alph_dec_->pre_processing_ != ALPHA_PREPROCESSED_LEVELS) {
|
||||
dec->alpha_dithering_ = 0; // disable dithering
|
||||
dec->alpha_dithering_ = 0; // disable dithering
|
||||
} else {
|
||||
num_rows = io->height - row; // decode everything in one pass
|
||||
num_rows = height - row; // decode everything in one pass
|
||||
}
|
||||
}
|
||||
|
||||
assert(dec->alph_dec_ != NULL);
|
||||
assert(row + num_rows <= io->height);
|
||||
assert(row + num_rows <= height);
|
||||
if (!ALPHDecode(dec, row, num_rows)) goto Error;
|
||||
|
||||
if (dec->is_alpha_decoded_) { // finished?
|
||||
ALPHDelete(dec->alph_dec_);
|
||||
dec->alph_dec_ = NULL;
|
||||
if (dec->alpha_dithering_ > 0) {
|
||||
if (!WebPDequantizeLevels(dec->alpha_plane_, width, height, width,
|
||||
dec->alpha_dithering_)) {
|
||||
uint8_t* const alpha = dec->alpha_plane_ + io->crop_top * width
|
||||
+ io->crop_left;
|
||||
if (!WebPDequantizeLevels(alpha,
|
||||
io->crop_right - io->crop_left,
|
||||
io->crop_bottom - io->crop_top,
|
||||
width, dec->alpha_dithering_)) {
|
||||
goto Error;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user