[xiph-cvs] cvs commit: vorbis/lib mapping0.c

Segher Boessenkool segher at xiph.org
Mon Dec 17 16:55:55 PST 2001



segher      01/12/17 16:55:54

  Modified:    lib      mapping0.c
  Log:
  getting rid of some hypot() calls

Revision  Changes    Path
1.40      +5 -3      vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- mapping0.c	2001/12/16 04:15:46	1.39
+++ mapping0.c	2001/12/18 00:55:53	1.40
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.39 2001/12/16 04:15:46 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.40 2001/12/18 00:55:53 segher Exp $
 
  ********************************************************************/
 
@@ -317,6 +317,7 @@
 
   for(i=0;i<vi->channels;i++){
     float scale=4.f/n;
+    float scale_dB;
 
     /* the following makes things clearer to *me* anyway */
     float *pcm     =vb->pcm[i]; 
@@ -329,6 +330,7 @@
     float *logmax  =work;
     float *logmask =work+n/2;*/
 
+    scale_dB=todB(&scale);
     _analysis_output("pcm",seq+i,pcm,n,0,0);
 
     /* window the PCM data */
@@ -347,8 +349,8 @@
     logfft[0]=todB(fft);
     local_ampmax[i]=logfft[0];
     for(j=1;j<n-1;j+=2){
-      float temp=scale*FAST_HYPOT(fft[j],fft[j+1]);
-      temp=logfft[(j+1)>>1]=todB(&temp);
+      float temp=fft[j]*fft[j]+fft[j+1]*fft[j+1];
+      temp=logfft[(j+1)>>1]=scale_dB+.5f*todB(&temp);
       if(temp>local_ampmax[i])local_ampmax[i]=temp;
     }
 

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list