rez icon indicating copy to clipboard operation
rez copied to clipboard

Gamma handling?

Open lilith opened this issue 9 years ago • 1 comments

24-bit RGB and YCbCr both use a gamma-adjusted scale for luminosity. Averaging of luminosity values must be done in the linear space in order to avoid corruption (shadows expanding/eating nearby pixels).

Does this library address this? I don't see a reference to gamma adjustment, and the storage format appears to be 8-bit per channel, which can only contain gamma-adjusted data without loss, since you need 14 bits to store linearized values without truncation.

The approach you took to SIMD acceleration here is impressive; I haven't seen an equivalent elsewhere.

lilith avatar Jul 09 '15 16:07 lilith

No, the library only support 8-bit currently, which means no gamma correction To do that, like you said, you would need to add 8-bit to N-bit conversion, N-bit resize and N-bit to 8-bit. That was part of my original plans but lost motivation along the way.

Also, I'm not completely satisfied by the current design. Adding N-bit resizes would explode complexity, and maybe just in time code generation is a better way forward.

Anyway, thanks for your comments !

bamiaux avatar Jul 09 '15 18:07 bamiaux