OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
Noel Gordon
2016/02/17 10:42:24
Nit: 2015 -> 2016.
radu.velea
2016/02/17 11:31:00
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the Chromium LICENSE file. | |
4 | |
5 #include "qcmsint.h" | |
6 | |
7 #include <math.h> | |
8 | |
9 typedef struct _qcms_coords { | |
10 float x; | |
11 float y; | |
12 } qcms_coords; | |
13 | |
14 typedef struct _qcms_triangle { | |
15 qcms_coords verticies[3]; | |
16 } qcms_triangle; | |
17 | |
18 #define NTSC_1953_GAMUT_SIZE 0.1582 | |
19 | |
20 static qcms_triangle get_profile_triangle(qcms_profile *profile) | |
21 { | |
22 float sumRed = s15Fixed16Number_to_float(profile->redColorant.X) + | |
23 s15Fixed16Number_to_float(profile->redColorant.Y) + | |
Noel Gordon
2016/02/17 10:42:24
Make the s15Fixed16Number_to_float line-up.
floa
radu.velea
2016/02/17 11:31:00
Done.
| |
24 s15Fixed16Number_to_float(profile->redColorant.Z); | |
25 float xRed = s15Fixed16Number_to_float(profile->redColorant.X) / sumRed; | |
26 float yRed = s15Fixed16Number_to_float(profile->redColorant.Y) / sumRed; | |
27 | |
28 float sumGreen = s15Fixed16Number_to_float(profile->greenColorant.X) + | |
29 s15Fixed16Number_to_float(profile->greenColorant.Y) + | |
30 s15Fixed16Number_to_float(profile->greenColorant.Z); | |
31 float xGreen = s15Fixed16Number_to_float(profile->greenColorant.X) / sumGree n; | |
32 float yGreen = s15Fixed16Number_to_float(profile->greenColorant.Y) / sumGree n; | |
33 | |
34 float sumBlue = s15Fixed16Number_to_float(profile->blueColorant.X) + | |
35 s15Fixed16Number_to_float(profile->blueColorant.Y) + | |
36 s15Fixed16Number_to_float(profile->blueColorant.Z); | |
37 float xBlue = s15Fixed16Number_to_float(profile->blueColorant.X) / sumBlue; | |
38 float yBlue = s15Fixed16Number_to_float(profile->blueColorant.Y) / sumBlue; | |
39 | |
40 qcms_triangle triangle = {{{xRed, yRed}, {xGreen, yGreen}, {xBlue, yBlue}}}; | |
41 | |
Noel Gordon
2016/02/17 10:42:24
Remove this blank line.
radu.velea
2016/02/17 11:31:00
Done.
| |
42 return triangle; | |
43 } | |
44 | |
45 static float get_triangle_area(const qcms_triangle candidate) | |
46 { | |
47 float xRed = candidate.verticies[0].x; | |
48 float yRed = candidate.verticies[0].y; | |
49 float xGreen = candidate.verticies[1].x; | |
50 float yGreen = candidate.verticies[1].y; | |
51 float xBlue = candidate.verticies[2].x; | |
52 float yBlue = candidate.verticies[2].y; | |
53 float A = fabs((xRed - xBlue) * (yGreen - yBlue) - (xGreen - xBlue) * (yRed - yBlue)) / 2; | |
Noel Gordon
2016/02/17 10:42:24
nit: Space before this line.
Also, A -> area.
fl
radu.velea
2016/02/17 11:31:00
Done.
| |
54 | |
55 return A; | |
56 } | |
57 | |
58 static float get_ntsc_gamut_metric_area(const qcms_triangle candidate) | |
59 { | |
60 float A = get_triangle_area(candidate); | |
Noel Gordon
2016/02/17 10:42:24
nit: A -> area.
radu.velea
2016/02/17 11:31:00
Done.
| |
61 return A * 100 / NTSC_1953_GAMUT_SIZE; | |
62 } | |
63 | |
64 float qcms_profile_ntsc_relative_gamut_size(qcms_profile *profile) | |
65 { | |
66 qcms_triangle triangle = get_profile_triangle(profile); | |
Noel Gordon
2016/02/17 10:42:24
nit: alignment / spacing.
Compare with this align
radu.velea
2016/02/17 11:31:00
Done.
| |
67 return get_ntsc_gamut_metric_area(triangle); | |
68 } | |
69 | |
70 | |
OLD | NEW |