File indexing completed on 2024-04-28 15:50:41

0001 /*
0002     SPDX-FileCopyrightText: 2006-2015 Gilles Caulier <caulier dot gilles at gmail dot com>
0003     SPDX-FileCopyrightText: 2006-2013 Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0004     SPDX-FileCopyrightText: 2007-2008 Guillaume Castagnino <casta at xwing dot info>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #include "rawdecodingsettings.h"
0010 
0011 namespace KDcrawIface
0012 {
0013 
0014 RawDecodingSettings::RawDecodingSettings()
0015 {
0016     fixColorsHighlights        = false;
0017     autoBrightness             = true;
0018     sixteenBitsImage           = false;
0019     brightness                 = 1.0;
0020     RAWQuality                 = BILINEAR;
0021     inputColorSpace            = NOINPUTCS;
0022     outputColorSpace           = SRGB;
0023     RGBInterpolate4Colors      = false;
0024     DontStretchPixels          = false;
0025     unclipColors               = 0;
0026     whiteBalance               = CAMERA;
0027     customWhiteBalance         = 6500;
0028     customWhiteBalanceGreen    = 1.0;
0029     medianFilterPasses         = 0;
0030 
0031     halfSizeColorImage         = false;
0032 
0033     enableBlackPoint           = false;
0034     blackPoint                 = 0;
0035 
0036     enableWhitePoint           = false;
0037     whitePoint                 = 0;
0038 
0039     NRType                     = NONR;
0040     NRThreshold                = 0;
0041 
0042     enableCACorrection         = false;
0043     caMultiplier[0]            = 0.0;
0044     caMultiplier[1]            = 0.0;
0045 
0046     inputProfile               = QString();
0047     outputProfile              = QString();
0048 
0049     deadPixelMap               = QString();
0050 
0051     whiteBalanceArea           = QRect();
0052 
0053     //-- Extended demosaicing settings ----------------------------------------------------------
0054 
0055     dcbIterations              = -1;
0056     dcbEnhanceFl               = false;
0057     eeciRefine                 = false;
0058     esMedPasses                = 0;
0059     NRChroThreshold            = 0;
0060     expoCorrection             = false;
0061     expoCorrectionShift        = 1.0;
0062     expoCorrectionHighlight    = 0.0;
0063 }
0064 
0065 RawDecodingSettings::~RawDecodingSettings()
0066 {
0067 }
0068 
0069 RawDecodingSettings::RawDecodingSettings(const RawDecodingSettings& o) = default;
0070 
0071 RawDecodingSettings& RawDecodingSettings::operator=(const RawDecodingSettings& o) = default;
0072 
0073 bool RawDecodingSettings::operator==(const RawDecodingSettings& o) const
0074 {
0075     return fixColorsHighlights     == o.fixColorsHighlights
0076         && autoBrightness          == o.autoBrightness
0077         && sixteenBitsImage        == o.sixteenBitsImage
0078         && brightness              == o.brightness
0079         && RAWQuality              == o.RAWQuality
0080         && inputColorSpace         == o.inputColorSpace
0081         && outputColorSpace        == o.outputColorSpace
0082         && RGBInterpolate4Colors   == o.RGBInterpolate4Colors
0083         && DontStretchPixels       == o.DontStretchPixels
0084         && unclipColors            == o.unclipColors
0085         && whiteBalance            == o.whiteBalance
0086         && customWhiteBalance      == o.customWhiteBalance
0087         && customWhiteBalanceGreen == o.customWhiteBalanceGreen
0088         && halfSizeColorImage      == o.halfSizeColorImage
0089         && enableBlackPoint        == o.enableBlackPoint
0090         && blackPoint              == o.blackPoint
0091         && enableWhitePoint        == o.enableWhitePoint
0092         && whitePoint              == o.whitePoint
0093         && NRType                  == o.NRType
0094         && NRThreshold             == o.NRThreshold
0095         && enableCACorrection      == o.enableCACorrection
0096         && caMultiplier[0]         == o.caMultiplier[0]
0097         && caMultiplier[1]         == o.caMultiplier[1]
0098         && medianFilterPasses      == o.medianFilterPasses
0099         && inputProfile            == o.inputProfile
0100         && outputProfile           == o.outputProfile
0101         && deadPixelMap            == o.deadPixelMap
0102         && whiteBalanceArea        == o.whiteBalanceArea
0103 
0104         //-- Extended demosaicing settings ----------------------------------------------------------
0105 
0106         && dcbIterations           == o.dcbIterations
0107         && dcbEnhanceFl            == o.dcbEnhanceFl
0108         && eeciRefine              == o.eeciRefine
0109         && esMedPasses             == o.esMedPasses
0110         && NRChroThreshold         == o.NRChroThreshold
0111         && expoCorrection          == o.expoCorrection
0112         && expoCorrectionShift     == o.expoCorrectionShift
0113         && expoCorrectionHighlight == o.expoCorrectionHighlight
0114         ;
0115 }
0116 
0117 void RawDecodingSettings::optimizeTimeLoading()
0118 {
0119     fixColorsHighlights     = false;
0120     autoBrightness          = true;
0121     sixteenBitsImage        = true;
0122     brightness              = 1.0;
0123     RAWQuality              = BILINEAR;
0124     inputColorSpace         = NOINPUTCS;
0125     outputColorSpace        = SRGB;
0126     RGBInterpolate4Colors   = false;
0127     DontStretchPixels       = false;
0128     unclipColors            = 0;
0129     whiteBalance            = CAMERA;
0130     customWhiteBalance      = 6500;
0131     customWhiteBalanceGreen = 1.0;
0132     halfSizeColorImage      = true;
0133     medianFilterPasses      = 0;
0134 
0135     enableBlackPoint        = false;
0136     blackPoint              = 0;
0137 
0138     enableWhitePoint        = false;
0139     whitePoint              = 0;
0140 
0141     NRType                  = NONR;
0142     NRThreshold             = 0;
0143 
0144     enableCACorrection      = false;
0145     caMultiplier[0]         = 0.0;
0146     caMultiplier[1]         = 0.0;
0147 
0148     inputProfile            = QString();
0149     outputProfile           = QString();
0150 
0151     deadPixelMap            = QString();
0152 
0153     whiteBalanceArea        = QRect();
0154 
0155     //-- Extended demosaicing settings ----------------------------------------------------------
0156 
0157     dcbIterations           = -1;
0158     dcbEnhanceFl            = false;
0159     eeciRefine              = false;
0160     esMedPasses             = 0;
0161     NRChroThreshold         = 0;
0162     expoCorrection          = false;
0163     expoCorrectionShift     = 1.0;
0164     expoCorrectionHighlight = 0.0;
0165 }
0166 
0167 QDebug operator<<(QDebug dbg, const RawDecodingSettings& s)
0168 {
0169     dbg.nospace() << '\n';
0170     dbg.nospace() << "-- RAW DECODING SETTINGS --------------------------------" << '\n';
0171     dbg.nospace() << "-- autoBrightness:          " << s.autoBrightness          << '\n';
0172     dbg.nospace() << "-- sixteenBitsImage:        " << s.sixteenBitsImage        << '\n';
0173     dbg.nospace() << "-- brightness:              " << s.brightness              << '\n';
0174     dbg.nospace() << "-- RAWQuality:              " << s.RAWQuality              << '\n';
0175     dbg.nospace() << "-- inputColorSpace:         " << s.inputColorSpace         << '\n';
0176     dbg.nospace() << "-- outputColorSpace:        " << s.outputColorSpace        << '\n';
0177     dbg.nospace() << "-- RGBInterpolate4Colors:   " << s.RGBInterpolate4Colors   << '\n';
0178     dbg.nospace() << "-- DontStretchPixels:       " << s.DontStretchPixels       << '\n';
0179     dbg.nospace() << "-- unclipColors:            " << s.unclipColors            << '\n';
0180     dbg.nospace() << "-- whiteBalance:            " << s.whiteBalance            << '\n';
0181     dbg.nospace() << "-- customWhiteBalance:      " << s.customWhiteBalance      << '\n';
0182     dbg.nospace() << "-- customWhiteBalanceGreen: " << s.customWhiteBalanceGreen << '\n';
0183     dbg.nospace() << "-- halfSizeColorImage:      " << s.halfSizeColorImage      << '\n';
0184     dbg.nospace() << "-- enableBlackPoint:        " << s.enableBlackPoint        << '\n';
0185     dbg.nospace() << "-- blackPoint:              " << s.blackPoint              << '\n';
0186     dbg.nospace() << "-- enableWhitePoint:        " << s.enableWhitePoint        << '\n';
0187     dbg.nospace() << "-- whitePoint:              " << s.whitePoint              << '\n';
0188     dbg.nospace() << "-- NoiseReductionType:      " << s.NRType                  << '\n';
0189     dbg.nospace() << "-- NoiseReductionThreshold: " << s.NRThreshold             << '\n';
0190     dbg.nospace() << "-- enableCACorrection:      " << s.enableCACorrection      << '\n';
0191     dbg.nospace() << "-- caMultiplier:            " << s.caMultiplier[0]
0192                   << ", "                           << s.caMultiplier[1]         << '\n';
0193     dbg.nospace() << "-- medianFilterPasses:      " << s.medianFilterPasses      << '\n';
0194     dbg.nospace() << "-- inputProfile:            " << s.inputProfile            << '\n';
0195     dbg.nospace() << "-- outputProfile:           " << s.outputProfile           << '\n';
0196     dbg.nospace() << "-- deadPixelMap:            " << s.deadPixelMap            << '\n';
0197     dbg.nospace() << "-- whiteBalanceArea:        " << s.whiteBalanceArea        << '\n';
0198 
0199     //-- Extended demosaicing settings ----------------------------------------------------------
0200 
0201     dbg.nospace() << "-- dcbIterations:           " << s.dcbIterations           << '\n';
0202     dbg.nospace() << "-- dcbEnhanceFl:            " << s.dcbEnhanceFl            << '\n';
0203     dbg.nospace() << "-- eeciRefine:              " << s.eeciRefine              << '\n';
0204     dbg.nospace() << "-- esMedPasses:             " << s.esMedPasses             << '\n';
0205     dbg.nospace() << "-- NRChrominanceThreshold:  " << s.NRChroThreshold         << '\n';
0206     dbg.nospace() << "-- expoCorrection:          " << s.expoCorrection          << '\n';
0207     dbg.nospace() << "-- expoCorrectionShift:     " << s.expoCorrectionShift     << '\n';
0208     dbg.nospace() << "-- expoCorrectionHighlight: " << s.expoCorrectionHighlight << '\n';
0209     dbg.nospace() << "---------------------------------------------------------" << '\n';
0210 
0211     return dbg.space();
0212 }
0213 
0214 }  // namespace KDcrawIface