Skip to content

Do not perform expensive alpha blending when it's not needed #150

@Shnatsel

Description

@Shnatsel

There are several cases where we are running expensive alpha blending when it's not actually needed.

tests/images/animated/random_lossless.web has a frame with blend: 1 but does not contain any alpha chunks, so there is no alpha channel. Despite that, we're still wasting time running alpha blending. This is why I had to fudge the image in #123 - both libwebp and our alpha blending is approximate and this caused slight divergences in the output; but alpha blending should not be done there at all.

And in #119 a real-world image has a paletted alpha chunk with a 1-bit palette, so the only alpha values that can be expressed are full transparency and full opacity. In that case we don't need to do any complex alpha blending at all and can simply select the pixel from the correct frame, which is much faster.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions