Skip to content

Commit

Permalink
fix bug where the unclamped value is being sent into the PQ encoding …
Browse files Browse the repository at this point in the history
…function and HLG encoding instead of using the clamped value defined on the above line
  • Loading branch information
scottdyer committed Jul 24, 2024
1 parent 3c2bd52 commit 4457bb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Lib.Academy.DisplayEncoding.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ float[3] eotf_inv( float rgb_linear[3],
return pow_f3( rgb_clamped, 1/2.6);
} else if (eotf_enum == 4) { // ST. 2084
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, referenceLuminance);
return Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_linear) );
return Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_clamped) );
} else if (eotf_enum == 5) { // HLG
float rgb_clamped[3] = clamp_f3( rgb_linear, 0.0, referenceLuminance);
float PQ[3] = Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_linear) );
float PQ[3] = Y_to_ST2084_f3( mult_f_f3( referenceLuminance, rgb_clamped) );
return ST2084_to_HLG_1000nits_f3( PQ );
} else { // display linear
return rgb_linear;
Expand Down

0 comments on commit 4457bb2

Please sign in to comment.