[FFmpeg-devel] [PATCH v3 5/5] Replace division with ldexp

Yigithan Yigit yigithanyigitdevel at gmail.com
Tue Jul 2 04:33:54 EEST 2024


---
 libavfilter/af_volumedetect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c
index a53212015d..856d5a295d 100644
--- a/libavfilter/af_volumedetect.c
+++ b/libavfilter/af_volumedetect.c
@@ -49,7 +49,7 @@ static inline double logdb(double v, enum AVSampleFormat sample_fmt)
             return MAX_DB_FLT;
         return -log10(v) * 10;
     } else {
-        double d = v / (double)(0x8000 * 0x8000);
+        double d = ldexp(v, -30);
         if (!v)
             return MAX_DB;
         return -log10(d) * 10;
-- 
2.45.2



More information about the ffmpeg-devel mailing list