AOMediaCodec / av1-avif

AV1 Image File Format Specification - ISO-BMFF/HEIF derivative
https://aomediacodec.github.io/av1-avif/
BSD 2-Clause "Simplified" License
450 stars 40 forks source link

HDR and monochrome images #203

Open 0xC0000054 opened 1 year ago

0xC0000054 commented 1 year ago

Is it valid for a monochrome image to use the HDR transfer curves?

ITU-R BT.2100-2 does not appear to have any references to monochrome images, but the transfer curve should work the same way for both monochrome and RGB data. SMPTE 428-1-2006 also makes no mention of monochrome images, and I am not sure if its transfer function is implied to require RGB.

I created two grayscale test images in Photoshop that have the PQ or SMPTE 428 transfer curves applied when saving. The images appear to load fine in Krita, but there are some tone differences in Chrome 107.0.5304.107.

It appears that Krita only applies the PQ and SMPTE 428 transfer curves to RGB images, grayscale images are saved as SDR.

hdr monochrome.zip

leo-barnes commented 1 year ago

Is it valid for a monochrome image to use the HDR transfer curves?

Yes, that should be valid AFAIK. Monochrome images can be tagged with transfer curves, otherwise you would have no way of knowing if they are in linear or gamma space. Unless the specs that describe the curves somehow state that they don't work for monochrome images I can't see why HDR curves should not apply.

0xC0000054 commented 1 year ago

Unless the specs that describe the curves somehow state that they don't work for monochrome images I can't see why HDR curves should not apply.

The math for SMPTE 428-1-2006 and ITU-R BT.2100-2 HLG appears to assume RGB data. But it appears that ITU-R BT.2100-2 PQ may support monochrome:

"FD is the luminance of a displayed linear component {RD, GD, BD} or YD or ID, in cd/m2."

I am currently thinking I will disable HDR saving for monochrome images, this is probably the safest option in case I have misunderstood the various specs.