]> git.sesse.net Git - kdenlive/blob - src/lib/audio/fftCorrelation.h
Use QLatin1String
[kdenlive] / src / lib / audio / fftCorrelation.h
1 /*
2 Copyright (C) 2012  Simon A. Eugster (Granjow)  <simon.eu@gmail.com>
3 This file is part of kdenlive. See www.kdenlive.org.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 */
10
11 #ifndef FFTCORRELATION_H
12 #define FFTCORRELATION_H
13
14 #include <inttypes.h>
15
16 /**
17   This class provides methods to calculate convolution
18   and correlation of two vectors by means of FFT, which
19   is O(n log n) (convolution in spacial domain would be
20   O(n²)).
21   */
22 class FFTCorrelation
23 {
24 public:
25
26     /**
27       Computes the convolution between \c left and \c right.
28       \c out_correlated must be a pre-allocated vector of size
29       \c leftSize + \c rightSize.
30       */
31     static void convolve(const float *left, const int leftSize,
32                           const float *right, const int rightSize,
33                           float *out_convolved);
34
35     /**
36       Computes the correlation between \c left and \c right.
37       \c out_correlated must be a pre-allocated vector of size
38       \c leftSize + \c rightSize.
39       */
40     static void correlate(const int64_t *left, const int leftSize,
41                           const int64_t *right, const int rightSize,
42                           float *out_correlated);
43
44     static void correlate(const int64_t *left, const int leftSize,
45                           const int64_t *right, const int rightSize,
46                           int64_t *out_correlated);
47 };
48
49 #endif // FFTCORRELATION_H