sketch PQ and HLG APIs

In the end I'd like to support 3 new forms to transfer function,

   - PQ / inv PQ
   - HLG
   - inv HLG

PQ's inverse is in the same form, but no luck for HLG.

I've written the HLG and inv HLG factories to take the same parameters,
hoping that makes things easier to work with.  I figure most people come
at this from the perspective of the encoding inverse HLG (hence the
"log" in the name... it's not HEG hybrid-exponent-gamma), so those
shared parameters are in the form most natural to describe the inverse,
making the description of the decoding HLG forward direction just a bit

It's unclear to me if we really want to be the arbiters of canonical
"PQ" or "HLG" functions or if we just provide the PQ-ish and HLG-ish
factories.  There's so much nuance and opinion involved in what the
output range of these functions should be.   PQ 0->1 or 0->10000?  HLG
0->1 or 0->12?  Or some other range!?

I'm also uncertain whether HLG and its inverse will need a parameter
to control the gamma/log crossover point, or if it's always best at 1.
Will probably find this out as I implement and test.

I learned even the beautiful PQ function needs a clamp up to zero
in its numerator or the math will go complex.  Crushed my heart.

So far I'm roughly at:
   [x] draft some APIs
   [x] impl. and test scalar PQ
   [ ] impl. and test scalar HLG
   [ ] impl. and test vector PQ
   [ ] impl. and test vector HLG
   [ ] make sure we're happy with APIs

I think this might be a good first spot to land now that
the unit tests do their first vaguely interesting work.

Bug: chromium:960620
Change-Id: If22584f8ad24158fdaf3c30e084dd6754455d8fb
Commit-Queue: Mike Klein <>
Reviewed-by: Brian Osman <>
3 files changed