So in config:
- Transform to E Gamut
- Apply Shaper
Then In python
- Record Original Input value as variable
- Decode Shaper
- Transform from E Gamut to BT.709 (or whatever the display encoding is)
- Compare range, storing the boolean value in a variable for valid range
- Apply Low side Guard Rail function
- Apply High side Guard Rail function
- Transform from BT.709 to E Gamut
- Re-apply shaper
- Use the boolean variable, output Original Input value if valid == True
Then in config
- Decode shaper
- Transform from E Gamut to sRGB 2.2
If I change the input primaries to BT.709, then there is no need to transform from and to E gamut in the python script. But then wider gamut renders will be clipped. But anything wider than BT.709 would shift the values around due to precision, even P3.