| 305 | } |
| 306 | |
| 307 | float |
| 308 | Lut::fromColorSpaceUint16ToLinearFloatFast(unsigned short v) const |
| 309 | { |
| 310 | assert(init_); |
| 311 | // the following is from ImageMagick's quantum.h |
| 312 | unsigned char v8u_prev = ( v - (v >> 8) ) >> 8; |
| 313 | unsigned char v8u_next = v8u_prev + 1; |
| 314 | unsigned short v16u_prev = (v8u_prev << 8) + v8u_prev; |
| 315 | unsigned short v16u_next = (v8u_next << 8) + v8u_next; |
| 316 | float v32f_prev = fromColorSpaceUint8ToLinearFloatFast(v8u_prev); |
| 317 | float v32f_next = fromColorSpaceUint8ToLinearFloatFast(v8u_next); |
| 318 | |
| 319 | // interpolate linearly |
| 320 | return v32f_prev + (v - v16u_prev) * (v32f_next - v32f_prev) / (v16u_next - v16u_prev); |
| 321 | } |
| 322 | |
| 323 | void |
| 324 | Lut::fillTables() const |
no outgoing calls
no test coverage detected