OLD | NEW |
1 //------------------------------------------------------------------------------
--- | 1 //------------------------------------------------------------------------------
--- |
2 // | 2 // |
3 // Little Color Management System | 3 // Little Color Management System |
4 // Copyright (c) 1998-2012 Marti Maria Saguer | 4 // Copyright (c) 1998-2012 Marti Maria Saguer |
5 // | 5 // |
6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 y0 = LutTable[cell0]; | 208 y0 = LutTable[cell0]; |
209 y1 = LutTable[cell0+1]; | 209 y1 = LutTable[cell0+1]; |
210 | 210 |
211 | 211 |
212 Output[0] = LinearInterp(rest, y0, y1); | 212 Output[0] = LinearInterp(rest, y0, y1); |
213 } | 213 } |
214 | 214 |
215 // To prevent out of bounds indexing | 215 // To prevent out of bounds indexing |
216 cmsINLINE cmsFloat32Number fclamp(cmsFloat32Number v) | 216 cmsINLINE cmsFloat32Number fclamp(cmsFloat32Number v) |
217 { | 217 { |
218 return v < 0.0f ? 0.0f : (v > 1.0f ? 1.0f : v); | 218 return ((v < 0.0f) || isnan(v)) ? 0.0f : (v > 1.0f ? 1.0f : v); |
219 } | 219 } |
220 | 220 |
221 // Floating-point version of 1D interpolation | 221 // Floating-point version of 1D interpolation |
222 static | 222 static |
223 void LinLerp1Dfloat(const cmsFloat32Number Value[], | 223 void LinLerp1Dfloat(const cmsFloat32Number Value[], |
224 cmsFloat32Number Output[], | 224 cmsFloat32Number Output[], |
225 const cmsInterpParams* p) | 225 const cmsInterpParams* p) |
226 { | 226 { |
227 cmsFloat32Number y1, y0; | 227 cmsFloat32Number y1, y0; |
228 cmsFloat32Number val2, rest; | 228 cmsFloat32Number val2, rest; |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 break; | 1497 break; |
1498 | 1498 |
1499 break; | 1499 break; |
1500 | 1500 |
1501 default: | 1501 default: |
1502 Interpolation.Lerp16 = NULL; | 1502 Interpolation.Lerp16 = NULL; |
1503 } | 1503 } |
1504 | 1504 |
1505 return Interpolation; | 1505 return Interpolation; |
1506 } | 1506 } |
OLD | NEW |