| 187 | // Used by five-bit brightness and HD108 pipelines. |
| 188 | |
| 189 | constexpr u16 eval16(u8 x, u32 gamma_raw) FL_NOEXCEPT { |
| 190 | return x == 0 ? static_cast<u16>(0) |
| 191 | : x == 255 ? static_cast<u16>(65535) |
| 192 | : static_cast<u16>( |
| 193 | (pow_fp( |
| 194 | static_cast<u32>((static_cast<u64>(x) << FRAC) / 255), |
| 195 | gamma_raw |
| 196 | ) * 65535ULL + (SCALE >> 1)) >> FRAC |
| 197 | ); |
| 198 | } |
| 199 | |
| 200 | } // namespace gamma_constexpr |
| 201 | } // namespace detail |