mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
exr: optimize exr_halflt2uint()
30% faster Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
cabc0ac72f
commit
3532a87a25
@ -77,15 +77,13 @@ static inline uint16_t exr_flt2uint(uint32_t v)
|
|||||||
*/
|
*/
|
||||||
static inline uint16_t exr_halflt2uint(uint16_t v)
|
static inline uint16_t exr_halflt2uint(uint16_t v)
|
||||||
{
|
{
|
||||||
int exp = v >> 10;
|
unsigned exp = 14 - (v >> 10);
|
||||||
if (v & 0x8000)
|
if (exp >= 14) {
|
||||||
return 0;
|
if (exp == 14) return (v >> 9) & 1;
|
||||||
if (!exp)
|
else return (v & 0x8000) ? 0 : 0xffff;
|
||||||
return (v >> 9) & 1;
|
}
|
||||||
if (exp >= 15)
|
|
||||||
return 0xffff;
|
|
||||||
v <<= 6;
|
v <<= 6;
|
||||||
return (v + (1 << 16)) >> (15 - exp);
|
return (v + (1 << 16)) >> (exp + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user