User:Smoro100/sandbox

ICTCP, ICtCp, or ITP is a color space used as a part of the color image pipeline in video and digital photography systems for High-Dynamic-Range and Wide-Color-Gamut imagery and is specified in ITU-R BT.2100. I is the intensity luma component encoded using the PQ SMPTE ST 2084 or Hybrid Log-Gamma non-linearity and CT and CP are the blue-yellow (named from tritanopia) and red-green (named from protanopia) chroma components.

ICtCp is defined from BT.2100 RGB as follows:

Calculate LMS from BT.2100:
 * $$\begin{align}

L &= ( 1688 \cdot R + 2146 \cdot G + 262 \cdot B) / 4096\\ M &= ( 683 \cdot R + 2951 \cdot G + 462 \cdot B) / 4096\\ S &= ( 99 \cdot R + 309 \cdot G + 3688 \cdot B) / 4096\\ \end{align}$$

Calculate L'M'S' using the PQ inverse EOTF (the HLG OETF may also be used):
 * $$\begin{align}

L' &= EOTF_{PQ}^{-1}(L)\\ M' &= EOTF_{PQ}^{-1}(M)\\ S' &= EOTF_{PQ}^{-1}(S)\\ \end{align}$$

Calculate ICtCp:
 * $$\begin{align}

I &= ( 0.5 \cdot L' + 0.5 \cdot M')\\ C_T &= ( 6610 \cdot L' - 13613 \cdot M' + 7003 \cdot S') / 4096\\ C_P &= ( 17933 \cdot L' - 17390 \cdot M' - 543 \cdot S') / 4096\\ \end{align}$$

ICTCP is near constant luminance, which improves chroma subsampling versus YCbCr. ICTCP also improves hue linearity compared with YCbCr which helps with compression performance and color volume mapping. With reshaping, ICTCP can improve compression performance by 10%.