mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
util: remove unused half_to_unorm8
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
This commit is contained in:
parent
e25fdc701b
commit
0b6c0bfa09
2 changed files with 0 additions and 27 deletions
|
|
@ -171,32 +171,6 @@ _mesa_half_to_float_slow(uint16_t val)
|
|||
return f32.f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert 0.0 to 0x00, 1.0 to 0xff.
|
||||
* Values outside the range [0.0, 1.0] will give undefined results.
|
||||
*/
|
||||
uint8_t _mesa_half_to_unorm8(uint16_t val)
|
||||
{
|
||||
const int m = val & 0x3ff;
|
||||
const int e = (val >> 10) & 0x1f;
|
||||
ASSERTED const int s = (val >> 15) & 0x1;
|
||||
|
||||
/* v = round_to_nearest(1.mmmmmmmmmm * 2^(e-15) * 255)
|
||||
* = round_to_nearest((1.mmmmmmmmmm * 255) * 2^(e-15))
|
||||
* = round_to_nearest((1mmmmmmmmmm * 255) * 2^(e-25))
|
||||
* = round_to_zero((1mmmmmmmmmm * 255) * 2^(e-25) + 0.5)
|
||||
* = round_to_zero(((1mmmmmmmmmm * 255) * 2^(e-24) + 1) / 2)
|
||||
*
|
||||
* This happens to give the correct answer for zero/subnormals too
|
||||
*/
|
||||
assert(s == 0 && val <= FP16_ONE); /* check 0 <= this <= 1 */
|
||||
/* (implies e <= 15, which means the bit-shifts below are safe) */
|
||||
|
||||
uint32_t v = ((1 << 10) | m) * 255;
|
||||
v = ((v >> (24 - e)) + 1) >> 1;
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a uint16_t, divides by 65536, converts the infinite-precision
|
||||
* result to fp16 with round-to-zero. Used by the ASTC decoder.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ extern "C" {
|
|||
|
||||
uint16_t _mesa_float_to_half_slow(float val);
|
||||
float _mesa_half_to_float_slow(uint16_t val);
|
||||
uint8_t _mesa_half_to_unorm8(uint16_t v);
|
||||
uint16_t _mesa_uint16_div_64k_to_half(uint16_t v);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue