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

0001 /*
0002     SPDX-FileCopyrightText: 2007-2015 Gilles Caulier <caulier dot gilles at gmail dot com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 // Local includes
0008 
0009 #include "dcrawinfocontainer.h"
0010 
0011 namespace KDcrawIface
0012 {
0013 
0014 DcrawInfoContainer::DcrawInfoContainer()
0015 {
0016     sensitivity       = -1.0;
0017     exposureTime      = -1.0;
0018     aperture          = -1.0;
0019     focalLength       = -1.0;
0020     pixelAspectRatio  = 1.0;    // Default value. This can be unavailable (depending of camera model).
0021     rawColors         = -1;
0022     rawImages         = -1;
0023     hasIccProfile     = false;
0024     isDecodable       = false;
0025     daylightMult[0]   = 0.0;
0026     daylightMult[1]   = 0.0;
0027     daylightMult[2]   = 0.0;
0028     cameraMult[0]     = 0.0;
0029     cameraMult[1]     = 0.0;
0030     cameraMult[2]     = 0.0;
0031     cameraMult[3]     = 0.0;
0032     blackPoint        = 0;
0033 
0034     for (int ch=0; ch<4; ch++)
0035     {
0036         blackPointCh[ch] = 0;
0037     }
0038 
0039     whitePoint        = 0;
0040     topMargin         = 0;
0041     leftMargin        = 0;
0042     orientation       = ORIENTATION_NONE;
0043 
0044     for (int x=0 ; x<3 ; x++)
0045     {
0046         for (int y=0 ; y<4 ; y++)
0047         {
0048             cameraColorMatrix1[x][y] = 0.0;
0049             cameraColorMatrix2[x][y] = 0.0;
0050             cameraXYZMatrix[y][x]    = 0.0;       // NOTE: see B.K.O # 253911 : [y][x] not [x][y]
0051         }
0052     }
0053 }
0054 
0055 DcrawInfoContainer::~DcrawInfoContainer()
0056 {
0057 }
0058 
0059 bool DcrawInfoContainer::isEmpty()
0060 {
0061     if (make.isEmpty()                  &&
0062         model.isEmpty()                 &&
0063         filterPattern.isEmpty()         &&
0064         colorKeys.isEmpty()             &&
0065         DNGVersion.isEmpty()            &&
0066         exposureTime     == -1.0        &&
0067         aperture         == -1.0        &&
0068         focalLength      == -1.0        &&
0069         pixelAspectRatio == 1.0         &&
0070         sensitivity      == -1.0        &&
0071         rawColors        == -1          &&
0072         rawImages        == -1          &&
0073         blackPoint       == 0           &&
0074         blackPointCh[0]  == 0           &&
0075         blackPointCh[1]  == 0           &&
0076         blackPointCh[2]  == 0           &&
0077         blackPointCh[3]  == 0           &&
0078         whitePoint       == 0           &&
0079         topMargin        == 0           &&
0080         leftMargin       == 0           &&
0081         !dateTime.isValid()             &&
0082         !imageSize.isValid()            &&
0083         !fullSize.isValid()             &&
0084         !outputSize.isValid()           &&
0085         !thumbSize.isValid()            &&
0086         cameraColorMatrix1[0][0] == 0.0 &&
0087         cameraColorMatrix1[0][1] == 0.0 &&
0088         cameraColorMatrix1[0][2] == 0.0 &&
0089         cameraColorMatrix1[0][3] == 0.0 &&
0090         cameraColorMatrix1[1][0] == 0.0 &&
0091         cameraColorMatrix1[1][1] == 0.0 &&
0092         cameraColorMatrix1[1][2] == 0.0 &&
0093         cameraColorMatrix1[1][3] == 0.0 &&
0094         cameraColorMatrix1[2][0] == 0.0 &&
0095         cameraColorMatrix1[2][1] == 0.0 &&
0096         cameraColorMatrix1[2][2] == 0.0 &&
0097         cameraColorMatrix1[2][3] == 0.0 &&
0098         cameraColorMatrix2[0][0] == 0.0 &&
0099         cameraColorMatrix2[0][1] == 0.0 &&
0100         cameraColorMatrix2[0][2] == 0.0 &&
0101         cameraColorMatrix2[0][3] == 0.0 &&
0102         cameraColorMatrix2[1][0] == 0.0 &&
0103         cameraColorMatrix2[1][1] == 0.0 &&
0104         cameraColorMatrix2[1][2] == 0.0 &&
0105         cameraColorMatrix2[1][3] == 0.0 &&
0106         cameraColorMatrix2[2][0] == 0.0 &&
0107         cameraColorMatrix2[2][1] == 0.0 &&
0108         cameraColorMatrix2[2][2] == 0.0 &&
0109         cameraColorMatrix2[2][3] == 0.0 &&
0110         cameraXYZMatrix[0][0]    == 0.0 &&
0111         cameraXYZMatrix[0][1]    == 0.0 &&
0112         cameraXYZMatrix[0][2]    == 0.0 &&
0113         cameraXYZMatrix[1][0]    == 0.0 &&
0114         cameraXYZMatrix[1][1]    == 0.0 &&
0115         cameraXYZMatrix[1][2]    == 0.0 &&
0116         cameraXYZMatrix[2][0]    == 0.0 &&
0117         cameraXYZMatrix[2][1]    == 0.0 &&
0118         cameraXYZMatrix[2][2]    == 0.0 &&
0119         cameraXYZMatrix[3][0]    == 0.0 &&
0120         cameraXYZMatrix[3][1]    == 0.0 &&
0121         cameraXYZMatrix[3][2]    == 0.0 &&
0122         orientation              == ORIENTATION_NONE
0123        )
0124     {
0125         return true;
0126     }
0127     else
0128     {
0129         return false;
0130     }
0131 }
0132 
0133 QDebug operator<<(QDebug dbg, const DcrawInfoContainer& c)
0134 {
0135     dbg.nospace() << "DcrawInfoContainer::sensitivity: "      << c.sensitivity      << ", ";
0136     dbg.nospace() << "DcrawInfoContainer::exposureTime: "     << c.exposureTime     << ", ";
0137     dbg.nospace() << "DcrawInfoContainer::aperture: "         << c.aperture         << ", ";
0138     dbg.nospace() << "DcrawInfoContainer::focalLength: "      << c.focalLength      << ", ";
0139     dbg.nospace() << "DcrawInfoContainer::pixelAspectRatio: " << c.pixelAspectRatio << ", ";
0140     dbg.nospace() << "DcrawInfoContainer::rawColors: "        << c.rawColors        << ", ";
0141     dbg.nospace() << "DcrawInfoContainer::rawImages: "        << c.rawImages        << ", ";
0142     dbg.nospace() << "DcrawInfoContainer::hasIccProfile: "    << c.hasIccProfile    << ", ";
0143     dbg.nospace() << "DcrawInfoContainer::isDecodable: "      << c.isDecodable      << ", ";
0144     dbg.nospace() << "DcrawInfoContainer::daylightMult: "     << c.daylightMult     << ", ";
0145     dbg.nospace() << "DcrawInfoContainer::cameraMult: "       << c.cameraMult       << ", ";
0146     dbg.nospace() << "DcrawInfoContainer::blackPoint: "       << c.blackPoint       << ", ";
0147     dbg.nospace() << "DcrawInfoContainer::whitePoint: "       << c.whitePoint       << ", ";
0148     dbg.nospace() << "DcrawInfoContainer::topMargin: "        << c.topMargin        << ", ";
0149     dbg.nospace() << "DcrawInfoContainer::leftMargin: "       << c.leftMargin       << ", ";
0150     dbg.nospace() << "DcrawInfoContainer::orientation: "      << c.orientation;
0151     return dbg.space();
0152 }
0153 
0154 } // namespace KDcrawIface