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 denoiseinterface_h__
21 #define denoiseinterface_h__
22 #include <rawstudio.h>
23 
24 
25 #ifdef _unix_
26 G_BEGIN_DECLS
27 #endif
28 
29 #ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
30 extern "C" {
31 #endif
32 
33 typedef enum {
34   PROCESS_RGB, PROCESS_YUV, PROCESS_PATTERN_RGB, PROCESS_PATTERN_YUV
35 } InitDenoiseMode;
36 
37 typedef struct {
38   InitDenoiseMode processMode;  // Set this before initializing, DO NOT modify after that.
39   RS_IMAGE16* image;            // This will be input and output
40   float sigmaLuma;              // In RGB mode this is used for all planes, YUV mode only luma.
41   float sigmaChroma;            // Used only in YUV mode.
42   float betaLuma;               // In RGB mode this is used for all planes, YUV mode only luma.
43   float betaChroma;             // Used only in YUV mode.
44 
45   /* Sharpening - Luma is used for all planes in RGB */
46   float sharpenLuma;            // sharpening strength (default=0 - not sharpen)
47   float sharpenCutoffLuma;      // sharpening cutoff frequency, relative to max (default=0.3)
48   float sharpenMinSigmaLuma;    // Minimum limit (approximate noise margin) for sharpening stage (default=4.0)
49   float sharpenMaxSigmaLuma;    // Maximum limit (approximate oversharping margin) for sharpening stage (default=20.0)
50   float sharpenChroma;          // sharpening strength (default=0 - not sharpen)
51   float sharpenCutoffChroma;    // sharpening cutoff frequency, relative to max (default=0.3)
52   float sharpenMinSigmaChroma;  // Minimum limit (approximate noise margin) for sharpening stage (default=4.0)
53   float sharpenMaxSigmaChroma;  // Maximum limit (approximate oversharping margin) for sharpening stage (default=20.0)
54 
55   float redCorrection;          // Red coefficient, multiplid to R in YUV conversion. (default: 1.0)
56   float blueCorrection;         // Blue coefficient, multiplid to R in YUV conversion. (default: 1.0)
57   void* _this;                  // Do not modify this value.
58 } FFTDenoiseInfo;
59 
60 void initDenoiser(FFTDenoiseInfo* info);
61 void denoiseImage(FFTDenoiseInfo* info);
62 void destroyDenoiser(FFTDenoiseInfo* info);
63 void abortDenoiser(FFTDenoiseInfo* info);
64 
65 #ifdef _unix_
66 G_END_DECLS
67 #endif
68 
69 #ifdef __cplusplus /* If this is a C++ compiler, end C linkage */
70 }
71 #endif
72 
73 
74 
75 #endif // denoiseinterface_h__
76