enable re_rav1d by default for avif decoding
I would like to be able ...
Decode avif images without having to fight pkg-config, ninja, meson, and vckpg to build this crate on Microsoft-Windows.
My specific use case for this functionality is ...
Decoding avif images on Microsoft Windows.
This is more generally applicable to ...
Anyone who wants to use this crate & decode avif images on Windows.
Draft
re_rav1d::dav1d is full compatible with the dav1d crate, as its API is a fork.
I've managed to get this to build with the following operation:
$ git clone https://github.com/image-rs/image
$ cd image
# Update our Cargo.toml
$ sed -i '59i re_rav1d = { version = "0.1.3", optional = true }' Cargo.toml
$ sed -i 's/nasm = \["ravif?\/asm"\]/nasm = ["ravif?\/asm", "re_rav1d?\/asm"]/' Cargo.toml
$ sed -i 's/avif-native = \["dep:mp4parse", "dep:dav1d"\]/avif-native = ["dep:dav1d"]/' Cargo.toml
$ sed -i 's/avif = \["dep:ravif", "dep:rgb"\]/avif = ["dep:ravif", "dep:rgb", "dep:re_rav1d", "dep:mp4parse"]/' Cargo.toml
Then src/codecs/av1f/decoder.rs is updated to the import statement becomes
#[cfg(all(feature = "avif", not(feature = "avif-native")))]
use re_rav1d::dav1d::{PixelLayout, PlanarImageComponent};
#[cfg(all(feature = "avif", not(feature = "avif-native")))]
use re_rav1d::dav1d;
#[cfg(all(feature = "avif", feature = "avif-native"))]
use dav1d::{PixelLayout, PlanarImageComponent};
#[cfg(all(feature = "avif", feature = "avif-native"))]
use dav1d::{self};
To ensure there is always a dav1d prefix.
It seems to just work provided you update the src/codecs/av1f/mod.rs #feature gates.
We've been waiting on https://github.com/memorysafety/rav1d/pull/1439 or for dav1d-sys crate to support rav1d before we can switch to rav1d for decoding.
Depending on a private fork of rav1d that is not getting updated as frequently and may not receive timely security patches does not seem like a great idea for a major crate like image.