-
Notifications
You must be signed in to change notification settings - Fork 189
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
Build libavif with encoding support on Windows #415
Comments
You have to choose an encoder backend:
EDIT: I guess aom should be the choice, but you decide. Either way, the dlls will noticeably increase in size Apart from them, do you require libyuv support in libavif? (https://chromium.googlesource.com/libyuv/libyuv/, C++) |
I think aom is the way to go. The HDR cases are not in the libyuv fast path, but it would be a shame for us to always use the slow path. I’ve built it here statically linked with Visual Studio and libsharpyuv and the other bells and whistles. We can use that instead, if you want. |
OK, aom it is. We'll need to vendor it too, and drop dav1d support. Will this be for SDL3 only?
Hmph.. Static libstdc++ bloat will be there. Will need to vendor libyuv too
In the interim maybe: those dlls will have all MSVC runtime and Win10 dll dependencies, no? I'll try to build something using mingw later these days. |
Yes, SDL3 only. The static linking with VC means we don’t have runtime dependencies. I’ll go ahead and drop in the VC libs for now. @madebr, do you want to help with the vendoringand non-Windows builds? |
If I remember correctly, dav1d is a faster decoder. Do we want both back ends configured? |
libavif allows multiple backends, don't know how it prioritizes codecs though. |
Here are the initial libavif dll builds with encoder support: dlls.tar.gz Included: dav1d 1.2.1 as decoder, aom 3.6.1 as encoder, libsharpyuv from libwebp HEAD. aom was configured without decoder support, like this:
IIRC, the cpu target needed explicit speciying for x86 - replace with x86_64 for x86_64 I didn't bother including libyuv yet: if you want I can do that too. The dlls are large in size even after stripping. |
avif has 2 configuration options to control encoding/decoding with aom: Inside |
Will try and get back immediately |
Oops, noticed that I already disabled that option. So, these libavif builds use libaom really only for encoding |
Isn't that good? dav1d for decoding and aom for encoding? |
Yes it is, and it was the intention. Only that I didn't expect these large dll sizes only because of aom encoder inclusion (8.9M x86 dll and 13.4M x64 dll) |
Off-topic: I don't seem to have write permissions to our aom fork at https://github.com/libsdl-org/aom.git |
Fixed! |
I'm not surprised, the size of the aom encoder is pretty big. Remember these are optional DLLs, so users who don't want to include them in their project can leave them out. |
OK then |
P.S.: We are currently vendoring aom 3.6.1, however 3.7.1+ has at least one CVE fix. I suggest upgrading to aom 3.7.2 or 3.8.1 |
When finished, it would also be useful to test storing avif in the test. Line 153 in c9c809b
|
I used 3.6.1 because that is the version that is recommended with the libavif we're using. However, it looks like the API is pretty stable, we should be able to bump to a newer aom if we want. |
Now that avif save commit c1600c4 is in, should I push the new dlls to msvc project I you aren't doing that yourself already? |
Sure, go for it. However I'm going to ask @madebr's help with these:
|
Pushed 5d95dc1 |
I think we can vendor it. We already have libsharpyuv in webp. |
libavif HEAD has inlined a very crippled version of libyuv under their 3rdparty directory without any cpu optimizations: We can do something similar if necessary with cpu optimizations included? And as a matter of fact most of libyuv can actually be built as C-only, at least the parts that are of interest to us: libavif's own vendored version is C-only for example. |
The patch looks very straightforward. |
This is done in 1d91d7e |
I made a libyuv fork and created a branch for C-only build -- here if interested: https://github.com/sezero/libyuv/tree/sezero |
Untested, but with |
OK, learnt something new about cmake - thanks. |
Pushed 87c811f which updates libavif dlls with added libyuv support included (libyuv built from my C-only fork above, and of course statically linked.) |
Just noticed that libyuv disables cpu optimizations if targeting x86 (not x64) and |
Pushed sezero/libyuv@11df275 to my libyuv fork to enable SIMD functions for x86 with gcc >= 4.9 by using target attributes. Rebuilt our libavif x86 dll against it and pushed d5eda04 |
I'd like to add support for saving images as AVIF. Could you rebuild libavif with encoder support?
The text was updated successfully, but these errors were encountered: