[vlc-commits] Use maximum precision for FI32 volume

Rémi Denis-Courmont git at videolan.org
Mon Sep 26 22:23:55 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Sep 26 23:22:16 2011 +0300| [f0ee4072512db8894a47dc9f847ac10b591b2f43] | committer: Rémi Denis-Courmont

Use maximum precision for FI32 volume

Right shifting 32-bits is typically easier than 24-bits (it should be
free on most 32-bits platforms). Also, this cannot overflow with the
current volume scale.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f0ee4072512db8894a47dc9f847ac10b591b2f43
---

 modules/audio_mixer/fixed32.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/audio_mixer/fixed32.c b/modules/audio_mixer/fixed32.c
index 3827d27..ee50d6f 100644
--- a/modules/audio_mixer/fixed32.c
+++ b/modules/audio_mixer/fixed32.c
@@ -60,16 +60,16 @@ static int Activate (vlc_object_t *obj)
 
 static void FilterFI32 (audio_mixer_t *mixer, block_t *block, float volume)
 {
-    const int64_t mult = volume * FIXED32_ONE;
+    const int64_t mult = volume * 0x1.p32;
 
-    if (mult == FIXED32_ONE)
+    if (mult == 0x1.p32)
         return;
 
     int32_t *p = (int32_t *)block->p_buffer;
 
     for (size_t n = block->i_buffer / sizeof (*p); n > 0; n--)
     {
-        *p = (*p * mult) >> FIXED32_FRACBITS;
+        *p = (*p * mult) >> INT64_C(32);
         p++;
     }
 



More information about the vlc-commits mailing list