-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 support #722
AVIF support #722
Conversation
codecs/avif_enc/avif_enc.cpp
Outdated
avifPixelFormat format; | ||
switch (options.subsample) { | ||
case 0: | ||
format = AVIF_PIXEL_FORMAT_YUV420; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's expose the actual underlying enum instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll pick this up (and as many other options as I can find) when I do the UI
@surma Just copying some of my unresolved comments from resolved conversation on the build system PR, just so that they're not lost:
|
I (hopefully) fixed the leaky bits now :) |
The code looks good to me now, but I'd still double-check with sanitizers enabled and the manual "run leak checks" function call like in the blog post to be sure :) |
Oh yeah, I’m definitely looking forward to you unleashing the sanitizer on the code base :D |
I already did on the existing codecs, now it needs to be done on any new ones by whoever adds them :P |
Thanks for volunteering. |
codecs/avif/dec/avif_dec.cpp
Outdated
|
||
using namespace emscripten; | ||
|
||
class RawImage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@surma Please remove this in favour of ImageData
using other codecs as examples.
Nice try. |
- Update to newer APIs. - Avoid manual pixel-by-pixel copy in favour of decoding directly to desired format & bit depth. - Avoid use-after-free by cloning the Uint8Array Wasm memory view into a JS-owned Uint8Array right away.
Co-authored-by: Ingvar Stepanyan <rreverser@google.com>
This reverts commit d89e846.
@RReverser The current code passed the sanitizer test :) I made a commit and reverted it to keep the code available. I didn’t want to do all the macro juggling at this point without making a plan with you. |
Done |
Congrats @surma 🤘🏼😊🤘🏼 |
This PR lands support for AVIF.
So far, the codec is ported and integrated into Squoosh. Options UI needs polish, which @jakearchibald will do.