mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 15:32:53 +01:00
Update lossless encoder strategy:
Don't use any other transform when using palette. Change-Id: I488ac546869677f1b6e4eed80e973569c757e997
This commit is contained in:
parent
0e6fa06595
commit
149b5098a9
@ -126,9 +126,13 @@ static int AnalyzeEntropy(const uint32_t const *argb, int xsize, int ysize,
|
|||||||
|
|
||||||
static int VP8LEncAnalyze(VP8LEncoder* const enc) {
|
static int VP8LEncAnalyze(VP8LEncoder* const enc) {
|
||||||
const WebPPicture* const pic = enc->pic_;
|
const WebPPicture* const pic = enc->pic_;
|
||||||
int non_pred_entropy, pred_entropy;
|
|
||||||
assert(pic && pic->argb);
|
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,
|
if (!AnalyzeEntropy(pic->argb, pic->width, pic->height,
|
||||||
&non_pred_entropy, &pred_entropy)) {
|
&non_pred_entropy, &pred_entropy)) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -138,10 +142,7 @@ static int VP8LEncAnalyze(VP8LEncoder* const enc) {
|
|||||||
enc->use_predict_ = 1;
|
enc->use_predict_ = 1;
|
||||||
enc->use_cross_color_ = 1;
|
enc->use_cross_color_ = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
enc->use_palette_ =
|
|
||||||
AnalyzeAndCreatePalette(pic->argb, pic->width * pic->height,
|
|
||||||
enc->palette_, &enc->palette_size_);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,6 +866,7 @@ static int EncodeImageInternal(VP8LBitWriter* const bw,
|
|||||||
static int EvalAndApplySubtractGreen(VP8LBitWriter* const bw,
|
static int EvalAndApplySubtractGreen(VP8LBitWriter* const bw,
|
||||||
VP8LEncoder* const enc,
|
VP8LEncoder* const enc,
|
||||||
int width, int height) {
|
int width, int height) {
|
||||||
|
if (!enc->use_palette_) {
|
||||||
int i;
|
int i;
|
||||||
VP8LHistogram* before = NULL;
|
VP8LHistogram* before = NULL;
|
||||||
// Check if it would be a good idea to subtract green from red and blue.
|
// 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);
|
VP8LSubtractGreenFromBlueAndRed(enc->argb_, width * height);
|
||||||
}
|
}
|
||||||
free(after);
|
free(after);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user