MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / clamp255

Function clamp255

cmp_compressonatorlib/astc/astc_encode_kernel.cpp:4550–4563  ·  view source on GitHub ↗

clamp an input value to [0,255]; NaN is turned into 0

Source from the content-addressed store, hash-verified

4548
4549// clamp an input value to [0,255]; NaN is turned into 0
4550float clamp255(float val)
4551{
4552 if (val > 255.0f)
4553 val = 255.0f;
4554 else if (val > 0.0f)
4555 {
4556 // deliberately empty
4557 // switching the order of calculation here will fail to handle 0.
4558 }
4559 else
4560 val = 0.0f;
4561
4562 return val;
4563}
4564
4565// clamp an input value to [0,1]; Nan is turned into 0.
4566float clamp01(float val)

Callers 11

quantize_rgbFunction · 0.85
quantize_rgbaFunction · 0.85
try_quantize_rgb_deltaFunction · 0.85
try_quantize_alpha_deltaFunction · 0.85
quantize_rgbs_newFunction · 0.85
quantize_rgbs_alpha_newFunction · 0.85
quantize_luminanceFunction · 0.85
quantize_luminance_alphaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected