mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 15:32:53 +01:00
Speedup Alpha plane encoding.
Disable costly 'BackwardReferencesTraceBackwards' for encoding Alpha plane. Increase the threshold for triggering 'BackwardReferencesTraceBackwards' to quality 25 and above. Also lower the Alpha quality (at method 3) to be lesser than this threshold (25). Change-Id: Ic29fb2e6943472c564223df9fe099b19ccda0f31
This commit is contained in:
parent
b7346a1ed2
commit
6674014077
@ -81,8 +81,10 @@ static int EncodeLossless(const uint8_t* const data, int width, int height,
|
|||||||
WebPConfigInit(&config);
|
WebPConfigInit(&config);
|
||||||
config.lossless = 1;
|
config.lossless = 1;
|
||||||
config.method = effort_level; // impact is very small
|
config.method = effort_level; // impact is very small
|
||||||
// Set a moderate default quality setting for alpha.
|
// Set a low default quality for encoding alpha. Ensure that Alpha quality at
|
||||||
config.quality = 10.f * effort_level;
|
// lower methods (3 and below) is less than the threshold for triggering
|
||||||
|
// costly 'BackwardReferencesTraceBackwards'.
|
||||||
|
config.quality = 8.f * effort_level;
|
||||||
assert(config.quality >= 0 && config.quality <= 100.f);
|
assert(config.quality >= 0 && config.quality <= 100.f);
|
||||||
|
|
||||||
ok = VP8LBitWriterInit(&tmp_bw, (width * height) >> 3);
|
ok = VP8LBitWriterInit(&tmp_bw, (width * height) >> 3);
|
||||||
|
@ -780,8 +780,8 @@ int VP8LGetBackwardReferences(int width, int height,
|
|||||||
|
|
||||||
// Choose appropriate backward reference.
|
// Choose appropriate backward reference.
|
||||||
if (lz77_is_useful) {
|
if (lz77_is_useful) {
|
||||||
// TraceBackwards is costly. Don't execute it at lower quality (q <= 10).
|
// TraceBackwards is costly. Don't execute it at lower quality.
|
||||||
const int try_lz77_trace_backwards = (quality > 10);
|
const int try_lz77_trace_backwards = (quality >= 25);
|
||||||
*best = refs_lz77; // default guess: lz77 is better
|
*best = refs_lz77; // default guess: lz77 is better
|
||||||
VP8LClearBackwardRefs(&refs_rle);
|
VP8LClearBackwardRefs(&refs_rle);
|
||||||
if (try_lz77_trace_backwards) {
|
if (try_lz77_trace_backwards) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user