MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / encode_texel_unorm

Function encode_texel_unorm

Source/astcenc_image.cpp:129–139  ·  view source on GitHub ↗

* @brief Encode a texel that is entirely LDR linear. * * Out-of-range inputs will be clamped to the valid UNORM range. * * @param data The RGBA data to encode. * @param lns_mask The mask for the HDR channels that need LNS encoding. */

Source from the content-addressed store, hash-verified

127 * @param lns_mask The mask for the HDR channels that need LNS encoding.
128 */
129static vfloat4 encode_texel_unorm(
130 vfloat4 data,
131 vmask4 lns_mask
132) {
133 (void)lns_mask;
134 vfloat4 raw_value = data * 65535.0f;
135
136 // Unorm data must be in 0-1 range, so clamp because data can come from an
137 // unconstrained float. This will replace NaNs with zero.
138 return clamp(0.0f, 65535.0f, raw_value);
139}
140
141/**
142 * @brief Encode a texel that includes at least some HDR LNS texels.

Callers 1

encode_texel_lnsFunction · 0.85

Calls 1

clampFunction · 0.70

Tested by

no test coverage detected