Fix to near lossless artefacts on palettized images.

Don't rely on palette not being there before the palette colors are counted.

Change-Id: I988286675d3398f2da8f6d2fb6462db08af8028d
This commit is contained in:
Pascal Massimino 2015-01-22 17:47:50 +01:00
parent d4615d0889
commit f480d1a7ef

View File

@ -1223,7 +1223,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
const int height = picture->height;
VP8LEncoder* const enc = VP8LEncoderNew(config, picture);
const size_t byte_position = VP8LBitWriterNumBytes(bw);
const int use_near_lossless = !enc->use_palette_ && config->near_lossless;
int use_near_lossless = 0;
int hdr_size = 0;
int data_size = 0;
@ -1241,6 +1241,7 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
}
// If no prediction transform just apply near-lossless preprocessing.
use_near_lossless = !enc->use_palette_ && config->near_lossless;
if (!enc->use_predict_ && use_near_lossless &&
!VP8ApplyNearLossless(width, height, picture->argb,
config->near_lossless)) {