image-webp icon indicating copy to clipboard operation
image-webp copied to clipboard

Reddish color bleed on some WebP images

Open Shnatsel opened this issue 1 year ago • 1 comments

Found in image-webp v0.2.0

Input: 1600195945.webp.gz

imagemagick result: 1600195945 webp magick image-webp result: 1600195945 webp image

Note the reddish area in the bottom right corner of the image-webp output.

Same versions and reproduction code as in https://github.com/image-rs/image-webp/issues/117

Shnatsel avatar Oct 16 '24 18:10 Shnatsel

~~Another image triggering this: magicountry_20210418221542.webp.gz~~ that's #142

Shnatsel avatar Oct 16 '24 18:10 Shnatsel

Does this still happen?

fintelia avatar Jun 09 '25 01:06 fintelia

Yes, this is still a problem as of v0.2.2

Shnatsel avatar Jun 09 '25 08:06 Shnatsel

On 1600195945.webp the biggest divergence is block-shaped:

Image

So we can rule out issues with loop filter and narrow it down to code that operates on blocks.

Shnatsel avatar Jun 09 '25 09:06 Shnatsel

The 8x8 discoloration in the bottom right corner points to an issue with a chroma block. Something like intra prediction not processing the last block correctly, or residue coding not being applied to the last block.

Shnatsel avatar Jun 09 '25 11:06 Shnatsel

For a 4:2:0 image, this would code for 24x24 luma pixels and 12x12 chroma pixels. With chroma macroblocks being 8x8, this means we have a 8x8 block, a partial 8x4 block, a partial 4x8 block, and the final 4x4 block which is the problematic one. The whole block is still coded but only a quarter of it is visible; it's likely that we're hitting some edge case in that scenario.

Shnatsel avatar Jun 09 '25 12:06 Shnatsel

When taking #142 into account and comparing against dwebp -nofancy, all the divergence is clearly isolated to the last block:

Image

Shnatsel avatar Jun 09 '25 14:06 Shnatsel