| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Argyll Overview</title> |
| 5 | <meta http-equiv="content-type" |
| 6 | content="text/html; charset=ISO-8859-1"> |
| 7 | </head> |
| 8 | <body> |
| 9 | <h2><u>Source Code Documentation</u></h2> |
| 10 | Some general comments about how different software works.<br> |
| 11 | <br> |
| 12 | <b>TARGET</b><br> |
| 13 | <br> |
| 14 | Nearly all current Color correction systems generate test charts |
| 15 | (or device characterization target charts) by laying out a regular |
| 16 | rectangular grid of test points in device space (Targen will do this if |
| 17 | you feed it a non-zero <span style="font-weight: bold;">-m</span> |
| 18 | option). On some consideration, this approach is far from optimal. Not |
| 19 | only is a regular grid inefficient in packing the multidimensional |
| 20 | device space but if the points are spaced evenly in device space, they |
| 21 | will probably not be optimal in determining the underlying device |
| 22 | characteristic, sampling too finely where the device behavior is |
| 23 | smooth, and too coarsely where the device behavior changes rapidly. |
| 24 | Some commercial color systems tackle |
| 25 | the latter problem by "pre-linearizing" the device, which amounts to |
| 26 | distorting |
| 27 | the regular device space grid points with a perceptual inverse per |
| 28 | device |
| 29 | channel lookup curve.<br> |
| 30 | <br> |
| 31 | The approach I have taken with Argyll, is a little different. Both a |
| 32 | device independent and device dependent approach are available. In the |
| 33 | device independent mode, test points are distributed so as to minimize |
| 34 | the distance from any point in the device space to the nearest test |
| 35 | chart value. When the device dependent approach is used, test points |
| 36 | are chosen so as to minimize the expected error between the resulting |
| 37 | profile and the underlying device response.<br> |
| 38 | <br> |
| 39 | For higher dimensional spaces, where the aim is to create a more |
| 40 | approximate device profile, I've used an "incremental far point" point |
| 41 | generator, that starting with a previous test point as a seed, use a |
| 42 | minimization algorithm to locate another point that is as far as |
| 43 | possible from the nearest existing test point in perceptual space, |
| 44 | while remaining in gamut at all tines. This means that ideally each |
| 45 | point "fills in" the gaps in the existing distribution.<br> |
| 46 | <br> |
| 47 | Another issue with laying test points out in regular grids, is that |
| 48 | this means that the device response is poorly sampled (since the grids |
| 49 | are usually coarse), and this can make it impossible to create detailed |
| 50 | device linearisation "shaper" curves from the resulting data ! Ideally, |
| 51 | in any colorspace (input or output), when viewed from any possible |
| 52 | angle, none of the test data points should appear to line up. The |
| 53 | Argyll target generator seems to achieve this goal.<br> |
| 54 | <br> |
| 55 | <br> |
| 56 | target/printtarg.c:<br> |
| 57 | <br> |
| 58 | printtarg simply generates a PostScript file containing the patches |
| 59 | laid out for an Xrite DTP51/DTP41/SpectroScan. It allows them to be |
| 60 | laid out on |
| 61 | a choice of paper sizes, with the appropriate contrasting color spacers |
| 62 | between |
| 63 | each patch for the strip reading instruments. Unlike other charts, |
| 64 | Argyll |
| 65 | charts are generated as required, rather that being fixed. Also unlike |
| 66 | most |
| 67 | other strip reading charts, the spacers may colored, so that the |
| 68 | density contrast |
| 69 | ratio is guaranteed, even when two patches are about 50% density.<br> |
| 70 | <br> |
| 71 | Another feature is the pseudo random patch layout. This has three |
| 72 | purposes. One is to try and average out any variation in the device |
| 73 | response in relationship to the location of the patch on the paper. |
| 74 | Color copiers and printing presses (for instance), are notorious in |
| 75 | having side to side density variations.<br> |
| 76 | <br> |
| 77 | Another purpose of the random patch layout, is that it gives the |
| 78 | reading program a good mechanism for detecting user error. It can guess |
| 79 | the expected values, compare them to the readings, and complain if it |
| 80 | seems that the strip is probably the wrong one.<br> |
| 81 | <br> |
| 82 | The final purpose of the random patch layout is to optimize the |
| 83 | contrast |
| 84 | between patches in a strip, to improve the robustness of the strip |
| 85 | reading. |
| 86 | Using this, small charts may be even be generated without any gaps |
| 87 | between |
| 88 | the test patches.<br> |
| 89 | <b><br> |
| 90 | RSPL</b><br> |
| 91 | <br> |
| 92 | A lot of core Argyll algorithms are bound up in the RSPL (Regular |
| 93 | Spline) class. The RSPL class is closely related to the CLUT table |
| 94 | structure used in the ICC profile format, and is a general purpose way |
| 95 | of mapping one multi-dimensional value to another, using interpolation |
| 96 | to reduce the mapping function to a manageable size.<br> |
| 97 | Regular splines are not directly related to other types of splines, and |
| 98 | do not generally suffer from the sort of "wiggles" and "overshoot" |
| 99 | characteristic of other spline systems.<br> |
| 100 | <br> |
| 101 | The RSPL class adds three basic methods to the underlying data |
| 102 | structure:<br> |
| 103 | <br> |
| 104 | 1) Interpolation<br> |
| 105 | <br> |
| 106 | 2) Creation from scattered data<br> |
| 107 | <br> |
| 108 | The regular spline implementation was inspired by the following |
| 109 | technical reports:<br> |
| 110 | <br> |
| 111 | D.J. Bone, "Adaptive Multi-Dimensional Interpolation Using Regularized |
| 112 | Linear Splines," Proc. SPIE Vol. 1902, p.243-253, Nonlinear Image |
| 113 | Processing IV, Edward R. Dougherty; Jaakko T. Astola; Harold G. |
| 114 | Longbotham;(Eds)(1993).<br> |
| 115 | <br> |
| 116 | D.J. Bone, "Adaptive Colour Printer Modeling using regularized linear |
| 117 | splines," Proc. SPIE Vol. 1909, p. 104-115, Device-Independent Color |
| 118 | Imaging and Imaging Systems Integration, Ricardo J. Motta; Hapet A. |
| 119 | Berberian; Eds.(1993)<br> |
| 120 | <br> |
| 121 | Don Bone and Duncan Stevenson, "Modelling of Colour Hard Copy Devices |
| 122 | Using Regularised Linear Splines," Proceedings of the APRS workshop on |
| 123 | Colour Imaging and Applications, Canberra (1994)<br> |
| 124 | <br> |
| 125 | see <http://www.cmis.csiro.au/Don.Bone/><br> |
| 126 | <br> |
| 127 | Also of interest was:<br> |
| 128 | <br> |
| 129 | "Discrete Smooth Interpolation", Jean-Laurent Mallet, ACM Transactions |
| 130 | on Graphics, Volume 8, Number 2, April 1989, Pages 121-144.<br> |
| 131 | <br> |
| 132 | 3) Inversion<br> |
| 133 | <br> |
| 134 | Simplex interpolation is normally done in Baricentric space, where |
| 135 | there |
| 136 | is one more baricentric coordinate than dimensions, and the sum of all |
| 137 | the |
| 138 | baricentric coordinates must be 1.<br> |
| 139 | To simplify things, we work in a "Simplex parameter" space, in which |
| 140 | there are only <dimension> parameters, and each directly |
| 141 | corresponds with a cartesian coordinate, but the parameter order |
| 142 | corresponds with the baricentric order.<br> |
| 143 | For example, given cartesian coordinates D0, D1, D2 these should be |
| 144 | sorted from smallest to largest, thereby choosing a particular simplex |
| 145 | within a cube, |
| 146 | and allowing a correspondence to the parameter coordinates, ie:<br> |
| 147 | <br> |
| 148 | D1 D0 D2 Smallest -> Largest cartesian sort<br> |
| 149 | P2 P1 P0 Corresponding Parameter coordinates |
| 150 | (note reverse order!)<br> |
| 151 | <br> |
| 152 | B0 = P0 Conversion to Baricentric |
| 153 | coordinates<br> |
| 154 | B1 = P1 - P0<br> |
| 155 | B2 = P2 - P1<br> |
| 156 | B3 = 1 - P2<br> |
| 157 | <br> |
| 158 | The vertex values directly correspond to Baricentric coordinates,<br> |
| 159 | giving the usual interpolation equation of:<br> |
| 160 | <br> |
| 161 | VV0 * B0<br> |
| 162 | + VV1 * B1<br> |
| 163 | + VV2 * B2<br> |
| 164 | + VV3 * B3<br> |
| 165 | <br> |
| 166 | where VVn is the vertex value for each of the 4 vertices of the simplex.<br> |
| 167 | <br> |
| 168 | Reversing the Parameter -> Baricentric equations gives the<br> |
| 169 | following interpolation equation using Parameter coordinates:<br> |
| 170 | <br> |
| 171 | VV0 - VV1 * P0<br> |
| 172 | + VV1 - VV2 * P1<br> |
| 173 | + VV2 - VV3 * P2<br> |
| 174 | + VV3<br> |
| 175 | <br> |
| 176 | It is this which is used in rev.c for solving the reverse interpolation |
| 177 | problem. Within a simplex, only linear algebra is needed to compute |
| 178 | inverses. To deal with the 4D->3D nature of a CMYK profile, the SVD |
| 179 | (Singular Value Decomposition) approach is used to solving a CMYK for a |
| 180 | given CIE value, the result being the equation of the line of |
| 181 | solutions. The lines from adjacent simplexes form a solution locus, |
| 182 | that can be resolved into a single point solution once a black |
| 183 | generation rule is applied.<br> |
| 184 | <br> |
| 185 | Outline of inversion processing:<br> |
| 186 | <br> |
| 187 | Basic function requirements: exact, |
| 188 | auxil, locus, clip inversion.<br> |
| 189 | Fwd cell - reverse cell list lookup<br> |
| 190 | Basic layout di -> fdi + auxils + ink limit<br> |
| 191 | Basic search strategy<br> |
| 192 | Sub Simplex decomposition & properties<br> |
| 193 | How each type of function finds solutions<br> |
| 194 | Sub-simplex dimensionality & |
| 195 | dof + target dim & dof<br> |
| 196 | Linear algebra choices.<br> |
| 197 | How final solutions are chosen<br> |
| 198 | <b><br> |
| 199 | XICC</b><br> |
| 200 | <br> |
| 201 | Profiling using concatenated shapers to augment thin |
| 202 | plate splines for per channel curves.<br> |
| 203 | <br> |
| 204 | <b>IMDI</b><br> |
| 205 | <br> |
| 206 | This module generates C code routines which implement an integer |
| 207 | multi-channel transform. The input values are read, passed through per |
| 208 | channel lookup tables, a multi-dimensional interpolation table, and |
| 209 | then a per channel output lookup table, before being written.<br> |
| 210 | <br> |
| 211 | <b> MPP<br> |
| 212 | </b> <br> |
| 213 | Outline model parameter optimization using slope accelerated error |
| 214 | metric, and initial parameter speedup for adjacent spectral bands etc.<br> |
| 215 | <br> |
| 216 | <br> |
| 217 | <br> |
| 218 | </body> |
| 219 | </html> |