[SCM] calf/master: + Framework: an attempt at optimizing Hermite interpolation a little bit

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:38:41 UTC 2013


The following commit has been merged in the master branch:
commit fab2582ec958ce17288bb5167f56fe26e4c7e2a0
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Thu Nov 27 00:03:57 2008 +0000

    + Framework: an attempt at optimizing Hermite interpolation a little bit

diff --git a/src/calf/primitives.h b/src/calf/primitives.h
index e76a154..ee23a09 100644
--- a/src/calf/primitives.h
+++ b/src/calf/primitives.h
@@ -497,8 +497,14 @@ inline float hermite_interpolation(float x, float x0, float x1, float p0, float
     m1 *= width;
     float t2 = t*t;
     float t3 = t2*t;
-    // printf("t=%f p0=%f p1=%f m0=%f m1=%f\n", t, p0, p1, m0, m1);
-    return (2*t3 - 3*t2 + 1) * p0 + (t3 - 2*t2 + t) * m0 + (-2*t3 + 3*t2) * p1 + (t3-t2) * m1;
+    
+    float ct0 = p0;
+    float ct1 = m0;
+    float ct2 = -3 * p0 - 2 * m0 + 3 * p1 - m1;
+    float ct3 = 2 * p0 + m0  - 2 * p1 + m1;
+    
+    return ct3 * t3 + ct2 * t2 + ct1 * t + ct0;
+    //return (2*t3 - 3*t2 + 1) * p0 + (t3 - 2*t2 + t) * m0 + (-2*t3 + 3*t2) * p1 + (t3-t2) * m1;
 }
 
 };

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list