shithub: opus

Download patch

ref: 58b3727fcf38747dc37604da06f22badeda49e89
parent: c994394fc3bb1a12df7c5b233318f537e30ad6d9
author: Jean-Marc Valin <[email protected]>
date: Sat Aug 30 10:53:44 EDT 2008

exp() and log() are faster than pow() and log10() for dB conversion

--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -71,7 +71,8 @@
 static inline celt_ener_t dB2Amp(celt_ener_t dB)
 {
    celt_ener_t amp;
-   amp = pow(10, .05*dB)-.3;
+   /*amp = pow(10, .05*dB)-.3;*/
+   amp = exp(0.115129f*dB)-.3f;
    if (amp < 0)
       amp = 0;
    return amp;
@@ -78,7 +79,8 @@
 }
 static inline celt_word16_t amp2dB(celt_ener_t amp)
 {
-   return 20*log10(.3+amp);
+   /*return 20*log10(.3+amp);*/
+   return 8.68589f*log(.3f+amp);
 }
 #endif