mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
Faster alpha coding for webp
No significant size degradation (+0.001 %) for 1000 image corpus Fixes the 8 ms vs 2 ms degradation from: "lossless: 0.37 % compression density improvement" Change-Id: Id540169a305d9d5c6213a82b46c879761b3ca608
This commit is contained in:
parent
5e75642efd
commit
2cce031704
@ -289,6 +289,12 @@ static int AnalyzeAndInit(VP8LEncoder* const enc) {
|
|||||||
enc->use_palette_ =
|
enc->use_palette_ =
|
||||||
AnalyzeAndCreatePalette(pic, enc->palette_, &enc->palette_size_);
|
AnalyzeAndCreatePalette(pic, enc->palette_, &enc->palette_size_);
|
||||||
|
|
||||||
|
// TODO(jyrki): replace the decision to be based on an actual estimate
|
||||||
|
// of entropy, or even spatial variance of entropy.
|
||||||
|
enc->histo_bits_ = GetHistoBits(method, enc->use_palette_,
|
||||||
|
pic->width, pic->height);
|
||||||
|
enc->transform_bits_ = GetTransformBits(method, enc->histo_bits_);
|
||||||
|
|
||||||
if (low_effort) {
|
if (low_effort) {
|
||||||
// AnalyzeEntropy is somewhat slow.
|
// AnalyzeEntropy is somewhat slow.
|
||||||
enc->use_predict_ = !enc->use_palette_;
|
enc->use_predict_ = !enc->use_palette_;
|
||||||
@ -316,10 +322,6 @@ static int AnalyzeAndInit(VP8LEncoder* const enc) {
|
|||||||
enc->use_cross_color_ = enc->use_predict_ =
|
enc->use_cross_color_ = enc->use_predict_ =
|
||||||
(min_entropy_ix == kSpatial) || (min_entropy_ix == kSpatialSubGreen);
|
(min_entropy_ix == kSpatial) || (min_entropy_ix == kSpatialSubGreen);
|
||||||
}
|
}
|
||||||
// Evaluate histogram bits based on the original value of use_palette flag.
|
|
||||||
enc->histo_bits_ = GetHistoBits(method, enc->use_palette_, pic->width,
|
|
||||||
pic->height);
|
|
||||||
enc->transform_bits_ = GetTransformBits(method, enc->histo_bits_);
|
|
||||||
|
|
||||||
if (!VP8LHashChainInit(&enc->hash_chain_, pix_cnt)) return 0;
|
if (!VP8LHashChainInit(&enc->hash_chain_, pix_cnt)) return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user