summaryrefslogtreecommitdiff
path: root/libavcodec/exr.c
diff options
context:
space:
mode:
authorMark Reid <mindmark@gmail.com>2020-11-22 20:32:15 -0800
committerPaul B Mahol <onemda@gmail.com>2020-12-09 12:31:09 +0100
commit8d19b3c4a5176c181dc1751e08834193b549162c (patch)
treea85319cf83d34cda646a30f6738759200a7d2b83 /libavcodec/exr.c
parent7777e5119ad3377e2c4cb20a7aff56448d035b55 (diff)
avcodec/exr: preserve half-float NaN bits and add fate test
Handles NaNs more like the official implementation handles them, preserving the original bits.
Diffstat (limited to 'libavcodec/exr.c')
-rw-r--r--libavcodec/exr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index d233dd43fb..6e6ce4275c 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -193,8 +193,7 @@ static union av_intfloat32 exr_half2float(uint16_t hf)
// half-float NaNs will be converted to a single precision NaN
// half-float Infs will be converted to a single precision Inf
exp = FLOAT_MAX_BIASED_EXP;
- if (mantissa)
- mantissa = (1 << 23) - 1; // set all bits to indicate a NaN
+ mantissa <<= 13; // preserve half-float NaN bits if set
} else if (exp == 0x0) {
// convert half-float zero/denorm to single precision value
if (mantissa) {