MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / fromColorSpaceUint16ToLinearFloatFast

Method fromColorSpaceUint16ToLinearFloatFast

Engine/Lut.cpp:307–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307float
308Lut::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
323void
324Lut::fillTables() const

Calls

no outgoing calls

Tested by

no test coverage detected