]> git.sesse.net Git - kdenlive/blobdiff - src/lib/audio/fftCorrelation.h
FFT correlation is now used for larger audio samples when aligning.
[kdenlive] / src / lib / audio / fftCorrelation.h
index 502b5067c0709b6a7474223ed8d2305c7072e32d..6b098ba24a8d8b809563f4ae2d1b9177b438365b 100644 (file)
@@ -13,16 +13,37 @@ the Free Software Foundation, either version 3 of the License, or
 
 #include <inttypes.h>
 
+/**
+  This class provides methods to calculate convolution
+  and correlation of two vectors by means of FFT, which
+  is O(n log n) (convolution in spacial domain would be
+  O(n²)).
+  */
 class FFTCorrelation
 {
 public:
+
+    /**
+      Computes the convolution between \c left and \c right.
+      \c out_correlated must be a pre-allocated vector of size
+      \c leftSize + \c rightSize.
+      */
     static void convolute(const float *left, const int leftSize,
                           const float *right, const int rightSize,
-                          float **out_convolved, int &out_size);
+                          float *out_convolved);
+
+    /**
+      Computes the correlation between \c left and \c right.
+      \c out_correlated must be a pre-allocated vector of size
+      \c leftSize + \c rightSize.
+      */
+    static void correlate(const int64_t *left, const int leftSize,
+                          const int64_t *right, const int rightSize,
+                          float *out_correlated);
 
     static void correlate(const int64_t *left, const int leftSize,
                           const int64_t *right, const int rightSize,
-                          float **out_correlated, int &out_size);
+                          int64_t *out_correlated);
 };
 
 #endif // FFTCORRELATION_H