saucecontrol / PhotoSauce

MagicScaler high-performance, high-quality image processing pipeline for .NET
http://photosauce.net/
MIT License
569 stars 49 forks source link

[Feature Request] AVIF Decoder #97

Closed iamcarbon closed 1 year ago

iamcarbon commented 1 year ago

AVIF images are becoming more common on the web, and would be useful to be able to decode in MagicScaler.

This is an issue to determine the feasibility of an adding a native AVIF decoder, using libheif's (+libaom), or the libavif libraries.

saucecontrol commented 1 year ago

Adding aom to the libheif build is easy enough, so I'll go ahead and do that short-term. My longer term plan was to ditch libheif in favor of handling the container managed-side and using libde265 directly for the frame decode. I'll have to give libavif a look and see if it's any better.

saucecontrol commented 1 year ago

I went ahead and added dav1d to the libheif build since it's reached stable now and is quite a bit faster than aom. I've only done minimal testing so far, but it's looking good.

Package is up on the CI feed if anybody wants to check it out.

iamcarbon commented 1 year ago

Awesome!

One small issue trying out the CI feeds:

Nuget seems to consider prereleases (-ci...) to be < a full release, so these unreleased dependencies don't resolve when using package ranges (e.g. >= 0.13.2) [as there's no 0.13.2 release].

Screen Shot 2022-10-15 at 1 31 00 PM Screen Shot 2022-10-15 at 1 21 20 PM

I'll give a local build a try later!

saucecontrol commented 1 year ago

Ah, thanks for the heads up on that. I'll see if I can work out a better way to set up the package dependencies so they update together. There was some internal refactoring that means the native codecs do actually require the 0.13.2 preview of the main lib, so you could reference the 0.13.2-ci* version of the main lib explicitly, I believe.

saucecontrol commented 1 year ago

Oh! I remember why they're set up that way. The msbuild task that sets the dependency range was messing up release builds because I've pushed release versions of the main lib together with preview versions of the native codec packages. The fix for that is what's breaking the -ci dependency versions. I can fix that 😄

iamcarbon commented 1 year ago

@saucecontrol ^ that fix worked! Will keep you updated on how it works in production!

saucecontrol commented 1 year ago

Package is up on nuget.org