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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Martin Vignali 2017-04-25 22:52:50 +02:00 committed by Michael Niedermayer
parent f16180f448
commit e46d637452
1 changed files with 2 additions and 2 deletions

View File

@ -220,9 +220,9 @@ static union av_intfloat32 exr_half2float(uint16_t hf)
*
* @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
// is also handled by this condition, avoids explicit check for sign bit.
if (exp <= 127 + 7 - 24) // we would shift out all bits anyway