Commit b391e4c8 authored by Martin Vignali's avatar Martin Vignali Committed by Michael Niedermayer

libavcodec/exr : fix float to uint16 conversion for negative float value

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e46d6374)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 82e5f2c7
...@@ -216,9 +216,9 @@ static union av_intfloat32 exr_half2float(uint16_t hf) ...@@ -216,9 +216,9 @@ static union av_intfloat32 exr_half2float(uint16_t hf)
* *
* @return normalized 16-bit unsigned int * @return normalized 16-bit unsigned int
*/ */
static inline uint16_t exr_flt2uint(uint32_t v) static inline uint16_t exr_flt2uint(int32_t v)
{ {
unsigned int exp = v >> 23; int32_t exp = v >> 23;
// "HACK": negative values result in exp< 0, so clipping them to 0 // "HACK": negative values result in exp< 0, so clipping them to 0
// is also handled by this condition, avoids explicit check for sign bit. // is also handled by this condition, avoids explicit check for sign bit.
if (exp <= 127 + 7 - 24) // we would shift out all bits anyway if (exp <= 127 + 7 - 24) // we would shift out all bits anyway
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment