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

Method fromColorSpaceUint16ToLinearFloatFast

Engine/Lut.cpp:306–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Calls

no outgoing calls

Tested by

no test coverage detected