1
1
2
2
function XYZ_to_ICtCp ( XYZ ) {
3
- // convert an array of absolute, D65 XYZ to the ICtCp form of LMS
3
+ // convert an array of absolute, D65 XYZ to the ICtCp form of LMS
4
4
5
5
// The matrix below includes the 4% crosstalk components
6
6
// and is from the procedure in the Dolby "What is ICtCp" paper"
@@ -32,17 +32,17 @@ function LMStoICtCp (LMS) {
32
32
[ 17933 / 4096 , - 17390 / 4096 , - 543 / 4096 ] ,
33
33
] ;
34
34
35
- // apply the PQ EOTF
36
- // we can't ever be dividing by zero because of the "1 +" in the denominator
37
- let PQLMS = LMS . map ( function ( val ) {
38
- let num = c1 + ( c2 * ( ( val / 10000 ) ** m1 ) ) ;
39
- let denom = 1 + ( c3 * ( ( val / 10000 ) ** m1 ) ) ;
35
+ // apply the PQ EOTF
36
+ // we can't ever be dividing by zero because of the "1 +" in the denominator
37
+ let PQLMS = LMS . map ( function ( val ) {
38
+ let num = c1 + ( c2 * ( ( val / 10000 ) ** m1 ) ) ;
39
+ let denom = 1 + ( c3 * ( ( val / 10000 ) ** m1 ) ) ;
40
40
41
- return ( num / denom ) ** m2 ;
42
- } ) ;
41
+ return ( num / denom ) ** m2 ;
42
+ } ) ;
43
43
44
- // LMS to IPT, with rotation for Y'C'bC'r compatibility
45
- return multiplyMatrices ( M , PQLMS ) ;
44
+ // LMS to IPT, with rotation for Y'C'bC'r compatibility
45
+ return multiplyMatrices ( M , PQLMS ) ;
46
46
}
47
47
48
48
function ICtCp_to_XYZ ( ICtCp ) {
@@ -55,7 +55,7 @@ function ICtCp_to_XYZ (ICtCp) {
55
55
] ;
56
56
57
57
let LMS = ICtCptoLMS ( ICtCp ) ;
58
- return multiplyMatrices ( M , LMS ) ;
58
+ return multiplyMatrices ( M , LMS ) ;
59
59
}
60
60
61
61
function ICtCptoLMS ( ICtCp ) {
@@ -72,14 +72,14 @@ function ICtCptoLMS (ICtCp) {
72
72
[ 0.9999999999999998 , 0.5600313357106791 , - 0.3206271749873188 ] ,
73
73
] ;
74
74
75
- let PQLMS = multiplyMatrices ( M , ICtCp ) ;
75
+ let PQLMS = multiplyMatrices ( M , ICtCp ) ;
76
76
77
- // Undo PQ encoding, From BT.2124-0 Annex 2 Conversion 3
78
- let LMS = PQLMS . map ( function ( val ) {
79
- let num = Math . max ( ( val ** im2 ) - c1 , 0 ) ;
80
- let denom = ( c2 - ( c3 * ( val ** im2 ) ) ) ;
81
- return 10000 * ( ( num / denom ) ** im1 ) ;
82
- } ) ;
77
+ // Undo PQ encoding, From BT.2124-0 Annex 2 Conversion 3
78
+ let LMS = PQLMS . map ( function ( val ) {
79
+ let num = Math . max ( ( val ** im2 ) - c1 , 0 ) ;
80
+ let denom = ( c2 - ( c3 * ( val ** im2 ) ) ) ;
81
+ return 10000 * ( ( num / denom ) ** im1 ) ;
82
+ } ) ;
83
83
84
- return LMS ;
84
+ return LMS ;
85
85
}
0 commit comments