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

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



segher      01/12/17 17:58:17

  Modified:    lib      psy.c
  Log:
  Some more hypot() removal.

Revision  Changes    Path
1.58      +7 -17     vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- psy.c	2001/12/12 09:45:25	1.57
+++ psy.c	2001/12/18 01:58:15	1.58
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.57 2001/12/12 09:45:25 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.58 2001/12/18 01:58:15 segher Exp $
 
  ********************************************************************/
 
@@ -925,28 +925,18 @@
                          float granule,float igranule,
                          float fmag, float *mag, float *ang){
 
-  float origmag=FAST_HYPOT(A*fA,B*fB),corr;
+  float corr;
 
   if(fmag!=0.f){
-    //float phase=rint((A-B)*.5/fmag);
-    
     if(fabs(A)>fabs(B)){
-      *mag=A;//phase=(A>0?phase:-phase);
+      *mag=A;
     }else{
-      *mag=B;//phase=(B>0?phase:-phase);
+      *mag=B;
     }
     
-    //switch((int)phase){
-      //case 0:
-      corr=origmag/FAST_HYPOT(fmag*fA,fmag*fB);
-      *mag=rint(*mag*corr*igranule)*granule; 
-      *ang=0.f;
-      //break;
-      //default:
-      //*mag=0.f;
-      //*ang=0.f;
-      //break;
-      //}
+    corr=sqrt((A*A*fA*fA+B*B*fB*fB)/(fA*fA+fB*fB))/fmag;
+    *mag=rint(*mag*corr*igranule)*granule; 
+    *ang=0.f;
   }else{
     *mag=0.f;
     *ang=0.f;

--- >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