avcodec/exr: preserve half-float NaN bits and add fate test

Handles NaNs more like the official implementation handles them, preserving
the original bits.
This commit is contained in:
Mark Reid 2020-11-22 20:32:15 -08:00 committed by Paul B Mahol
parent 7777e5119a
commit 8d19b3c4a5
3 changed files with 9 additions and 2 deletions

View File

@ -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) {

View File

@ -317,6 +317,8 @@ fate-exr-rgb-scanline-half-zip-dw-outside: CMD = framecrc -i $(TARGET_SAMPLES)/e
FATE_EXR += fate-exr-rgb-tile-half-zip-dw-outside
fate-exr-rgb-tile-half-zip-dw-outside: CMD = framecrc -i $(TARGET_SAMPLES)/exr/rgb_tile_half_zip_dw_outside.exr -pix_fmt gbrpf32le
FATE_EXR += fate-exr-rgb-scanline-zip-half-0x0-0xFFFF
fate-exr-rgb-scanline-zip-half-0x0-0xFFFF: CMD = framecrc -i $(TARGET_SAMPLES)/exr/rgb_scanline_zip_half_float_0x0_to_0xFFFF.exr -pix_fmt gbrpf32le
FATE_EXR-$(call DEMDEC, IMAGE2, EXR) += $(FATE_EXR)

View File

@ -0,0 +1,6 @@
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 256x256
#sar 0: 1/1
0, 0, 0, 1, 786432, 0x1445e411