[SCM] calf/master: + Benchmark: add very crude benchmark for FFT

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


The following commit has been merged in the master branch:
commit f184ba25fcc69d9bed52dcdfd79e87939d2c5d3d
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sat Dec 20 22:46:21 2008 +0000

    + Benchmark: add very crude benchmark for FFT

diff --git a/src/benchmark.cpp b/src/benchmark.cpp
index dd70d82..3602c32 100644
--- a/src/benchmark.cpp
+++ b/src/benchmark.cpp
@@ -148,6 +148,28 @@ struct filter_12dB_lp_d2: public filter_lp24dB_benchmark<biquad_d2<> >
     }
 };
 
+template<int N>
+struct fft_test_class
+{
+    typedef fft<float, N> fft_class;
+    fft_class ffter;
+    float result;
+    complex<float> data[1 << N], output[1 << N];
+    void prepare() {
+        for (int i = 0; i < (1 << N); i++)
+            data[i] = sin(i);
+        result = 0;
+    }
+    void cleanup()
+    {
+    }
+    void run()
+    {
+        ffter.calculate(data, output, false);
+    }
+    double scaler() { return 1 << N; }
+};
+
 #define ALIGN_TEST_RUN 1024
 
 struct __attribute__((aligned(8))) alignment_test: public empty_benchmark<ALIGN_TEST_RUN>
@@ -213,6 +235,11 @@ void biquad_test()
         do_simple_benchmark<filter_12dB_lp_d2>();
 }
 
+void fft_test()
+{
+        do_simple_benchmark<fft_test_class<17> >(5, 10);
+}
+
 void alignment_test()
 {
         do_simple_benchmark<misaligned_double>();
@@ -510,5 +537,8 @@ int main(int argc, char *argv[])
     if (unit && !strcmp(unit, "aweighting"))
         aweighting_calc();
 
+    if (!unit || !strcmp(unit, "fft"))
+        fft_test();
+    
     return 0;
 }

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list