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

Monty xiphmont at xiph.org
Tue May 7 18:06:34 PDT 2002



xiphmont    02/05/07 18:06:34

  Modified:    lib      Tag: branch_monty_20020507 psy.c
  Log:
  Modify Segher's optimized hybridmp to have identical high end boundary
  conditions to original unoptimized version in rc3.
  
  Monty

Revision  Changes    Path
No                   revision

<p>No                   revision

<p>1.67.2.2  +17 -12    vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.67.2.1
retrieving revision 1.67.2.2
diff -u -r1.67.2.1 -r1.67.2.2
--- psy.c	2002/05/07 23:47:14	1.67.2.1
+++ psy.c	2002/05/08 01:06:33	1.67.2.2
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.67.2.1 2002/05/07 23:47:14 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.67.2.2 2002/05/08 01:06:33 xiphmont Exp $
 
  ********************************************************************/
 
@@ -717,6 +717,9 @@
   float tN, tX, tXX, tY, tXY;
   float fi;
   int i;
+
+  int lo, hi;
+  float R, A, B, D;
   
   tN = tX = tXX = tY = tXY = 0.f;
   for (i = 0, fi = 0.f; i < n; i++, fi += 1.f) {
@@ -744,8 +747,6 @@
   XY[i] = tXY;
   
   for (i = 0, fi = 0.f;; i++, fi += 1.f) {
-    int lo, hi;
-    float R, A, B, D;
     
     lo = b[i] >> 16;
     if( lo>=0 ) break;
@@ -766,10 +767,8 @@
     
     noise[i] = R - offset;
   }
-
-  for ( ; i < n; i++, fi += 1.f) {
-    int lo, hi;
-    float R, A, B, D;
+  
+  for ( ; hi < n; i++, fi += 1.f) {
     
     lo = b[i] >> 16;
     hi = b[i] & 0xffff;
@@ -788,13 +787,17 @@
     
     noise[i] = R - offset;
   }
+  for ( ; i < n; i++, fi += 1.f) {
+    
+    R = (A + fi * B) / D;
+    if (R < 0.f) R = 0.f;
+    
+    noise[i] = R - offset;
+  }
   
   if (fixed <= 0) return;
   
   for (i = 0, fi = 0.f; i < (fixed + 1) / 2; i++, fi += 1.f) {
-    int lo, hi;
-    float R, A, B, D;
-    
     hi = i + fixed / 2;
     lo = hi - fixed;
     
@@ -812,9 +815,7 @@
 
     if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
   }
-  for ( ; i < n; i++, fi += 1.f) {
-    int lo, hi;
-    float R, A, B, D;
+  for ( ; hi < n; i++, fi += 1.f) {
     
     hi = i + fixed / 2;
     lo = hi - fixed;
@@ -830,6 +831,10 @@
     D = tN * tXX - tX * tX;
     R = (A + fi * B) / D;
     
+    if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
+  }
+  for ( ; i < n; i++, fi += 1.f) {
+    R = (A + fi * B) / D;
     if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
   }
 }

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