Skip to content

Commit

Permalink
remove clamp in eotf_inv since values should already be clamped from …
Browse files Browse the repository at this point in the history
…the white_limiting step which includes a clamp to peakLuminance
  • Loading branch information
scottdyer committed Aug 17, 2024
1 parent feb97bd commit 41cd735
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/Lib.Academy.DisplayEncoding.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -356,29 +356,23 @@ float[3] eotf_inv( float rgb_linear[3],
return rgb_linear;
} else if (eotf_enum == 1) {
// ST. 2084
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, referenceLuminance);
return Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_clamped) );
return Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_linear) );
} else if (eotf_enum == 2) {
// HLG
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, referenceLuminance);
float PQ[3] = Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_clamped) );
float PQ[3] = Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_linear) );
return ST2084_to_HLG_1000nits_f3( PQ );
} else if (eotf_enum == 3) {
// gamma 2.6
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, 1.0);
return pow_f3( rgb_clamped, 1/2.6);
return pow_f3( rgb_linear, 1/2.6);
} else if (eotf_enum == 4) {
// BT.1886 with gamma 2.4
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, 1.0);
return bt1886_inv_f3( rgb_clamped, 2.4, 1.0, 0.0 );
return bt1886_inv_f3( rgb_linear, 2.4, 1.0, 0.0 );
} else if (eotf_enum == 5) {
// gamma 2.2
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, 1.0);
return pow_f3( rgb_clamped, 1/2.2);
return pow_f3( rgb_linear, 1/2.2);
} else {
// sRGB IEC 61966-2-1:1999
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, 1.0);
return moncurve_inv_f3( rgb_clamped, 2.4, 0.055);
return moncurve_inv_f3( rgb_linear, 2.4, 0.055);
}
}

Expand Down

0 comments on commit 41cd735

Please sign in to comment.