1 /*
2  * * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>,
3  * * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef fftwindow_h__
21 #define fftwindow_h__
22 #include "floatimageplane.h"
23 
24 namespace RawStudio {
25 namespace FFTFilter {
26 
27 class FFTWindow
28 {
29 public:
30   FFTWindow(int _w, int _h);
31   virtual ~FFTWindow(void);
32   FloatImagePlane analysis;
33   FloatImagePlane synthesis;
34   void createHalfCosineWindow(int ox, int oy);
35   void createRaisedCosineWindow(int ox, int oy);
36   void createSqrtHalfCosineWindow(int ox, int oy);
37   void applyAnalysisWindow(FloatImagePlane *image, FloatImagePlane *dst);
38   void applySynthesisWindow( FloatImagePlane *image ); // Inplace, written back to image
39 private:
40   void applyAnalysisWindowSSE( FloatImagePlane *image, FloatImagePlane *dst );
41   float createWindow( FloatImagePlane &window, int ox, float* wx);  // Returns sum
42   bool analysisIsFlat;
43   bool synthesisIsFlat;
44   bool SSEAvailable;
45 };
46 
47 }} // namespace RawStudio::FFTFilter
48 
49 #endif // fftwindow_h__
50