Update lossless encoder strategy:

Don't use any other transform when using palette.

Change-Id: I488ac546869677f1b6e4eed80e973569c757e997
This commit is contained in:
Urvang Joshi 2012-04-23 18:23:18 +00:00 committed by James Zern
parent 0e6fa06595
commit 149b5098a9

View File

@ -126,9 +126,13 @@ static int AnalyzeEntropy(const uint32_t const *argb, int xsize, int ysize,
static int VP8LEncAnalyze(VP8LEncoder* const enc) {
const WebPPicture* const pic = enc->pic_;
int non_pred_entropy, pred_entropy;
assert(pic && pic->argb);
enc->use_palette_ =
AnalyzeAndCreatePalette(pic->argb, pic->width * pic->height,
enc->palette_, &enc->palette_size_);
if (!enc->use_palette_) {
int non_pred_entropy, pred_entropy;
if (!AnalyzeEntropy(pic->argb, pic->width, pic->height,
&non_pred_entropy, &pred_entropy)) {
return 0;
@ -138,10 +142,7 @@ static int VP8LEncAnalyze(VP8LEncoder* const enc) {
enc->use_predict_ = 1;
enc->use_cross_color_ = 1;
}
enc->use_palette_ =
AnalyzeAndCreatePalette(pic->argb, pic->width * pic->height,
enc->palette_, &enc->palette_size_);
}
return 1;
}
@ -865,6 +866,7 @@ static int EncodeImageInternal(VP8LBitWriter* const bw,
static int EvalAndApplySubtractGreen(VP8LBitWriter* const bw,
VP8LEncoder* const enc,
int width, int height) {
if (!enc->use_palette_) {
int i;
VP8LHistogram* before = NULL;
// Check if it would be a good idea to subtract green from red and blue.
@ -891,6 +893,7 @@ static int EvalAndApplySubtractGreen(VP8LBitWriter* const bw,
VP8LSubtractGreenFromBlueAndRed(enc->argb_, width * height);
}
free(after);
}
return 1;
}