1 // ____ ______ __ 2 // / __ \ / ____// / 3 // / /_/ // / / / 4 // / ____// /___ / /___ PixInsight Class Library 5 // /_/ \____//_____/ PCL 2.1.19 6 // ---------------------------------------------------------------------------- 7 // Standard RAW_compat File Format Module Version 1.5.3 8 // ---------------------------------------------------------------------------- 9 // RawPreferences.h - Released 2020-01-14T11:57:23Z 10 // ---------------------------------------------------------------------------- 11 // This file is part of the standard RAW_compat PixInsight module. 12 // 13 // Copyright (c) 2003-2020 Pleiades Astrophoto S.L. All Rights Reserved. 14 // 15 // Redistribution and use in both source and binary forms, with or without 16 // modification, is permitted provided that the following conditions are met: 17 // 18 // 1. All redistributions of source code must retain the above copyright 19 // notice, this list of conditions and the following disclaimer. 20 // 21 // 2. All redistributions in binary form must reproduce the above copyright 22 // notice, this list of conditions and the following disclaimer in the 23 // documentation and/or other materials provided with the distribution. 24 // 25 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names 26 // of their contributors, may be used to endorse or promote products derived 27 // from this software without specific prior written permission. For written 28 // permission, please contact info@pixinsight.com. 29 // 30 // 4. All products derived from this software, in any form whatsoever, must 31 // reproduce the following acknowledgment in the end-user documentation 32 // and/or other materials provided with the product: 33 // 34 // "This product is based on software from the PixInsight project, developed 35 // by Pleiades Astrophoto and its contributors (http://pixinsight.com/)." 36 // 37 // Alternatively, if that is where third-party acknowledgments normally 38 // appear, this acknowledgment must be reproduced in the product itself. 39 // 40 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS 41 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 42 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS 44 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 45 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS 46 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE, 47 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 48 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 50 // POSSIBILITY OF SUCH DAMAGE. 51 // ---------------------------------------------------------------------------- 52 53 #ifndef __RawPreferences_h 54 #define __RawPreferences_h 55 56 #include <pcl/Settings.h> 57 58 namespace pcl 59 { 60 61 // ---------------------------------------------------------------------------- 62 63 class RawPreferences 64 { 65 public: 66 67 enum Interpolation { Bilinear, VNG, PPG, AHD, HalfSize, DCB, DHT, AAHD, Default = VNG }; 68 69 Interpolation interpolation = Default; 70 bool interpolateAs4Colors = false; 71 bool useAutoWhiteBalance = false; 72 bool useCameraWhiteBalance = true; 73 bool noWhiteBalance = false; 74 bool createSuperPixels = false; 75 bool outputRawRGB = false; 76 bool outputCFA = false; 77 bool noAutoFlip = false; 78 bool noAutoCrop = false; 79 bool noBlackPointCorrection = false; 80 bool noClipHighlights = false; 81 int noiseThreshold = 0; 82 int dcbIterations = 3; 83 bool dcbRefinement = false; 84 int fbddNoiseReduction = 0; 85 InterpolationAsString() const86 String InterpolationAsString() const 87 { 88 switch ( interpolation ) 89 { 90 case Bilinear: return "Bilinear"; 91 case VNG: return "VNG"; 92 case PPG: return "PPG"; 93 case AHD: return "AHD"; 94 case HalfSize: return "HalfSize"; 95 case DCB: return "DCB"; 96 case DHT: return "DHT"; 97 case AAHD: return "AAHD"; 98 default: // ?! 99 return "<unknown>"; 100 } 101 } 102 WhiteBalancingAsString() const103 String WhiteBalancingAsString() const 104 { 105 if ( noWhiteBalance ) 106 return "disabled"; 107 String text; 108 if ( useCameraWhiteBalance ) 109 text << "camera"; 110 if ( useAutoWhiteBalance ) 111 { 112 if ( !text.IsEmpty() ) 113 text << ','; 114 text << "auto"; 115 } 116 return text; 117 } 118 OutputModeAsString() const119 String OutputModeAsString() const 120 { 121 if ( createSuperPixels ) 122 return "super-pixel"; 123 if ( outputRawRGB ) 124 return "raw-RGB"; 125 if ( outputCFA ) 126 return "cfa"; 127 return "demosaic"; 128 } 129 130 public : 131 132 RawPreferences() = default; 133 134 RawPreferences( const RawPreferences& ) = default; 135 ~RawPreferences()136 virtual ~RawPreferences() 137 { 138 } 139 140 RawPreferences& operator =( const RawPreferences& ) = default; 141 142 #define READ_OR_WRITE( what ) \ 143 Settings::what##I( "RawPreferences_interpolation", interpolation ); \ 144 Settings::what ( "RawPreferences_interpolateAs4Colors", interpolateAs4Colors ); \ 145 Settings::what ( "RawPreferences_useAutoWhiteBalance", useAutoWhiteBalance ); \ 146 Settings::what ( "RawPreferences_useCameraWhiteBalance", useCameraWhiteBalance ); \ 147 Settings::what ( "RawPreferences_noWhiteBalance", noWhiteBalance ); \ 148 Settings::what ( "RawPreferences_createSuperPixels", createSuperPixels ); \ 149 Settings::what ( "RawPreferences_outputRawRGB", outputRawRGB ); \ 150 Settings::what ( "RawPreferences_outputCFA", outputCFA ); \ 151 Settings::what ( "RawPreferences_noAutoFlip", noAutoFlip ); \ 152 Settings::what ( "RawPreferences_noAutoCrop", noAutoCrop ); \ 153 Settings::what ( "RawPreferences_noBlackPointCorrection", noBlackPointCorrection ); \ 154 Settings::what ( "RawPreferences_noClipHighlights", noClipHighlights ); \ 155 Settings::what ( "RawPreferences_noiseThreshold", noiseThreshold ); \ 156 Settings::what ( "RawPreferences_dcbIterations", dcbIterations ); \ 157 Settings::what ( "RawPreferences_dcbRefinement", dcbRefinement ); \ 158 Settings::what ( "RawPreferences_fbddNoiseReduction", fbddNoiseReduction ); 159 SaveToSettings()160 void SaveToSettings() 161 { 162 READ_OR_WRITE( Write ) 163 } 164 LoadFromSettings()165 void LoadFromSettings() 166 { 167 READ_OR_WRITE( Read ) 168 } 169 }; 170 171 // ---------------------------------------------------------------------------- 172 173 } // pcl 174 175 #endif // __RawPreferences_h 176 177 // ---------------------------------------------------------------------------- 178 // EOF RawPreferences.h - Released 2020-01-14T11:57:23Z 179