File indexing completed on 2025-01-05 03:57:11
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-12-09 0007 * Description : Raw decoding settings 0008 * 0009 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * SPDX-FileCopyrightText: 2007-2008 by Guillaume Castagnino <casta at xwing dot info> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #include "drawdecodersettings.h" 0018 0019 // Local includes 0020 0021 #include "digikam_globals.h" 0022 0023 namespace Digikam 0024 { 0025 0026 DRawDecoderSettings::DRawDecoderSettings() 0027 : fixColorsHighlights (false), 0028 autoBrightness (true), 0029 sixteenBitsImage (false), 0030 halfSizeColorImage (false), 0031 whiteBalance (CAMERA), 0032 customWhiteBalance (6500), 0033 customWhiteBalanceGreen (1.0), 0034 RGBInterpolate4Colors (false), 0035 DontStretchPixels (false), 0036 unclipColors (0), 0037 RAWQuality (BILINEAR), 0038 medianFilterPasses (0), 0039 NRType (NONR), 0040 NRThreshold (0), 0041 brightness (1.0), 0042 enableBlackPoint (false), 0043 blackPoint (0), 0044 enableWhitePoint (false), 0045 whitePoint (0), 0046 inputColorSpace (NOINPUTCS), 0047 inputProfile (QString()), 0048 outputColorSpace (SRGB), 0049 outputProfile (QString()), 0050 deadPixelMap (QString()), 0051 whiteBalanceArea (QRect()), 0052 0053 //-- Extended demosaicing settings ---------------------------------------------------------- 0054 0055 dcbIterations (-1), 0056 dcbEnhanceFl (false), 0057 expoCorrection (false), 0058 expoCorrectionShift (1.0), 0059 expoCorrectionHighlight (0.0) 0060 { 0061 } 0062 0063 DRawDecoderSettings::~DRawDecoderSettings() 0064 { 0065 } 0066 0067 DRawDecoderSettings::DRawDecoderSettings(const DRawDecoderSettings& o) 0068 : fixColorsHighlights (o.fixColorsHighlights), 0069 autoBrightness (o.autoBrightness), 0070 sixteenBitsImage (o.sixteenBitsImage), 0071 halfSizeColorImage (o.halfSizeColorImage), 0072 whiteBalance (o.whiteBalance), 0073 customWhiteBalance (o.customWhiteBalance), 0074 customWhiteBalanceGreen (o.customWhiteBalanceGreen), 0075 RGBInterpolate4Colors (o.RGBInterpolate4Colors), 0076 DontStretchPixels (o.DontStretchPixels), 0077 unclipColors (o.unclipColors), 0078 RAWQuality (o.RAWQuality), 0079 medianFilterPasses (o.medianFilterPasses), 0080 NRType (o.NRType), 0081 NRThreshold (o.NRThreshold), 0082 brightness (o.brightness), 0083 enableBlackPoint (o.enableBlackPoint), 0084 blackPoint (o.blackPoint), 0085 enableWhitePoint (o.enableWhitePoint), 0086 whitePoint (o.whitePoint), 0087 inputColorSpace (o.inputColorSpace), 0088 inputProfile (o.inputProfile), 0089 outputColorSpace (o.outputColorSpace), 0090 outputProfile (o.outputProfile), 0091 deadPixelMap (o.deadPixelMap), 0092 whiteBalanceArea (o.whiteBalanceArea), 0093 0094 //-- Extended demosaicing settings ---------------------------------------------------------- 0095 0096 dcbIterations (o.dcbIterations), 0097 dcbEnhanceFl (o.dcbEnhanceFl), 0098 expoCorrection (o.expoCorrection), 0099 expoCorrectionShift (o.expoCorrectionShift), 0100 expoCorrectionHighlight (o.expoCorrectionHighlight) 0101 { 0102 } 0103 0104 DRawDecoderSettings& DRawDecoderSettings::operator=(const DRawDecoderSettings& o) 0105 { 0106 fixColorsHighlights = o.fixColorsHighlights; 0107 autoBrightness = o.autoBrightness; 0108 sixteenBitsImage = o.sixteenBitsImage; 0109 brightness = o.brightness; 0110 RAWQuality = o.RAWQuality; 0111 inputColorSpace = o.inputColorSpace; 0112 outputColorSpace = o.outputColorSpace; 0113 RGBInterpolate4Colors = o.RGBInterpolate4Colors; 0114 DontStretchPixels = o.DontStretchPixels; 0115 unclipColors = o.unclipColors; 0116 whiteBalance = o.whiteBalance; 0117 customWhiteBalance = o.customWhiteBalance; 0118 customWhiteBalanceGreen = o.customWhiteBalanceGreen; 0119 halfSizeColorImage = o.halfSizeColorImage; 0120 enableBlackPoint = o.enableBlackPoint; 0121 blackPoint = o.blackPoint; 0122 enableWhitePoint = o.enableWhitePoint; 0123 whitePoint = o.whitePoint; 0124 NRType = o.NRType; 0125 NRThreshold = o.NRThreshold; 0126 medianFilterPasses = o.medianFilterPasses; 0127 inputProfile = o.inputProfile; 0128 outputProfile = o.outputProfile; 0129 deadPixelMap = o.deadPixelMap; 0130 whiteBalanceArea = o.whiteBalanceArea; 0131 0132 //-- Extended demosaicing settings ---------------------------------------------------------- 0133 0134 dcbIterations = o.dcbIterations; 0135 dcbEnhanceFl = o.dcbEnhanceFl; 0136 expoCorrection = o.expoCorrection; 0137 expoCorrectionShift = o.expoCorrectionShift; 0138 expoCorrectionHighlight = o.expoCorrectionHighlight; 0139 0140 return *this; 0141 } 0142 0143 bool DRawDecoderSettings::operator==(const DRawDecoderSettings& o) const 0144 { 0145 return ( 0146 (fixColorsHighlights == o.fixColorsHighlights) && 0147 (autoBrightness == o.autoBrightness) && 0148 (sixteenBitsImage == o.sixteenBitsImage) && 0149 (brightness == o.brightness) && 0150 (RAWQuality == o.RAWQuality) && 0151 (inputColorSpace == o.inputColorSpace) && 0152 (outputColorSpace == o.outputColorSpace) && 0153 (RGBInterpolate4Colors == o.RGBInterpolate4Colors) && 0154 (DontStretchPixels == o.DontStretchPixels) && 0155 (unclipColors == o.unclipColors) && 0156 (whiteBalance == o.whiteBalance) && 0157 (customWhiteBalance == o.customWhiteBalance) && 0158 (customWhiteBalanceGreen == o.customWhiteBalanceGreen) && 0159 (halfSizeColorImage == o.halfSizeColorImage) && 0160 (enableBlackPoint == o.enableBlackPoint) && 0161 (blackPoint == o.blackPoint) && 0162 (enableWhitePoint == o.enableWhitePoint) && 0163 (whitePoint == o.whitePoint) && 0164 (NRType == o.NRType) && 0165 (NRThreshold == o.NRThreshold) && 0166 (medianFilterPasses == o.medianFilterPasses) && 0167 (inputProfile == o.inputProfile) && 0168 (outputProfile == o.outputProfile) && 0169 (deadPixelMap == o.deadPixelMap) && 0170 (whiteBalanceArea == o.whiteBalanceArea) && 0171 0172 //-- Extended demosaicing settings ---------------------------------------------------------- 0173 0174 (dcbIterations == o.dcbIterations) && 0175 (dcbEnhanceFl == o.dcbEnhanceFl) && 0176 (expoCorrection == o.expoCorrection) && 0177 (expoCorrectionShift == o.expoCorrectionShift) && 0178 (expoCorrectionHighlight == o.expoCorrectionHighlight) 0179 ); 0180 } 0181 0182 void DRawDecoderSettings::optimizeTimeLoading() 0183 { 0184 fixColorsHighlights = false; 0185 autoBrightness = true; 0186 sixteenBitsImage = true; 0187 brightness = 1.0; 0188 RAWQuality = BILINEAR; 0189 inputColorSpace = NOINPUTCS; 0190 outputColorSpace = SRGB; 0191 RGBInterpolate4Colors = false; 0192 DontStretchPixels = false; 0193 unclipColors = 0; 0194 whiteBalance = CAMERA; 0195 customWhiteBalance = 6500; 0196 customWhiteBalanceGreen = 1.0; 0197 halfSizeColorImage = true; 0198 medianFilterPasses = 0; 0199 0200 enableBlackPoint = false; 0201 blackPoint = 0; 0202 0203 enableWhitePoint = false; 0204 whitePoint = 0; 0205 0206 NRType = NONR; 0207 NRThreshold = 0; 0208 0209 inputProfile = QString(); 0210 outputProfile = QString(); 0211 0212 deadPixelMap = QString(); 0213 0214 whiteBalanceArea = QRect(); 0215 0216 //-- Extended demosaicing settings ---------------------------------------------------------- 0217 0218 dcbIterations = -1; 0219 dcbEnhanceFl = false; 0220 expoCorrection = false; 0221 expoCorrectionShift = 1.0; 0222 expoCorrectionHighlight = 0.0; 0223 } 0224 0225 QDebug operator<<(QDebug dbg, const DRawDecoderSettings& s) 0226 { 0227 dbg.nospace() << QT_ENDL; 0228 dbg.nospace() << "-- RAW DECODING SETTINGS --------------------------------" << QT_ENDL; 0229 dbg.nospace() << "-- autoBrightness: " << s.autoBrightness << QT_ENDL; 0230 dbg.nospace() << "-- sixteenBitsImage: " << s.sixteenBitsImage << QT_ENDL; 0231 dbg.nospace() << "-- brightness: " << s.brightness << QT_ENDL; 0232 dbg.nospace() << "-- RAWQuality: " << s.RAWQuality << QT_ENDL; 0233 dbg.nospace() << "-- inputColorSpace: " << s.inputColorSpace << QT_ENDL; 0234 dbg.nospace() << "-- outputColorSpace: " << s.outputColorSpace << QT_ENDL; 0235 dbg.nospace() << "-- RGBInterpolate4Colors: " << s.RGBInterpolate4Colors << QT_ENDL; 0236 dbg.nospace() << "-- DontStretchPixels: " << s.DontStretchPixels << QT_ENDL; 0237 dbg.nospace() << "-- unclipColors: " << s.unclipColors << QT_ENDL; 0238 dbg.nospace() << "-- whiteBalance: " << s.whiteBalance << QT_ENDL; 0239 dbg.nospace() << "-- customWhiteBalance: " << s.customWhiteBalance << QT_ENDL; 0240 dbg.nospace() << "-- customWhiteBalanceGreen: " << s.customWhiteBalanceGreen << QT_ENDL; 0241 dbg.nospace() << "-- halfSizeColorImage: " << s.halfSizeColorImage << QT_ENDL; 0242 dbg.nospace() << "-- enableBlackPoint: " << s.enableBlackPoint << QT_ENDL; 0243 dbg.nospace() << "-- blackPoint: " << s.blackPoint << QT_ENDL; 0244 dbg.nospace() << "-- enableWhitePoint: " << s.enableWhitePoint << QT_ENDL; 0245 dbg.nospace() << "-- whitePoint: " << s.whitePoint << QT_ENDL; 0246 dbg.nospace() << "-- NoiseReductionType: " << s.NRType << QT_ENDL; 0247 dbg.nospace() << "-- NoiseReductionThreshold: " << s.NRThreshold << QT_ENDL; 0248 dbg.nospace() << "-- medianFilterPasses: " << s.medianFilterPasses << QT_ENDL; 0249 dbg.nospace() << "-- inputProfile: " << s.inputProfile << QT_ENDL; 0250 dbg.nospace() << "-- outputProfile: " << s.outputProfile << QT_ENDL; 0251 dbg.nospace() << "-- deadPixelMap: " << s.deadPixelMap << QT_ENDL; 0252 dbg.nospace() << "-- whiteBalanceArea: " << s.whiteBalanceArea << QT_ENDL; 0253 0254 //-- Extended demosaicing settings ---------------------------------------------------------- 0255 0256 dbg.nospace() << "-- dcbIterations: " << s.dcbIterations << QT_ENDL; 0257 dbg.nospace() << "-- dcbEnhanceFl: " << s.dcbEnhanceFl << QT_ENDL; 0258 dbg.nospace() << "-- expoCorrection: " << s.expoCorrection << QT_ENDL; 0259 dbg.nospace() << "-- expoCorrectionShift: " << s.expoCorrectionShift << QT_ENDL; 0260 dbg.nospace() << "-- expoCorrectionHighlight: " << s.expoCorrectionHighlight << QT_ENDL; 0261 dbg.nospace() << "---------------------------------------------------------" << QT_ENDL; 0262 0263 return dbg.space(); 0264 } 0265 0266 } // namespace Digikam