File indexing completed on 2024-04-28 04:51:59
0001 /* 0002 SPDX-FileCopyrightText: 2012 Simon A. Eugster (Granjow) <simon.eu@gmail.com> 0003 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 #pragma once 0007 0008 #include <QtGlobal> 0009 /** @class FFTCorrelation 0010 @brief This class provides methods to calculate convolution 0011 and correlation of two vectors by means of FFT, which 0012 is O(n log n) (convolution in spacial domain would be 0013 O(n²)). 0014 */ 0015 class FFTCorrelation 0016 { 0017 public: 0018 /** 0019 Computes the convolution between \c left and \c right. 0020 \c out_correlated must be a pre-allocated vector of size 0021 \c leftSize + \c rightSize + 1. 0022 */ 0023 static void convolve(const float *left, const size_t leftSize, const float *right, const size_t rightSize, float *out_convolved); 0024 0025 /** 0026 Computes the correlation between \c left and \c right. 0027 \c out_correlated must be a pre-allocated vector of size 0028 \c leftSize + \c rightSize + 1. 0029 */ 0030 static void correlate(const qint64 *left, const size_t leftSize, const qint64 *right, const size_t rightSize, float *out_correlated); 0031 0032 static void correlate(const qint64 *left, const size_t leftSize, const qint64 *right, const size_t rightSize, qint64 *out_correlated); 0033 };