lovell / sharp-libvips

Packaging scripts to prebuild libvips and its dependencies - you're probably looking for https://github.com/lovell/sharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Experiment: consider switching from aom to dav1d+rav1e

lovell opened this issue · comments

The dav1d decoder provides a meson build script and is straightforward to cross-compile.

https://github.com/lovell/sharp-libvips/tree/dav1d

The rav1e encoder does not provide build tooling and relies on cargo cinstall, which is not that simple to get working with cross-compilation. It causes rust symbol conflicts as we also statically-link the rust-based librsvg, so requires the slightly dangerous -Wl,--allow-multiple-definition linker flag.

https://github.com/lovell/sharp-libvips/tree/rav1e

Is there any performance difference between aom and dav1d+rav1e?

@grantbeattie The latter are sold on performance and the former is the reference implementation, which would historically suggest that there will be, however these libraries are all under heavy development so this is probably one of those "it depends" situations.

I would like to comment that latest rav1e has some issue: xiph/rav1e#2662

Due to this, we had to revert to 0.3.4 version and eventually to libaom.

rav1e v0.5.0 was just released, which contains a fix for the issue mentioned above. The slightly dangerous -Wl,--allow-multiple-definition linker flag is still needed as rust-lang/rust#44322 isn't fixed (yet).

As for the Windows builds, the dav1d-rav1e branch integrates this. Unfortunally, this requires a patched cargo-c that allows the use of the -Zbuild-std feature flag and provides support for the ARM/ARM64 llvm-mingw dlltool targets.

Any progress on this?

In addition to build difficulties, strukturag/libheif#554 (SEGV when encoding AVIF images with transparency) can also be a blocking issue. Given all this, my feeling is that it would be easier to only switch the decoder to dav1d and still use libaom for encoding. Of course, this change must be done in OSS-Fuzz first.

FWIW, librsvg is also considering using cargo-c (https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/657), so it's likely that we'll have to include that build dependency anyway.

libaom has made a number of performance improvements during the last year e.g. encoding is ~2x faster, and I've not seen any recent comparative benchmarks against dav1d or rav1e.

Adding dav1d for decoding with libaom compiled for encode-only increases the resultant binary size by ~6%.

We will revisit this, perhaps later in the year.

Libaom still seems slow on decoding front. Can you let me know switches to disable encoding and how to build dav1d? May be we can give it a try for decoding.