Initial commit: ArgyllCMS v3.5.0 and multichannel profiling research

This commit is contained in:
2026-10-31 14:27:14 +03:30
commit 66f664fc82
1828 changed files with 1123613 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
CTI2
DESCRIPTOR "Argyll Calibration Target chart information 2"
# Standard Macbeth ColorChecker 6x4 chart, read patch by patch
ORIGINATOR "Argyll printtarg"
CREATED "Wed Apr 11 22:19:15 2007"
KEYWORD "TARGET_INSTRUMENT"
TARGET_INSTRUMENT "GretagMacbeth SpectroScan"
KEYWORD "APPROX_WHITE_POINT"
APPROX_WHITE_POINT "86.776 90.361 70.642"
KEYWORD "COLOR_REP"
COLOR_REP "RGB"
KEYWORD "STEPS_IN_PASS"
STEPS_IN_PASS "6"
KEYWORD "PASSES_IN_STRIPS2"
PASSES_IN_STRIPS2 "4"
KEYWORD "STRIP_INDEX_PATTERN"
STRIP_INDEX_PATTERN "A-Z, 2-9;A-X,2A-9Z"
KEYWORD "PATCH_INDEX_PATTERN"
PATCH_INDEX_PATTERN "0-9,@-9,@-9;1-999"
KEYWORD "SAMPLE_LOC"
NUMBER_OF_FIELDS 9
BEGIN_DATA_FORMAT
SAMPLE_ID SAMPLE_LOC RGB_R RGB_G RGB_B XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 24
BEGIN_DATA
1 "A1" 0 0 0 11.773 10.213 4.9219
2 "A2" 0 0 0 40.174 36.201 20.217
3 "A3" 0 0 0 17.675 19.409 26.983
4 "A4" 0 0 0 11.121 13.530 5.5615
5 "A5" 0 0 0 25.551 24.404 34.847
6 "A6" 0 0 0 31.744 43.164 35.249
7 "B1" 0 0 0 40.056 30.947 4.8180
8 "B2" 0 0 0 12.544 11.700 28.648
9 "B3" 0 0 0 30.675 20.352 10.837
10 "B4" 0 0 0 8.3961 6.5047 10.849
11 "B5" 0 0 0 36.036 44.991 8.9494
12 "B6" 0 0 0 50.203 44.570 6.2773
13 "C1" 0 0 0 7.4590 6.0952 23.518
14 "C2" 0 0 0 15.439 23.986 7.7482
15 "C3" 0 0 0 22.850 13.022 4.1188
16 "C4" 0 0 0 59.637 60.332 7.3520
17 "C5" 0 0 0 30.450 20.015 22.947
18 "C6" 0 0 0 13.591 19.466 30.479
19 "D1" 0 0 0 86.776 90.361 70.642
20 "D2" 0 0 0 56.865 59.038 48.218
21 "D3" 0 0 0 34.763 36.036 29.378
22 "D4" 0 0 0 18.884 19.603 16.309
23 "D5" 0 0 0 8.4332 8.7464 7.1022
24 "D6" 0 0 0 3.0110 3.0971 2.5475
END_DATA

1578
Argyll_V3.5.0/target/ECI2002.ti2 Executable file

File diff suppressed because it is too large Load Diff

1517
Argyll_V3.5.0/target/ECI2002R.ti2 Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,120 @@
CTI1
DESCRIPTOR "Argyll Calibration Target chart information 1"
ORIGINATOR "Manualy created for FOGRA strip #2 "
CREATED "Wed Jun 1 15:06:24 2004"
KEYWORD "DEFAULT_EXPECTED_VALUES"
DEFAULT_EXPECTED_VALUES "true"
KEYWORD "APPROX_WHITE_POINT"
APPROX_WHITE_POINT "83.77 87.26 66.79"
KEYWORD "TOTAL_INK_LIMIT"
TOTAL_INK_LIMIT "270.0"
KEYWORD "COLOR_REP"
COLOR_REP "CMYK"
KEYWORD "SAMPLE_LOC"
NUMBER_OF_FIELDS 8
BEGIN_DATA_FORMAT
SAMPLE_ID CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 46
BEGIN_DATA
1 100 0 0 0 19.21 25.37 45.6
2 70 0 0 0 28.25 35.4 51.26
3 40 0 0 0 45.2 52.51 58.34
4 0 100 0 0 35.66 21.75 16.18
5 0 70 0 0 41.16 28.04 22.51
6 0 40 0 0 54.44 44.85 37.56
7 0 0 100 0 70.46 73.51 10.34
8 0 0 70 0 72.54 76.67 16.6
9 0 0 40 0 76.58 81.29 31.57
10 20 70 70 0 26.84 20.24 9.68
11 40 70 70 20 15.21 13.33 8.47
12 40 100 100 20 13.26 10.8 6.56
13 40 100 40 20 15.41 12.16 10.32
14 40 40 100 20 17.64 18.07 7.7
15 100 40 100 20 8.74 11.04 7.8
16 100 40 40 20 10.64 12.84 14.75
17 100 100 40 20 8.44 8.45 10.12
18 0 0 0 10 69.21 72.04 55.31
19 0 0 0 20 57.67 59.99 46.27
20 0 0 0 40 37.79 39.2 30.25
21 0 0 0 60 22.87 23.62 18.11
22 0 0 0 80 12.52 12.83 9.74
23 0 0 0 100 7.34 7.42 5.6
24 100 100 0 0 10.64 10.02 15.7
25 70 70 0 0 15.73 14.48 21.18
26 40 40 0 0 31.46 29.92 34.72
27 0 100 100 0 32.06 19.73 6.79
28 0 70 70 0 37.86 26.24 10.23
29 0 40 40 0 50.42 41.91 21.32
30 100 0 100 0 11.84 18.76 9.74
31 70 0 70 0 20.00 28.29 14.84
32 40 0 40 0 37.71 46.37 28.51
33 10 40 40 0 44.02 38.09 21.16
34 0 40 100 0 46.00 37.51 8.7
35 0 100 40 0 34.28 21.23 12.07
36 40 100 0 0 20.58 15.09 16.73
37 40 0 100 0 32.29 40.42 10.44
38 100 0 40 0 15.35 22.58 24.53
39 100 40 0 0 14.68 16.88 29.74
40 0 0 0 0 83.77 87.26 66.79
41 10 6 6 0 69.49 73.01 57.1
42 20 12 12 0 53.95 56.73 46.26
43 40 27 27 0 31.75 33.56 28.39
44 60 45 45 0 18.83 20.03 17.45
45 80 65 65 0 11.98 12.82 11.37
46 100 85 85 0 8.30 8.90 8.39
END_DATA
CTI1
DESCRIPTOR "Argyll Calibration Target chart information 1"
ORIGINATOR "Argyll targen"
KEYWORD "DENSITY_EXTREME_VALUES"
DENSITY_EXTREME_VALUES "8"
CREATED "April 22, 2008"
KEYWORD "INDEX"
NUMBER_OF_FIELDS 8
BEGIN_DATA_FORMAT
INDEX CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 8
BEGIN_DATA
0 0.0000 0.0000 0.0000 0.0000 96.420 100.00 82.490
1 100.00 0.0000 0.0000 0.0000 12.000 18.000 48.000
2 0.0000 100.00 0.0000 0.0000 38.000 19.000 20.000
3 100.00 0.0000 0.0000 45.486 3.2503 4.8706 13.063
4 0.0000 17.988 100.00 0.0000 59.720 57.803 8.0538
5 100.00 0.0000 100.00 40.023 3.1381 4.8335 2.1311
6 0.0000 100.00 100.00 18.089 19.420 9.9765 1.7309
7 0.0000 31.327 0.0000 100.00 0.65916 0.54433 0.57384
END_DATA
CTI1
DESCRIPTOR "Argyll Calibration Target chart information 1"
ORIGINATOR "Argyll targen"
KEYWORD "DEVICE_COMBINATION_VALUES"
DEVICE_COMBINATION_VALUES "9"
CREATED "April 22, 2008"
KEYWORD "INDEX"
NUMBER_OF_FIELDS 8
BEGIN_DATA_FORMAT
INDEX CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 9
BEGIN_DATA
0 0.0000 0.0000 0.0000 0.0000 96.420 100.00 82.490
1 100.00 0.0000 0.0000 0.0000 12.000 18.000 48.000
2 0.0000 100.00 0.0000 0.0000 38.000 19.000 20.000
3 100.00 100.00 0.0000 0.0000 4.7293 3.4200 11.638
4 0.0000 0.0000 100.00 0.0000 76.000 81.000 11.000
5 100.00 0.0000 100.00 0.0000 9.4586 14.580 6.4008
6 0.0000 100.00 100.00 0.0000 29.952 15.390 2.6670
7 100.00 100.00 100.00 100.00 0.038661 0.027702 0.018813
8 40.000 40.000 40.000 0.0000 19.978 17.645 12.009
END_DATA

View File

@@ -0,0 +1,75 @@
CTI2
DESCRIPTOR "Argyll Calibration Target chart information 2"
ORIGINATOR "Manualy created for FOGRA strip #2 in 2 strip layout"
CREATED "Wed Jun 1 15:06:24 2004"
KEYWORD "TARGET_INSTRUMENT"
TARGET_INSTRUMENT "GretagMacbeth SpectroScan"
KEYWORD "APPROX_WHITE_POINT"
APPROX_WHITE_POINT "83.77 87.26 66.79"
KEYWORD "TOTAL_INK_LIMIT"
TOTAL_INK_LIMIT "270.0"
KEYWORD "COLOR_REP"
COLOR_REP "CMYK"
KEYWORD "STEPS_IN_PASS"
STEPS_IN_PASS "23"
KEYWORD "PASSES_IN_STRIPS"
PASSES_IN_STRIPS "2"
KEYWORD "SAMPLE_LOC"
NUMBER_OF_FIELDS 9
BEGIN_DATA_FORMAT
SAMPLE_ID SAMPLE_LOC CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 46
BEGIN_DATA
1 "A1" 100 0 0 0 19.21 25.37 45.6
2 "A2" 70 0 0 0 28.25 35.4 51.26
3 "A3" 40 0 0 0 45.2 52.51 58.34
4 "A4" 0 100 0 0 35.66 21.75 16.18
5 "A5" 0 70 0 0 41.16 28.04 22.51
6 "A6" 0 40 0 0 54.44 44.85 37.56
7 "A7" 0 0 100 0 70.46 73.51 10.34
8 "A8" 0 0 70 0 72.54 76.67 16.6
9 "A9" 0 0 40 0 76.58 81.29 31.57
10 "A10" 20 70 70 0 26.84 20.24 9.68
11 "A11" 40 70 70 20 15.21 13.33 8.47
12 "A12" 40 100 100 20 13.26 10.8 6.56
13 "A13" 40 100 40 20 15.41 12.16 10.32
14 "A14" 40 40 100 20 17.64 18.07 7.7
15 "A15" 100 40 100 20 8.74 11.04 7.8
16 "A16" 100 40 40 20 10.64 12.84 14.75
17 "A17" 100 100 40 20 8.44 8.45 10.12
18 "A18" 0 0 0 10 69.21 72.04 55.31
19 "A19" 0 0 0 20 57.67 59.99 46.27
20 "A20" 0 0 0 40 37.79 39.2 30.25
21 "A21" 0 0 0 60 22.87 23.62 18.11
22 "A22" 0 0 0 80 12.52 12.83 9.74
23 "A23" 0 0 0 100 7.34 7.42 5.6
24 "B1" 100 100 0 0 10.64 10.02 15.7
25 "B2" 70 70 0 0 15.73 14.48 21.18
26 "B3" 40 40 0 0 31.46 29.92 34.72
27 "B4" 0 100 100 0 32.06 19.73 6.79
28 "B5" 0 70 70 0 37.86 26.24 10.23
29 "B6" 0 40 40 0 50.42 41.91 21.32
30 "B7" 100 0 100 0 11.84 18.76 9.74
31 "B8" 70 0 70 0 20.00 28.29 14.84
32 "B9" 40 0 40 0 37.71 46.37 28.51
33 "B10" 10 40 40 0 44.02 38.09 21.16
34 "B11" 0 40 100 0 46.00 37.51 8.7
35 "B12" 0 100 40 0 34.28 21.23 12.07
36 "B13" 40 100 0 0 20.58 15.09 16.73
37 "B14" 40 0 100 0 32.29 40.42 10.44
38 "B15" 100 0 40 0 15.35 22.58 24.53
39 "B16" 100 40 0 0 14.68 16.88 29.74
40 "B17" 0 0 0 0 83.77 87.26 66.79
41 "B18" 10 6 6 0 69.49 73.01 57.1
42 "B19" 20 12 12 0 53.95 56.73 46.26
43 "B20" 40 27 27 0 31.75 33.56 28.39
44 "B21" 60 45 45 0 18.83 20.03 17.45
45 "B22" 80 65 65 0 11.98 12.82 11.37
46 "B23" 100 85 85 0 8.30 8.90 8.39
END_DATA

View File

@@ -0,0 +1,146 @@
CTI1
DESCRIPTOR "Argyll Calibration Target chart information 1"
ORIGINATOR "Manualy created for FOGRA strip #3 "
CREATED "Thu Jan 12 15:06:24 2011"
KEYWORD "DEFAULT_EXPECTED_VALUES"
DEFAULT_EXPECTED_VALUES "true"
KEYWORD "APPROX_WHITE_POINT"
APPROX_WHITE_POINT "87.38 90.38 75.45"
KEYWORD "TOTAL_INK_LIMIT"
TOTAL_INK_LIMIT "270.0"
KEYWORD "COLOR_REP"
COLOR_REP "CMYK"
KEYWORD "SAMPLE_LOC"
NUMBER_OF_FIELDS 9
BEGIN_DATA_FORMAT
SAMPLE_ID CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 72
BEGIN_DATA
1 100 0 0 0 14.91 22.41 53.72
2 70 0 0 0 24.6 32.11 56.56
3 40 0 0 0 41.86 48.84 63.97
4 20 0 0 0 59.49 65.47 69.4
5 10 0 0 0 71.85 76.74 72.45
6 0 100 0 0 35.87 18.39 16.7
7 0 70 0 0 42.6 27.5 24.95
8 0 40 0 0 56.48 44.98 40.26
9 0 20 0 0 69.77 63.34 55.08
10 0 10 0 0 79.71 77.36 66.28
11 0 0 100 0 74.36 78.79 7.06
12 0 0 70 0 75.77 80.62 16.06
13 0 0 40 0 78.94 83.73 32.04
14 0 0 20 0 82.9 87.23 49.82
15 0 0 10 0 85.2 88.98 61.85
16 0 0 0 10 67.91 70.15 58.39
17 0 0 0 20 49.47 51.05 42.55
18 0 0 0 40 30.07 30.99 26.02
19 0 0 0 60 15.9 16.31 13.78
20 0 0 0 80 7.04 7.13 6.22
21 0 0 0 100 1.69 1.61 1.67
22 0 100 0 100 1.41 1.14 1.48
23 0 70 70 60 9.68 7.17 3.38
24 0 0 70 80 7.27 7.64 3.38
25 100 100 0 0 4.35 2.81 13.31
26 70 70 0 0 12.04 10.07 21.64
27 40 40 0 0 28.32 26.36 35.63
28 20 20 0 0 47.53 46.5 50.03
29 10 10 0 0 64.23 64.56 61.64
30 0 100 100 0 32.69 17.25 2.74
31 0 70 70 0 39.4 25.83 7.73
32 0 40 40 0 52.14 42.32 20.67
33 0 20 20 0 66.2 60.84 38.79
34 0 10 10 0 77.01 75.27 54.63
35 100 0 100 0 6.66 16.31 5.63
36 70 0 70 0 16.97 26.86 13.73
37 40 0 40 0 35.31 44.25 29.06
38 20 0 20 0 55.17 62.38 46.73
39 10 0 10 0 69.88 75.46 59.92
40 10 6 6 0 66.27 68.73 60.0
41 20 12 12 0 48.71 50.74 45.17
42 40 27 27 0 28.15 29.54 26.91
43 60 45 45 0 15.65 16.58 15.62
44 80 65 65 0 7.41 7.92 7.94
45 100 85 85 0 3.11 3.51 4.29
46 100 0 0 100 1.00 1.07 1.42
47 20 100 70 60 6.34 3.91 2.68
48 70 0 70 80 3.22 4.15 3.04
49 100 100 100 0 2.42 2.16 2.69
50 70 70 70 0 8.92 8.36 6.83
51 40 40 40 0 24.72 24.12 18.8
52 20 20 20 0 44.17 44.18 35.62
53 10 10 10 0 61.84 62.76 51.51
54 20 70 70 0 26.95 19.18 7.57
55 40 70 70 20 13.71 10.9 5.89
56 40 100 100 20 10.62 6.33 2.41
57 40 100 40 20 11.7 6.77 7.24
58 40 40 100 20 16.45 16.81 3.73
59 100 40 100 20 3.62 6.84 3.5
60 100 40 40 20 5.33 8.00 12.8
61 100 100 40 20 2.75 2.07 6.41
62 10 40 40 0 43.46 36.9 20.39
63 0 40 100 0 49.78 40.72 4.88
64 0 100 40 0 34.02 17.62 9.73
65 40 100 0 0 16.66 9.11 14.75
66 40 0 100 0 31.1 40.61 6.39
67 100 0 40 0 9.99 19.02 25.24
68 100 40 0 0 9.18 11.79 30.55
69 0 0 0 0 87.38 90.38 75.45
70 0 0 100 100 1.57 1.54 1.33
71 0 70 0 60 10.61 7.67 7.74
72 70 0 0 80 3.84 4.59 6.23
END_DATA
CTI1
DESCRIPTOR "Argyll Calibration Target chart information 1"
ORIGINATOR "Argyll targen"
KEYWORD "DENSITY_EXTREME_VALUES"
DENSITY_EXTREME_VALUES "8"
CREATED "April 22, 2008"
KEYWORD "INDEX"
NUMBER_OF_FIELDS 8
BEGIN_DATA_FORMAT
INDEX CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 8
BEGIN_DATA
0 0.0000 0.0000 0.0000 0.0000 96.420 100.00 82.490
1 100.00 0.0000 0.0000 0.0000 12.000 18.000 48.000
2 0.0000 100.00 0.0000 0.0000 38.000 19.000 20.000
3 100.00 0.0000 0.0000 45.486 3.2503 4.8706 13.063
4 0.0000 17.988 100.00 0.0000 59.720 57.803 8.0538
5 100.00 0.0000 100.00 40.023 3.1381 4.8335 2.1311
6 0.0000 100.00 100.00 18.089 19.420 9.9765 1.7309
7 0.0000 31.327 0.0000 100.00 0.65916 0.54433 0.57384
END_DATA
CTI1
DESCRIPTOR "Argyll Calibration Target chart information 1"
ORIGINATOR "Argyll targen"
KEYWORD "DEVICE_COMBINATION_VALUES"
DEVICE_COMBINATION_VALUES "9"
CREATED "April 22, 2008"
KEYWORD "INDEX"
NUMBER_OF_FIELDS 8
BEGIN_DATA_FORMAT
INDEX CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 9
BEGIN_DATA
0 0.0000 0.0000 0.0000 0.0000 96.420 100.00 82.490
1 100.00 0.0000 0.0000 0.0000 12.000 18.000 48.000
2 0.0000 100.00 0.0000 0.0000 38.000 19.000 20.000
3 100.00 100.00 0.0000 0.0000 4.7293 3.4200 11.638
4 0.0000 0.0000 100.00 0.0000 76.000 81.000 11.000
5 100.00 0.0000 100.00 0.0000 9.4586 14.580 6.4008
6 0.0000 100.00 100.00 0.0000 29.952 15.390 2.6670
7 100.00 100.00 100.00 100.00 0.038661 0.027702 0.018813
8 40.000 40.000 40.000 0.0000 19.978 17.645 12.009
END_DATA

View File

@@ -0,0 +1,101 @@
CTI2
DESCRIPTOR "Argyll Calibration Target chart information 2"
ORIGINATOR "Manualy created for FOGRA strip #3 in 3 strip layout (E3Z)"
CREATED "Thu Jan 12 15:06:24 2011"
KEYWORD "TARGET_INSTRUMENT"
TARGET_INSTRUMENT "GretagMacbeth SpectroScan"
KEYWORD "APPROX_WHITE_POINT"
APPROX_WHITE_POINT "83.77 87.26 66.79"
KEYWORD "TOTAL_INK_LIMIT"
TOTAL_INK_LIMIT "270.0"
KEYWORD "COLOR_REP"
COLOR_REP "CMYK"
KEYWORD "STEPS_IN_PASS"
STEPS_IN_PASS "24"
KEYWORD "PASSES_IN_STRIPS"
PASSES_IN_STRIPS "3"
KEYWORD "SAMPLE_LOC"
NUMBER_OF_FIELDS 9
BEGIN_DATA_FORMAT
SAMPLE_ID SAMPLE_LOC CMYK_C CMYK_M CMYK_Y CMYK_K XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 72
BEGIN_DATA
1 "A1" 100 0 0 0 14.91 22.41 53.72
2 "A2" 70 0 0 0 24.6 32.11 56.56
3 "A3" 40 0 0 0 41.86 48.84 63.97
4 "A4" 20 0 0 0 59.49 65.47 69.4
5 "A5" 10 0 0 0 71.85 76.74 72.45
6 "A6" 0 100 0 0 35.87 18.39 16.7
7 "A7" 0 70 0 0 42.6 27.5 24.95
8 "A8" 0 40 0 0 56.48 44.98 40.26
9 "A9" 0 20 0 0 69.77 63.34 55.08
10 "A10" 0 10 0 0 79.71 77.36 66.28
11 "A11" 0 0 100 0 74.36 78.79 7.06
12 "A12" 0 0 70 0 75.77 80.62 16.06
13 "A13" 0 0 40 0 78.94 83.73 32.04
14 "A14" 0 0 20 0 82.9 87.23 49.82
15 "A15" 0 0 10 0 85.2 88.98 61.85
16 "A16" 0 0 0 10 67.91 70.15 58.39
17 "A17" 0 0 0 20 49.47 51.05 42.55
18 "A18" 0 0 0 40 30.07 30.99 26.02
19 "A19" 0 0 0 60 15.9 16.31 13.78
20 "A20" 0 0 0 80 7.04 7.13 6.22
21 "A21" 0 0 0 100 1.69 1.61 1.67
22 "A22" 0 100 0 100 1.41 1.14 1.48
23 "A23" 0 70 70 60 9.68 7.17 3.38
24 "A24" 0 0 70 80 7.27 7.64 3.38
25 "B1" 100 100 0 0 4.35 2.81 13.31
26 "B2" 70 70 0 0 12.04 10.07 21.64
27 "B3" 40 40 0 0 28.32 26.36 35.63
28 "B4" 20 20 0 0 47.53 46.5 50.03
29 "B5" 10 10 0 0 64.23 64.56 61.64
30 "B6" 0 100 100 0 32.69 17.25 2.74
31 "B7" 0 70 70 0 39.4 25.83 7.73
32 "B8" 0 40 40 0 52.14 42.32 20.67
33 "B9" 0 20 20 0 66.2 60.84 38.79
34 "B10" 0 10 10 0 77.01 75.27 54.63
35 "B11" 100 0 100 0 6.66 16.31 5.63
36 "B12" 70 0 70 0 16.97 26.86 13.73
37 "B13" 40 0 40 0 35.31 44.25 29.06
38 "B14" 20 0 20 0 55.17 62.38 46.73
39 "B15" 10 0 10 0 69.88 75.46 59.92
40 "B16" 10 6 6 0 66.27 68.73 60.0
41 "B17" 20 12 12 0 48.71 50.74 45.17
42 "B18" 40 27 27 0 28.15 29.54 26.91
43 "B19" 60 45 45 0 15.65 16.58 15.62
44 "B20" 80 65 65 0 7.41 7.92 7.94
45 "B21" 100 85 85 0 3.11 3.51 4.29
46 "B22" 100 0 0 100 1.00 1.07 1.42
47 "B23" 20 100 70 60 6.34 3.91 2.68
48 "B24" 70 0 70 80 3.22 4.15 3.04
49 "C1" 100 100 100 0 2.42 2.16 2.69
50 "C2" 70 70 70 0 8.92 8.36 6.83
51 "C3" 40 40 40 0 24.72 24.12 18.8
52 "C4" 20 20 20 0 44.17 44.18 35.62
53 "C5" 10 10 10 0 61.84 62.76 51.51
54 "C6" 20 70 70 0 26.95 19.18 7.57
55 "C7" 40 70 70 20 13.71 10.9 5.89
56 "C8" 40 100 100 20 10.62 6.33 2.41
57 "C9" 40 100 40 20 11.7 6.77 7.24
58 "C10" 40 40 100 20 16.45 16.81 3.73
59 "C11" 100 40 100 20 3.62 6.84 3.5
60 "C12" 100 40 40 20 5.33 8.00 12.8
61 "C13" 100 100 40 20 2.75 2.07 6.41
62 "C14" 10 40 40 0 43.46 36.9 20.39
63 "C15" 0 40 100 0 49.78 40.72 4.88
64 "C16" 0 100 40 0 34.02 17.62 9.73
65 "C17" 40 100 0 0 16.66 9.11 14.75
66 "C18" 40 0 100 0 31.1 40.61 6.39
67 "C19" 100 0 40 0 9.99 19.02 25.24
68 "C20" 100 40 0 0 9.18 11.79 30.55
69 "C21" 0 0 0 0 87.38 90.38 75.45
70 "C22" 0 0 100 100 1.57 1.54 1.33
71 "C23" 0 70 0 60 10.61 7.67 7.74
72 "C24" 70 0 0 80 3.84 4.59 6.23
END_DATA

74
Argyll_V3.5.0/target/Jamfile Executable file
View File

@@ -0,0 +1,74 @@
# Print Calibration Target Data File generator
#PREF_CCFLAGS += $(CCOPTFLAG) ; # Turn optimisation on
PREF_CCFLAGS += $(CCDEBUGFLAG) ; # Debugging flags
#PREF_CCFLAGS += $(CCHEAPDEBUG) ; # Heap Debugging flags
PREF_LINKFLAGS += $(LINKDEBUGFLAG) ; # Link debugging flags
#PREF_CCFLAGS += $(CCPROFFLAG) ; # Profile flags
#PREF_LINKFLAGS += $(LINKPROFFLAG) ; # Profile link flags
#Products
Executables = targen printtarg ;
Samples = ECI2002.ti2
ECI2002R.ti2
ColorChecker.ti2
FograStrip2.ti1 FograStrip2_2.ti2
FograStrip3.ti1 FograStrip3_3.ti2
i1_RGB_Scan_1.4.ti2 ;
#Install
InstallBin $(DESTDIR)$(PREFIX)/bin : $(Executables) ;
InstallFile $(DESTDIR)$(PREFIX)/$(REFSUBDIR) : $(Samples) ;
HDRS = ../h ../numlib ;
Objects alphix.c randix.c ;
HDRS += ../plot ../rspl ../cgats ../icc ../gamut ../xicc ../spectro ../render $(TIFFINC) ;
LINKLIBS = ../xicc/libxcolorants ../xicc/libxicc ../spectro/libinsttypes
../spectro/libdisptechs ../gamut/libgamut ../rspl/librspl
../render/librender ../cgats/libcgats ../plot/libplot ../plot/libvrml
../icc/libicc ../spectro/libconv ../numlib/libnum ../numlib/libui
$(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIB) $(LibWin) ;
LINKFLAGS += $(GUILINKFLAGS) ;
#target generator
Main targen : targen.c ofps.c ifarp.c simplat.c simdlat.c prand.c ;
# Film Calibration Target File generator
Main filmtarg : filmtarg.c : : : $(TIFFINC) : alphix randix : $(TIFFLIB) $(JPEGLIB) ;
# Print Calibration Target Postscript File generator
Main printtarg : printtarg.c : : : : alphix randix : ;
# Individual stand alone test of sample point classes
# Optimised farthest point sampling class
MainVariant ofps : ofps.c : : STANDALONE_TEST ;
# Incremental far point class
MainVariant ifarp : ifarp.c : : STANDALONE_TEST ;
MainVariant simplat : simplat.c : : STANDALONE_TEST ;
# Device space simplex lattice
MainVariant simdlat : simdlat.c : : STANDALONE_TEST ;
if $(BUILD_JUNK) {
# Test program
Main test : test.c : : : : alphix ;
# Test program
Main temp : temp.c ;
# Test lmean experiment
Main lmean : lmean.c ;
# Percepttual point distribution. Replaced by ofps ?
#MainVariant ppoint : ppoint.c : : STANDALONE_TEST ;
}

662
Argyll_V3.5.0/target/License.txt Executable file
View File

@@ -0,0 +1,662 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

13
Argyll_V3.5.0/target/Readme.txt Executable file
View File

@@ -0,0 +1,13 @@
This directory containts routines that generate print or
film calibration test charts, based on perceptually evenly
distributed, random sequence points, suitable for reading
using an Xrite DTP51 coloromiter or Xrite DTP41 spectromter
(print) or Gretag Spectrolino (film). The generated print
file is a PostScript file, while the film recorder file is
a TIFF file.
targen Is used to generate the test point values.
target Is used to generate a PostScript file from those values.

30
Argyll_V3.5.0/target/afiles Executable file
View File

@@ -0,0 +1,30 @@
Readme.txt
License.txt
afiles
Jamfile
randix.c
randix.h
alphix.c
alphix.h
targen.c
targen.h
printtarg.c
filmtarg.c
ofps.h
ofps.c
simplat.h
simplat.c
simdlat.h
simdlat.c
ifarp.h
ifarp.c
prand.h
prand.c
ColorChecker.ti2
FograStrip2.ti1
FograStrip2_2.ti2
FograStrip3.ti1
FograStrip3_3.ti2
i1_RGB_Scan_1.4.ti2
ECI2002.ti2
ECI2002R.ti2

View File

@@ -0,0 +1,476 @@
/*
* Alphabetic index class.
*/
/*
* Argyll Color Correction System
*
* Author: Graeme W. Gill
* Date: 22/8/2005
*
* Copyright 2005, Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/* TTBD:
It would be nice if it was possible to add a delimeter between
the X and Y identifiers so that number + number or alpha + alpha
identification was possible.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "numsup.h"
#include "alphix.h"
/* Return the alpha index for the given raw index number */
/* Return NULL on error */
static char *torawix(alphix *p, int ix) {
int i, j, n;
int z = 0;
char *rv, *v;
if (ix < 0 || ix >= p->rmct)
return NULL; /* Index range error */
if ((rv = malloc((p->nd+1) * sizeof(char))) == NULL)
return NULL;
for (v = rv, j = 0, i = p->nd-1; i >= 0; j++, i--) {
char c;
n = ix / p->ds[i].b;
ix -= n * p->ds[i].b;
c = p->ds[i].seq[n];
if (p->ds[i].z && z == 0 && c == '0')
c = ' ';
if (z != 0 || c != ' ') {
*v++ = p->ds[i].seq[n];
z = 1;
}
}
*v = '\000';
return rv;
}
/* Return the the raw index number given the alpha index */
/* return -1 on error */
static int fromanat(alphix *p, char *ax) {
char *v, *tb, _tb[11];
int cl;
int i, k, rv = 0;
cl = strlen(ax);
if (cl > p->nd) /* String is too long to be our index */
return -1;
if (p->nd > 10) {
if ((tb = malloc((p->nd+1) * sizeof(char))) == NULL)
return -1; /* Malloc error */
} else
tb = _tb;
/* Pack the string out to the right number of digits with spaces. */
for (v = tb; cl < p->nd; v++, cl++)
*v = ' ';
strcpy(v, ax);
/* For each digit, convert to numerical and accumulate */
for (v = tb, i = p->nd-1; i >= 0; v++, i--) {
for (k = 0; k < p->ds[i].n; k++) {
if (*v == p->ds[i].seq[k]
|| (p->ds[i].z && *v == ' ' && p->ds[i].seq[k] == '0')) {
rv += k * p->ds[i].b;
break;
}
}
if (k >= p->ds[i].n) {
if (tb != _tb)
free(tb);
return -1; /* Unknown digit */
}
}
if (tb != _tb)
free(tb);
return rv;
}
/* Working from the end of the string, */
/* return a pointer to the maximum number of characters */
/* that are legaly part of this alpha index. */
static char *find_start(alphix *p, char *ax) {
int i, k;
char *v;
v = ax + strlen(ax) - 1; /* start at last character */
for (i = 0; v >= ax && i < p->nd; v--, i++) { /* working backwards */
for (k = 0; k < p->ds[i].n; k++) { /* Locate */
if (*v == p->ds[i].seq[k])
break; /* Found */
}
if (k >= p->ds[i].n) /* Not found, so we are at the start */
break;
}
return v+1;
}
/* Convert from cooked index to raw index. */
/* Return -1 if out of range */
static int cookedtoraw(alphix *p, int ix) {
int i;
if (p->nr == 0)
return ix;
for (i = 0; i < p->nr; i++) {
if (ix >= p->rs[i].c0 && ix <= p->rs[i].c1) {
ix = ix - p->rs[i].c0 + p->rs[i].r0;
return ix;
}
}
return -1;
}
/* Convert from raw index to cooked index. */
/* Return -1 if out of range */
static int rawtocooked(alphix *p, int ix) {
int i;
if (p->nr == 0)
return ix;
for (i = 0; i < p->nr; i++) {
if (ix >= p->rs[i].r0 && ix <= p->rs[i].r1) {
ix = ix - p->rs[i].r0 + p->rs[i].c0;
return ix;
}
}
return -1;
}
/* Return the maximum possible length of count */
static int alphix_maxlen(alphix *p) {
return p->cmct;
}
/* Return the alpha index for the given index number (0 based) */
/* Return NULL on error */
/* (Free after use) */
static char *alphix_aix(alphix *p, int ix) {
if ((ix = cookedtoraw(p, ix)) < 0)
return NULL;
return torawix(p, ix);
}
/* Return the index number for the given alpha index */
int alphix_nix(alphix *p, char *ax) {
int rv;
if ((rv = fromanat(p, ax)) < 0)
return -1;
return rawtocooked(p, rv);
}
/* Destroy ourselves */
static void
alphix_del(alphix *p) {
int i;
for (i = 0; i < p->nd; i++)
free(p->ds[i].seq);
free (p->ds);
free (p->rs);
free (p);
}
/* Constructor: */
alphix *new_alphix(char *pattern) {
alphix *p;
char *pp = pattern;
int i;
if ((p = (alphix *)calloc(1,sizeof(alphix))) == NULL)
error("alphix: malloc failed");
p->maxlen = alphix_maxlen;
p->aix = alphix_aix;
p->nix = alphix_nix;
p->del = alphix_del;
/* We now need to parse the pattern to setup our index sequence: */
/* For all digits */
for (p->nd = 0; ; p->nd++) {
if (*pp == '\000' || *pp == ';') {
break;
}
/* We are starting a new digit sequence */
if (p->nd >= p->_nd) { /* Allocate space for current digit */
p->_nd = 2 + p->_nd;
if ((p->ds = (dig *)realloc(p->ds, p->_nd * sizeof(dig))) == NULL)
error ("alphix: realloc failed");
}
p->ds[p->nd].n = 0;
p->ds[p->nd].seq = NULL;
p->ds[p->nd]._n = 0;
p->ds[p->nd].z = 0;
/* For all symbols in this digit */
for (p->ds[p->nd].n = 0; ;) {
char c, c1, c2;
/* We are adding another character to the sequence */
if (*pp == '\000' || *pp == ';' || *pp == ',')
break; /* Done this digit */
if (pp[1] == '-' && pp[2] != '\000' && pp[2] != ';' && pp[2] != ',') {
c1 = pp[0];
c2 = pp[2];
pp += 3;
} else {
c1 = c2 = *pp;
pp++;
}
if (c1 == '@') {
c1 = '0';
p->ds[p->nd].z = 1;
}
if (c2 == '@') {
c2 = '0';
p->ds[p->nd].z = 1;
}
/* Expand digit sequence */
for (c = c1; c <= c2; c++) {
if (p->ds[p->nd].n >= p->ds[p->nd]._n) { /* Allocate space for next character */
p->ds[p->nd]._n = 20 + p->ds[p->nd]._n;
if ((p->ds[p->nd].seq = (char *)realloc(p->ds[p->nd].seq, p->ds[p->nd]._n * sizeof(char))) == NULL)
error ("alphix: realloc failed");
}
p->ds[p->nd].seq[p->ds[p->nd].n++] = c;
}
}
if (*pp == '\000' || *pp == ';')
continue;
pp++;
}
/* Compute the native maximum index count */
for (p->rmct = 1, i = 0; i < p->nd; i++) {
p->ds[i].b = p->rmct;
p->rmct *= p->ds[i].n;
}
/* Search for valid ranges */
if (*pp == ';') {
char *v, *tb, _tb[11];
pp++;
if (p->nd > 10) {
if ((tb = malloc((p->nd+1) * sizeof(char))) == NULL)
error ("alphix: malloc failed");
} else
tb = _tb;
/* For each range */
for (p->nr = 0; ; p->nr++) {
if (*pp == '\000' || *pp == ';')
break;
/* We are adding a new range */
if (p->nr >= p->_nr) { /* Allocate space for current range */
p->_nr = 2 + p->_nr;
if ((p->rs = (rngsq *)realloc(p->rs, p->_nr * sizeof(rngsq))) == NULL)
error ("alphix: realloc failed");
}
/* Locate the end of the range start */
for(v = tb; *pp != '\000' && *pp != '-' && *pp != ','; v++, pp++)
*v = *pp;
*v = '\000';
p->rs[p->nr].r0 = p->rs[p->nr].r1 = fromanat(p, tb);
if (p->rs[p->nr].r0 < 0)
error("alphix: range start definition error on '%s'",tb);
if (*pp != '-') { /* oops - bad definition */
error("alphix: range definition error - missing '-'");
}
/* Locate the end of the range end */
for(v = tb, pp++; *pp != '\000' && *pp != ','; v++, pp++)
*v = *pp;
*v = '\000';
p->rs[p->nr].r1 = fromanat(p, tb);
if (p->rs[p->nr].r1 < 0)
error("alphix: range end definition error on '%s'",tb);
if (p->rs[p->nr].r1 < p->rs[p->nr].r0) /* Hmm */
error("alphix: range definition error, end < start ");
/* Compute cooked index range */
p->rs[p->nr].c0 = 0;
p->rs[p->nr].c1 = p->rs[p->nr].r1 - p->rs[p->nr].r0;
if (p->nr > 0) {
int ofs = p->rs[p->nr-1].c1+1;
p->rs[p->nr].c0 += ofs;
p->rs[p->nr].c1 += ofs;
}
if (*pp == '\000' || *pp == ';')
continue;
pp++;
}
if (tb != _tb)
free(tb);
}
/* Compute cooked actual range */
p->cmct = p->rmct;
if (p->nr > 0) {
p->cmct = p->rs[p->nr-1].c1+1;
}
#ifdef NEVER
// ###########################################################
/* Debug stuff */
printf("~1 There are %d digits, %d ranges, raw max = %d, cooked max = %d\n",
p->nd,p->nr,p->rmct, p->maxlen(p));
/* Digit sequences */
for (i = 0; i < p->nd; i++) {
printf(" ~1 Digit %d has %d symbols\n",i,p->ds[i].n);
for (j = 0; j < p->ds[i].n; j++)
printf(" ~1 symbol %d = '%c'\n",j,p->ds[i].seq[j]);
}
/* Ranges */
for (i = 0; i < p->nr; i++) {
printf(" ~1 Range %d is raw %d - %d, cooked %d - %d\n",
i,p->rs[i].r0, p->rs[i].r1, p->rs[i].c0, p->rs[i].c1);
}
/* Itterate the sequence */
for (i = 0; i < p->cmct; i++) {
char *v;
v = p->aix(p, i);
printf("ix %d -> '%s'\n",i,v);
free(v);
}
// ###########################################################
#endif /* NEVER */
return p;
}
/* ==================================================================== */
/* Utility function: */
/* Given the strip and patch alphix objects, and order flag, */
/* Return a patch location. Free the returned string after use. */
/* Return NULL on error */
char *patch_location(
alphix *saix, /* Strip alpha index object */
alphix *paix, /* Patch alpha index object */
int ixord, /* Index order, 0 = strip then patch */
int six, /* Strip index */
int pix /* Patch index */
) {
char *sl, *pl, *rv;
int ll;
if ((sl = saix->aix(saix, six)) == NULL)
return NULL;
if ((pl = paix->aix(paix, pix)) == NULL) {
free (sl);
return NULL;
}
ll = strlen(sl) + strlen(pl) + 1;
if ((rv = malloc(ll * sizeof(char))) == NULL) {
free (pl);
free (sl);
return NULL;
}
if (ixord == 0) {
strcpy (rv, sl);
strcat (rv, pl);
} else {
strcpy (rv, pl);
strcat (rv, sl);
}
return rv;
}
/* ==================================================================== */
/* Utility function: */
/* Given the strip and patch alphix objects, and order flag, */
/* and a corresonding patch location string, return an index */
/* number suitable for sorting location strings. */
/* The sort order is in order of strips, then patches within each strip */
/* Return -1 on error */
int patch_location_order(
alphix *saix, /* Strip alpha index object */
alphix *paix, /* Patch alpha index object */
int ixord, /* Index order, 0 = strip then patch */
char *_ax /* Patch location string */
) {
char *ax; /* Copy of input string */
char *v;
alphix *rh; /* Least significant, right hand alphix */
alphix *lh; /* Most significant, left hand alphix */
int ri, li; /* Right hand and left hand index numbers */
if ((ax = malloc(strlen(_ax)+1)) == NULL)
return -1;
strcpy(ax,_ax);
if (ixord == 0) {
lh = saix; /* Strip is left hand */
rh = paix; /* Patch is right hand */
} else {
rh = saix; /* Strip is right hand */
lh = paix; /* Patch is left hand */
}
/* We need to identify the boundary between */
/* the right hand and left hand indexes. */
/* We assume that the sequences are distinguishable ... */
v = find_start(rh, ax);
if (*v == '\000') /* Nothing looks like a alphix */
return -1;
ri = rh->nix(rh, v);
*v = '\000';
li = lh->nix(lh, ax);
free(ax);
if (ri < 0 || li < 0)
return -1;
if (ixord == 0) /* Strip is left hand */
return li * rh->cmct + ri;
else
return ri * lh->cmct + li;
}

View File

@@ -0,0 +1,120 @@
#ifndef ALPHIX_H
/*
* Alphabetic indexing class
*/
/*
* Argyll Color Correction System
*
* Author: Graeme W. Gill
* Date: 22/8/2005
*
* Copyright 2005, Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/*
*
* Syntax of alphix pattern:
*
* First comes the definition of the symbols for each digit
* location, LS to MS. The number of definitions declares the
* maximum number of digits. For example, for a normal 2 digit numerical
* sequence: "0123456789, 123456789" (note the space is significant)
* would define 0..99 with the MS digit supressed when it is 0.
* Ranges can be used for brevity: * "0-9, 1-9".
* As a special case, the '@' character can be used
* instead of '0' to indicate suppression of the leading zero.
* Leading ' ' characters in a generated sequence are omitted.
*
* Optional, and delimited by a ';' character, valid segments of the
* index sequence can be defined. For instance, to define the index
* range to be 1..49 one could use the pattern "0-9, 1-9;1-49"
*
* Of course the main reason for using alphix is to allow letter index
* sequences. For a sequence A, B, C .. AA, AB, AC etc. (the default
* used in Argyll), the following pattern would be used: "A-Z, A-Z"
*
* For a some ECI2002R charts that skip columns Y and Z, the following
* might be used: "A-Z, 2-9;A-X,2A-9Z"
*/
#define ALPHIX_MAX 4 /* Maximum digits allowed */
/* Definition for each digit sequence */
typedef struct {
int n; /* Number of characters in sequence */
char *seq; /* Sequence of characters */
int _n; /* Allocation size of seq */
int b; /* Base of this digit */
int z; /* NZ if leading zero is to be supressed */
} dig;
/* Definition for each range sequence */
typedef struct {
int r0,r1; /* Raw index start and end of range */
int c0,c1; /* Cooked index start and end of range */
} rngsq;
struct _alphix {
/* private: */
int nd; /* Number of digits */
dig *ds; /* Digit sequences */
int _nd; /* Allocation size of ds */
int rmct; /* Raw maximum count */
int cmct; /* Cooked maximum count */
int nr; /* Number of ranges */
rngsq *rs; /* Digit sequences */
int _nr; /* Allocation size of rs */
/* public: */
/* Return the maximum possible length of count */
int (*maxlen)(struct _alphix *p);
/* Return the alpha index for the given index number (0 based) */
/* Return NULL on error */
char *(*aix)(struct _alphix *p, int ix);
/* Return the index number for the given alpha index */
/* Return -1 on error */
int (*nix)(struct _alphix *p, char *ax);
/* Destroy ourselves */
void (*del)(struct _alphix *p);
}; typedef struct _alphix alphix;
/* Constructor: */
extern alphix *new_alphix(char *pattern);
/* Utility function: */
/* Given the strip and patch alhix objects, and order flag, */
/* Return a patch location. */
/* Return NULL on error */
char *patch_location(
alphix *saix, /* Strip alpha index object */
alphix *paix, /* Patch alpha index object */
int ixord, /* Index order, 0 = strip then patch */
int six, /* Strip index (from 0) */
int pix); /* Patch index (from 0) */
/* Utility function: */
/* Given the strip and patch alphix objects, and order flag, */
/* and a coresonding patch location string, return an index */
/* number suitable for sorting location strings. */
/* Return -1 on error */
int patch_location_order(
alphix *saix, /* Strip alpha index object */
alphix *paix, /* Patch alpha index object */
int ixord, /* Index order, 0 = strip then patch */
char *_ax); /* Patch location string */
#define ALPHIX_H
#endif /* ALPHIX_H */

View File

@@ -0,0 +1,450 @@
/*
* Argyll Color Correction System
* Film recorder chart generator module.
*
* Author: Neil Okamoto
* Date: 1/3/2001
*
* Copyright 2001, DreamWorks LLC
* All rights reserved.
*
* This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 :-
* see the License2.txt file for licencing details.
*/
/* This program generates a set of TIFF images containing color test patches,
* given the .ti1 file specifying what the colors are.
*
* The output is designed to facilitate output on a 35mm motion picture film
* recorder such as those manufactured by Cineon, Celco, MGI, ARRI, etc. */
/* Description:
*
*/
/* TTBD:
*
* - eliminate gamma hack -- do it correctly in targen.
* - write a proper description
* - multi-patch mosaics on a single tiff image
* - render text labels into images
*/
#undef DEBUG
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <ctype.h>
#include "copyright.h"
#include "aconfig.h"
#include "cgats.h"
#include "randix.h"
#include "tiffio.h"
#include <stdarg.h>
void error(char *fmt, ...), warning(char *fmt, ...), verbose(int level, char *fmt, ...);
/* A color structure */
/* This can hold all representations simultaniously */
typedef struct {
int t; /* Tag */
#define T_W 0x1
#define T_RGB 0x2
#define T_CMYK 0x4
double gy;
double r,g,b;
double c,m,y,k;
char *id; /* Id string */
char loc[5]; /* Location ID string */
} col;
void
generate_tiffs(
char *basename, /* Base file name for output tiffs */
col *cols, /* Array of colors to be put on target chart */
int npat, /* Number of test targets needed */
char *label, /* Per set label */
int pw, int ph, /* Patch width and height */
int rand, /* Randomise flag */
int rstart, /* Starting index for random */
int verb) /* Verbose flag */
{
randix *r = NULL; /* Random index order object */
int ix; /* Patch index in target list */
int i; /* Logical patch in target list */
char slab[6]; /* Strip label */
char fname[200]; /* File name */
TIFF *tiff; /* TIFF file handle */
unsigned short* scanline; /* scanline buffer */
int x,y; /* position in TIFF image */
if (rand)
r = new_randix(npat, rstart);
i = 0;
while (i < npat) {
if (rand)
ix = r->next(r); /* Next pseudo random index */
else
ix = i;
sprintf(slab, "P%04d",i+1);
strcpy(cols[ix].loc, slab);
sprintf(fname, "%s.%04d.tiff", basename, i+1);
if ((tiff = TIFFOpen(fname, "w")) == NULL) {
fprintf(stderr,"Failed to open output %s\n", fname);
exit(-1);
}
if (!(scanline = (unsigned short*)malloc(3*sizeof(short)*pw))) {
fprintf(stderr,"Failed to malloc a scanline buffer\n");
exit(-1);
}
TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, pw);
TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, ph);
TIFFSetField(tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 3);
TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 16);
TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
TIFFSetField(tiff, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
if (verb) {
printf("writing patch %4d (%4.2f %4.2f %4.2f) to %s\n",
ix, cols[ix].r, cols[ix].g, cols[ix].b, fname);
}
/* fill scanline */
for (x=0; x<pw; x++) {
int xx = 3*x;
scanline[xx++] = (unsigned short)((cols[ix].r * 65535.0) + 0.5);
scanline[xx++] = (unsigned short)((cols[ix].g * 65535.0) + 0.5);
scanline[xx] = (unsigned short)((cols[ix].b * 65535.0) + 0.5);
}
for (y=0; y<ph; y++) {
if (TIFFWriteScanline(tiff, (tdata_t)scanline, y, 0) < 0) {
fprintf(stderr,"WriteScanline Failed at line %d\n",y);
exit (-1);
}
}
TIFFClose(tiff);
free(scanline);
i++;
}
if (rand)
r->del(r);
}
/* film size structure */
typedef struct {
char *name; /* User name (lower case) */
int w,h; /* Width and height in pixels */
} film;
static film filmsizes[] = {
{ "Acad_Full", 3656, 2664 },
{ "Acad_Half", 1828, 1332 },
{ "Cscope_Full", 3656, 3112 },
{ "Cscope_Half", 1828, 1556 },
{ "FullAp_Full", 4096, 3112 },
{ "FullAp_Half", 2048, 1556 },
{ "Vista_Full", 4096, 6144 },
{ "Vista_Half", 2048, 3072 },
{ NULL, 0, 0 }
};
/* Case independent string compare */
int
cistrcmp(char *s1, char *s2) {
for (;;s1++, s2++) {
if (tolower(*s1) != tolower(*s2))
return 1;
if (*s1 == '\000')
return 0;
}
}
void
usage(void) {
film *ff;
fprintf(stderr,"Generate Film Target image sequence, Version %s\n",ARGYLL_VERSION_STR);
fprintf(stderr,"Licensed under the GPL\n");
fprintf(stderr,"usage: filmtarg [-v] [-r] [-g gamma] [-f format] basename\n");
fprintf(stderr," -v Verbose mode\n");
fprintf(stderr," -r Don't randomise patch location\n");
fprintf(stderr," -g gamma Gamma correction / linearization\n");
fprintf(stderr," -f format Select format from:\n");
for (ff = filmsizes; ff->name != NULL; ff++)
fprintf(stderr," \t%s\t[%d x %d]\n", ff->name, ff->w, ff->h);
fprintf(stderr," basename Base name for input(.ti1)/output(.ti2)\n");
exit(1);
}
int
main(argc,argv)
int argc;
char *argv[];
{
int fa,nfa; /* current argument we're looking at */
int verb = 0;
int rand = 1;
double gamma = 1.0;
static char inname[MAXNAMEL+10+1] = { 0 }; /* Input cgats file base name */
static char outname[MAXNAMEL+10+1] = { 0 }; /* Output cgats file base name */
static char tiffname[MAXNAMEL+1] = { 0 }; /* Output postscrip file base name */
cgats *icg; /* input cgats structure */
cgats *ocg; /* output cgats structure */
int i;
int si, fi, wi; /* sample id index, field index, keyWord index */
char *label = "Argyll Color Correction System - Development chart";
film *flm = &filmsizes[1]; /* Default film format = Academy Half */
col *cols;
int npat; /* Number of patches */
time_t clk = time(0);
struct tm *tsp = localtime(&clk);
char *atm = asctime(tsp); /* Ascii time */
char buf[100]; /* general sprintf buffer */
int rstart = 0; /* Random sequence start value */
if (argc <= 1)
usage();
/* Process the arguments */
for(fa = 1;fa < argc;fa++)
{
nfa = fa; /* skip to nfa if next argument is used */
if (argv[fa][0] == '-') /* Look for any flags */
{
char *na = NULL; /* next argument after flag, null if none */
if (argv[fa][2] != '\000')
na = &argv[fa][2]; /* next is directly after flag */
else
{
if ((fa+1) < argc)
{
if (argv[fa+1][0] != '-')
{
nfa = fa + 1;
na = argv[nfa]; /* next is seperate non-flag argument */
}
}
}
if (argv[fa][1] == '?')
usage();
/* Verbosity */
else if (argv[fa][1] == 'v' || argv[fa][1] == 'V')
verb = 1;
/* Randomisation */
else if (argv[fa][1] == 'r' || argv[fa][1] == 'R')
rand = 0;
/* Gamma */
else if (argv[fa][1] == 'g' || argv[fa][1] == 'G') {
fa = nfa;
if (na == NULL) usage();
gamma = atof(na);
}
/* Image format */
else if (argv[fa][1] == 'f' || argv[fa][1] == 'F') {
fa = nfa;
if (na == NULL) usage();
for (flm = filmsizes; flm->name != NULL; flm++) {
if (cistrcmp(na, flm->name) == 0)
break;
}
if (flm->name == NULL)
usage();
} else
usage();
}
else
break;
}
/* Get the file name argument */
if (fa >= argc || argv[fa][0] == '-') usage();
strncpy(inname,argv[fa],MAXNAMEL); inname[MAXNAMEL] = '\000';
strcat(inname,".ti1");
strncpy(outname,argv[fa],MAXNAMEL); outname[MAXNAMEL] = '\000';
strcat(outname,".ti2");
strncpy(tiffname,argv[fa++],MAXNAMEL); tiffname[MAXNAMEL] = '\000';
icg = new_cgats(); /* Create a CGATS structure */
icg->add_other(icg, "CTI1"); /* our special input type is Calibration Target Information 1 */
if (icg->read_name(icg, inname))
error("CGATS file read error : %s",icg->e.m);
if (icg->t[0].tt != tt_other || icg->t[0].oi != 0)
error ("Input file isn't a CTI1 format file");
if (icg->ntables < 1)
error ("Input file doesn't contain at least one table");
if ((npat = icg->t[0].nsets) <= 0)
error ("No sets of data");
if ((cols = (col *)malloc(sizeof(col) * npat)) == NULL)
error("Malloc failed!");
/* Setup output cgats file */
ocg = new_cgats(); /* Create a CGATS structure */
ocg->add_other(ocg, "CTI2"); /* our special type is Calibration Target Information 2 */
ocg->add_table(ocg, tt_other, 0); /* Start the first table */
ocg->add_kword(ocg, 0, "DESCRIPTOR", "Argyll Calibration Target chart information 2",NULL);
ocg->add_kword(ocg, 0, "ORIGINATOR", "Argyll filmtarg", NULL);
atm[strlen(atm)-1] = '\000'; /* Remove \n from end */
ocg->add_kword(ocg, 0, "CREATED",atm, NULL);
/* Note what instrument this chart is setup for */
ocg->add_kword(ocg, 0, "TARGET_INSTRUMENT", "GretagMacbeth SpectroScanT", NULL);
/* Copy various parameters through */
if ((wi = icg->find_kword(icg, 0, "SINGLE_DIM_STEPS")) >= 0)
ocg->add_kword(ocg, 0, "SINGLE_DIM_STEPS",icg->t[0].kdata[wi], NULL);
if ((wi = icg->find_kword(icg, 0, "COMP_GREY_STEPS")) >= 0)
ocg->add_kword(ocg, 0, "COMP_GREY_STEPS",icg->t[0].kdata[wi], NULL);
if ((wi = icg->find_kword(icg, 0, "MULTI_DIM_STEPS")) >= 0)
ocg->add_kword(ocg, 0, "MULTI_DIM_STEPS",icg->t[0].kdata[wi], NULL);
if ((wi = icg->find_kword(icg, 0, "FULL_SPREAD_PATCHES")) >= 0)
ocg->add_kword(ocg, 0, "FULL_SPREAD_PATCHES",icg->t[0].kdata[wi], NULL);
/* Fields we want */
ocg->add_field(ocg, 0, "SAMPLE_ID", nqcs_t);
ocg->add_field(ocg, 0, "SAMPLE_LOC", cs_t);
if ((si = icg->find_field(icg, 0, "SAMPLE_ID")) < 0)
error ("Input file doesn't contain field SAMPLE_ID");
if (icg->t[0].ftype[si] != nqcs_t)
error ("Field SAMPLE_ID is wrong type");
/* Figure out the color space */
if ((fi = icg->find_kword(icg, 0, "COLOR_REP")) < 0)
error ("Input file doesn't contain keyword COLOR_REPS");
if (strcmp(icg->t[0].kdata[fi],"CMYK") == 0) {
error ("We don't support CMYK yet");
} else if (strcmp(icg->t[0].kdata[fi],"RGB") == 0) {
int ri, gi, bi;
if ((ri = icg->find_field(icg, 0, "RGB_R")) < 0)
error ("Input file doesn't contain field RGB_R");
if (icg->t[0].ftype[ri] != r_t)
error ("Field RGB_R is wrong type");
if ((gi = icg->find_field(icg, 0, "RGB_G")) < 0)
error ("Input file doesn't contain field RGB_G");
if (icg->t[0].ftype[gi] != r_t)
error ("Field RGB_G is wrong type");
if ((bi = icg->find_field(icg, 0, "RGB_B")) < 0)
error ("Input file doesn't contain field RGB_B");
if (icg->t[0].ftype[bi] != r_t)
error ("Field RGB_B is wrong type");
ocg->add_field(ocg, 0, "RGB_R", r_t);
ocg->add_field(ocg, 0, "RGB_G", r_t);
ocg->add_field(ocg, 0, "RGB_B", r_t);
ocg->add_kword(ocg, 0, "COLOR_REP","RGB", NULL);
if (gamma != 1.0) {
sprintf(buf, "%6.4f", gamma);
ocg->add_kword(ocg, 0, "GAMMA", buf, NULL);
}
for (i = 0; i < npat; i++) {
cols[i].t = T_RGB;
cols[i].id = ((char *)icg->t[0].fdata[i][si]);
/* normalized and possibly gamma corrected */
cols[i].r = pow(*((double *)icg->t[0].fdata[i][ri]) / 100.0, gamma);
cols[i].g = pow(*((double *)icg->t[0].fdata[i][gi]) / 100.0, gamma);
cols[i].b = pow(*((double *)icg->t[0].fdata[i][bi]) / 100.0, gamma);
}
} else if (strcmp(icg->t[0].kdata[fi],"W") == 0) {
error ("We don't support GRAY yet");
} else
error ("Input file keyword COLOR_REPS has unknown value");
if (verb)
printf("Film format chosen is %s [%d x %d]\n", flm->name, flm->w, flm->h);
if (rand) {
rstart = clk % npat;
sprintf(buf,"%d",rstart);
ocg->add_kword(ocg, 0, "RANDOM_START", buf, NULL);
}
generate_tiffs(tiffname, cols, npat, label, flm->w, flm->h, rand, rstart, verb);
/* Write out the patch info to the output CGATS file */
for (i = 0; i < npat; i++) {
if (cols[i].t & T_CMYK)
ocg->add_set(ocg, 0, cols[i].id, cols[i].loc, 100.0 * cols[i].c, 100.0 * cols[i].m,
100.0 * cols[i].y, 100.0 * cols[i].k);
else if (cols[i].t & T_RGB)
ocg->add_set(ocg, 0, cols[i].id, cols[i].loc, 100.0 * cols[i].r,
100.0 * cols[i].g, 100.0 * cols[i].b);
else if (cols[i].t & T_W)
ocg->add_set(ocg, 0, cols[i].id, cols[i].loc, 100.0 * cols[i].gy);
}
if (ocg->write_name(ocg, outname))
error("Write error : %s",ocg->e.m);
free(cols);
ocg->del(ocg); /* Clean up */
icg->del(icg); /* Clean up */
return 0;
}
/******************************************************************/
/* Error/debug output routines */
/******************************************************************/
/* Basic printf type error() and warning() routines */
void
error(char *fmt, ...)
{
va_list args;
fprintf(stderr,"filmtarg: Error - ");
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
fprintf(stderr, "\n");
exit (-1);
}
void
warning(char *fmt, ...)
{
va_list args;
fprintf(stderr,"filmtarg: Warning - ");
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
fprintf(stderr, "\n");
}

View File

@@ -0,0 +1,319 @@
CTI2
DESCRIPTOR "Argyll Calibration Target chart information 2 for Eye-One Scan Target 1.4"
ORIGINATOR "Argyll printtarg"
CREATED "Wed Sep 12 00:02:26 2007"
KEYWORD "TARGET_INSTRUMENT"
TARGET_INSTRUMENT "GretagMacbeth i1 Pro"
KEYWORD "ACCURATE_EXPECTED_VALUES"
ACCURATE_EXPECTED_VALUES "true"
KEYWORD "COLOR_REP"
COLOR_REP "RGB"
KEYWORD "STEPS_IN_PASS"
STEPS_IN_PASS "18"
KEYWORD "PASSES_IN_STRIPS2"
PASSES_IN_STRIPS2 "16"
KEYWORD "STRIP_INDEX_PATTERN"
STRIP_INDEX_PATTERN "0-9,@-9,@-9;1-999"
KEYWORD "PATCH_INDEX_PATTERN"
PATCH_INDEX_PATTERN "A-Z, A-Z"
KEYWORD "INDEX_ORDER"
INDEX_ORDER "PATCH_THEN_STRIP"
KEYWORD "SAMPLE_LOC"
NUMBER_OF_FIELDS 8
BEGIN_DATA_FORMAT
SAMPLE_ID SAMPLE_LOC RGB_R RGB_G RGB_B XYZ_X XYZ_Y XYZ_Z
END_DATA_FORMAT
NUMBER_OF_SETS 288
BEGIN_DATA
1 "A1" 0 0 0 0.52 0.59 0.56
2 "A2" 20 40 100 10.27 10 32.62
3 "A3" 80 0 20 13.89 7.3 2.84
4 "A4" 100 40 20 33.34 23.69 4.75
5 "A5" 69.8 69.8 69.8 31.79 33.22 28.61
6 "A6" 46.67 46.67 46.67 13.85 14.51 12.72
7 "A7" 100 40 40 35.52 25.53 10.91
8 "A8" 66.67 60 66.67 27.16 27.04 25.26
9 "A9" 29.8 29.8 29.8 6.12 6.42 5.76
10 "A10" 26.67 33.33 33.33 6.04 6.8 6.75
11 "A11" 0 20 100 4.4 3.47 20.55
12 "A12" 40 0 60 6.34 3.41 11.34
13 "A13" 40 20 60 9.03 7.05 14.88
14 "A14" 40 20 40 7.91 6.52 8.41
15 "A15" 60 20 80 16.18 10.77 24.37
16 "A16" 0 0 60 1.97 1.1 8.66
17 "B1" 60 100 20 27.55 34.83 6.23
18 "B2" 80 20 0 17.94 11.4 1.02
19 "B3" 80 80 20 34.87 35.19 5.79
20 "B4" 20 80 80 13.05 19.54 29.87
21 "B5" 0 60 100 6.88 9.15 27.74
22 "B6" 100 100 80 70.59 73.69 44.02
23 "B7" 13.33 13.33 6.67 2.04 2.19 1.41
24 "B8" 0 40 0 1.35 2.84 0.94
25 "B9" 100 60 80 49.51 40.62 36.32
26 "B10" 100 60 40 43.26 35.61 12.01
27 "B11" 13.33 20 20 2.65 3.13 3.25
28 "B12" 40 80 60 17.77 24.45 21.08
29 "B13" 0 100 100 8.51 14.13 31.85
30 "B14" 0 80 100 7.84 11.93 30.12
31 "B15" 0 100 60 5.81 12.04 16.38
32 "B16" 60 20 0 11.49 8.06 0.99
33 "C1" 100 20 100 34.5 19.81 37.1
34 "C2" 80 80 73.33 42.27 43.99 33.47
35 "C3" 0 60 60 4.36 7.54 14.12
36 "C4" 100 100 20 58.73 57.76 6.5
37 "C5" 60 0 80 11.22 5.5 17.82
38 "C6" 6.67 13.33 13.33 1.55 1.89 2.09
39 "C7" 74.9 74.9 74.9 37.5 39.03 33.61
40 "C8" 80 40 20 23.67 18.54 4.44
41 "C9" 20 80 20 8.12 14.07 4.81
42 "C10" 0 100 0 2.9 7.38 1.41
43 "C11" 73.33 73.33 66.67 34.09 35.82 26.91
44 "C12" 40 33.33 40 9.45 9.34 9.05
45 "C13" 100 60 20 41.11 33.34 5.29
46 "C14" 80 40 60 27.38 21.65 19.2
47 "C15" 64.71 64.71 64.71 27.38 28.66 24.61
48 "C16" 80 80 100 48.58 49.16 58.53
49 "D1" 20 80 0 7.47 12.02 1.86
50 "D2" 80 0 80 17.27 8.47 18.91
51 "D3" 100 20 0 24.86 14.78 0.99
52 "D4" 60 0 20 8.61 4.81 2.74
53 "D5" 80 60 20 28.85 26.03 5.07
54 "D6" 40 80 80 20.34 26.75 33.64
55 "D7" 40 0 40 5.39 3.09 6.34
56 "D8" 40 0 80 7.42 3.7 17.12
57 "D9" 86.67 100 100 60.57 66.88 64.61
58 "D10" 26.67 20 26.67 4.42 4.33 4.38
59 "D11" 0 20 60 2.63 2.73 10.91
60 "D12" 80 100 60 46.48 54.19 25.5
61 "D13" 0 20 20 1.24 2.02 2.92
62 "D14" 0 60 20 2.43 5.58 3.81
63 "D15" 40 0 0 4.46 2.69 0.72
64 "D16" 100 0 80 23.58 11.3 19.67
65 "E1" 60 40 60 18.33 16.26 18.07
66 "E2" 40 80 0 13.25 17.2 1.73
67 "E3" 40 80 40 16.1 22.52 11.75
68 "E4" 86.67 86.67 80 50.7 52.96 40.49
69 "E5" 4.71 4.71 4.71 0.93 1.03 0.98
70 "E6" 0 0 80 2.58 1.28 12.24
71 "E7" 93.33 93.33 86.67 61.11 63.67 49.46
72 "E8" 20 80 40 9.69 16.36 11.19
73 "E9" 60 60 20 19.64 20.4 5.14
74 "E10" 100 100 69.8 68.63 71.55 34.47
75 "E11" 73.33 66.67 73.33 33.86 33.75 30.83
76 "E12" 100 0 0 18.65 9.44 0.83
77 "E13" 20 100 60 12.88 22.5 20.49
78 "E14" 80 60 100 40.57 35.97 51.8
79 "E15" 60 60 80 25.89 26.22 33.39
80 "E16" 60 100 40 30.29 39.21 13.78
81 "F1" 0 80 20 3.2 7.65 4.38
82 "F2" 0 20 80 3.71 3.35 16.24
83 "F3" 80 20 80 23.31 14.61 25.55
84 "F4" 80 20 40 20.14 13.3 9.05
85 "F5" 53.33 60 60 19.65 21.55 20.22
86 "F6" 6.67 6.67 0 1.21 1.33 0.75
87 "F7" 0 60 80 5.8 8.65 21.51
88 "F8" 100 0 40 20.82 10.37 7.25
89 "F9" 60 0 100 12.98 6.05 24.77
90 "F10" 60 40 20 15.96 14.23 4.62
91 "F11" 100 100 0 54.03 50.45 2.31
92 "F12" 60 60 60 23.38 24.4 20.86
93 "F13" 20 40 0 4.42 5.8 1.14
94 "F14" 40 100 20 17.42 25.87 5.81
95 "F15" 0 40 20 1.8 3.63 3.4
96 "F16" 60 20 20 12.33 9.08 3.65
97 "G1" 100 40 80 41.01 28.98 32.18
98 "G2" 20 100 80 14.7 24.18 31.92
99 "G3" 0 40 80 4.63 5.68 19.04
100 "G4" 100 100 93.33 73.8 76.63 58.3
101 "G5" 100 0 100 25.16 11.63 27.13
102 "G6" 60 80 20 23.64 27.52 5.74
103 "G7" 80 80 60 40.74 42.65 24.74
104 "G8" 20 40 20 5.04 6.8 4
105 "G9" 20 80 100 15.6 21.51 42.53
106 "G10" 80 86.67 86.67 47.5 50.89 46.6
107 "G11" 40 46.67 46.67 11.95 13.23 12.63
108 "G12" 0 0 20 0.74 0.68 2.21
109 "G13" 60 40 80 20.56 17.42 28.91
110 "G14" 20 20 13.33 3.34 3.61 2.24
111 "G15" 80 0 60 15.88 7.93 12.58
112 "G16" 60 100 60 32.76 42.79 24.95
113 "H1" 13.33 6.67 13.33 1.99 1.85 1.96
114 "H2" 20 20 60 5.23 4.73 13.17
115 "H3" 60 100 80 35.1 45.5 39.54
116 "H4" 49.8 49.8 49.8 15.44 16.22 14.02
117 "H5" 54.9 54.9 54.9 18.85 19.72 16.96
118 "H6" 100 0 20 19.88 10.01 3.06
119 "H7" 40 20 100 12.31 8.36 31.05
120 "H8" 80 60 80 37.11 33.66 35.77
121 "H9" 80 60 40 31.4 29.01 12.25
122 "H10" 20 40 40 5.92 7.65 8.81
123 "H11" 94.9 94.9 94.9 65.82 68.12 58.73
124 "H12" 40 60 60 15.16 18.34 19.38
125 "H13" 60 40 0 14.99 12.73 1.65
126 "H14" 86.67 93.33 93.33 56.71 60.58 54.75
127 "H15" 20 60 60 9.34 13.22 17.86
128 "H16" 80 0 40 14.91 7.72 6.98
129 "I1" 80 40 40 25.37 20.12 10.52
130 "I2" 84.71 84.71 84.71 49.34 51.3 44.11
131 "I3" 33.33 26.67 33.33 6.63 6.47 6.58
132 "I4" 6.67 0 6.67 1.07 0.94 1.24
133 "I5" 60 0 0 8.34 4.69 0.92
134 "I6" 60 40 100 23.16 18.65 41.02
135 "I7" 20 60 20 6.72 10.56 4.53
136 "I8" 80 60 0 27.97 23.98 1.71
137 "I9" 0 0 100 3.27 1.46 15.75
138 "I10" 100 80 60 55.74 51.88 24.53
139 "I11" 20 60 40 7.7 11.77 9.88
140 "I12" 9.8 9.8 9.8 1.57 1.7 1.49
141 "I13" 60 60 100 28.92 28.09 47.66
142 "I14" 100 20 40 28.27 17.22 9.16
143 "I15" 100 100 86.67 72.13 75.17 50.99
144 "I16" 0 40 60 3.58 5.09 12.93
145 "J1" 20 60 100 13.14 15.8 38.03
146 "J2" 20 100 20 9.81 17.93 5.25
147 "J3" 100 86.67 100 68.6 65.82 63.75
148 "J4" 100 40 100 43.83 30.19 45.87
149 "J5" 80 0 100 18.39 8.6 26.07
150 "J6" 0 80 60 5.36 10.17 15.84
151 "J7" 86.67 86.67 100 55.67 57.15 61.71
152 "J8" 40 60 80 17.35 19.86 30.55
153 "J9" 60 0 40 9.34 5.12 6.56
154 "J10" 20 26.67 26.67 4.06 4.65 4.46
155 "J11" 100 80 80 59.67 55.56 40.66
156 "J12" 86.67 80 86.67 49.63 49.42 45.4
157 "J13" 80 100 20 41.62 45.81 6.35
158 "J14" 20 20 40 4.44 4.57 7.21
159 "J15" 46.67 40 46.67 12.73 12.57 11.83
160 "J16" 80 60 60 33.9 31.33 21.78
161 "K1" 80 100 0 39.02 40.41 2.14
162 "K2" 20 20 80 6.59 5.47 20
163 "K3" 20 60 80 11 14.42 27.43
164 "K4" 0 20 40 1.86 2.4 6.45
165 "K5" 40 100 40 18.68 28.5 12.59
166 "K6" 100 100 100 75.76 78.23 67.4
167 "K7" 33.33 33.33 26.67 7.32 7.87 5.36
168 "K8" 60 60 0 18.49 18.14 1.64
169 "K9" 80 80 40 37.54 38.95 13.07
170 "K10" 80 100 100 55.35 62.8 63.8
171 "K11" 33.33 40 40 8.76 9.83 9.34
172 "K12" 34.9 34.9 34.9 8.38 8.86 7.56
173 "K13" 80 20 60 21.69 14.04 16.27
174 "K14" 40 100 0 16.19 22.43 2.19
175 "K15" 100 100 40 62.66 63.7 14.84
176 "K16" 0 100 80 7.22 13.33 24.18
177 "L1" 40 0 20 4.75 2.89 2.62
178 "L2" 60 100 100 38.93 48.68 58.9
179 "L3" 93.33 100 93.33 65.92 71 57.4
180 "L4" 100 100 60 66.52 69 26.91
181 "L5" 40 40 100 15.55 13.99 36.92
182 "L6" 60 40 40 17.18 15.48 10.42
183 "L7" 80 100 80 51.65 59.75 43.16
184 "L8" 60 20 100 18.25 11.8 33.47
185 "L9" 20 20 20 3.47 3.71 3.23
186 "L10" 60 20 40 12.9 9.35 8.48
187 "L11" 100 80 100 64.65 59.55 61.46
188 "L12" 100 80 0 45.13 38.69 1.96
189 "L13" 0 80 80 6.43 10.92 22.75
190 "L14" 60 53.33 60 21.35 21.35 19.83
191 "L15" 80 40 100 33.05 24.65 43.94
192 "L16" 60 60 53.33 22.66 23.84 17.58
193 "M1" 100 86.67 86.67 65.11 63.01 48.58
194 "M2" 20 0 0 1.94 1.46 0.65
195 "M3" 80 40 0 22.58 16.86 1.28
196 "M4" 60 0 60 10.28 5.41 11.55
197 "M5" 20 100 40 11.02 20.07 11.6
198 "M6" 93.33 86.67 93.33 59.78 59.84 54.76
199 "M7" 0 40 40 2.71 4.6 7.83
200 "M8" 40 100 80 23.91 34.53 36.93
201 "M9" 100 20 60 30.27 18.26 16.91
202 "M10" 40 100 100 26.5 36.45 52.65
203 "M11" 40 60 40 13.33 16.63 10.94
204 "M12" 0 80 40 4.04 8.83 9.08
205 "M13" 26.67 26.67 26.67 5.17 5.59 5.05
206 "M14" 0 100 20 3.61 9.2 4.51
207 "M15" 40 40 33.33 10.14 10.8 7.78
208 "M16" 20 20 0 3.13 3.26 0.84
209 "N1" 0 60 40 3.29 6.6 8.25
210 "N2" 0 100 40 4.65 10.78 9.31
211 "N3" 66.67 73.33 73.33 30.72 33.49 30.48
212 "N4" 40 60 0 10.72 12.58 1.45
213 "N5" 40 20 80 10.17 7.54 21.82
214 "N6" 20 80 60 11.18 18 19.3
215 "N7" 100 80 40 53.3 49.34 13.79
216 "N8" 40 20 20 7.14 6.18 3.7
217 "N9" 20 40 60 7.18 8.54 15.43
218 "N10" 40 40 40 10.26 10.86 9.44
219 "N11" 93.33 93.33 100 64.17 66.15 63.94
220 "N12" 80 40 80 29.82 22.94 30.75
221 "N13" 80 73.33 80 41.27 41.14 38.01
222 "N14" 40 40 80 13.72 13.09 26.73
223 "N15" 93.33 100 100 67.54 72.16 65.85
224 "N16" 100 69.8 100 59.57 51.66 57.98
225 "O1" 80 0 0 13.5 7.07 0.76
226 "O2" 100 80 20 49.21 44.05 5.87
227 "O3" 80 20 20 18.71 12.3 3.74
228 "O4" 73.33 80 80 38.42 41.38 37.84
229 "O5" 40 80 20 14.29 19.83 5.34
230 "O6" 100 40 60 38.12 27.36 19.84
231 "O7" 0 20 0 0.82 1.5 0.8
232 "O8" 86.67 100 86.67 58.19 65.09 49.46
233 "O9" 60 80 0 22.03 24.06 1.89
234 "O10" 100 60 100 54.38 44.04 54.64
235 "O11" 53.33 53.33 46.67 17.33 18.31 13.39
236 "O12" 20 13.33 20 3.07 2.92 2.94
237 "O13" 40 40 0 8.57 8.65 1.33
238 "O14" 0 60 0 2.04 4.54 1.45
239 "O15" 20 0 100 5.58 2.53 20.51
240 "O16" 40 40 20 9.55 10.01 4.38
241 "P1" 60 80 60 27.28 32.46 22.7
242 "P2" 0 0 40 1.26 0.88 4.93
243 "P3" 60 80 100 33.17 37.11 53.34
244 "P4" 40 0 100 8.31 3.84 22.57
245 "P5" 0 6.67 6.67 0.65 0.9 1.06
246 "P6" 20 0 60 3.58 1.97 10.4
247 "P7" 20 100 100 17.53 26.57 45.79
248 "P8" 100 60 0 38.54 30.11 1.74
249 "P9" 100 93.33 93.33 70.01 70.01 56.41
250 "P10" 69.8 100 100 45.98 54.96 61.34
251 "P11" 0 40 100 5.76 6.4 24.4
252 "P12" 66.67 66.67 60 27.4 28.95 21.64
253 "P13" 20 40 80 8.91 9.56 24.29
254 "P14" 60 20 60 14.32 10.16 15.55
255 "P15" 80 100 40 44.13 50.38 14.14
256 "P16" 80 20 100 25.91 15.77 35.63
257 "Q1" 20 20 100 7.89 5.75 27.26
258 "Q2" 40 60 100 19.45 21.15 43.11
259 "Q3" 20 0 20 2.18 1.59 2.48
260 "Q4" 14.9 14.9 14.9 2.47 2.57 2.36
261 "Q5" 100 93.33 100 71.98 71.6 65.38
262 "Q6" 60 66.67 66.67 25.4 27.72 25.57
263 "Q7" 100 60 60 46.78 38.92 22.52
264 "Q8" 60 80 80 30.85 35.91 37
265 "Q9" 20 100 0 9.11 15.52 1.94
266 "Q10" 40 40 60 11.65 11.86 16.65
267 "Q11" 60 60 40 20.6 21.96 11.36
268 "Q12" 0 80 0 2.49 6.09 1.38
269 "Q13" 80 80 80 43.66 45.37 39.11
270 "Q14" 89.8 89.8 89.8 56.73 58.92 50.71
271 "Q15" 46.67 46.67 40 13.37 14.14 10.18
272 "Q16" 60 80 40 25.67 30.42 12.63
273 "R1" 40 60 20 11.96 14.98 5.06
274 "R2" 60 100 0 25.55 30.36 2.16
275 "R3" 40 100 60 20.96 31.53 22.46
276 "R4" 100 20 20 26.63 16.16 3.75
277 "R5" 46.67 53.33 53.33 15.45 17.15 15.99
278 "R6" 20 0 40 2.87 1.83 5.87
279 "R7" 20 60 0 5.94 8.9 1.32
280 "R8" 100 0 60 22.2 10.8 12.85
281 "R9" 100 20 80 32.45 19.2 26.87
282 "R10" 100 40 0 31.17 21.44 1.48
283 "R11" 20 0 80 4.71 2.36 15.65
284 "R12" 53.33 46.67 53.33 16.81 16.68 15.67
285 "R13" 80 80 0 33.39 31.69 1.87
286 "R14" 40 20 0 6.67 5.46 0.93
287 "R15" 40 80 100 23.87 29.65 49.1
288 "R16" 26.67 26.67 20 5.1 5.43 3.45
END_DATA

View File

@@ -0,0 +1,940 @@
/*
* Argyll Color Correction System
*
* Incremental far point class
*
* Author: Graeme W. Gill
* Date: 6/11/2002
*
* Copyright 2002 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/*
Algorithm:
Starting with a previous test point as a seed, use a random starte point
and minimisation algorithm to locate another point that is as far as
possible from the nearest existing test point in perceptual space,
while remaining in gamut at all tines. This means that ideally each
point "fills in" the gaps in the existing distribution, while starting
from an existing point.
The performance is still not very good, as the inner loop involves
locating the nearest existing point, as well as converting from
device coordinates to perceptual space. If the powell search radius
is reduced too much the uniformity of the distribution suffers.
*/
/* TTBD:
It would probably help the uniformity of distribution if we could
aproximately locate the next seed point as the one with the
biggest adjoing "gap", and this may speed things up by allowing us
to reduce the powel search radius.
Perhaps switching to a balltree indexing structure would speed up
nearest ppoint finding as well as providing a mechanism to quickly
locate the nearest "void".
Subsequent experience indicates that furthest distance in perceptual
space may not be the best strategy, but furthest distance in device
space may be. Add #define allowing this to be tested ??
*/
#undef DEBUG
#define PERC_PLOT 1 /* Emit perceptive space plots (if DEBUG) */
#define DO_WAIT 1 /* Wait for user key after each plot */
#define ASSERTS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "copyright.h"
#include "aconfig.h"
#ifdef DEBUG
# include "plot.h"
# include "ui.h"
#endif
#include "numlib.h"
#include "sort.h"
#include "icc.h"
#include "xcolorants.h"
#include "targen.h"
#include "ifarp.h"
#include "sort.h" /* Heap sort */
#ifdef DEBUG
static void dump_image(ifarp *s, int pcp);
static void dump_image_final(ifarp *s, int pcp);
#endif
#define MAX_TRIES 30 /* Maximum itterations */
/* nn functions */
static double nearest(ifarp *s, double *q);
static void init_nn(ifarp *s);
static void add_nn(ifarp *s);
static void del_nn(ifarp *s);
/* ----------------------------------------------------- */
/* Default convert the nodes device coordinates into approximate perceptual coordinates */
static void
ifarp_to_percept(void *od, double *p, double *d) {
ifarp *s = (ifarp *)od;
int e;
/* Do nothing - copy device to perceptual. */
for (e = 0; e < s->di; e++) {
p[e] = d[e] * 100.0;
}
}
/* Return the largest distance of the point outside the device gamut. */
/* This will be 0 if inside the gamut, and > 0 if outside. */
static double
ifarp_in_dev_gamut(ifarp *s, double *d) {
int e;
int di = s->di;
double tt, dd = 0.0;
double ss = 0.0;
for (e = 0; e < di; e++) {
ss += d[e];
tt = 0.0 - d[e];
if (tt > 0.0) {
if (tt > dd)
dd = tt;
}
tt = d[e] - 1.0;
if (tt > 0.0) {
if (tt > dd)
dd = tt;
}
}
tt = ss - s->uilimit;
if (tt > 0.0) {
if (tt > dd)
dd = tt;
}
return dd;
}
/* Snap a point to the device gamut boundary. */
/* Return nz if it has been snapped. */
static int snap_to_gamut(ifarp *s, double *d) {
int e;
int di = s->di;
double dd; /* Smallest distance */
double ss; /* Sum */
int rv = 0;
/* Snap to ink limit first */
for (ss = 0.0, e = 0; e < di; e++)
ss += d[e];
dd = fabs(ss - s->uilimit);
if (dd < 0.0) {
int j;
for (j = 0; j < di; j++)
d[j] *= s->uilimit/ss; /* Snap to ink limit */
rv = 1;
}
/* Now snap to any other dimension */
for (e = 0; e < di; e++) {
dd = fabs(d[e] - 0.0);
if (dd < 0.0) {
d[e] = 0.0; /* Snap to orthogonal boundary */
rv = 1;
}
dd = fabs(1.0 - d[e]);
if (dd < 0.0) {
d[e] = 1.0; /* Snap to orthogonal boundary */
rv = 1;
}
}
return rv;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Reverse lookup function :- perceptual to device coordinates */
/* Definition of the optimization functions handed to powell() */
/* Return metric to be minimised, and */
/* an error >= 50000 on being out of device gamut */
static double efunc(void *edata, double p[]) {
ifarp *s = (ifarp *)edata;
double rv;
if ((rv = (ifarp_in_dev_gamut(s, p))) > 0.0) {
rv = rv * 500.0 + 500.0; /* Discourage being out of gamut */
} else {
double v[MXTD];
s->percept(s->od, v, p);
rv = 500.0 - nearest(s, v);
}
//printf("~1 rv = %f from %f %f\n",rv,p[0],p[1]);
return rv;
}
/* Given a point in device space, optimise it to be */
/* within the device gamut, as well as being as far as */
/* possible from the nearest point in perceptual space. */
/* return nz if powell failed */
static int
optimise_point(
ifarp *s,
double *d /* starting and returned device position */
) {
int e, di = s->di;
double sr[MXTD]; /* Search radius in each device dimension */
double drad = 1.0; /* Search Radius (affects fill evenness) */
double ptol = 0.001; /* Tolerance */
double tt;
// ~~99
for (e = 0; e < di; e++)
sr[e] = drad; /* Device space search radius */
if (powell(&tt, di, d, sr, ptol, 500, efunc, (void *)s, NULL, NULL) != 0 || tt >= 50000.0) {
#ifdef DEBUG
warning("ifarp: powell failed, tt = %f",tt);
#endif
return 1;
}
snap_to_gamut(s, d);
return 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Create a new node. */
/* Return current number of nodes */
static int new_node(
ifarp *s,
int ix /* Index of point to start from */
) {
int di = s->di;
int e;
// ~~99
/* Retry if powell failes */
for (;;) {
/* Create the new point by cloning the existing point */
s->nodes[s->np].fx = 0; /* Not a fixed/pre-existing node */
for (e = 0; e < di; e++) {
s->nodes[s->np].p[e] = s->nodes[ix].p[e];
}
/* Compute new point location that is farthest from nearest existing point */
if (optimise_point(s, s->nodes[s->np].p) == 0)
break;
}
/* compute perceptual location */
s->percept(s->od, s->nodes[s->np].v, s->nodes[s->np].p);
#ifdef DEBUG
printf("Added node %d at perc %f %f, dev %f %f\n",
s->np,
s->nodes[s->np].v[0],
s->nodes[s->np].v[1],
s->nodes[s->np].p[0],
s->nodes[s->np].p[1]);
#endif
/* Add the node to our current list */
s->nodes[s->np].touch = s->tbase;
s->np++;
add_nn(s);
return s->np;
}
/* ============================================= */
/* Main object functions */
/* Initialise, ready to read out all the points */
static void ifarp_reset(ifarp *s) {
s->rix = 0;
}
/* Read the next set of non-fixed points values */
/* return non-zero when no more points */
static int ifarp_read(
ifarp *s,
double *d, /* Device position */
double *p /* Perceptual value */
) {
int j;
for (; s->rix < s->np; s->rix++) {
if (s->nodes[s->rix].fx == 0) {
for (j = 0; j < s->di; j++) {
if (d != NULL)
d[j] = s->nodes[s->rix].p[j];
if (p != NULL)
p[j] = s->nodes[s->rix].v[j];
}
s->rix++;
return 0;
}
}
return 1;
}
/* Destroy ourselves */
static void
ifarp_del(ifarp *s) {
if (s->nodes != NULL)
free(s->nodes);
free (s);
}
/* Constructor */
ifarp *new_ifarp(
int verb, /* Verbosity */
int di, /* Dimensionality of device space */
double uilimit, /* (linearized) Ink limit (sum of device coords max) */
int inp, /* Number of points to generate */
fxpos *fxlist, /* List of existing fixed points (may be NULL) */
int fxno, /* Number of existing fixes points */
void (*percept)(void *od, double *out, double *in), /* Perceptual lookup func. */
void *od /* context for Perceptual function */
) {
ifarp *s;
int e, i;
#ifdef DEBUG
printf("new_ifarp called with di %d, inp %d, fxno = %d\n",di,inp,fxno);
#endif
if ((s = (ifarp *)calloc(sizeof(ifarp), 1)) == NULL)
error ("ifarp: ifarp malloc failed");
s->reset = ifarp_reset;
s->read = ifarp_read;
s->del = ifarp_del;
/* If no perceptual function given, use default */
if (percept == NULL) {
s->percept = ifarp_to_percept;
s->od = s;
} else {
s->percept = percept;
s->od = od;
}
s->uilimit = uilimit;
s->inp = inp; /* Intended number of points */
s->np = 0;
if (di > MXTD)
error ("ifarp: Can't handle di %d",di);
s->di = di;
s->tbase = 0;
/* Initial alloc of nodes */
if ((s->nodes = (ifpnode *)malloc(s->inp * sizeof(ifpnode))) == NULL)
error ("ifarp: nodes malloc failed");
/* Copy fixed nodes */
for (i = 0; (i < fxno) && (s->np < s->inp); i++) {
s->nodes[s->np].fx = 1;
for (e = 0; e < di; e++)
s->nodes[s->np].p[e] = fxlist[i].p[e];
s->percept(s->od, s->nodes[i].v, s->nodes[i].p);
s->nodes[s->np].touch = s->tbase;
s->np++;
}
/* Create at least one seed point */
if (s->np == 0) {
s->nodes[s->np].fx = 0;
for (e = 0; e < di; e++)
s->nodes[s->np].p[e] = 0.0; /* This is assumed to be in gamut */
s->percept(s->od, s->nodes[i].v, s->nodes[i].p);
s->nodes[s->np].touch = s->tbase;
s->np++;
}
/* Setup initial nearest point acceleration structure */
init_nn(s);
/* Create initial patches */
// ~~99
if (verb)
printf("Full points:\n");
for (i = 0; s->np < s->inp; i += 17) {
i %= s->np;
new_node(s, i);
if (verb) {
int pc = (int)(100.0 * s->np/s->inp + 0.5);
printf(" % 3d%%%c",pc,cr_char); fflush(stdout);
}
}
if (verb)
printf("\n");
/* We're done with acceleration structure */
del_nn(s);
return s;
}
/* --------------------------------------------------- */
/* (This code is has been copied from gamut/gamut.c) */
#ifdef DEBUG
#define NN_INF 100000.0
#else
#define NN_INF 1e307
#endif
/* Given a point, */
/* return the nearest existint test point. */
static double
nearest(
ifarp *s,
double *q /* Target point location */
) {
int e, i, k;
int di = s->di;
int wex[MXTD * 2]; /* Current window edge indexes */
double wed[MXTD * 2]; /* Current window edge distances */
/* Indexes are axis * 2 +0 for lower edge, */
/* +1 for upper edge of search box. */
/* We are comparing lower edge of search box */
/* with upper edge of bounding box etc. */
//printf("~1 nearest called\n");
/* We have to find out which existing point the point will be nearest */
if ((s->tbase + di) < s->tbase) { /* Overflow of touch count */
for (i = 0; i < s->np; i++)
s->sax[0][i]->touch = 0; /* reset it in all the objects */
s->tbase = 0;
}
s->ttarget = s->tbase + di; /* Target touch value */
//printf("\n");
//printf("Query point is %f %f\n",q[0], q[1]);
/* Find starting indexes within axis arrays */
for (e = 0; e < (2 * di); e++) { /* For all axes min & max */
int f = e/2; /* Axis */
int i0, i1, i2; /* Search indexes */
double v0, v1, v2; /* Box */
double qf, ww;
/* Binary search this edge */
qf = q[f]; /* strength reduced q[f] */
//printf("\n");
//printf("isearching axis %d %s for %f\n",f, e & 1 ? "max" : "min", qf);
i0 = 0;
i2 = s->np - 1;
v0 = s->sax[f][i0]->v[f];
v2 = s->sax[f][i2]->v[f];
//printf("start points %d - %d, bound %f - %f\n",i0, i2, v0, v2);
if (qf <= v0) {
i2 = i0;
v2 = v0;
} else if (qf >= v2) {
i0 = i2;
v0 = v2;
} else {
do {
i1 = (i2 + i0)/2; /* Trial point */
v1 = s->sax[f][i1]->v[f]; /* Value at trial */
if (v1 < qf) {
i0 = i1; /* Take top half */
v0 = v1;
} else {
i2 = i1; /* Take bottom half */
v2 = v1;
}
//printf("current point %d - %d, bound %f - %f\n",i0, i2, v0, v2);
} while ((i2 - i0) > 1);
}
if (e & 1) { /* Max side of window */
int tc; /* total object count */
ww = v2 - qf;
wed[e] = fabs(ww) * ww;
wex[e] = i2;
/* Check that min and max together will cover at least s->np objects */
tc = s->np - i2 + wex[e ^ 1] + 1;
//printf("got %d, expected %d\n",tc, s->np);
/* (I don't really understand why this works!) */
if (tc < s->np) { /* We haven't accounted for all the objects */
int el = e ^ 1; /* Low side sax */
int ti0, ti2;
double tv0, tv2;
ti0 = wex[el];
ti2 = i2;
//printf("We have straddling objects, initial indexes are %d - %d\n",ti0, ti2);
/* While straddling objects remain undiscovered: */
while (tc < s->np) {
tv0 = NN_INF; /* Guard values */
tv2 = -NN_INF;
/* Increment low side until we find a straddler */
while (ti0 < (s->np-1)) {
ww = s->sax[f][++ti0]->v[f]; /* Position of the other end */
if (ww < qf) {
//printf("found low object %d at index %d that straddles\n",s->sax[f][ti0]-s->nodes,ti0);
tv0 = qf - s->sax[f][ti0]->v[f];
break;
}
}
/* Decrement high side until we find a straddler */
while (ti2 > 0) {
ww = s->sax[f][--ti2]->v[f]; /* Position of the other end */
if (ww > qf) {
//printf("found high object %d at index %d that straddles\n",s->sax[f][ti2]-s->nodes,ti2);
tv2 = s->sax[f][ti2]->v[f] - qf;
break;
}
}
/* Choose the closest */
if (tv0 > tv2) {
wed[el] = fabs(tv0) * tv0;
wex[el] = ti0;
tc++;
} else {
wed[e] = fabs(tv2) * tv2;
wex[e] = ti2;
tc++;
}
}
//printf("After correction we have %d - %d\n",wex[e^1], wex[e]);
}
} else { /* Min side of window */
ww = q[f] - v0;
wed[e] = fabs(ww) * ww;
wex[e] = i0;
}
}
/* Expand a di dimenstional cube centered on the target point, */
/* jumping to the next nearest point on any axis, discovering */
/* any bounding boxes that are within the expanding window */
/* by checking their touch count. */
/* The first point found establishes the initial best distance. */
/* When the window expands beyond the point where it can improve */
/* the best distance, stop */
{
double bw = 0.0; /* Current window distance */
double bdist = NN_INF; /* Best possible distance to an object outside the window */
int bix; /* Index of best point */
/* Until we're done */
for (;;) {
int ee; /* Axis & expanding box edge */
int ff; /* Axis */
int ii; /* Index of chosen point */
ifpnode *ob; /* Current object */
unsigned int ctv; /* Current touch value */
//printf("\n");
//printf("wwidth = %f, bdist = %f, window = %d-%d, %d-%d\n",
//bw, bdist, wex[0], wex[1], wex[2], wex[3]);
//printf("window edge distances are = %f-%f, %f-%f\n",
//wed[0], wed[1], wed[2], wed[3]);
/* find next (smallest) window increment axis and direction */
ee = 0;
ii = wex[ee];
bw = wed[ee];
for (e = 1; e < (2 * di); e++) {
if (wed[e] < bw) {
ee = e;
ii = wex[e];
bw = wed[e];
}
}
//printf("Next best is axisdir %d, object %d, axis index %d, best possible dist %f\n",
//ee, s->sax[ee/2][ii] - s->nodes, ii, bw);
if (bw == NN_INF || bw > bdist) {
break; /* Can't go any further, or further points will be worse */
}
#ifdef ASSERTS
if (ii < 0 || ii >= s->np) {
printf("Assert: went out of bounds of sorted axis array\n");
exit(0);
}
#endif
/* Chosen point on ee axis/direction, index ii */
ff = ee / 2; /* Axis only */
ob = s->sax[ff][ii];
/* Touch value of current object */
ctv = ob->touch;
if (ctv < s->ttarget) { /* Not been dealt with before */
/* Touch this new window boundary point */
ob->touch = ctv = ((ctv < s->tbase) ? s->tbase : ctv) + 1;
//printf("New touch count on %d is %d, target %d\n",
//ob - s->nodes, s->sax[ff][ii]->touch, s->ttarget);
/* Check the point out */
if (ctv == (s->tbase + di)) { /* Is within window on all axes */
double tdist = 0.0;
/* Compute distance from query point to this object */
for (k = 0; k < di; k++) {
double tt = ob->v[k] - q[k];
tdist += tt * tt;
}
//printf("Got new best point %d, dist %f\n",ob-s->nodes,sqrt(tdist));
if (tdist < bdist) { /* New closest distance */
bdist = tdist;
bix = ob - s->nodes;
}
}
}
/* Increment next window edge candidate, and figure new edge distance */
if (ee & 1) { /* Top */
if (++wex[ee] >= s->np) {
wed[ee] = NN_INF;
wex[ee]--;
} else {
double ww = s->sax[ff][wex[ee]]->v[ff] - q[ff];
wed[ee] = fabs(ww) * ww;
}
} else {
if (--wex[ee] < 0) {
wed[ee] = NN_INF;
wex[ee]++;
} else {
double ww = q[ff] - s->sax[ff][wex[ee]]->v[ff];
wed[ee] = fabs(ww) * ww;
}
}
}
s->tbase += di; /* Next touch */
//printf("~1 returning closest to node %d distance %f\n",bix,sqrt(bdist));
return sqrt(bdist); /* Return nearest distance */
}
}
/* Setup the nearest function acceleration structure */
/* with the existing points */
static void
init_nn(
ifarp *s
) {
int di = s->di;
int i, k;
int np = s->np; /* Existing number of points */
//printf("~9 init_nn called\n");
s->tbase = 0; /* Initialse touch flag */
/* Allocate the arrays spaces for intended number of points */
for (k = 0; k < di; k++) {
if ((s->sax[k] = (ifpnode **)malloc(sizeof(ifpnode *) * s->inp)) == NULL)
error("Failed to allocate sorted index array");
}
/* Add each existing test point to the axis lists. */
for (i = 0; i < np; i++) {
for (k = 0; k < di; k++)
s->sax[k][i] = &s->nodes[i];
}
/* Sort the axis arrays */
for (k = 0; k < di; k++) {
/* Sort nodes edge list */
#define HEAP_COMPARE(A,B) (A->v[k] < B->v[k])
HEAPSORT(ifpnode *, &s->sax[k][0], np)
#undef HEAP_COMPARE
}
//printf("~9 init_nn done\n");
}
#ifdef NEVER /* Slower but simpler version */
/* Add the last point to the acceleration structure */
static void
add_nn(
ifarp *s
) {
int di = s->di;
int i, k;
int np = s->np; /* Existing number of points */
int ap = np - 1; /* Index of point ot add */
//printf("~9 add_nn called with point ix %d, pos %f %f\n",ap, s->nodes[ap].v[0],s->nodes[ap].v[1]);
for (k = 0; k < di; k++) {
s->sax[k][ap] = &s->nodes[ap];
}
/* Sort the axis arrays */
for (k = 0; k < di; k++) {
/* Sort nodes edge list */
#define HEAP_COMPARE(A,B) (A->v[k] < B->v[k])
HEAPSORT(ifpnode *, &s->sax[k][0], np)
#undef HEAP_COMPARE
}
}
#else
/* Add the last point to the acceleration structure */
static void
add_nn(
ifarp *s
) {
int di = s->di;
int e;
int np = s->np; /* Existing number of points */
int ap = np - 1; /* Index of point to add */
//printf("~9 add_nn called with point ix %d, pos %f %f\n",ap, s->nodes[ap].v[0],s->nodes[ap].v[1]);
for (e = 0; e < di; e++) { /* For all axes */
int i0, i1, i2; /* Search indexes */
double v0, v1, v2; /* Box */
double qf;
qf = s->nodes[ap].v[e]; /* value to be insertion sorted */
//printf("isearching axis %d for %f\n",e, qf);
/* Find index of lowest value that is greater than target */
i0 = 0;
i2 = ap - 1;
v0 = s->sax[e][i0]->v[e];
v2 = s->sax[e][i2]->v[e];
//printf("start points %d - %d, bound %f - %f\n",i0, i2, v0, v2);
if (qf <= v0) {
i1 = i0;
} else if (qf >= v2) {
i1 = ap;
} else {
do {
i1 = (i2 + i0)/2; /* Trial point */
v1 = s->sax[e][i1]->v[e]; /* Value at trial */
if (qf > v1) {
i0 = i1; /* Take top half */
v0 = v1;
} else { /* qf <= v1 */
i2 = i1; /* Take bottom half */
v2 = v1;
}
//printf("current point %d - %d, bound %f - %f\n",i0, i2, v0, v2);
} while ((i2 - i0) > 1);
i1 = i0;
v1 = s->sax[e][i1]->v[e];
/* Ensure we're > than target */
while (v1 <= qf) {
i1++;
if (i1 < ap)
v1 = s->sax[e][i1]->v[e];
else
break;
}
}
/* Make room */
if (i1 < ap) {
memmove((void *)&s->sax[e][i1+1], (void *)&s->sax[e][i1], (ap - i1) * sizeof(ifpnode *));
}
/* Insert */
s->sax[e][i1] = &s->nodes[ap];
}
}
#endif
/* Free everything to do with the nn */
static void del_nn(ifarp *s) {
int di = s->di;
int k;
for (k = 0; k < di; k++) {
free (s->sax[k]);
}
}
/* =================================================== */
#ifdef STANDALONE_TEST
icxColorantLu *clu;
void sa_percept(void *od, double *out, double *in) {
#ifdef NEVER
double lab[3];
clu->dev_to_rLab(clu, lab, in);
out[0] = lab[0];
// out[1] = (lab[1]+100.0)/2.0;
out[1] = (lab[2]+100.0)/2.0;
#else
out[0] = in[0] * 100.0;
out[1] = in[1] * 100.0;
#endif
}
int
main(argc,argv)
int argc;
char *argv[];
{
int npoints = 500;
ifarp *s;
int mask = ICX_BLACK | ICX_GREEN;
int di = 2;
error_program = argv[0];
check_if_not_interactive();
if (argc > 1)
npoints = atoi(argv[1]);
if ((clu = new_icxColorantLu(mask)) == NULL)
error ("Creation of xcolorant lu object failed");
/* Create the required points */
s = new_ifarp(1, di, 1.5, npoints, NULL, 0, sa_percept, (void *)NULL);
#ifdef DEBUG
/* Dump perceptual map */
dump_image(s, PERC_PLOT);
#endif /* DEBUG */
s->del(s);
return 0;
}
#endif /* STANDALONE_TEST */
#ifdef DEBUG
/* Dump the current point positions to a plot window file */
static void
dump_image(ifarp *s, int pcp) {
double minx, miny, maxx, maxy;
double *x1a = NULL;
double *y1a = NULL;
double *x2a = NULL;
double *y2a = NULL;
double *x3a = NULL;
double *y3a = NULL;
int i, nu;
ifpnode *p;
if (s->np == 0)
return;
if (pcp) { /* Perceptual range */
minx = 0.0; /* Assume */
miny = 0.0;
maxx = 100.0;
maxy = 100.0;
} else {
minx = 0.0; /* Assume */
miny = 0.0;
maxx = 1.0;
maxy = 1.0;
}
if ((x1a = (double *)malloc(s->np * sizeof(double))) == NULL)
error ("ifarp: plot malloc failed %d",s->np);
if ((y1a = (double *)malloc(s->np * sizeof(double))) == NULL)
error ("ifarp: plot malloc failed %d",s->np);
if ((x2a = (double *)malloc(s->np * sizeof(double))) == NULL)
error ("ifarp: plot malloc failed %d",s->np);
if ((y2a = (double *)malloc(s->np * sizeof(double))) == NULL)
error ("ifarp: plot malloc failed %d",s->np);
for (nu = i = 0; i < s->np; i++) {
p = &s->nodes[i];
if (pcp) {
x1a[nu] = p->v[0];
y1a[nu] = p->v[1];
x2a[nu] = p->v[0];
y2a[nu] = p->v[1];
} else {
x1a[nu] = p->p[0];
y1a[nu] = p->p[1];
x2a[nu] = p->p[0];
y2a[nu] = p->p[1];
}
nu++;
}
/* Plot the vectors */
do_plot_vec(minx, maxx, miny, maxy,
x1a, y1a, x2a, y2a, nu, DO_WAIT, x3a, y3a, NULL, NULL, 0);
free(x1a);
free(y1a);
free(x2a);
free(y2a);
}
#endif /* DEBUG */

View File

@@ -0,0 +1,68 @@
#ifndef IFARP_H
/*
* Argyll Color Correction System
*
* Incremental far point class
*
* Author: Graeme W. Gill
* Date: 6/11/2002
*
* Copyright 2002 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/* A sample point node */
struct _ifpnode {
int fx; /* nz if point is fixed (existing) */
double p[MXTD]; /* Device coordinate position */
double v[MXTD]; /* Subjective value (Labnnn..) */
unsigned int touch; /* nn: Per value touch count */
}; typedef struct _ifpnode ifpnode;
/* Main simplex latice object */
struct _ifarp {
/* private: */
int di; /* Point dimensionality */
double uilimit; /* (linearized) ink limit - limit on sum of p[] */
int inp; /* Intended number of points in list */
int np; /* Number of point nodes in list */
ifpnode *nodes; /* Current array of nodes */
int rix; /* Next read index */
/* Perceptual function */
void (*percept)(void *od, double *out, double *in);
void *od; /* Opaque data for perceptual point */
/* nn support */
ifpnode **sax[MXTD]; /* Sorted axis pointers, one for each direction */
unsigned int tbase; /* Touch base value for this pass */
unsigned int ttarget; /* Touch target value for this pass */
/* public: */
/* Initialise, ready to read out all the points */
void (*reset)(struct _ifarp *s);
/* Read the next set of non-fixed points values */
/* return non-zero when no more points */
int (*read)(struct _ifarp *s, double *d, double *p);
/* Destroy ourselves */
void (*del)(struct _ifarp *s);
}; typedef struct _ifarp ifarp;
/* Constructor */
extern ifarp *new_ifarp(int verb, int di, double uilimit,
int npoints, fxpos *fxlist, int fxno,
void (*percept)(void *od, double *out, double *in), void *od
);
#define IFARP_H
#endif /* IFARP_H */

10369
Argyll_V3.5.0/target/ofps.c Normal file

File diff suppressed because it is too large Load Diff

440
Argyll_V3.5.0/target/ofps.h Normal file
View File

@@ -0,0 +1,440 @@
#ifndef OFPS_H
/*
* Argyll Color Correction System
*
* Optimised Farthest Point Sampling
*
* Author: Graeme W. Gill
* Date: 6/9/2004
*
* Copyright 2004 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
#ifndef MXPD
#define MXPD 4 /* Maximum ofps dimentionality */
#endif
#define MXNIX (MXPD+3) /* Maximum vertex node indexes + hash + ixm */
struct _acell;
/* A gamut surface plane equation. */
struct _pleq {
double pe[MXPD+1]; /* Vertex plane equation. First di elements are normalized */
/* outward pointing normal (from first sample point), last element */
/* is constant. If point . pe > 0, then point is outside surface */
int ix; /* Index of fake node associated with gamut surface (-ve) */
}; typedef struct _pleq pleq;
/* A sub-surface set mask */
#define MXSMASKW 6 /* Maximum number of setmask words */
typedef struct {
unsigned int m[MXSMASKW];
} setmask;
/* A vertex. This is a point that has the highest eserr within */
/* the local region of di+1 nodes. It is therefore a candidate for a new */
/* sample node during seeding, or a point at which the sampling */
/* error of the current node locations can be estimated. */
/* Vertexes are the vericies of the Voronoi polyhedra. */
/* Because these are based on the natural eserr neighborhood, */
/* they are not necessarily exactly poyhedra. */
/* (Non gamut boundary vertices are shared) */
struct _vtx {
int no; /* Serial number for id */
int nix[MXNIX]; /* di+1 Sample point node indexes involved in vertex */
/* Index is -ve if it is a fake gamut boundary node, */
/* sorted largest to smallest (so fake gamut nodes are last) */
/* [MXPD+1] is hash of all the node indexes, */
/* [MXPD+2] is the OR of all the node ixm's */
double ce[MXPD+1]; /* Estimated curvature error from mid point to each real node */
/* (ce's are compacted, skipping fake boundary nodes) */
int nnv; /* Number of neighbour vertices (vertex net) */
int _nnv; /* Number allocated */
struct _vtx **nv; /* List of neighbour vertices. This includes hidden verts. */
/* (If we didn't have to support INDEP_SURFACE, then there would */
/* be exactly di neighbour vertices.) */
double p[MXPD]; /* Vertex location */
double v[MXPD]; /* Subjective value at vertex (Labj) ? */
double eperr; /* Estimated position error */
double eserr; /* Estimated sampling error */
double p_eperr; /* Previous estimated position error */
char ghost; /* Don't use for optimization or stats. */
char ifake; /* A fake inside node */
char ofake; /* A fake outside node */
char used; /* Set to nz if already used for seeding */
char bch; /* nz if added to batch update list */
char del; /* Marked for deletion (used by add_to_vsurf()) */
char add; /* 1 = add to node, 2 = update hm (used by add_to_vsurf()) */
char par; /* Marked for deletion because it's already a parent node */
int sch; /* Sanity check houskeeping */
setmask buvm; /* Batch update to sub-surface hidden setmask */
setmask bdvm; /* Batch delete change to sub-surface hidden setmask */
struct _vtx *batch; /* Batch update list */
int nsp; /* Number of gamut surface planes it touches */
pleq *sp[MXPD+1]; /* List of gamut surface planes */
unsigned int pmask; /* Gamut surface plane mask, from its location */
unsigned int cmask; /* Gamut surface composition mask, from it's parent nodes */
setmask vm; /* Sub-surface visiblility setmask */
struct _vtx *link; /* Linked list of free/used vtx's */
struct _vtx **plp; /* Pointer to link pointer in used list */
struct _vtx *n; /* Next in acceleration list */
struct _vtx **pn; /* Pointer to link pointer in acceleration list */
int pci; /* Accelleration grid index */
struct _vtx *chn; /* Next in cache index list */
struct _vtx **pchn; /* Pointer to link pointer in cache index list */
int fflag; /* fchl set flag set from s->fflag */
struct _vtx *fchl; /* Next in fixup check list */
struct _vtx **pfchl;/* Pointer to link pointer */
int fupcount; /* Number of times vertex has fixed in a round */
double fuptol; /* Tollerance for fixing this vertex */
struct _node *hnode;/* Hit node */
double hitmarg; /* Hit margine to node */
struct _vtx **psvtxs; /* Pointer to entry in s->svtxs[] */
int cflag; /* Vertex checked for hit flag, set from s->flag */
int sflag; /* Vertex search before flag, set from s->flag */
int hflag; /* Vertex search after hit flag, set from s->flag */
char opqsq; /* flag, on post hit search queue */
struct _vtx *slist; /* Breadth first search list link */
int disth; /* Search distance from hit vertex, valid when hflag == s->flag */
struct _vtx *nxh; /* Vtxs hit by node (to be deleted) list set by ofps_check_vtx_vn() */
double nba_eperr; /* node being added eperr, valid if cflag == s->flag */
struct _vtx *dell; /* Deleted/Not Deleted list */
}; typedef struct _vtx vtx;
/* A mid point. This is a point that has the highest eserr directly */
/* between two neighboring nodes. It is used during optimization */
/* to try and encourage even spacing between nodes. */
struct _mid {
int no; /* Serial number for id */
double p[MXPD]; /* Midpoint location */
int nix[2]; /* The two sample point node indexes involved in midpoint */
double ce[2]; /* Estimated curvature error from mid point to two nodes */
double np; /* Interpolation point between nux[0] and nix[1] */
double v[MXPD]; /* Subjective value at midpoint (Labj) ? */
double eperr; /* Estimated position error */
double eserr; /* Estimated sampling error */
int refc; /* Reference count */
struct _mid *link; /* Linked list of free/used mid's */
struct _mid **plp; /* Pointer to link pointer in used list */
}; typedef struct _mid mid;
/* A measurement sample point node. */
/* Sample points are the points around which the Voronoi polyhedra */
/* are constructed. If a network is constructed between nodes that */
/* form a vertex, the netork will be the Delaunay tesselation. */
struct _node {
int ix; /* Index of node in s->n[] */
int ixm; /* Hash mask of node ix */
int fx; /* nz if point is fixed */
double p[MXPD]; /* Device coordinate position */
double v[MXPD]; /* Subjective value (Labk) ? */
double np[MXPD]; /* Next device coordinates during opt */
double nv[MXPD]; /* Next subjective coordinates during opt */
double op[MXPD]; /* Previous device coordinates during opt */
int nvv; /* Number of Voronoi surface vertices */
int _nvv; /* Number allocated */
vtx **vv; /* List of Voronoi surface vertices */
int nvn; /* Number of Voronoi nodes & midpoints */
int _nvn; /* Number allocated */
int *vn; /* List of Voronoi nodes indexes. Doesn't include this node. */
/* Index is -ve if it is a fake gamut boundary node. */
mid **mm; /* List of midpoints. Midpoints will be NULL if not created yet. */
int nsp; /* Number of touched gamut surface planes */
pleq *sp[MXPD+1]; /* List of touched gamut surface planes */
unsigned int pmask; /* Gamut surface plane mask */
struct _acell *cell;/* Pointer to cell vertex is in */
struct _node *n; /* Next in acceleration list */
struct _node **pn; /* Pointer to link pointer in acceleration list */
int pci; /* Accelleration grid index */
int flag; /* Node being added access flag, set from s->flag */
int nvnflag; /* node_recomp_nvn_dmxs access flag */
struct _node *na; /* Next in 'to be added' list */
int upflag; /* Set to s->flag if node has been added to ->nup list */
struct _node *nup; /* Next node in 'recomp_nvn' list */
}; typedef struct _node node;
#define BOUND_GFLAG ((unsigned int)-1) /* Boundary cell gflag */
/* An acceleration structure cube */
struct _acell {
unsigned int gflag; /* Acceleration grid search touched & boundary flag */
node *head; /* List of nodes inside acceleration cell */
vtx *vhead; /* List of vertices with all real nodes inside acceleration cell */
int co[MXPD]; /* coordinate of cell */
double p[MXPD]; /* Device position of base of cell */
double v[MXPD]; /* Corresponfing perceptual value of base of cell */
double cp[MXPD]; /* Device position of center of cell */
double cv[MXPD]; /* Corresponfing perceptual value of center of cell */
double eperr; /* Worst case eperr from a corner to the center */
struct _acell *slist; /* Search list */
}; typedef struct _acell acell;
/* Storage for a node combination/new position */
struct _nodecomb {
int nix[MXNIX]; /* di+1 Sample point node indexes involved in vertex */
double ce[MXPD+1]; /* Estimated curvature error from mid point to two nodes */
vtx **v1, **v2; /* Deleted and non-deleted vertex involved */
int _count; /* v1/v2 allocation */
int count; /* Number of times this is generated, used of v1/v2 */
double p[MXPD]; /* Position of resulting vertex or */
double v[MXPD]; /* Value of resulting vertex or */
double eperr;
double eserr;
double weserr;
int pvalid; /* Valid new position, else use deleted location & eserr */
vtx *vv; /* Existing vertex at this combination (if opt) */
double ceperr; /* Current eperr to be bettered */
double oog; /* Out of gamut value */
setmask vm; /* Sub-surface visibility setmask */
int startex; /* nz if existing p[] should be starting dnsqe point */
}; typedef struct _nodecomb nodecomb;
/* Vertex cache hash index/table size */
#define VTXCHSIZE 33037
//#define VTXCHSIZE 67493
/* Record of a set of gamut surface plane combination */
struct _surfcomb {
unsigned int co; /* Surface combination mask */
int valid; /* Valid flag */
int nos; /* Number surfaces */
int smset; /* i_sm has been set */
setmask i_sm; /* Indiviual set of this surface combination */
setmask a_sm; /* Accumulated set of this and higher dimensions */
struct _surfcomb *ds; /* Circular list of the disjoint set */
}; typedef struct _surfcomb surfcomb;
/* Main sample point object */
struct _ofps {
/* private: */
int verb; /* Verbose */
int di; /* Point dimensionality */
double ilimit; /* Ink limit - limit on sum of p[] */
double imin[MXPD]; /* Ink limit - limit on min of p[], must be >= 0.0 */
double imax[MXPD]; /* Ink limit - limit on min of p[], must be <= 1.0 */
int good; /* 0 = fast, 1 = good flag */
double surftol; /* Surface tollerance distance */
int maxits; /* Maximum itterative improvement passes */
double lperterb; /* level of random peturbation */
double ssurfpref, esurfpref; /* Start and end surface preference weightig */
/* Error estimate model parameters */
double devd_wght; /* Device space weighting */
double perc_wght; /* Perceptual space weighting */
double curv_wght; /* Curvature weighting */
int fxno; /* Total number of fixed points provided, possibly non-unique */
fxpos **ufx; /* fnp randomized unique fixed points to add */
int gnp; /* Number of fake gamut nodes (-ve index) */
/* -1 to -2di-1 are fake boundary node indexes, */
/* with -2di-1 being the ink limit boundary. */
/* -2di-2 is the fake inside node, */
/* -2di-3 is the fake outside node, */
int fnp; /* Number of unique fixed points in list */
int tinp; /* Target number of total points in list, including fnp */
int np; /* Number of points currently in list */
node *_n, **n; /* tinp allocation of points, list of pointers to points */
int nv; /* Current number of vertices */
int nxvno; /* Next vertex serial number */
int nxmno; /* Next midpoint serial number */
/* Gamut surface definition planes. */
int nbp; /* Number of boundary planes. Either 2di or 2di+1 */
pleq gpeqs[2 + MXPD * 2 + 1]; /* Plane equations associated */
/* with the fake gamut surface/boundary nodes */
/* points. Index is 1-ix */
/* (allow for other fakes, just in case) */
int sminit; /* Flag, nz if sc has been inited */
surfcomb *sc; /* Array of (1 << nbp) surface combinations */
int smbits; /* Total set mask bits */
int bpsmw; /* Bits per set mask word */
int nsmw; /* Number of setmask words */
unsigned int lwmask; /* Last word mask */
/* Perceptual function handed in. All device values must have been */
/* clipped before calling this. (On running, is replaced with rspl */
/* cached version) */
void (*percept)(void *od, double *out, double *in);
void *od; /* Opaque data for perceptual point */
int pcache_res; /* Grid resolution of pcache */
rspl *pcache; /* cache of perceptual lookup */
/* Other info */
int rix; /* Next read index */
double mn,mx,av; /* serr stats */
double smns; /* Closest node spacing */
double mxmvsq; /* Maximum movement during optimisation */
int optit; /* Optimization itteration */
vtx *nxh; /* Vtxs hit by node (to be deleted) list set by ofps_check_vtx_vn() */
vtx *nxp; /* Vtxs that are already parents of added node list (fixups) */
struct _vtx *batch; /* Batch update list */
int checklev; /* check node recursion level */
struct _vtx *fchl; /* Next vertex in fixup check list */
struct _vtx **svtxs;/* Vertex "to be fixed" list */
int nsvtxs; /* Number in vertex "to be fixed" list */
int _nsvtxs; /* Allocated size of vertex "to be fixed" list */
struct _node *nup; /* Next node in 'recomp_nvn' list */
/* Used and free lists */
struct _vtx *uvtx; /* Linked list of used vtx's */
struct _vtx *fvtx; /* Linked list of free vtx's */
struct _vtx *hvtx; /* Linked list of hidden vtx's */
struct _mid *umid; /* Linked list of used mid's */
struct _mid *fmid; /* Linked list of free mid's */
/* Unbounded perceptual model */
double pmod[MXPD * (1 << MXPD)];
int pmod_init; /* It's been initialised */
/* Acceleration structure */
int agres; /* Acceleration grid resolution (not including extra row) */
double gw; /* Grid cell width */
int gim[MXPD]; /* Grid index multiplier */
double gcd; /* Grid cell diagonal */
int nig; /* Number of cells in grid (including guard rows) */
acell *_grid; /* Pointer to allocated array of grid structures */
acell *grid; /* Pointer to base of array of grid structures */
int agrid_init; /* accell grid p[] and v[] have been inited */
unsigned int gflag; /* Acceleration grid search flag */
int nacnl; /* Number of bytes in Accelleration cell neighbour offset list */
int *acnl; /* Accelleration cell neighbour offset list */
int flag; /* Access flag associated with node being added */
int nvnflag; /* node_recomp_nvn_dmxs access flag */
int fflag; /* Fixup round flag */
vtx *vch[VTXCHSIZE]; /* Vertex cache index */
aat_atree_t *vtreep; /* Binary tree of vertexes sorted by eperr */
aat_atree_t *vtrees[MXPD+2]; /* Per nsp, binary tree of vertexes sorted by eserr */
/* We get di+2 planes for fake initial nodes */
/* Utility - avoid re-allocation/initialization */
sobol *sob;
nodecomb *combs; /* New node combinations being created in add_to_vsurf() */
int _ncombs; /* Number of node combinations allocated. */
/* Debug/stats */
int nopstop; /* Number of optimization passes before stopping with diagnostics */
int ntostop; /* Number of points before stopping with diagnostics */
int positions; /* Number of calls to locate vertex */
int dnsqs; /* Number of dnsq is called */
int funccount; /* Number of times dnsq callback function is called */
int maxfunc; /* Maximum function count per dnsq */
int sucfunc; /* Function count per sucessful dnsq */
int sucdnsq; /* Number of sucessful dnsqs */
int maxretries; /* Maximum retries used on sucessful dnsq */
int posfails; /* Number of position_vtx failures */
int posfailstp; /* Number of position_vtx failures this pass */
int nvtxcreated; /* Number of vertexes created */
int nvtxdeleted; /* Number of vertexes deleted */
int add_hit; /* Number of add_to_vsurf hits */
int add_mis; /* Number of add_to_vsurf misses */
int fadd_hit; /* Number of fixup add_to_vsurf hits */
int fadd_mis; /* Number of fixup add_to_vsurf misses */
int nvcheckhits; /* Number of vertexes hit durint ofps_check_node() */
int vvchecks; /* Number of vertexes checked for hit */
int vvpchecks; /* Number of vertexes that would be exaustively checked for hits */
int naccsrch; /* Number of accellerated searches */
int ncellssch; /* Number of accelleration cells searched */
int nnschd; /* Number of nodes nearest searched */
int nnfschd; /* Number of nodes for full nearest searched */
int nvschd; /* Number of vertexes nearest searched */
int nvfschd; /* Number of vertexes for full nearest searched */
int nsurfadds; /* Number of add_to_vsurf() calls */
int nhitv; /* Number of hit vertexes in add_to_vsurf() */
int maxhitv; /* Maximum number of hit vertexes in add_to_vsurf() */
int nfseeds; /* Number of times searched for vtx with largest eserr */
int nfseedsvtx; /* Number of vertexes searched for vtx with largest eserr */
unsigned int l_mstime; /* Last create surface pass timestamp */
int l_positions; /* Last Number of calls to locate vertex */
int l_nvtxcreated; /* Last Number of vertexes created */
int l_nvtxdeleted; /* Last Number of vertexes deleted */
struct _vtx *i_uvtx; /* Incrementallu created vertexes used by DEBUG_RESEED_AFTER_FIXUPS */
/* public: */
/* return non-zero if the perceptual point is within the device gammut */
int (*pig)(struct _ofps *s, double *p);
/* Initialise, ready to read out all the points */
void (*reset)(struct _ofps *s);
/* Read the next set of non-fixed points values */
/* return non-zero when no more points */
/* p = position, v = value, either may be NULL */
int (*read)(struct _ofps *s, double *p, double *v);
/* Calculate and print stats */
void (*stats)(struct _ofps *s);
/* Destroy ourselves */
void (*del)(struct _ofps *s);
}; typedef struct _ofps ofps;
/* Constructor */
extern ofps *new_ofps(
int verb,
int di, double ilimit, int npoints,
int good,
double dadaptation,
double devd_wght,
double perc_wght,
double curv_wght,
fxpos *fxlist, int fxno, /* Existing, fixed point list */
void (*percept)(void *od, double *out, double *in), void *od);
/* Extended constructor */
ofps *new_ofps_ex(
int verb, /* Verbosity */
int di, /* Dimensionality of device space */
double ilimit, /* Ink limit (sum of device coords max) */
double *imin, /* Ink limit - limit on min of p[], normally >= 0.0 */
double *imax, /* Ink limit - limit on min of p[], normally <= 1.0 */
int tinp, /* Total number of points to generate, including fixed */
int good, /* 0 = fast, 1 = good */
double dadaptation, /* Degree of adaptation to device characteristic 0.0 - 1.0, */
/* use -ve value for explicit weightings: */
double devd_wght, /* Device space weighting (if dad < 0) */
double perc_wght, /* Perceptual space weighting (if dad < 0) */
double curv_wght, /* Curvature weighting (if dad < 0) */
fxpos *fxlist, /* List of existing fixed points (may be NULL) */
int fxno, /* Number of existing fixes points */
void (*percept)(void *od, double *out, double *in), /* Perceptual lookup func. */
void *od, /* context for Perceptual function */
int ntostop, /* Debug - number of points until diagnostic stop */
int nopstop /* Debug - number of optimizations until diagnostic stop, -1 = not */
);
#define OFPS_H
#endif /* OFPS_H */

View File

@@ -0,0 +1,594 @@
/*
* Argyll Color Correction System
*
* Perceptual space random test point class
*
* Author: Graeme W. Gill
* Date: 12/9/2004
*
* Copyright 2004, 2009 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/* TTBD:
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "aconfig.h"
#include "numlib.h"
#include "sort.h"
#include "icc.h"
#include "conv.h"
#include "xicc.h"
#include "xcolorants.h"
#include "targen.h"
#include "prand.h"
static int prand_from_percept( prand *s, double *p, double *v);
/* ----------------------------------------------------- */
/* Default convert the nodes device coordinates into approximate perceptual coordinates */
/* (usually overriden by caller supplied function) */
static void
default_prand(void *od, double *p, double *d) {
prand *s = (prand *)od;
int e;
/* Default Do nothing - copy device to perceptual. */
for (e = 0; e < s->di; e++) {
p[e] = d[e] * 100.0;
}
}
/* Return the largest distance of the point outside the device gamut. */
/* This will be 0 if inside the gamut, and > 0 if outside. */
static double
prand_in_dev_gamut(prand *s, double *d) {
int e;
int di = s->di;
double tt, dd = 0.0;
double ss = 0.0;
for (e = 0; e < di; e++) {
ss += d[e];
tt = 0.0 - d[e];
if (tt > 0.0) {
if (tt > dd)
dd = tt;
}
tt = d[e] - 1.0;
if (tt > 0.0) {
if (tt > dd)
dd = tt;
}
}
tt = ss - s->ilimit;
if (tt > 0.0) {
if (tt > dd)
dd = tt;
}
return dd;
}
/* --------------------------------------------------- */
/* Seed the object with the initial fixed points */
static void
prand_add_fixed(
prand *s,
fxpos *fxlist, /* List of existing fixed points */
int fxno /* Number in fixed list */
) {
int e, di = s->di;
int i;
/* Add fixed points if there are any */
if (fxno > 0) {
for (i = 0; (i < fxno) && (i < s->tinp); i++) {
prnode *p = &s->n[i]; /* Destination for point */
for (e = 0; e < di; e++)
p->p[e] = fxlist[i].p[e];
p->fx = 1; /* is a fixed point */
s->percept(s->od, p->v, p->p);
s->np = s->fnp = i+1;
}
}
}
/* Seed the object with the perceptual space random points. */
static void
prand_seed(prand *s) {
int e, di = s->di;
printf("\n");
/* Seed the non-fixed points */
for (; s->np < s->tinp;) {
prnode *p = &s->n[s->np]; /* Next node */
for (e = 0; e < di; e++) {
if (e == 1 || e == 2)
p->v[e] = d_rand(-128.0, 128.0);
else
p->v[e] = d_rand(0.0, 100.0);
}
if (prand_from_percept(s, p->p, p->v) == 0) {
s->np++;
printf("%cAdded %d/%d",cr_char,s->np,s->tinp); fflush(stdout);
}
}
printf("\n");
}
/* Seed the object with the perceptual space quasi random points. */
static void
pqrand_seed(prand *s) {
int e, di = s->di;
sobol *sl = NULL;
if ((sl = new_sobol(di)) == NULL)
error("Creating sobol sequence generator failed");
printf("\n");
/* Seed the non-fixed points */
for (; s->np < s->tinp;) {
prnode *p = &s->n[s->np]; /* Next node */
if (sl->next(sl, p->v))
error("Run out of sobol random numbers!");
for (e = 0; e < di; e++) {
if (e == 1 || e == 2)
p->v[e] = p->v[e] * 256.0 - 128.0;
else
p->v[e] *= 100.0;
}
if (prand_from_percept(s, p->p, p->v) == 0) {
s->np++;
printf("%cAdded %d/%d",cr_char,s->np,s->tinp); fflush(stdout);
}
}
printf("\n");
sl->del(sl);
}
/* --------------------------------------------------- */
/* Support accessing the list of generated sample points */
/* Rest the read index */
static void
prand_reset(prand *s) {
s->rix = 0;
}
/* Read the next non-fixed point value */
/* Return nz if no more */
static int
prand_read(prand *s, double *p, double *f) {
int e;
/* Advance to next non-fixed point */
while(s->rix < s->np && s->n[s->rix].fx)
s->rix++;
if (s->rix >= s->np)
return 1;
/* Return point info to caller */
for (e = 0; e < s->di; e++) {
if (p != NULL)
p[e] = s->n[s->rix].p[e];
if (f != NULL)
f[e] = s->n[s->rix].v[e];
}
s->rix++;
return 0;
}
/* --------------------------------------------------- */
/* Main object creation/destruction */
static void init_pmod(prand *s);
/* Destroy ourselves */
static void
prand_del(prand *s) {
free(s->n);
if (s->pmod != NULL)
free(s->pmod);
free (s);
}
/* Creator */
prand *new_prand(
int di, /* Dimensionality of device space */
double ilimit, /* Ink limit (sum of device coords max) */
int tinp, /* Total number of points to generate, including fixed */
fxpos *fxlist, /* List of existing fixed points (may be NULL) */
int fxno, /* Number of existing fixes points */
int quasi, /* nz to use quasi random (sobol) */
void (*percept)(void *od, double *out, double *in), /* Perceptual lookup func. */
void *od /* context for Perceptual function */
) {
prand *s;
if ((s = (prand *)calloc(sizeof(prand), 1)) == NULL)
error ("prand: malloc failed");
s->di = di;
if (tinp < fxno) /* Make sure we return at least the fixed points */
tinp = fxno;
s->tinp = tinp; /* Target total number of points */
s->ilimit = ilimit;
/* Init method pointers */
s->reset = prand_reset;
s->read = prand_read;
s->del = prand_del;
/* If no perceptual function given, use default */
if (percept == NULL) {
s->percept = default_prand;
s->od = s;
} else {
s->percept = percept;
s->od = od;
}
/* Init the inverse perceptual function lookup */
init_pmod(s);
/* Allocate the space for the target number of points */
if ((s->n = (prnode *)calloc(sizeof(prnode), s->tinp)) == NULL)
error ("prand: malloc failed on sample nodes");
s->np = s->fnp = 0;
/* Setup the fixed points */
prand_add_fixed(s, fxlist, fxno);
if (tinp > fxno) { /* Create the perceptual space random points */
if (quasi)
pqrand_seed(s);
else
prand_seed(s);
}
prand_reset(s); /* Reset read index */
return s;
}
/* =================================================== */
/* Compute a simple but unbounded model of the */
/* perceptual function, used by inversion. We use the */
/* current vertex values to setup the model */
/* (Perhaps this should be moved to targen ?) */
/* A vertex point */
struct _vxpt {
double p[MXTD]; /* Device position */
double v[MXTD]; /* Perceptual value */
}; typedef struct _vxpt vxpt;
/* Structure to hold data for unbounded optimization function */
struct _ubfit {
prand *s; /* prand structure */
vxpt *vxs; /* List of vertex values */
int _nvxs, nvxs;
}; typedef struct _ubfit ubfit;
/* Matrix optimisation function handed to powell() */
static double xfitfunc(void *edata, double *x) {
ubfit *uf = (ubfit *)edata;
prand *s = uf->s;
int i, e, di = s->di;
double rv = 0.0;
/* For all the vertexes */
for (i = 0; i < uf->nvxs; i++) {
double v[MXTD], ev;
/* Apply matrix cube interpolation */
icxCubeInterp(x, di, di, v, uf->vxs[i].p);
/* Evaluate the error */
for (ev = 0.0, e = 0; e < di; e++) {
double tt;
tt = uf->vxs[i].v[e] - v[e];
ev += tt * tt;
}
rv += ev;
}
return rv;
}
/* Fit the unbounded perceptual model to the perceptual function */
static void init_pmod(prand *s) {
int i, ee, e, k, di = s->di;
double *sa;
double rerr;
ubfit uf;
uf.s = s;
uf.vxs = NULL;
uf.nvxs = uf._nvxs = 0;
/* Allocate space for parameters */
if ((s->pmod = malloc(di * (1 << di) * sizeof(double))) == NULL)
error("Malloc failed for pmod");
if ((sa = malloc(di * (1 << di) * sizeof(double))) == NULL)
error("Malloc failed for pmod sa");
/* Create a list of vertex values for the colorspace */
/* Use in gamut vertexes, and compute clipped edges */
for (ee = 0; ee < (1 << di); ee++) {
double p[MXTD], ss;
for (ss = 0.0, e = 0; e < di; e++) {
if (ee & (1 << e))
p[e] = 1.0;
else
p[e] = 0.0;
ss += p[e];
}
if (ss < s->ilimit) { /* Within gamut */
if (uf.nvxs >= uf._nvxs) {
uf._nvxs = 5 + uf._nvxs * 2;
if ((uf.vxs = (vxpt *)realloc(uf.vxs, sizeof(vxpt) * uf._nvxs)) == NULL)
error ("Failed to malloc uf.vxs");
}
for (k = 0; k < di; k++)
uf.vxs[uf.nvxs].p[k] = p[k];
uf.nvxs++;
} else if ((ss - 1.0) < s->ilimit) { /* far end of edge out of gamut */
double max = s->ilimit - (ss - 1.0); /* Maximum value of one */
for (e = 0; e < di; e++) {
if ((ee & (1 << e)) == 0)
continue;
p[e] = max;
if (uf.nvxs >= uf._nvxs) {
uf._nvxs = 5 + uf._nvxs * 2;
if ((uf.vxs = (vxpt *)realloc(uf.vxs, sizeof(vxpt) * uf._nvxs)) == NULL)
error ("Failed to malloc uf.vxs");
}
for (k = 0; k < di; k++)
uf.vxs[uf.nvxs].p[k] = p[k];
uf.nvxs++;
p[e] = 1.0; /* Restore */
}
} /* Else whole edge is out of gamut */
}
/* Lookup perceptual values */
for (i = 0; i < uf.nvxs; i++) {
s->percept(s->od, uf.vxs[i].v, uf.vxs[i].p);
//printf("~1 vtx %d: dev %f %f %f, perc %f %f %f\n",i, uf.vxs[i].p[0], uf.vxs[i].p[1], uf.vxs[i].p[2], uf.vxs[i].v[0], uf.vxs[i].v[1], uf.vxs[i].v[2]);
}
/* Setup matrix to be closest values initially */
for (e = 0; e < (1 << di); e++) { /* For each colorant combination */
int j, f;
double bdif = 1e6;
double ov[MXTD];
int bix = -1;
/* Search the vertex list to find the one closest to this input combination */
for (i = 0; i < uf.nvxs; i++) {
double dif = 0.0;
for (j = 0; j < di; j++) {
double tt;
if (e & (1 << j))
tt = 1.0 - uf.vxs[i].p[j];
else
tt = 0.0 - uf.vxs[i].p[j];
dif += tt * tt;
}
if (dif < bdif) { /* best so far */
bdif = dif;
bix = i;
if (dif < 0.001)
break; /* Don't bother looking further */
}
}
for (f = 0; f < di; f++)
s->pmod[f * (1 << di) + e] = uf.vxs[bix].v[f];
}
for (e = 0; e < (di * (1 << di)); e++)
sa[e] = 10.0;
if (powell(&rerr, di * (1 << di), s->pmod, sa, 0.001, 1000,
xfitfunc, (void *)&uf, NULL, NULL) != 0) {
warning("prand: powell failed to converge, residual error = %f",rerr);
}
#ifdef DEBUG
printf("Perceptual model fit residual = %f\n",sqrt(rerr));
#endif
s->pmod_init = 1;
free(sa);
}
/* Clip a device value to the gamut */
static int
prand_clip_point(prand *s, double *cd, double *d) {
int e, di = s->di;
double ss = 0.0;
int rv = 0;
for (e = 0; e < di; e++) {
ss += d[e];
cd[e] = d[e];
if (cd[e] < 0.0) {
cd[e] = 0.0;
rv |= 1;
} else if (cd[e] > 1.0) {
cd[e] = 1.0;
rv |= 1;
} \
}
if (ss > s->ilimit) {
ss = (ss - s->ilimit)/s->di;
for (e = 0; e < di; e++)
cd[e] -= ss;
rv |= 1;
}
return rv;
}
/* Unbounded perceptual lookup. */
/* return nz if it was actually clipped and extended */
static int prand_cc_percept(prand *s, double *v, double *p) {
double cp[MXTD];
int clip;
clip = prand_clip_point(s, cp, p);
s->percept(s->od, v, cp);
/* Extend perceptual value using matrix model */
if (clip) {
int e, di = s->di;
double mcv[MXTD], zv[MXTD];
#ifdef DEBUG
if (s->pmod_init == 0)
error("ofps_cc_percept() called before pmod has been inited");
#endif
/* Lookup matrix mode of perceptual at clipped device */
icxCubeInterp(s->pmod, di, di, mcv, cp);
/* Compute a correction factor to add to the matrix model to */
/* give the actual perceptual value at the clipped location */
for (e = 0; e < di; e++)
zv[e] = v[e] - mcv[e];
/* Compute the unclipped matrix model perceptual value */
icxCubeInterp(s->pmod, di, di, v, p);
/* Add the correction value to it */
for (e = 0; e < di; e++)
v[e] += zv[e];
}
return clip;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Reverse lookup function :- perceptual to device coordinates */
/* Using dnsq */
/* Structure to hold data for optimization function */
struct _rdatas {
prand *s; /* prand structure */
double *ptv; /* Perceptual target value */
}; typedef struct _rdatas rdatas;
/* calculate the functions at x[] */
int prand_dnsq_solver( /* Return < 0 on abort */
void *fdata, /* Opaque data pointer */
int n, /* Dimenstionality */
double *x, /* Multivariate input values */
double *fvec, /* Multivariate output values */
int iflag /* Flag set to 0 to trigger debug output */
) {
rdatas *ed = (rdatas *)fdata;
prand *s = ed->s;
double v[MXTD];
int e, di = s->di;
prand_cc_percept(s, v, x);
for (e = 0; e < di; e++)
fvec[e] = ed->ptv[e] - v[e];
//printf("~1 %f %f %f from %f %f %f\n", fvec[0], fvec[1], fvec[2], x[0], x[1], x[2]);
return 0;
}
/* Given a point in perceptual space, an approximate point */
/* in device space, return the device value corresponding to */
/* the perceptual value, plus the clipped perceptual value. */
/* Return 1 if the point is out of gamut or dnsq failed. */
static int
prand_from_percept(
prand *s,
double *p, /* return (clipped) device position */
double *v /* target perceptual */
) {
int e, di = s->di;
rdatas ed;
double ss; /* Initial search area */
double fvec[MXTD]; /* Array that will be RETURNed with thefunction values at the solution */
double dtol; /* Desired tollerance of the solution */
double tol; /* Desired tollerance of root */
int maxfev; /* Maximum number of function calls. set to 0 for automatic */
int rv;
//printf("~1 percept2 called with %f %f %f\n", v[0], v[1], v[2]);
ed.s = s;
ed.ptv = v; /* Set target perceptual point */
for (e = 0; e < di; e++)
p[e] = 0.3; /* Start location */
ss = 0.1;
dtol = 1e-6;
tol = 1e-8;
maxfev = 1000;
rv = dnsqe((void *)&ed, prand_dnsq_solver, NULL, di, p, ss, fvec, dtol, tol, maxfev, 0);
if (rv != 1 && rv != 3) { /* Fail to converge */
//printf("~1 failed with rv %d\n",rv);
return 1;
}
//printf("~1 got soln %f %f %f\n", p[0], p[1], p[2]);
if (prand_clip_point(s, p, p)) {
//printf("~1 clipped\n");
return 1;
}
return 0;
}

View File

@@ -0,0 +1,68 @@
#ifndef PRAND_H
/*
* Argyll Color Correction System
*
* Perceptual space random test point class
*
* Author: Graeme W. Gill
* Date: 12/9/2004
*
* Copyright 2004 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/* A sample point node */
struct _prnode {
int fx; /* nz if point is fixed */
double p[MXTD]; /* Device coordinate position */
double v[MXTD]; /* Subjective value (Labk) */
}; typedef struct _prnode prnode;
/* Main object */
struct _prand {
/* private: */
int di; /* Point dimensionality */
double ilimit; /* Ink limit - limit on sum of p[] */
int fnp; /* Number of existing fixed points in list */
int tinp; /* target number of total points in list, including fixed points */
int np; /* Number of points currently in list */
prnode *n; /* tinp list of points */
/* Perceptual function handed in */
void (*percept)(void *od, double *out, double *in);
void *od; /* Opaque data for perceptual point */
/* Unbounded perceptual model */
double *pmod;
int pmod_init; /* It's been initialised */
/* Other info */
int rix; /* Next read index */
/* public: */
/* Initialise, ready to read out all the points */
void (*reset)(struct _prand *s);
/* Read the next set of non-fixed points values */
/* return non-zero when no more points */
int (*read)(struct _prand *s, double *d, double *p);
/* Destroy ourselves */
void (*del)(struct _prand *s);
}; typedef struct _prand prand;
/* Constructor */
extern prand *new_prand(int di, double ilimit, int npoints,
fxpos *fxlist, int fxno, int quasi,
void (*percept)(void *od, double *out, double *in), void *od);
#define PRAND_H
#endif /* PRAND_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,166 @@
/*
* Argyll Color Correction System
*
* Random index routines.
*
* Author: Graeme W. Gill
* Date: 5/10/96
*
* Copyright 1996, Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
#include <stdio.h>
#include <stdlib.h>
#include "randix.h"
#include <stdarg.h>
void error(char *fmt, ...), warning(char *fmt, ...), verbose(int level, char *fmt, ...);
/* A table entry structure */
typedef struct {
int bits; /* Number of bits */
int length; /* Length of sequence */
int xorm; /* Xor mask */
} tabe;
static tabe table[] = {
{ 1, (1<<1)-1, 0x1},
{ 2, (1<<2)-1, 0x3},
{ 3, (1<<3)-1, 0x3},
{ 4, (1<<4)-1, 0x13},
{ 5, (1<<5)-1, 0x1b},
{ 6, (1<<6)-1, 0x1b},
{ 7, (1<<7)-1, 0x65},
{ 8, (1<<8)-1, 0xc3},
{ 9, (1<<9)-1, 0x1b5},
{ 10, (1<<10)-1, 0x1c7},
{ 11, (1<<11)-1, 0x6bb},
{ 12, (1<<12)-1, 0x5c5},
{ 13, (1<<13)-1, 0x15b9},
{ 14, (1<<14)-1, 0x36d1},
{ 15, (1<<15)-1, 0x376b},
{ 16, (1<<16)-1, 0x5bab},
{ 17, (1<<17)-1, 0x1b5c5},
{ 18, (1<<18)-1, 0x15561},
{ 19, (1<<19)-1, 0x5b4db},
{ 20, (1<<20)-1, 0xf6e01},
{ 21, (1<<21)-1, 0x186517},
{ 22, (1<<22)-1, 0x6bf4f},
{ 23, (1<<23)-1, 0x376623},
{ 24, (1<<24)-1, 0xf54e35},
{ 0, 0, 0}
};
#define PSRAND(S, XOV, TBIT, MASK) ((((S) & TBIT) ? (((S) << 1) ^ (XOV)) : ((S) << 1)) & MASK)
static int
randix_next(struct _randix *p) {
int rv = p->ss-1; /* Return start value first */
do {
p->ss = PSRAND(p->ss, p->xorm, p->tbit, p->mask);
} while(p->ss >= p->length);
return rv;
}
/* Destroy ourselves */
static void
randix_del(randix *p) {
free (p);
}
/* Creator */
randix *new_randix(int length, int start)
{
int i;
randix *p;
if ((p = (randix *)malloc(sizeof(randix))) == NULL)
error ("randix: malloc failed");
p->next = randix_next;
p->del = randix_del;
if (length == 0)
error ("randix: Can't handle length %d",length);
start %= length;
p->length = length+1;
for (i = 0; table[i].bits != 0; i++) {
if (length <= table[i].length) {
p->tbit = 1 << (table[i].bits-1);
p->mask = (p->tbit << 1)-1;
p->xorm = table[i].xorm;
p->ss = start + 1;
return p;
break;
}
}
error ("randix: Can't handle length %d",length);
return NULL;
}
#ifdef NEVER
main(argc,argv)
int argc;
char *argv[];
{
int length = 11;
int i, iv, cv;
randix *r;
if (argc > 1)
length = atoi(argv[1]);
r = new_randix(length, 0);
iv = r->next(r);
printf("First Val = %d\n",iv);
i = 0;
do {
cv = r->next(r);
i++;
} while (cv != iv);
printf("Last Val = %d\n",cv);
printf("Count for length %d = %d\n",length,i);
return 0;
}
/* Basic printf type error() and warning() routines */
void
error(char *fmt, ...)
{
va_list args;
fprintf(stderr,"targen: Error - ");
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
fprintf(stderr, "\n");
fflush(stdout);
exit (-1);
}
#endif /* NEVER */

View File

@@ -0,0 +1,41 @@
#ifndef RANDIX_H
/*
* Argyll Color Correction System
*
* Random array indexing class
*
* Author: Graeme W. Gill
* Date: 16/10/96
*
* Copyright 1996, Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
struct _randix {
/* private: */
int tbit; /* Top bit mask */
int mask; /* Overall mask */
int xorm; /* Xor value */
int length; /* Length needed */
int ss; /* Current value */
/* public: */
/* return the next in the sequence */
int (*next)(struct _randix *p);
/* Destroy ourselves */
void (*del)(struct _randix *p);
}; typedef struct _randix randix;
/* Creator */
/* Counts within range 0 to length-1 */
extern randix *new_randix(int length, int start);
#define RANDIX_H
#endif /* RANDIX_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
#ifndef SIMDLAT_H
/*
* Argyll Color Correction System
*
* Simplex device space latice test point class
*
* Author: Graeme W. Gill
* Date: 30/8/2004
*
* Copyright 2002 - 2004 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*
* Based on simplat.h
*/
#define SPT_HASHSIZE 4463 /* Hash index size */
/* A sample point node */
struct _sdtnode {
int vald; /* Valid flag */
int x[MXTD]; /* Index */
double p[MXTD]; /* Device coordinate position */
double v[MXTD]; /* Subjective value (Labk) */
int b; /* 1 if a gamut point, 2 if a boundary point */
unsigned long expm[2]; /* -ve/+ve dimention explored flags */
int hp; /* Hash linked list index */
int up; /* Unexplored linked list index */
}; typedef struct _sdtnode sdtnode;
/* Main simplex latice object */
struct _simdlat {
/* private: */
int di; /* Point dimensionality */
double ilimit; /* Ink limit - limit on sum of p[] */
int inp; /* Intended number of points in list */
int type; /* Type of point geometry, 0 = body centered etc. */
double angle; /* Grid angle */
double bo[MXTD]; /* Basis origin */
double bv[MXTD][MXTD]; /* Simplex basis vectors */
int np; /* Number of point nodes in list */
int nvp; /* Number of valid point nodes in list */
int np_a; /* Number of points allocated */
double dia; /* Point spacing in latice */
sdtnode *nodes; /* Current array of nodes */
int bnp; /* Number of point nodes in best list */
int bnvp; /* Number of best valid point nodes in list */
int bnp_a; /* Number of best points allocated */
double bdia; /* Point spacing in best latice */
sdtnode *bnodes; /* Current best array of nodes */
int hash[SPT_HASHSIZE]; /* Hash index */
int unex; /* Head of unexplored list index */
double tol; /* Snap tollerance */
/* Perceptual function */
void (*percept)(void *od, double *out, double *in);
void *od; /* Opaque data for perceptual point */
/* Fixed points to avoid */
fxpos *fxlist; /* List of existing fixed points (may be NULL) */
int fxno; /* Number of existing fixes points */
int rix; /* Next read index */
/* public: */
/* Initialise, ready to read out all the points */
void (*reset)(struct _simdlat *s);
/* Read the next set of non-fixed points values */
/* return non-zero when no more points */
int (*read)(struct _simdlat *s, double *d, double *p);
/* Destroy ourselves */
void (*del)(struct _simdlat *s);
}; typedef struct _simdlat simdlat;
/* geometry type */
#define SIMDLAT_BCC 0 /* Body centered Cubic */
#define SIMDLAT_EQSPLX 1 /* Equilateral Simplex */
#define SIMDLAT_FCC 2 /* Face Centered Cubic */
/* Constructor */
extern simdlat *new_simdlat(int di, double ilimit, int npoints,
fxpos *fxlist, int fxno, int type, double angle,
void (*percept)(void *od, double *out, double *in), void *od);
#define SIMDLAT_H
#endif /* SIMDLAT_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
#ifndef SIMPLAT_H
/*
* Argyll Color Correction System
*
* Simplex perceptual space latice test point class
*
* Author: Graeme W. Gill
* Date: 27/3/2002
*
* Copyright 2002 - 2004 Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
#define SPT_HASHSIZE 4463 /* Hash index size */
/* A sample point node */
struct _sptnode {
int vald; /* Valid flag */
int x[MXTD]; /* Index */
double p[MXTD]; /* Device coordinate position */
double v[MXTD]; /* Subjective value (Labk) */
int b; /* 1 if a gamut point, 2 if a boundary point */
unsigned long expm[2]; /* -ve/+ve dimention explored flags */
int hp; /* Hash linked list index */
int up; /* Unexplored linked list index */
}; typedef struct _sptnode sptnode;
/* Main simplex latice object */
struct _simplat {
/* private: */
int di; /* Point dimensionality */
double ilimit; /* Ink limit - limit on sum of p[] */
int inp; /* Intended number of points in list */
double angle; /* Grid angle */
double bo[MXTD]; /* Basis origin */
double bv[MXTD][MXTD]; /* Simplex basis vectors */
int np; /* Number of point nodes in list */
int nvp; /* Number of valid point nodes in list */
int np_a; /* Number of points allocated */
double dia; /* Point spacing in latice */
sptnode *nodes; /* Current array of nodes */
int bnp; /* Number of point nodes in best list */
int bnvp; /* Number of best valid point nodes in list */
int bnp_a; /* Number of best points allocated */
double bdia; /* Point spacing in best latice */
sptnode *bnodes; /* Current best array of nodes */
int hash[SPT_HASHSIZE]; /* Hash index */
int unex; /* Head of unexplored list index */
double tol; /* Snap tollerance */
/* Perceptual function */
void (*percept)(void *od, double *out, double *in);
void *od; /* Opaque data for perceptual point */
/* Fixed points to avoid */
fxpos *fxlist; /* List of existing fixed points (may be NULL) */
int fxno; /* Number of existing fixes points */
int rix; /* Next read index */
/* public: */
/* Initialise, ready to read out all the points */
void (*reset)(struct _simplat *s);
/* Read the next set of non-fixed points values */
/* return non-zero when no more points */
int (*read)(struct _simplat *s, double *d, double *p);
/* Destroy ourselves */
void (*del)(struct _simplat *s);
}; typedef struct _simplat simplat;
/* Constructor */
extern simplat *new_simplat(int di, double ilimit, int npoints,
fxpos *fxlist, int fxno, double angle,
void (*percept)(void *od, double *out, double *in), void *od);
#define SIMPLAT_H
#endif /* SIMPLAT_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
#ifndef TARGEN_H
/*
* Argyll Color Correction System
* Test target chart Generator.
*
* Author: Graeme W. Gill
* Date: 7/4/2002
*
* Copyright 2002, Graeme W. Gill
* All rights reserved.
*
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*/
/* Targen generation common defines */
#define MXTD ICX_MXINKS /* From xicc/xcolorants.h */
/* A fixed point position */
struct _fxpos {
double p[MXTD]; /* Device coordinate position */
double v[MXTD]; /* Room for perceptual value */
int eloc; /* if >= 0, cgats index, to even location */
}; typedef struct _fxpos fxpos;
#define TARGEN_H
#endif /* TARGEN_H */