Skip to content

Commit 4ccda9d

Browse files
committed
Remove div
1 parent f589548 commit 4ccda9d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dssim-core/src/tolab.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::lieon as rayon;
1010
use rayon::prelude::*;
1111

1212
const D65x: f32 = 0.9505;
13+
const D65y: f32 = 1.0;
1314
const D65z: f32 = 1.089;
1415

1516
pub type GBitmap = ImgVec<f32>;
@@ -24,9 +25,9 @@ fn fma_matrix(r: f32, rx: f32, g: f32, gx: f32, b: f32, bx: f32) -> f32 {
2425

2526
impl ToLAB for RGBLU {
2627
fn to_lab(&self) -> (f32, f32, f32) {
27-
let fx = fma_matrix(self.r, 0.4124, self.g, 0.3576, self.b, 0.1805) / D65x;
28-
let fy = fma_matrix(self.r, 0.2126, self.g, 0.7152, self.b, 0.0722); // D65y is 1.0
29-
let fz = fma_matrix(self.r, 0.0193, self.g, 0.1192, self.b, 0.9505) / D65z;
28+
let fx = fma_matrix(self.r, 0.4124 / D65x, self.g, 0.3576 / D65x, self.b, 0.1805 / D65x);
29+
let fy = fma_matrix(self.r, 0.2126 / D65y, self.g, 0.7152 / D65y, self.b, 0.0722 / D65y);
30+
let fz = fma_matrix(self.r, 0.0193 / D65z, self.g, 0.1192 / D65z, self.b, 0.9505 / D65z);
3031

3132
let epsilon: f32 = 216. / 24389.;
3233
let k = 24389. / (27. * 116.); // http://www.brucelindbloom.com/LContinuity.html

0 commit comments

Comments
 (0)