MCPcopy Create free account
hub / github.com/NatronGitHub/openfx-misc / floatToSample

Function floatToSample

Keyer/Keyer.cpp:355–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353
354template<class PIX, int maxValue>
355static PIX
356floatToSample(float value)
357{
358 if (maxValue == 1) {
359 return PIX(value);
360 }
361 if (value <= 0) {
362 return 0;
363 } else if (value >= 1.) {
364 return maxValue;
365 }
366
367 return PIX(value * maxValue + 0.5f);
368}
369
370template<class PIX, int maxValue>
371static PIX

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected