cavif-rs icon indicating copy to clipboard operation
cavif-rs copied to clipboard

HDR support

Open da2x opened this issue 4 years ago • 13 comments

Hi, any chance you could add support for 10 and 12-bit color depth, please? Either switching automatically based on the source image or using a command argument.

I’ve experimented with it in link-u/cavif, and the files are only 1–2 % bigger and still way smaller than the 8-bit JPEG/WebP equivalent.

da2x avatar Jan 17 '21 15:01 da2x

Yeah, that's doable.

kornelski avatar Jan 19 '21 11:01 kornelski

Yeah, that's doable.

+1 for this request, 10bit shows better performance even for 8bit sources

Libavif does 10bit, but releases or binaries around don't include rav1e (yet) :-\

gitoss avatar Apr 04 '21 07:04 gitoss

HDR metadata support would go nicely with this!

Ralith avatar Nov 03 '21 19:11 Ralith

I don't understand how HDR metadata support would help generating correct HDR files.

This crate supports JPEG and PNG as input, and AFAIK neither of these are good for HDR. I can put HDR metadata, but how do you get HDR pixels in?

kornelski avatar Nov 19 '21 23:11 kornelski

My interest is for using the ravif library to encode HDR data I generate myself; I don't know if it's relevant to transcoding from LDR using the command line tool, though it might be convenient for testing. Perhaps there's some esoteric form of JPEG that encodes the same metadata that would be nice to preserve?

Ralith avatar Nov 20 '21 00:11 Ralith

Is that something you consider in-scope, @kornelski?

Ralith avatar Dec 12 '21 18:12 Ralith

Use-case for programmatically-generated data makes sense. ravif could definitely support it, even if the CLI tool can't.

I haven't had time to play enough with HDR images to know how to best handle them. In my experience—for SDR—the separation between pixel data and color profiles that alter the meaning of the data is inelegant and has lead to a lot of broken software. Is is possible to make a better API for HDR data?

kornelski avatar Dec 12 '21 19:12 kornelski

HDR metadata is standardized and absolutely necessary, because it informs the ultimate display device of how to most effectively tonemap, avoiding unnecessary quality loss in common cases. I'm all in favor of designing an API to make it as difficult as possible to have missing/incorrect metadata, but it's not obvious to me what that would look like. Maybe require HDR metadata always be supplied if a HDR color space is used, for starters?

Ralith avatar Dec 12 '21 20:12 Ralith

10-bit encoding of sRGB has been released.

Encoding of HDR is still an open issue. What formats would you supply HDR images in? OpenEXR?

kornelski avatar Jan 27 '23 04:01 kornelski

That's again a non-issue for library users, which can just pass in raw uncompressed HDR10 bitmaps. Raw half-float bitmaps might also be useful.

Ralith avatar Jan 27 '23 06:01 Ralith