Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVIF lossless is not accurate #2696

Closed
tomByrer opened this issue May 6, 2021 · 2 comments
Closed

AVIF lossless is not accurate #2696

tomByrer opened this issue May 6, 2021 · 2 comments
Labels

Comments

@tomByrer
Copy link

tomByrer commented May 6, 2021

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

v0.28.1

What are the steps to reproduce?

.avif({ quality:50, speed:2, lossless:true })

What is the expected behavior?

The diff to be equal to source .png

Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?

I'm not sure if you want my entire testing program copy/pasted here? (I use sharp to diff ;) )

Are you able to provide a sample image that helps explain the problem?

src .png: (note: highly lossless compressed via FileOptimizer)
_gray-7f7f7f

sharp lossless CPU2 (note: file is really AVIF, but added .png at end to hack, urr I mean upload here)
_gray-7f7f7f  avif

diff:
_gray-7f7f7f png__gray-7f7f7f avif diffnote

diff with the low levels increased to see artifacts easier; note the blocks of red, blue, & green show lossless shifts more than edges:
_gray-7f7f7f png__gray-7f7f7f avif diffampnote

avif.to is much closer, though a few blocks & some edges still are not perfect:
_gray-7f7f7f png__gray-7f7f7f avif diffampnote

squoosh.app has truelly perfect lossless. Uses libavif also, but unsure how they encode lossless. Diff would be blank (useless), so here is their AVIF lossless output:
_gray-7f7f7f avif

What is the output of running npx envinfo --binaries --system?

System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz
Memory: 2.28 GB / 31.85 GB
Binaries:
Node: 16.0.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.1 - C:\p\n\yarn\bin\yarn.CMD
npm: 7.10.0 - C:\Program Files\nodejs\npm.CMD

Thanks for your interest & sharp!

@hdmr14
Copy link

hdmr14 commented May 6, 2021

same here

@lovell
Copy link
Owner

lovell commented May 6, 2021

Hi, this looks like the effects of chroma subsampling - please see #2562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants