-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 encoding is broken on browsers without multi-threaded support #1397
Comments
Thanks for the report. I'm trying to figure out the impact of this bug. How did you encounter it? Is there an environment where this is impacting users that aren't deliberately disabling features in their browser? |
Thanks @jakearchibald. I didn't expect such a prompt reply. I think the impact of this bug is quite small, it's definitely low priority.
I was just playing around with it 😅 . I have a hobby project that shares these codecs as individual ES modules (with licenses and correct attributions).
No, I don't think that's possible. A small number of older browsers might be affected, but I doubt you see much traffic for them on squoosh.app. |
Makes sense. We'll work on a fix, but it doesn't seem to warrant a rollback. Thanks for playing around with the project and finding the issue! |
Oof, just lost a couple of hours to trying to figure out why |
Quick way to reproduce this - In if (await checkThreadsSupport()) {
const avifEncoder = await import('codecs/avif/enc/avif_enc_mt');
return initEmscriptenModule<AVIFModule>(avifEncoder.default);
} to: if (false && await checkThreadsSupport()) {
const avifEncoder = await import('codecs/avif/enc/avif_enc_mt');
return initEmscriptenModule<AVIFModule>(avifEncoder.default);
} which enables only single-threaded encoding. Looking into this 👍 |
I have encountered the same problem. |
@wantehchang I've narrowed this issue down to this line in avif_enc.cpp: avifResult encodeResult = avifEncoderWrite(encoder.get(), image.get(), &output);
|
Aryan: We will need to debug it. You can start by logging the return value of |
I could be doing something wrong, but when I enabled some debugging flags like
It seems to fail before the I am sure there's more debugging to be done, but perhaps there's something up with how Full stack trace
|
Aha! Well that was a fun one to debug 😅 Looks like the issue was with the compilation of Do we need to compile different versions of |
Brilliant work, @jamsinclair. Thanks so much. We should definitely compile a separate copy of libsharpyuv, as we might have to add more permutations in the future. In fact, IIRC, we already do this for libaom in the Do you have the time and would you be willing to whip up a PR for the fix at hand? |
@jamsinclair wrote:
Please try libsharpyuv's (libwebp's) cmake option @jzern FYI. |
Sure thing, I'll whip that up later 🖖
Thank you! I'll give that a go. |
Describe the bug
When the browser does not support SharedArrayBuffer/Multi-threading, Squoosh fails to encode AVIF images.
To Reproduce
Steps to reproduce the behavior:
Cross-Origin-Opener-Policy
andCross-Origin-Embedder-Policy
to force the dev environment to use the single threaded logicnpm run dev
AVIF
compress option.Expected behavior
The image would still be encoded to AVIF with single threaded browser.
Version:
Additional context, screenshots, screencasts
This issue was introduced in the recent update of the AVIF version #1381
The text was updated successfully, but these errors were encountered: