pnggroup / libpng

LIBPNG: Portable Network Graphics support, official libpng repository
http://libpng.sf.net
Other
1.3k stars 628 forks source link

Implement cLLi chunk described in PNG 3rd Edition (Priority 3) #510

Open digitaltvguy opened 11 months ago

digitaltvguy commented 11 months ago

cLLi (Content Light Level Information) identifies luminance characteristics in the content itself and provides a method for tone mapping optimization.

jbowler commented 2 months ago

@ctruta: [libpng18] implementor required.

Part of a W3C draft so can't be done yet but preliminary implementations are possible. The draft definition is here:

https://www.w3.org/TR/png-3/#cLLi-chunk

Provides a hint as to the actual data but not reliable (the actual data is the authority, obviously). Ambiguous definition because it is not clear whether the absolute units are scene or display relative. Has a range of 2E5 to 1E-4 cd/m2 so inadequate for scene absolute information but accommodates the lowest range of human color vision so possibly intended for display relative use.

MaxCLL (Maximum Content Light Level) uses a static metadata value to indicate the maximum light level of any single pixel (in cd/m2, also known as nits) of the entire playback sequence.

Note that the values in the chunk use a novel encoding; rather than dividing by 100000 they divide by 10000! Whatever - neither value has much merit given that the SI uses multiples of 3. Implementation requires new code to scale the value from floating point without overflow. Maybe to in [libpng-ng] because binary16 can't represent the upper limit.

The chunk has artistic application because, hey, artists can lie! We can use the chunk to encode our desired lighting level regardless of the actual definition to achieve artistic effect in both HDR (better than 24-bit) and FDR (full dynamic range) images.

Personally I'd just use sCAL, but that doesn't work for obscure encodings.