jay3332 / ril

Rust Imaging Library: A high-level imaging crate for Rust.
https://crates.io/crates/ril
MIT License
81 stars 10 forks source link

`AVIF` format status #34

Open onkoe opened 2 months ago

onkoe commented 2 months ago

Hey there! Just wanted to quickly check in on the status of AVIF. Would you be interested in any contributions to get it into the library?

image supports some AVIF files, which makes it a better option for a general, inclusive use case, particularly when interacting with user images directly. However, this library benefits a lot from hindsight, and I adore the comfy API!

AVIF has some issues with portability if you use the reference implementation, but rav1e might help there. (strong name!)

It's also worth considering that image doesn't yet support 10-bit AVIF.

jay3332 commented 1 month ago

Yes, AVIF support would be greatly appreciated. It was originally planned to be after the initial stable release (1.0), but obviously there is no harm in getting it in RIL before so.

Quackdoc commented 1 month ago

avif can be done with rav1d instead of dav1d if you wanted a rust native decoder, however it lacks a usable rust api yet. dav1d-rs might look into using rav1d in the future. AVIF uses the HEIF container which is based on mp4, but not quite the same, so while mp4parse should decode most files to the extent you can use them to create an image, more fine grained details may be lost.

It would however be enough for ril most likely. Note that the container situation is the exact same situation as HEIC which I asked about in #33 though HEVC has no native rust decoding.

It could be worth implementing a dedicated HEIF parser which can then be used for HEIC, AVIF, AVCI (h264), as well as VVC + HEIF (I don't know if there is an actual spec/name for this, but libheif does support VVC inside of HEIF).

onkoe commented 1 month ago

thank you for the super helpful description! i'll take these into consideration :)