aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2017-04-25 22:52:50 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-16 16:00:22 +0200
commitb391e4c8f4fe08a1fbeb04df794230c0dfb0fd6e (patch)
tree0318f1555fafaa13cb2efd8d004634ccac2c7b38
parent82e5f2c76b6fbb4118066462b1e94306630cd91e (diff)
downloadffmpeg-b391e4c8f4fe08a1fbeb04df794230c0dfb0fd6e.tar.gz
libavcodec/exr : fix float to uint16 conversion for negative float value
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit e46d63745215c04637e7797228bad36bce49d881) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/exr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index a811c02b8a..0a7475fcb3 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -216,9 +216,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