AVIF (8/10/12-bit) image support for darktable

I’ve nearly finished implementing my first feature for darktable. Support for importing and exporting AVIF images. AVIF is an image format based on the AV1 video codec and has support for HDR images too.

Joe Drago, the author of libavif was very helpful and fixed all the bugs I discovered. Also he provided a lot of explanations. Thank you very much!

The feature is not fully finished yet, as I need to understand a few more details and if I should expose them to the UI or not.

As it is a new feature it will be available with darktable 3.0.1.

There are some things which needs to be address to have a nice experience for everyone:

libavif multi threaded encoding using rav1e
exif support for AVIF images in libexiv2
Still image support in rav1e
Lossless image support in rav1e
AVIF support in Firefox
Wide gamuts color spaces in darktable

21 Likes

Nice work !

Awesome!

Is this libavif an extended version of the libheif or a separate project?
Do you know if there are already smartphones or cameras that saves avif files directly?
If yes, do you have examples?

libavif is a separate project. It uses either aom and/or dav1d and rav1e.

I’m not aware that any camera or phone manufacturer is using it already.

1 Like

Thanks for the fast answer.

I’ve improved the code behind the quality slider and added a new option in the GUI to disable tiling. By default it is on as it makes encoding a lot faster.

I’m currently connecting up the nclx boxes of AVIF to the darktable color spaces.

However we need to add more color spaces soon:

2 Likes

I’m done with the implementation and opened a pull request for darktable.

4 Likes

@Pascal_Obry added HLG BT2020, PQ BT2020, PQ P3 and HLG P3 color spaces to darktable, so I wired them in the AVIF import and export code.

So we are able to read the AV1 AVIF test files from Netflix.

However I don’t have a 10bit HDR monitor which could display them correctly.

7 Likes

So the code is merged into the master branch; right?

But I don’t get the feature when I build dt.

Do I have to build libavif and associated library myself, which isn’t straightforward?

If your Distribution doesn’t provide them yet, yes you have to build them on your own. You need libavif and I suggest to use dav1d and rav1e.

libavif is available with openSUSE Tumbleweed and I’m working on getting it into Fedora. The first step, adding cargo-c has been done to build rav1e soon. Dependencies need to be packaged first.

Ok, thanks.

Turns out dav1d and libdav1d is available on fedora; version 0.5.2.

Just FYI, I do get a “cannot export” error when trying to run the conversion though.

Well you can step up and help with maintaining the packages. :wink: