| OLD | NEW |
| 1 // qcms | 1 // qcms |
| 2 // Copyright (C) 2009 Mozilla Foundation | 2 // Copyright (C) 2009 Mozilla Foundation |
| 3 // | 3 // |
| 4 // Permission is hereby granted, free of charge, to any person obtaining | 4 // Permission is hereby granted, free of charge, to any person obtaining |
| 5 // a copy of this software and associated documentation files (the "Software"), | 5 // a copy of this software and associated documentation files (the "Software"), |
| 6 // to deal in the Software without restriction, including without limitation | 6 // to deal in the Software without restriction, including without limitation |
| 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 8 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
| 9 // is furnished to do so, subject to the following conditions: | 9 // is furnished to do so, subject to the following conditions: |
| 10 // | 10 // |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 e = 0; | 189 e = 0; |
| 190 f = 0; | 190 f = 0; |
| 191 interval = -INFINITY; | 191 interval = -INFINITY; |
| 192 } | 192 } |
| 193 for (X = 0; X < 256; X++) { | 193 for (X = 0; X < 256; X++) { |
| 194 float x = X / 255.0; | 194 float x = X / 255.0; |
| 195 if (x >= interval) { | 195 if (x >= interval) { |
| 196 // XXX The equations are not exactly as definied in the
spec but are | 196 // XXX The equations are not exactly as definied in the
spec but are |
| 197 // algebraic equivilent. | 197 // algebraic equivilent. |
| 198 // TODO Should division by 255 be for the whole expressi
on. | 198 // TODO Should division by 255 be for the whole expressi
on. |
| 199 gamma_table[X] = clamp_float(pow(a * x + b, y) + c + e); | 199 gamma_table[X] = clamp_float(powf(a * x + b, y) + (c + e
)); |
| 200 } else { | 200 } else { |
| 201 gamma_table[X] = clamp_float(c * x + f); | 201 gamma_table[X] = clamp_float(c * x + f); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 void compute_curve_gamma_table_type0(float gamma_table[256]) | 206 void compute_curve_gamma_table_type0(float gamma_table[256]) |
| 207 { | 207 { |
| 208 unsigned int i; | 208 unsigned int i; |
| 209 for (i = 0; i < 256; i++) { | 209 for (i = 0; i < 256; i++) { |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 if (!curve || curve->type != PARAMETRIC_CURVE_TYPE) | 664 if (!curve || curve->type != PARAMETRIC_CURVE_TYPE) |
| 665 return 0; | 665 return 0; |
| 666 | 666 |
| 667 size = COUNT_TO_LENGTH[curve->count]; | 667 size = COUNT_TO_LENGTH[curve->count]; |
| 668 | 668 |
| 669 if (data) | 669 if (data) |
| 670 memcpy(data, curve->parameter, size * sizeof(float)); | 670 memcpy(data, curve->parameter, size * sizeof(float)); |
| 671 | 671 |
| 672 return size; | 672 return size; |
| 673 } | 673 } |
| OLD | NEW |