[FFmpeg-devel] [PATCH] avcodec/vorbisdec: don't use double intermediate in vorbisfloat2float

James Almer jamrial at gmail.com
Wed Jun 12 04:52:18 EEST 2024


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/vorbisdec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 700c6c8918..218e855f7a 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -181,11 +181,11 @@ static const char idx_err_str[] = "Index value %d out of range (0 - %d) for %s a
 
 static float vorbisfloat2float(unsigned val)
 {
-    double mant = val & 0x1fffff;
-    long exp    = (val & 0x7fe00000L) >> 21;
+    float mant = val & 0x1fffff;
+    int exp    = (val & 0x7fe00000) >> 21;
     if (val & 0x80000000)
         mant = -mant;
-    return ldexp(mant, exp - 20 - 768);
+    return ldexpf(mant, exp - 20 - 768);
 }
 
 
-- 
2.45.2



More information about the ffmpeg-devel mailing list