~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/dimg/filters/nr/nrfilter.h

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2010-04-09 21:30:01 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100409213001-4bfyibrd359rn7o3
Tags: 2:1.2.0-0ubuntu1
* New upstream release (LP: #560576)
* Remove all patches, fixed upstream
  - Remove quilt build-depend

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2005-05-25
 
7
 * Description : Wavelets Noise Reduction threaded image filter.
 
8
 *               This filter work in YCrCb color space.
 
9
 *
 
10
 * Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
11
 *
 
12
 * This program is free software; you can redistribute it
 
13
 * and/or modify it under the terms of the GNU General
 
14
 * Public License as published by the Free Software Foundation;
 
15
 * either version 2, or (at your option)
 
16
 * any later version.
 
17
 *
 
18
 * This program is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * ============================================================ */
 
24
 
 
25
#ifndef NRFILTER_H
 
26
#define NRFILTER_H
 
27
 
 
28
// Local includes
 
29
 
 
30
#include "digikam_export.h"
 
31
#include "dimgthreadedfilter.h"
 
32
 
 
33
namespace Digikam
 
34
{
 
35
 
 
36
class NRFilterPriv;
 
37
 
 
38
class DIGIKAM_EXPORT NRContainer
 
39
{
 
40
 
 
41
public:
 
42
 
 
43
    NRContainer()
 
44
    {
 
45
        leadThreshold = 1.2;
 
46
        leadSoftness  = 0.9;
 
47
        advanced      = false;
 
48
        thresholds[0] = 1.2;     // Y
 
49
        thresholds[1] = 1.2;     // Cr
 
50
        thresholds[2] = 1.2;     // Cb
 
51
        softness[0]   = 0.9;     // Y
 
52
        softness[1]   = 0.9;     // Cr
 
53
        softness[2]   = 0.9;     // Cb
 
54
    };
 
55
 
 
56
    ~NRContainer(){};
 
57
 
 
58
public:
 
59
 
 
60
    /** If false thresholds and softness values are the same for Y, Cr, and Cb
 
61
        else, each chanel has a dedicated value.
 
62
     */
 
63
    bool   advanced;
 
64
 
 
65
    /** General settings if advanced is false
 
66
     */
 
67
    double leadThreshold;
 
68
    double leadSoftness;
 
69
 
 
70
    /** Separated values per chanel
 
71
     */
 
72
    double thresholds[3];    // Y, Cr, Cb thresholds.
 
73
    double softness[3];      // Y, Cr, Cb softness.
 
74
};
 
75
 
 
76
// --------------------------------------------------------------------------
 
77
 
 
78
class DIGIKAM_EXPORT NRFilter : public DImgThreadedFilter
 
79
{
 
80
 
 
81
public:
 
82
 
 
83
    NRFilter(DImg* orgImage, QObject* parent, const NRContainer& settings);
 
84
    ~NRFilter();
 
85
 
 
86
private:
 
87
 
 
88
    void filterImage();
 
89
 
 
90
    void waveletDenoise(float* fimg[3], unsigned int width, unsigned int height,
 
91
                        float threshold, double softness);
 
92
    inline void hatTransform(float* temp, float *base, int st, int size, int sc);
 
93
 
 
94
    void srgb2ycbcr(float** fimg, int size);
 
95
    void ycbcr2srgb(float** fimg, int size);
 
96
 
 
97
    // Methods not used.
 
98
    void srgb2lab(float** fimg, int size);
 
99
    void lab2srgb(float** fimg, int size);
 
100
    void srgb2xyz(float** fimg, int size);
 
101
    void xyz2srgb(float** fimg, int size);
 
102
 
 
103
private:
 
104
 
 
105
    NRFilterPriv* const d;
 
106
};
 
107
 
 
108
}  // namespace Digikam
 
109
 
 
110
#endif /* NRFILTER_H */