mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
FlattenSimilarBlocks should only be tried when blending is possible.
This is because, FlattenSimilarBlocks() replaces some opaque pixels by transparent ones. This results in an equivalent output only if blending is turned on for the current frame. Change-Id: I05612c952fdbd4b3a6e0ac9f3a7d49822f0cfb9b
This commit is contained in:
parent
4171b6724e
commit
5cccdadf2e
@ -674,11 +674,9 @@ static WebPEncodingError GenerateCandidates(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (candidate_lossy->evaluate) {
|
if (candidate_lossy->evaluate) {
|
||||||
if (!is_key_frame) {
|
if (use_blending) {
|
||||||
// For lossy compression of a frame, it's better to:
|
// For lossy compression of a frame, it's better to replace similar blocks
|
||||||
// * Replace transparent pixels of 'curr' with actual RGB values,
|
// of pixels by a transparent block.
|
||||||
// whenever possible, and
|
|
||||||
// * Replace similar blocks of pixels by a transparent block.
|
|
||||||
if (!curr_canvas_saved) { // save if not already done so.
|
if (!curr_canvas_saved) { // save if not already done so.
|
||||||
CopyPixels(curr_canvas, curr_canvas_tmp);
|
CopyPixels(curr_canvas, curr_canvas_tmp);
|
||||||
}
|
}
|
||||||
@ -687,7 +685,7 @@ static WebPEncodingError GenerateCandidates(
|
|||||||
error_code = EncodeCandidate(sub_frame, rect, config_lossy, use_blending,
|
error_code = EncodeCandidate(sub_frame, rect, config_lossy, use_blending,
|
||||||
duration, candidate_lossy);
|
duration, candidate_lossy);
|
||||||
if (error_code != VP8_ENC_OK) return error_code;
|
if (error_code != VP8_ENC_OK) return error_code;
|
||||||
if (!is_key_frame) {
|
if (use_blending) {
|
||||||
CopyPixels(curr_canvas_tmp, curr_canvas); // restore
|
CopyPixels(curr_canvas_tmp, curr_canvas); // restore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user