.3DL format support

Jeremy Selan <jeremy...@...>

I'm fleshing out support for additional lut formats, and have a
question on 3d.

There's a 1D shaper lut at the top of the file, and the 3D component
further on, all of which use integer types. Simple enough. However,
the range of the integers appears not to be explicitly specified.

In the examples I've found thus far, all values appear to be either
10, 12, or 16 bit int. (and in a few cases the shaper lut and the 3d
component do not appear to have the same bit depth).

This means we'll need to be clever (bad clever, not good clever) in
determining bit depth.

if maxValue > 32768: return 16
if maxValue > 2048: return 12
if maxValue > 512: return 10

This would mean for a max value [513,2047] -> 10 bits, [2048,32768]
-> 12 bits, etc.
(I'm allowing for a bit of overshoot in the luts, presuming 11 / 13
bit luts aren't allowed).

The obvious downside (other than ugliness) is that depending on the
thresholds, you wouldnt be able to make a really dark lut which didnt
use the full range of output values. (Consider a 12 bit lut where you
really did want to darken the image below 512). This is unlikely to
happen in practice, but a bit unsettling.

How do other people handle this issue?

Should we only handle 10,12,16 bit luts, or all even bit depths >=8?