The current code did not check that the white level resulting from factor_16bit*white_level[ref_idx] would be in the range of [0, 2^16 -1]. On the Canon R5 MkII this calculation resulted in a white level of 65,536 (i.e. 2^16) which is too big to fit inside a uint16. The actual scaling code inside convert_float_to_uint16 properly clamps to uin16 range, but the values sent to texture_to_dng did not, resulting in a produced DNG being written which cannot be opened, not even by the dng convertor since it fails validation.
The current code did not check that the white level resulting from
factor_16bit*white_level[ref_idx]
would be in the range of [0, 2^16 -1]. On the Canon R5 MkII this calculation resulted in a white level of 65,536 (i.e. 2^16) which is too big to fit inside a uint16. The actual scaling code insideconvert_float_to_uint16
properly clamps to uin16 range, but the values sent totexture_to_dng
did not, resulting in a produced DNG being written which cannot be opened, not even by the dng convertor since it fails validation.