File indexing completed on 2025-01-19 03:57:40

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2011-01-07
0007  * Description : a command line tool to compare info from 2 DNG files
0008  *
0009  * SPDX-FileCopyrightText: 2011      by Jens Mueller <tschenser at gmx dot de>
0010  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 // C++ includes
0017 
0018 #include <cmath>
0019 #include <limits>
0020 
0021 // Qt includes
0022 
0023 #include <QString>
0024 #include <QCoreApplication>
0025 
0026 // DNG SDK includes
0027 
0028 #include "dng_file_stream.h"
0029 #include "dng_host.h"
0030 #include "dng_info.h"
0031 #include "dng_xmp_sdk.h"
0032 #include "dng_sdk_limits.h"
0033 
0034 // Local includes
0035 
0036 #include "digikam_debug.h"
0037 
0038 bool AreSame(real64 a, real64 b)
0039 {
0040     return (std::fabs(a - b) < std::numeric_limits<real32>::epsilon());
0041 }
0042 
0043 void compareExif(dng_exif* const exif1, dng_exif* const exif2)
0044 {
0045     if (!AreSame(exif1->fApertureValue.As_real64(), exif2->fApertureValue.As_real64()))
0046         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ApertureValue: %1 %2").arg(exif1->fApertureValue.As_real64()).arg(exif2->fApertureValue.As_real64());
0047 
0048     if (exif1->fArtist != exif2->fArtist)
0049         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Artist: %1 %2").arg(QLatin1String(exif1->fArtist.Get())).arg(QLatin1String(exif2->fArtist.Get()));
0050 
0051     if (exif1->fBatteryLevelA != exif2->fBatteryLevelA)
0052         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BatteryLevelA: %1 %2").arg(QLatin1String(exif1->fBatteryLevelA.Get())).arg(QLatin1String(exif2->fBatteryLevelA.Get()));
0053 
0054     if (!AreSame(exif1->fBatteryLevelR.As_real64(), exif2->fBatteryLevelR.As_real64()))
0055         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BatteryLevelR: %1 %2").arg(exif1->fBatteryLevelR.As_real64()).arg(exif2->fBatteryLevelR.As_real64());
0056 
0057     if (!AreSame(exif1->fBrightnessValue.As_real64(), exif2->fBrightnessValue.As_real64()))
0058         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BrightnessValue: %1 %2").arg(exif1->fBrightnessValue.As_real64()).arg(exif2->fBrightnessValue.As_real64());
0059 
0060     if (exif1->fCameraSerialNumber != exif2->fCameraSerialNumber)
0061         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CameraSerialNumber: %1 %2").arg(QLatin1String(exif1->fCameraSerialNumber.Get())).arg(QLatin1String(exif2->fCameraSerialNumber.Get()));
0062 
0063     if (0 != memcmp(exif1->fCFAPattern, exif2->fCFAPattern, kMaxCFAPattern * kMaxCFAPattern * sizeof(uint8)))
0064         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFAPattern");
0065 
0066     if (exif1->fCFARepeatPatternCols != exif2->fCFARepeatPatternCols)
0067         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFARepeatPatternCols: %1 %2").arg(exif1->fCFARepeatPatternCols).arg(exif2->fCFARepeatPatternCols);
0068 
0069     if (exif1->fCFARepeatPatternRows != exif2->fCFARepeatPatternRows)
0070         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFARepeatPatternRows: %1 %2").arg(exif1->fCFARepeatPatternRows).arg(exif2->fCFARepeatPatternRows);
0071 
0072     if (exif1->fColorSpace != exif2->fColorSpace)
0073         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ColorSpace: %1 %2").arg(exif1->fColorSpace).arg(exif2->fColorSpace);
0074 
0075     if (exif1->fComponentsConfiguration != exif2->fComponentsConfiguration)
0076         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ComponentsConfiguration: %1 %2").arg(exif1->fComponentsConfiguration).arg(exif2->fComponentsConfiguration);
0077 
0078     if (!AreSame(exif1->fCompresssedBitsPerPixel.As_real64(), exif2->fCompresssedBitsPerPixel.As_real64()))
0079         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CompresssedBitsPerPixel: %1 %2").arg(exif1->fCompresssedBitsPerPixel.As_real64()).arg(exif2->fCompresssedBitsPerPixel.As_real64());
0080 
0081     if (exif1->fContrast != exif2->fContrast)
0082         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Contrast: %1 %2").arg(exif1->fContrast).arg(exif2->fContrast);
0083 
0084     if (exif1->fCopyright != exif2->fCopyright)
0085         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Copyright: %1 %2").arg(QLatin1String(exif1->fCopyright.Get())).arg(QLatin1String(exif2->fCopyright.Get()));
0086 
0087     if (exif1->fCopyright2 != exif2->fCopyright2)
0088         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Copyright2: %1 %2").arg(QLatin1String(exif1->fCopyright2.Get())).arg(QLatin1String(exif2->fCopyright2.Get()));
0089 
0090     if (exif1->fCustomRendered != exif2->fCustomRendered)
0091         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CustomRendered: %1 %2").arg(exif1->fCustomRendered).arg(exif2->fCustomRendered);
0092 
0093     if (exif1->fDateTime.DateTime() != exif2->fDateTime.DateTime())
0094         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DateTime: %1 %2").arg(QLatin1String(exif1->fDateTime.Encode_ISO_8601().Get())).arg(QLatin1String(exif2->fDateTime.Encode_ISO_8601().Get()));
0095 
0096     if (exif1->fDateTimeDigitized.DateTime() != exif2->fDateTimeDigitized.DateTime())
0097         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DateTimeDigitized: %1 %2").arg(QLatin1String(exif1->fDateTimeDigitized.Encode_ISO_8601().Get())).arg( QLatin1String(exif2->fDateTimeDigitized.Encode_ISO_8601().Get()));
0098 
0099     //if ((exif1->fDateTimeDigitizedStorageInfo.IsValid() != exif2->fDateTimeDigitizedStorageInfo.IsValid()) ||
0100     //    ((exif1->fDateTimeDigitizedStorageInfo.IsValid()) &&
0101     //     (exif1->fDateTimeDigitizedStorageInfo.Format() != exif2->fDateTimeDigitizedStorageInfo.Format()) ||
0102     //     (exif1->fDateTimeDigitizedStorageInfo.Offset() != exif2->fDateTimeDigitizedStorageInfo.Offset())))
0103     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DateTimeDigitizedStorageInfo");
0104 
0105     if (exif1->fDateTimeOriginal.DateTime() != exif2->fDateTimeOriginal.DateTime())
0106         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DateTimeOriginal: %1 %2").arg(QLatin1String(exif1->fDateTimeOriginal.Encode_ISO_8601().Get())).arg(QLatin1String(exif2->fDateTimeOriginal.Encode_ISO_8601().Get()));
0107 
0108     //if ((exif1->fDateTimeOriginalStorageInfo.IsValid() != exif2->fDateTimeOriginalStorageInfo.IsValid()) ||
0109     //    ((exif1->fDateTimeOriginalStorageInfo.IsValid()) &&
0110     //     (exif1->fDateTimeOriginalStorageInfo.Format() != exif2->fDateTimeOriginalStorageInfo.Format()) ||
0111     //     (exif1->fDateTimeOriginalStorageInfo.Offset() != exif2->fDateTimeOriginalStorageInfo.Offset())))
0112     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DateTimeOriginalStorageInfo");
0113 
0114     //if ((exif1->fDateTimeStorageInfo.IsValid() != exif2->fDateTimeStorageInfo.IsValid()) ||
0115     //    ((exif1->fDateTimeStorageInfo.IsValid()) &&
0116     //     (exif1->fDateTimeStorageInfo.Format() != exif2->fDateTimeStorageInfo.Format()) ||
0117     //     (exif1->fDateTimeStorageInfo.Offset() != exif2->fDateTimeStorageInfo.Offset())))
0118     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DateTimeStorageInfo");
0119 
0120     if (!AreSame(exif1->fDigitalZoomRatio.As_real64(), exif2->fDigitalZoomRatio.As_real64()))
0121         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DigitalZoomRatio: %1 %2").arg(exif1->fDigitalZoomRatio.As_real64()).arg(exif2->fDigitalZoomRatio.As_real64());
0122 
0123     if (exif1->fExifVersion != exif2->fExifVersion)
0124         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExifVersion: %1 %2").arg(exif1->fExifVersion).arg(exif2->fExifVersion);
0125 
0126     if (!AreSame(exif1->fExposureBiasValue.As_real64(), exif2->fExposureBiasValue.As_real64()))
0127         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExposureBiasValue: %1 %2").arg(exif1->fExposureBiasValue.As_real64()).arg(exif2->fExposureBiasValue.As_real64());
0128 
0129     if (!AreSame(exif1->fExposureIndex.As_real64(), exif2->fExposureIndex.As_real64()))
0130         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExposureIndex: %1 %2").arg(exif1->fExposureIndex.As_real64()).arg(exif2->fExposureIndex.As_real64());
0131 
0132     if (exif1->fExposureMode != exif2->fExposureMode)
0133         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExposureMode: %1 %2").arg(exif1->fExposureMode).arg(exif2->fExposureMode);
0134 
0135     if (exif1->fExposureProgram != exif2->fExposureProgram)
0136         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExposureProgram: %1 %2").arg(exif1->fExposureProgram).arg(exif2->fExposureProgram);
0137 
0138     if (!AreSame(exif1->fExposureTime.As_real64(), exif2->fExposureTime.As_real64()))
0139         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExposureTime: %1 %2").arg(exif1->fExposureTime.As_real64()).arg(exif2->fExposureTime.As_real64());
0140 
0141     if (exif1->fFileSource != exif2->fFileSource)
0142         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FileSource: %1 %2").arg(exif1->fFileSource).arg(exif2->fFileSource);
0143 
0144     if (exif1->fFirmware != exif2->fFirmware)
0145         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Firmware: %1 %2").arg(QLatin1String(exif1->fFirmware.Get())).arg(QLatin1String(exif2->fFirmware.Get()));
0146 
0147     if (exif1->fFlash != exif2->fFlash)
0148         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Flash: %1 %2").arg(exif1->fFlash).arg(exif2->fFlash);
0149 
0150     if (!AreSame(exif1->fFlashCompensation.As_real64(), exif2->fFlashCompensation.As_real64()))
0151         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FlashCompensation: %1 %2").arg(exif1->fFlashCompensation.As_real64()).arg(exif2->fFlashCompensation.As_real64());
0152 
0153     if (exif1->fFlashMask != exif2->fFlashMask)
0154         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FlashMask: %1 %2").arg(exif1->fFlashMask).arg(exif2->fFlashMask);
0155 
0156     if (exif1->fFlashPixVersion != exif2->fFlashPixVersion)
0157         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FlashPixVersion: %1 %2").arg(exif1->fFlashPixVersion).arg(exif2->fFlashPixVersion);
0158 
0159     if (!AreSame(exif1->fFNumber.As_real64(), exif2->fFNumber.As_real64()))
0160         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FNumber: %1 %2").arg(exif1->fFNumber.As_real64()).arg(exif2->fFNumber.As_real64());
0161 
0162     if (!AreSame(exif1->fFocalLength.As_real64(), exif2->fFocalLength.As_real64()))
0163         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FocalLength: %1 %2").arg(exif1->fFocalLength.As_real64()).arg(exif2->fFocalLength.As_real64());
0164 
0165     if (exif1->fFocalLengthIn35mmFilm != exif2->fFocalLengthIn35mmFilm)
0166         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FocalLengthIn35mmFilm: %1 %2").arg(exif1->fFocalLengthIn35mmFilm).arg(exif2->fFocalLengthIn35mmFilm);
0167 
0168     if (exif1->fFocalPlaneResolutionUnit != exif2->fFocalPlaneResolutionUnit)
0169         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FocalPlaneResolutionUnit: %1 %2").arg(exif1->fFocalPlaneResolutionUnit).arg(exif2->fFocalPlaneResolutionUnit);
0170 
0171     if (!AreSame(exif1->fFocalPlaneXResolution.As_real64(), exif2->fFocalPlaneXResolution.As_real64()))
0172         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FocalPlaneXResolution: %1 %2").arg(exif1->fFocalPlaneXResolution.As_real64()).arg(exif2->fFocalPlaneXResolution.As_real64());
0173 
0174     if (!AreSame(exif1->fFocalPlaneYResolution.As_real64(), exif2->fFocalPlaneYResolution.As_real64()))
0175         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FocalPlaneYResolution: %1 %2").arg(exif1->fFocalPlaneYResolution.As_real64()).arg(exif2->fFocalPlaneYResolution.As_real64());
0176 
0177     if (exif1->fGainControl != exif2->fGainControl)
0178         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GainControl: %1 %2").arg(exif1->fGainControl).arg(exif2->fGainControl);
0179 
0180     if (!AreSame(exif1->fGamma.As_real64(), exif2->fGamma.As_real64()))
0181         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Gamma: %1 %2").arg(exif1->fGamma.As_real64()).arg(exif2->fGamma.As_real64());
0182 
0183     if (!AreSame(exif1->fGPSAltitude.As_real64(), exif2->fGPSAltitude.As_real64()))
0184         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSAltitude: %1 %2").arg(exif1->fGPSAltitude.As_real64()).arg(exif2->fGPSAltitude.As_real64());
0185 
0186     if (exif1->fGPSAltitudeRef != exif2->fGPSAltitudeRef)
0187         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSAltitudeRef: %1 %2").arg(exif1->fGPSAltitudeRef).arg(exif2->fGPSAltitudeRef);
0188 
0189     if (exif1->fGPSAreaInformation != exif2->fGPSAreaInformation)
0190         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSAreaInformation: %1 %2").arg(QLatin1String(exif1->fGPSAreaInformation.Get())).arg(QLatin1String(exif2->fGPSAreaInformation.Get()));
0191 
0192     if (exif1->fGPSDateStamp != exif2->fGPSDateStamp)
0193         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDateStamp: %1 %2").arg(QLatin1String(exif1->fGPSDateStamp.Get())).arg(QLatin1String(exif2->fGPSDateStamp.Get()));
0194 
0195     if (!AreSame(exif1->fGPSDestBearing.As_real64(), exif2->fGPSDestBearing.As_real64()))
0196         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestBearing: %1 %2").arg(exif1->fGPSDestBearing.As_real64()).arg(exif2->fGPSDestBearing.As_real64());
0197 
0198     if (exif1->fGPSDestBearingRef != exif2->fGPSDestBearingRef)
0199         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestBearingRef: %1 %2").arg(QLatin1String(exif1->fGPSDestBearingRef.Get())).arg(QLatin1String(exif2->fGPSDestBearingRef.Get()));
0200 
0201     if (!AreSame(exif1->fGPSDestDistance.As_real64(), exif2->fGPSDestDistance.As_real64()))
0202         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestDistance: %1 %2").arg(exif1->fGPSDestDistance.As_real64()).arg(exif2->fGPSDestDistance.As_real64());
0203 
0204     if (exif1->fGPSDestDistanceRef != exif2->fGPSDestDistanceRef)
0205         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestDistanceRef: %1 %2").arg(QLatin1String(exif1->fGPSDestDistanceRef.Get())).arg(QLatin1String(exif2->fGPSDestDistanceRef.Get()));
0206 
0207     if ((!AreSame(exif1->fGPSDestLatitude[0].As_real64(), exif2->fGPSDestLatitude[0].As_real64())) ||
0208         (!AreSame(exif1->fGPSDestLatitude[1].As_real64(), exif2->fGPSDestLatitude[1].As_real64())) ||
0209         (!AreSame(exif1->fGPSDestLatitude[2].As_real64(), exif2->fGPSDestLatitude[2].As_real64())))
0210         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestLatitude");
0211 
0212     if (exif1->fGPSDestLatitudeRef != exif2->fGPSDestLatitudeRef)
0213         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestLatitudeRef: %1 %2").arg(QLatin1String(exif1->fGPSDestLatitudeRef.Get())).arg(QLatin1String(exif2->fGPSDestLatitudeRef.Get()));
0214 
0215     if ((!AreSame(exif1->fGPSDestLongitude[0].As_real64(), exif2->fGPSDestLongitude[0].As_real64())) ||
0216         (!AreSame(exif1->fGPSDestLongitude[1].As_real64(), exif2->fGPSDestLongitude[1].As_real64())) ||
0217         (!AreSame(exif1->fGPSDestLongitude[2].As_real64(), exif2->fGPSDestLongitude[2].As_real64())))
0218         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestLongitude");
0219 
0220     if (exif1->fGPSDestLongitudeRef != exif2->fGPSDestLongitudeRef)
0221         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDestLongitudeRef: %1 %2").arg(QLatin1String(exif1->fGPSDestLongitudeRef.Get())).arg(QLatin1String(exif2->fGPSDestLongitudeRef.Get()));
0222 
0223     if (exif1->fGPSDifferential != exif2->fGPSDifferential)
0224         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDifferential: %1 %2").arg(exif1->fGPSDifferential).arg(exif2->fGPSDifferential);
0225 
0226     if (!AreSame(exif1->fGPSDOP.As_real64(), exif2->fGPSDOP.As_real64()))
0227         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSDOP: %1 %2").arg(exif1->fGPSDOP.As_real64()).arg(exif2->fGPSDOP.As_real64());
0228 
0229     if (!AreSame(exif1->fGPSImgDirection.As_real64(), exif2->fGPSImgDirection.As_real64()))
0230         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSImgDirection: %1 %2").arg(exif1->fGPSImgDirection.As_real64()).arg(exif2->fGPSImgDirection.As_real64());
0231 
0232     if (exif1->fGPSImgDirectionRef != exif2->fGPSImgDirectionRef)
0233         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSImgDirectionRef: %1 %2").arg(QLatin1String(exif1->fGPSImgDirectionRef.Get())).arg(QLatin1String(exif2->fGPSImgDirectionRef.Get()));
0234 
0235     if ((!AreSame(exif1->fGPSLatitude[0].As_real64(), exif2->fGPSLatitude[0].As_real64())) ||
0236         (!AreSame(exif1->fGPSLatitude[1].As_real64(), exif2->fGPSLatitude[1].As_real64())) ||
0237         (!AreSame(exif1->fGPSLatitude[2].As_real64(), exif2->fGPSLatitude[2].As_real64())))
0238         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSLatitude");
0239 
0240     if (exif1->fGPSLatitudeRef != exif2->fGPSLatitudeRef)
0241         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSLatitudeRef: %1 %2").arg(QLatin1String(exif1->fGPSLatitudeRef.Get())).arg(QLatin1String(exif2->fGPSLatitudeRef.Get()));
0242 
0243     if ((!AreSame(exif1->fGPSLongitude[0].As_real64(), exif2->fGPSLongitude[0].As_real64())) ||
0244         (!AreSame(exif1->fGPSLongitude[1].As_real64(), exif2->fGPSLongitude[1].As_real64())) ||
0245         (!AreSame(exif1->fGPSLongitude[2].As_real64(), exif2->fGPSLongitude[2].As_real64())))
0246         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSLongitude");
0247 
0248     if (exif1->fGPSLongitudeRef != exif2->fGPSLongitudeRef)
0249         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSLongitudeRef: %1 %2").arg(QLatin1String(exif1->fGPSLongitudeRef.Get())).arg(QLatin1String(exif2->fGPSLongitudeRef.Get()));
0250 
0251     if (exif1->fGPSMapDatum != exif2->fGPSMapDatum)
0252         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSMapDatum: %1 %2").arg(QLatin1String(exif1->fGPSMapDatum.Get())).arg(QLatin1String(exif2->fGPSMapDatum.Get()));
0253 
0254     if (exif1->fGPSMeasureMode != exif2->fGPSMeasureMode)
0255         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSMeasureMode: %1 %2").arg(QLatin1String(exif1->fGPSMeasureMode.Get())).arg(QLatin1String(exif2->fGPSMeasureMode.Get()));
0256 
0257     if (exif1->fGPSProcessingMethod != exif2->fGPSProcessingMethod)
0258         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSProcessingMethod: %1 %2").arg(QLatin1String(exif1->fGPSProcessingMethod.Get())).arg(QLatin1String(exif2->fGPSProcessingMethod.Get()));
0259 
0260     if (exif1->fGPSSatellites != exif2->fGPSSatellites)
0261         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSSatellites: %1 %2").arg(QLatin1String(exif1->fGPSSatellites.Get())).arg(QLatin1String(exif2->fGPSSatellites.Get()));
0262 
0263     if (!AreSame(exif1->fGPSSpeed.As_real64(), exif2->fGPSSpeed.As_real64()))
0264         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSSpeed: %1 %2").arg(exif1->fGPSSpeed.As_real64()).arg(exif2->fGPSSpeed.As_real64());
0265 
0266     if (exif1->fGPSSpeedRef != exif2->fGPSSpeedRef)
0267         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSSpeedRef: %1 %2").arg(QLatin1String(exif1->fGPSSpeedRef.Get())).arg(QLatin1String(exif2->fGPSSpeedRef.Get()));
0268 
0269     if (exif1->fGPSStatus != exif2->fGPSStatus)
0270         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSStatus: %1 %2").arg(QLatin1String(exif1->fGPSStatus.Get())).arg(QLatin1String(exif2->fGPSStatus.Get()));
0271 
0272     if ((!AreSame(exif1->fGPSTimeStamp[0].As_real64(), exif2->fGPSTimeStamp[0].As_real64())) ||
0273         (!AreSame(exif1->fGPSTimeStamp[1].As_real64(), exif2->fGPSTimeStamp[1].As_real64())) ||
0274         (!AreSame(exif1->fGPSTimeStamp[2].As_real64(), exif2->fGPSTimeStamp[2].As_real64())))
0275         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSTimeStamp");
0276 
0277     if (!AreSame(exif1->fGPSTrack.As_real64(), exif2->fGPSTrack.As_real64()))
0278         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSTrack: %1 %2").arg(exif1->fGPSTrack.As_real64()).arg(exif2->fGPSTrack.As_real64());
0279 
0280     if (exif1->fGPSTrackRef != exif2->fGPSTrackRef)
0281         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSTrackRef: %1 %2").arg(QLatin1String(exif1->fGPSTrackRef.Get())).arg(QLatin1String(exif2->fGPSTrackRef.Get()));
0282 
0283     if (exif1->fGPSVersionID != exif2->fGPSVersionID)
0284         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    GPSVersionID %1 %2").arg(exif1->fGPSVersionID).arg(exif2->fGPSVersionID);
0285 
0286     if (exif1->fImageDescription != exif2->fImageDescription)
0287         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ImageDescription: %1 %2").arg(QLatin1String(exif1->fImageDescription.Get())).arg(QLatin1String(exif2->fImageDescription.Get()));
0288 
0289     if (exif1->fImageNumber != exif2->fImageNumber)
0290         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ImageNumber: %1 %2").arg(exif1->fImageNumber).arg(exif2->fImageNumber);
0291 
0292     if (exif1->fImageUniqueID != exif2->fImageUniqueID)
0293         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ImageUniqueID");
0294 
0295     if (exif1->fInteroperabilityIndex != exif2->fInteroperabilityIndex)
0296         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    InteroperabilityIndex: %1 %2").arg(QLatin1String(exif1->fInteroperabilityIndex.Get())).arg(QLatin1String(exif2->fInteroperabilityIndex.Get()));
0297 
0298     if (exif1->fInteroperabilityVersion != exif2->fInteroperabilityVersion)
0299         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    InteroperabilityVersion: %1 %2").arg(exif1->fInteroperabilityVersion).arg(exif2->fInteroperabilityVersion);
0300 
0301     if ((exif1->fISOSpeedRatings[0] != exif2->fISOSpeedRatings[0]) ||
0302         (exif1->fISOSpeedRatings[1] != exif2->fISOSpeedRatings[1]) ||
0303         (exif1->fISOSpeedRatings[2] != exif2->fISOSpeedRatings[2]))
0304         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ISOSpeedRatings");
0305 
0306     if (exif1->fLensID != exif2->fLensID)
0307         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LensID: %1 %2").arg(QLatin1String(exif1->fLensID.Get())).arg(QLatin1String(exif2->fLensID.Get()));
0308 
0309     if ((!AreSame(exif1->fLensInfo[0].As_real64(), exif2->fLensInfo[0].As_real64())) ||
0310         (!AreSame(exif1->fLensInfo[1].As_real64(), exif2->fLensInfo[1].As_real64())) ||
0311         (!AreSame(exif1->fLensInfo[2].As_real64(), exif2->fLensInfo[2].As_real64())) ||
0312         (!AreSame(exif1->fLensInfo[3].As_real64(), exif2->fLensInfo[3].As_real64())))
0313         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LensInfo");
0314 
0315     if (exif1->fLensName != exif2->fLensName)
0316         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LensName: %1 %2").arg(QLatin1String(exif1->fLensName.Get())).arg(QLatin1String(exif2->fLensName.Get()));
0317 
0318     if (exif1->fLensSerialNumber != exif2->fLensSerialNumber)
0319         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LensSerialNumber: %1 %2").arg(QLatin1String(exif1->fLensSerialNumber.Get())).arg(QLatin1String(exif2->fLensSerialNumber.Get()));
0320 
0321     if (exif1->fLightSource != exif2->fLightSource)
0322         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LightSource: %1 %2").arg(exif1->fLightSource).arg(exif2->fLightSource);
0323 
0324     if (exif1->fMake != exif2->fMake)
0325         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Make: %1 %2").arg(QLatin1String(exif1->fMake.Get())).arg(QLatin1String(exif2->fMake.Get()));
0326 
0327     if (!AreSame(exif1->fMaxApertureValue.As_real64(), exif2->fMaxApertureValue.As_real64()))
0328         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    MaxApertureValue: %1 %2").arg(exif1->fMaxApertureValue.As_real64()).arg(exif2->fMaxApertureValue.As_real64());
0329 
0330     if (exif1->fMeteringMode != exif2->fMeteringMode)
0331         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    MeteringMode: %1 %2").arg(exif1->fMeteringMode).arg(exif2->fMeteringMode);
0332 
0333     if (exif1->fModel != exif2->fModel)
0334         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Model: %1 %2").arg(QLatin1String(exif1->fModel.Get())).arg(QLatin1String(exif2->fModel.Get()));
0335 
0336     if (exif1->fOwnerName != exif2->fOwnerName)
0337         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OwnerName: %1 %2").arg(QLatin1String(exif1->fOwnerName.Get())).arg(QLatin1String(exif2->fOwnerName.Get()));
0338 
0339     if (exif1->fPixelXDimension != exif2->fPixelXDimension)
0340         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PixelXDimension: %1 %2").arg(exif1->fPixelXDimension).arg(exif2->fPixelXDimension);
0341 
0342     if (exif1->fPixelYDimension != exif2->fPixelYDimension)
0343         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PixelYDimension: %1 %2").arg(exif1->fPixelYDimension).arg(exif2->fPixelYDimension);
0344 
0345     if (exif1->fRelatedImageFileFormat != exif2->fRelatedImageFileFormat)
0346         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RelatedImageFileFormat: %1 %2").arg(QLatin1String(exif1->fRelatedImageFileFormat.Get())).arg(QLatin1String(exif2->fRelatedImageFileFormat.Get()));
0347 
0348     if (exif1->fRelatedImageLength != exif2->fRelatedImageLength)
0349         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RelatedImageLength: %1 %2").arg(exif1->fRelatedImageLength).arg(exif2->fRelatedImageLength);
0350 
0351     if (exif1->fRelatedImageWidth != exif2->fRelatedImageWidth)
0352         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RelatedImageWidth: %1 %2").arg(exif1->fRelatedImageWidth).arg(exif2->fRelatedImageWidth);
0353 
0354     if (exif1->fSaturation != exif2->fSaturation)
0355         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Saturation: %1 %2").arg(exif1->fSaturation).arg(exif2->fSaturation);
0356 
0357     if (exif1->fSceneCaptureType != exif2->fSceneCaptureType)
0358         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SceneCaptureType: %1 %2").arg(exif1->fSceneCaptureType).arg(exif2->fSceneCaptureType);
0359 
0360     if (exif1->fSceneType != exif2->fSceneType)
0361         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SceneType: %1 %2").arg(exif1->fSceneType).arg(exif2->fSceneType);
0362 
0363     if (exif1->fSelfTimerMode != exif2->fSelfTimerMode)
0364         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SelfTimerMode: %1 %2").arg(exif1->fSelfTimerMode).arg(exif2->fSelfTimerMode);
0365 
0366     if (exif1->fSensingMethod != exif2->fSensingMethod)
0367         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SensingMethod: %1 %2").arg(exif1->fSensingMethod).arg(exif2->fSensingMethod);
0368 
0369     if (exif1->fSharpness != exif2->fSharpness)
0370         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Sharpness: %1 %2").arg(exif1->fSharpness).arg(exif2->fSharpness);
0371 
0372     if (!AreSame(exif1->fShutterSpeedValue.As_real64(), exif2->fShutterSpeedValue.As_real64()))
0373         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ShutterSpeedValue: %1 %2").arg(exif1->fShutterSpeedValue.As_real64()).arg(exif2->fShutterSpeedValue.As_real64());
0374 
0375     if (exif1->fSoftware != exif2->fSoftware)
0376         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Software: %1 %2").arg(QLatin1String(exif1->fSoftware.Get())).arg(QLatin1String(exif2->fSoftware.Get()));
0377 
0378     if (0 != memcmp(exif1->fSubjectArea, exif2->fSubjectArea, 4 * sizeof(uint32)))
0379         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubjectArea");
0380 
0381     if (exif1->fSubjectAreaCount != exif2->fSubjectAreaCount)
0382         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubjectAreaCount: %1 %2").arg(exif1->fSubjectAreaCount).arg(exif2->fSubjectAreaCount);
0383 
0384     if (!AreSame(exif1->fSubjectDistance.As_real64(), exif2->fSubjectDistance.As_real64()))
0385         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubjectDistance: %1 %2").arg(exif1->fSubjectDistance.As_real64()).arg(exif2->fSubjectDistance.As_real64());
0386 
0387     if (exif1->fSubjectDistanceRange != exif2->fSubjectDistanceRange)
0388         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubjectDistanceRange: %1 %2").arg(exif1->fSubjectDistanceRange).arg(exif2->fSubjectDistanceRange);
0389 
0390     if (exif1->fTIFF_EP_StandardID != exif2->fTIFF_EP_StandardID)
0391         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TIFF_EP_StandardID: %1 %2").arg(exif1->fTIFF_EP_StandardID).arg(exif2->fTIFF_EP_StandardID);
0392 
0393     if (exif1->fUserComment != exif2->fUserComment)
0394         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    UserComment: %1 %2").arg(QLatin1String(exif1->fUserComment.Get())).arg(QLatin1String(exif2->fUserComment.Get()));
0395 
0396     if (exif1->fWhiteBalance != exif2->fWhiteBalance)
0397         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    WhiteBalance: %1 %2").arg(exif1->fWhiteBalance).arg(exif2->fWhiteBalance);
0398 }
0399 
0400 void compareIfd(dng_ifd* const ifd1, dng_ifd* const ifd2)
0401 {
0402     if (ifd1->fActiveArea != ifd2->fActiveArea)
0403         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ActiveArea (t/l/b/r): %1/%2/%3/%4 %5/%6/%7/%8",
0404                ifd1->fActiveArea.t).arg(ifd1->fActiveArea.l).arg(ifd1->fActiveArea.b).arg(ifd1->fActiveArea.r,
0405                ifd2->fActiveArea.t).arg(ifd2->fActiveArea.l).arg(ifd2->fActiveArea.b).arg(ifd2->fActiveArea.r);
0406 
0407     if (!AreSame(ifd1->fAntiAliasStrength.As_real64(), ifd2->fAntiAliasStrength.As_real64()))
0408         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    AntiAliasStrength: %1 %2").arg(ifd1->fAntiAliasStrength.As_real64()).arg(ifd2->fAntiAliasStrength.As_real64());
0409 
0410     if (ifd1->fBayerGreenSplit != ifd2->fBayerGreenSplit)
0411         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BayerGreenSplit: %1 %2").arg(ifd1->fBayerGreenSplit).arg(ifd2->fBayerGreenSplit);
0412 
0413     if (!AreSame(ifd1->fBestQualityScale.As_real64(), ifd2->fBestQualityScale.As_real64()))
0414         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BestQualityScale: %1 %2").arg(ifd1->fBestQualityScale.As_real64()).arg(ifd2->fBestQualityScale.As_real64());
0415 
0416     if (0 != memcmp(ifd1->fBitsPerSample, ifd2->fBitsPerSample, kMaxSamplesPerPixel * sizeof(uint32)))
0417         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BitsPerSample");
0418 
0419     if (0 != memcmp(ifd1->fBlackLevel, ifd2->fBlackLevel, kMaxBlackPattern * kMaxBlackPattern * kMaxSamplesPerPixel * sizeof(real64)))
0420         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevel");
0421 
0422     if (ifd1->fBlackLevelDeltaHCount != ifd2->fBlackLevelDeltaHCount)
0423         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelDeltaHCount: %1 %2").arg(ifd1->fBlackLevelDeltaHCount).arg(ifd2->fBlackLevelDeltaHCount);
0424 
0425     //if (ifd1->fBlackLevelDeltaHOffset != ifd2->fBlackLevelDeltaHOffset)
0426     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelDeltaHOffset: %lld %lld").arg(ifd1->fBlackLevelDeltaHOffset).arg(ifd2->fBlackLevelDeltaHOffset);
0427 
0428     if (ifd1->fBlackLevelDeltaHType != ifd2->fBlackLevelDeltaHType)
0429         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelDeltaHType: %1 %2").arg(ifd1->fBlackLevelDeltaHType).arg(ifd2->fBlackLevelDeltaHType);
0430 
0431     if (ifd1->fBlackLevelDeltaVCount != ifd2->fBlackLevelDeltaVCount)
0432         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelDeltaVCount: %1 %2").arg(ifd1->fBlackLevelDeltaVCount).arg(ifd2->fBlackLevelDeltaVCount);
0433 
0434     //if (ifd1->fBlackLevelDeltaVOffset != ifd2->fBlackLevelDeltaVOffset)
0435     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelDeltaVOffset: %lld %lld").arg(ifd1->fBlackLevelDeltaVOffset).arg(ifd2->fBlackLevelDeltaVOffset);
0436 
0437     if (ifd1->fBlackLevelDeltaVType != ifd2->fBlackLevelDeltaVType)
0438         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelDeltaVType: %1 %2").arg(ifd1->fBlackLevelDeltaVType).arg(ifd2->fBlackLevelDeltaVType);
0439 
0440     if (ifd1->fBlackLevelRepeatCols != ifd2->fBlackLevelRepeatCols)
0441         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelRepeatCols: %1 %2").arg(ifd1->fBlackLevelRepeatCols).arg(ifd2->fBlackLevelRepeatCols);
0442 
0443     if (ifd1->fBlackLevelRepeatRows != ifd2->fBlackLevelRepeatRows)
0444         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BlackLevelRepeatRows: %1 %2").arg(ifd1->fBlackLevelRepeatRows).arg(ifd2->fBlackLevelRepeatRows);
0445 
0446     if (!AreSame(ifd1->fChromaBlurRadius.As_real64(), ifd2->fChromaBlurRadius.As_real64()))
0447         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ChromaBlurRadius: %1 %2").arg(ifd1->fChromaBlurRadius.As_real64()).arg(ifd2->fChromaBlurRadius.As_real64());
0448 
0449     if (ifd1->fCompression != ifd2->fCompression)
0450         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Compression: %1 %2").arg(ifd1->fCompression).arg(ifd2->fCompression);
0451 
0452     if (!AreSame(ifd1->fDefaultCropOriginH.As_real64(), ifd2->fDefaultCropOriginH.As_real64()))
0453         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropOriginH: %1 %2").arg(ifd1->fDefaultCropOriginH.As_real64()).arg(ifd2->fDefaultCropOriginH.As_real64());
0454 
0455     if (!AreSame(ifd1->fDefaultCropOriginV.As_real64(), ifd2->fDefaultCropOriginV.As_real64()))
0456         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropOriginV: %1 %2").arg(ifd1->fDefaultCropOriginV.As_real64()).arg(ifd2->fDefaultCropOriginV.As_real64());
0457 
0458     if (!AreSame(ifd1->fDefaultCropSizeH.As_real64(), ifd2->fDefaultCropSizeH.As_real64()))
0459         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropSizeH: %1 %2").arg(ifd1->fDefaultCropSizeH.As_real64()).arg(ifd2->fDefaultCropSizeH.As_real64());
0460 
0461     if (!AreSame(ifd1->fDefaultCropSizeV.As_real64(), ifd2->fDefaultCropSizeV.As_real64()))
0462         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropSizeV: %1 %2").arg(ifd1->fDefaultCropSizeV.As_real64()).arg(ifd2->fDefaultCropSizeV.As_real64());
0463 
0464     if (!AreSame(ifd1->fDefaultScaleH.As_real64(), ifd2->fDefaultScaleH.As_real64()))
0465         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultScaleH: %1 %2").arg(ifd1->fDefaultScaleH.As_real64()).arg(ifd2->fDefaultScaleH.As_real64());
0466 
0467     if (!AreSame(ifd1->fDefaultScaleV.As_real64(), ifd2->fDefaultScaleV.As_real64()))
0468         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultScaleV: %1 %2").arg(ifd1->fDefaultScaleV.As_real64()).arg(ifd2->fDefaultScaleV.As_real64());
0469 
0470     if (0 != memcmp(ifd1->fExtraSamples, ifd2->fExtraSamples, kMaxSamplesPerPixel * sizeof(uint32)))
0471         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExtraSamples");
0472 
0473     if (ifd1->fExtraSamplesCount != ifd2->fExtraSamplesCount)
0474         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ExtraSamplesCount: %1 %2").arg(ifd1->fExtraSamplesCount).arg(ifd2->fExtraSamplesCount);
0475 
0476     if (ifd1->fFillOrder != ifd2->fFillOrder)
0477         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    FillOrder: %1 %2").arg(ifd1->fFillOrder).arg(ifd2->fFillOrder);
0478 
0479     if (ifd1->fImageLength != ifd2->fImageLength)
0480         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ImageLength: %1 %2").arg(ifd1->fImageLength).arg(ifd2->fImageLength);
0481 
0482     if (ifd1->fImageWidth != ifd2->fImageWidth)
0483         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ImageWidth: %1 %2").arg(ifd1->fImageWidth).arg(ifd2->fImageWidth);
0484 
0485     if (ifd1->fJPEGInterchangeFormat != ifd2->fJPEGInterchangeFormat)
0486         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    JPEGInterchangeFormat: %1 %2").arg(ifd1->fJPEGInterchangeFormat).arg(ifd2->fJPEGInterchangeFormat);
0487 
0488     if (ifd1->fJPEGInterchangeFormatLength != ifd2->fJPEGInterchangeFormatLength)
0489         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    JPEGInterchangeFormatLength: %1 %2").arg(ifd1->fJPEGInterchangeFormatLength).arg(ifd2->fJPEGInterchangeFormatLength);
0490 
0491     if (ifd1->fJPEGTablesCount != ifd2->fJPEGTablesCount)
0492         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    JPEGTablesCount: %1 %2").arg(ifd1->fJPEGTablesCount).arg(ifd2->fJPEGTablesCount);
0493 
0494     //if (ifd1->fJPEGTablesOffset != ifd2->fJPEGTablesOffset)
0495     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    JPEGTablesOffset: %lld %lld").arg(ifd1->fJPEGTablesOffset).arg(ifd2->fJPEGTablesOffset);
0496 
0497     if (ifd1->fLinearizationTableCount != ifd2->fLinearizationTableCount)
0498         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LinearizationTableCount: %1 %2").arg(ifd1->fLinearizationTableCount).arg(ifd2->fLinearizationTableCount);
0499 
0500     //if (ifd1->fLinearizationTableOffset != ifd2->fLinearizationTableOffset)
0501     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LinearizationTableOffset: %1 %2").arg(ifd1->fLinearizationTableOffset).arg(ifd2->fLinearizationTableOffset);
0502 
0503     if (ifd1->fLinearizationTableType != ifd2->fLinearizationTableType)
0504         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LinearizationTableType: %1 %2").arg(ifd1->fLinearizationTableType).arg(ifd2->fLinearizationTableType);
0505 
0506     if (ifd1->fLosslessJPEGBug16 != ifd2->fLosslessJPEGBug16)
0507         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LosslessJPEGBug16: %1 %2").arg(ifd1->fLosslessJPEGBug16).arg(ifd2->fLosslessJPEGBug16);
0508 
0509     for (unsigned int i = 0 ; i < kMaxMaskedAreas ; i++)
0510     {
0511         if (ifd1->fMaskedArea[i] != ifd2->fMaskedArea[i])
0512         {
0513             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    MaskedArea");
0514         }
0515     }
0516 
0517     if (ifd1->fMaskedAreaCount != ifd2->fMaskedAreaCount)
0518         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    MaskedAreaCount: %1 %2").arg(ifd1->fMaskedAreaCount).arg(ifd2->fMaskedAreaCount);
0519 
0520     if (ifd1->fNewSubFileType != ifd2->fNewSubFileType)
0521         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    NewSubFileType: %1 %2").arg(ifd1->fNewSubFileType).arg(ifd2->fNewSubFileType);
0522 
0523     if (ifd1->fNextIFD != ifd2->fNextIFD)
0524         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    NextIFD: %1 %2").arg(ifd1->fNextIFD).arg(ifd2->fNextIFD);
0525 
0526     if (ifd1->fOpcodeList1Count != ifd2->fOpcodeList1Count)
0527         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OpcodeList1Count: %1 %2").arg(ifd1->fOpcodeList1Count).arg(ifd2->fOpcodeList1Count);
0528 
0529     //if (ifd1->fOpcodeList1Offset != ifd2->fOpcodeList1Offset)
0530     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OpcodeList1Offset");
0531 
0532     if (ifd1->fOpcodeList2Count != ifd2->fOpcodeList2Count)
0533         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OpcodeList2Count: %1 %2").arg(ifd1->fOpcodeList2Count).arg(ifd2->fOpcodeList2Count);
0534 
0535     //if (ifd1->fOpcodeList2Offset != ifd2->fOpcodeList2Offset)
0536     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OpcodeList2Offset");
0537 
0538     if (ifd1->fOpcodeList3Count != ifd2->fOpcodeList3Count)
0539         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OpcodeList3Count: %1 %2").arg(ifd1->fOpcodeList3Count).arg(ifd2->fOpcodeList3Count);
0540 
0541     //if (ifd1->fOpcodeList3Offset != ifd2->fOpcodeList3Offset)
0542     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OpcodeList3Offset");
0543 
0544     if (ifd1->fOrientation != ifd2->fOrientation)
0545         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Orientation: %1 %2").arg(ifd1->fOrientation).arg(ifd2->fOrientation);
0546 
0547     if (ifd1->fOrientationBigEndian != ifd2->fOrientationBigEndian)
0548         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OrientationBigEndian: %1 %2").arg(ifd1->fOrientationBigEndian).arg(ifd2->fOrientationBigEndian);
0549 
0550     //if (ifd1->fOrientationOffset != ifd2->fOrientationOffset)
0551     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OrientationOffset: %lld %lld").arg(ifd1->fOrientationOffset).arg(ifd2->fOrientationOffset);
0552 
0553     if (ifd1->fOrientationType != ifd2->fOrientationType)
0554         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OrientationType: %1 %2").arg(ifd1->fOrientationType).arg(ifd2->fOrientationType);
0555 
0556     if (ifd1->fPhotometricInterpretation != ifd2->fPhotometricInterpretation)
0557         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PhotometricInterpretation: %1 %2").arg(ifd1->fPhotometricInterpretation).arg(ifd2->fPhotometricInterpretation);
0558 
0559     if (ifd1->fPlanarConfiguration != ifd2->fPlanarConfiguration)
0560         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PlanarConfiguration: %1 %2").arg(ifd1->fPlanarConfiguration).arg(ifd2->fPlanarConfiguration);
0561 
0562     if (ifd1->fPredictor != ifd2->fPredictor)
0563         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Predictor: %1 %2").arg(ifd1->fPredictor).arg(ifd2->fPredictor);
0564 
0565     if (ifd1->fPreviewInfo.fApplicationName != ifd2->fPreviewInfo.fApplicationName)
0566         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo ApplicationName: %1 %2").arg(QLatin1String(ifd1->fPreviewInfo.fApplicationName.Get())).arg(QLatin1String(ifd2->fPreviewInfo.fApplicationName.Get()));
0567 
0568     if (ifd1->fPreviewInfo.fApplicationVersion != ifd2->fPreviewInfo.fApplicationVersion)
0569         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo ApplicationVersion: %1 %2").arg(QLatin1String(ifd1->fPreviewInfo.fApplicationVersion.Get())).arg(QLatin1String(ifd2->fPreviewInfo.fApplicationVersion.Get()));
0570 
0571     if (ifd1->fPreviewInfo.fColorSpace != ifd2->fPreviewInfo.fColorSpace)
0572         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo ColorSpace");
0573 
0574     if (ifd1->fPreviewInfo.fDateTime != ifd2->fPreviewInfo.fDateTime)
0575         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo DateTime");
0576 
0577     if (ifd1->fPreviewInfo.fIsPrimary != ifd2->fPreviewInfo.fIsPrimary)
0578         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo");
0579 
0580     if (ifd1->fPreviewInfo.fSettingsDigest != ifd2->fPreviewInfo.fSettingsDigest)
0581         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo");
0582 
0583     if (ifd1->fPreviewInfo.fSettingsName != ifd2->fPreviewInfo.fSettingsName)
0584         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PreviewInfo");
0585 
0586     if (0 != memcmp(ifd1->fReferenceBlackWhite, ifd2->fReferenceBlackWhite, 6 * sizeof(real64)))
0587         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ReferenceBlackWhite");
0588 
0589     if (ifd1->fResolutionUnit != ifd2->fResolutionUnit)
0590         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ResolutionUnit: %1 %2").arg(ifd1->fResolutionUnit).arg(ifd2->fResolutionUnit);
0591 
0592     if (ifd1->fRowInterleaveFactor != ifd2->fRowInterleaveFactor)
0593         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RowInterleaveFactor: %1 %2").arg(ifd1->fRowInterleaveFactor).arg(ifd2->fRowInterleaveFactor);
0594 
0595     if (ifd1->fSampleBitShift != ifd2->fSampleBitShift)
0596         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SampleBitShift: %1 %2").arg(ifd1->fSampleBitShift).arg(ifd2->fSampleBitShift);
0597 
0598     if (0 != memcmp(ifd1->fSampleFormat, ifd2->fSampleFormat, kMaxSamplesPerPixel * sizeof(uint32)))
0599         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SampleFormat");
0600 
0601     if (ifd1->fSamplesPerPixel != ifd2->fSamplesPerPixel)
0602         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SamplesPerPixel: %1 %2").arg(ifd1->fSamplesPerPixel).arg(ifd2->fSamplesPerPixel);
0603 
0604     if (ifd1->fSubIFDsCount != ifd2->fSubIFDsCount)
0605         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubIFDsCount: %1 %2").arg(ifd1->fSubIFDsCount).arg(ifd2->fSubIFDsCount);
0606 
0607     //if (ifd1->fSubIFDsOffset != ifd2->fSubIFDsOffset)
0608     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubIFDsOffset");
0609 
0610     if (ifd1->fSubTileBlockCols != ifd2->fSubTileBlockCols)
0611         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubTileBlockCols: %1 %2").arg(ifd1->fSubTileBlockCols).arg(ifd2->fSubTileBlockCols);
0612 
0613     if (ifd1->fSubTileBlockRows != ifd2->fSubTileBlockRows)
0614         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SubTileBlockRows: %1 %2").arg(ifd1->fSubTileBlockRows).arg(ifd2->fSubTileBlockRows);
0615 
0616     //if (ifd1->fThisIFD != ifd2->fThisIFD)
0617     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ThisIFD:");
0618 
0619     if (0 != memcmp(ifd1->fTileByteCount, ifd2->fTileByteCount, dng_ifd::kMaxTileInfo * sizeof(uint32)))
0620         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileByteCount");
0621 
0622     if (ifd1->fTileByteCountsCount != ifd2->fTileByteCountsCount)
0623         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileByteCountsCount: %1 %2").arg(ifd1->fTileByteCountsCount).arg(ifd2->fTileByteCountsCount);
0624 
0625     //if (ifd1->fTileByteCountsOffset != ifd2->fTileByteCountsOffset)
0626     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileByteCountsOffset");
0627 
0628     if (ifd1->fTileByteCountsType != ifd2->fTileByteCountsType)
0629         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileByteCountsType: %1 %2").arg(ifd1->fTileByteCountsType).arg(ifd2->fTileByteCountsType);
0630 
0631     if (ifd1->fTileLength != ifd2->fTileLength)
0632         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileLength: %1 %2").arg(ifd1->fTileLength).arg(ifd2->fTileLength);
0633 
0634     //if (ifd1->fTileOffset != ifd2->fTileOffset)
0635     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileOffset");
0636 
0637     if (ifd1->fTileOffsetsCount != ifd2->fTileOffsetsCount)
0638         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileOffsetsCount: %1 %2").arg(ifd1->fTileOffsetsCount).arg(ifd2->fTileOffsetsCount);
0639 
0640     //if (ifd1->fTileOffsetsOffset != ifd2->fTileOffsetsOffset)
0641     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileOffsetsOffset");
0642 
0643     if (ifd1->fTileOffsetsType != ifd2->fTileOffsetsType)
0644         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileOffsetsType: %1 %2").arg(ifd1->fTileOffsetsType).arg(ifd2->fTileOffsetsType);
0645 
0646     if (ifd1->fTileWidth != ifd2->fTileWidth)
0647         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    TileWidth: %1 %2").arg(ifd1->fTileWidth).arg(ifd2->fTileWidth);
0648 
0649     if (ifd1->fUsesNewSubFileType != ifd2->fUsesNewSubFileType)
0650         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    UsesNewSubFileType: %1 %2").arg(ifd1->fUsesNewSubFileType).arg(ifd2->fUsesNewSubFileType);
0651 
0652     if (ifd1->fUsesStrips != ifd2->fUsesStrips)
0653         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    UsesStrips: %1 %2").arg(ifd1->fUsesStrips).arg(ifd2->fUsesStrips);
0654 
0655     if (ifd1->fUsesTiles != ifd2->fUsesTiles)
0656         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    UsesTiles: %1 %2").arg(ifd1->fUsesTiles).arg(ifd2->fUsesTiles);
0657 
0658     if (0 != memcmp(ifd1->fWhiteLevel, ifd2->fWhiteLevel, kMaxSamplesPerPixel * sizeof(real64)))
0659         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    WhiteLevel");
0660 
0661     if (!AreSame(ifd1->fXResolution, ifd2->fXResolution))
0662         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    XResolution: %1 %2").arg(ifd1->fXResolution).arg(ifd2->fXResolution);
0663 
0664     if (!AreSame(ifd1->fYCbCrCoefficientB, ifd2->fYCbCrCoefficientB))
0665         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YCbCrCoefficientB: %1 %2").arg(ifd1->fYCbCrCoefficientB).arg(ifd2->fYCbCrCoefficientB);
0666 
0667     if (!AreSame(ifd1->fYCbCrCoefficientG, ifd2->fYCbCrCoefficientG))
0668         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YCbCrCoefficientG: %1 %2").arg(ifd1->fYCbCrCoefficientG).arg(ifd2->fYCbCrCoefficientG);
0669 
0670     if (!AreSame(ifd1->fYCbCrCoefficientR, ifd2->fYCbCrCoefficientR))
0671         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YCbCrCoefficientR: %1 %2").arg(ifd1->fYCbCrCoefficientR).arg(ifd2->fYCbCrCoefficientR);
0672 
0673     if (ifd1->fYCbCrPositioning != ifd2->fYCbCrPositioning)
0674         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YCbCrPositioning: %1 %2").arg(ifd1->fYCbCrPositioning).arg(ifd2->fYCbCrPositioning);
0675 
0676     if (ifd1->fYCbCrSubSampleH != ifd2->fYCbCrSubSampleH)
0677         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YCbCrSubSampleH: %1 %2").arg(ifd1->fYCbCrSubSampleH).arg(ifd2->fYCbCrSubSampleH);
0678 
0679     if (ifd1->fYCbCrSubSampleV != ifd2->fYCbCrSubSampleV)
0680         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YCbCrSubSampleV: %1 %2").arg(ifd1->fYCbCrSubSampleV).arg(ifd2->fYCbCrSubSampleV);
0681 
0682     if (!AreSame(ifd1->fYResolution, ifd2->fYResolution))
0683         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    YResolution: %1 %2").arg(ifd1->fYResolution).arg(ifd2->fYResolution);
0684 }
0685 
0686 void compareNegative(dng_negative* const negative1, dng_negative* const negative2)
0687 {
0688     if (negative1->AsShotProfileName() != negative2->AsShotProfileName())
0689         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    AsShotProfileName: %1 %2").arg(QLatin1String(negative1->AsShotProfileName().Get())).arg(QLatin1String(negative2->AsShotProfileName().Get()));
0690 
0691     if (!AreSame(negative1->AntiAliasStrength().As_real64(), negative2->AntiAliasStrength().As_real64()))
0692         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BaselineExposure: %1 %2").arg(negative1->AntiAliasStrength().As_real64()).arg(negative2->AntiAliasStrength().As_real64());
0693 
0694     if (negative1->AspectRatio() != negative2->AspectRatio())
0695         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    AspectRatio: %1 %2").arg(negative1->AspectRatio()).arg(negative2->AspectRatio());
0696 
0697     if (negative1->BaselineExposure() != negative2->BaselineExposure())
0698         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BaselineExposure: %1 %2").arg(negative1->BaselineExposure()).arg(negative2->BaselineExposure());
0699 
0700     if (negative1->BaselineNoise() != negative2->BaselineNoise())
0701         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BaselineNoise: %1 %2").arg(negative1->BaselineNoise()).arg(negative2->BaselineNoise());
0702 
0703     if (negative1->BaselineSharpness() != negative2->BaselineSharpness())
0704         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BaselineSharpness: %1 %2").arg(negative1->BaselineSharpness()).arg(negative2->BaselineSharpness());
0705 
0706     if (negative1->BaseOrientation() != negative2->BaseOrientation())
0707         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BaseOrientation: %1 %2").arg(negative1->BaseOrientation().GetAdobe()).arg(negative2->BaseOrientation().GetAdobe());
0708 
0709     //if (negative1->BestQualityFinalHeight() != negative2->BestQualityFinalHeight())
0710     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BestQualityFinalHeight: %1 %2").arg(negative1->BestQualityFinalHeight()).arg(negative2->BestQualityFinalHeight());
0711 
0712     //if (negative1->BestQualityFinalWidth() != negative2->BestQualityFinalWidth())
0713     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BestQualityFinalWidth: %1 %2").arg(negative1->BestQualityFinalWidth()).arg(negative2->BestQualityFinalWidth());
0714 
0715     if (!AreSame(negative1->BestQualityScale().As_real64(), negative2->BestQualityScale().As_real64()))
0716         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BestQualityScale");
0717 
0718     if (negative1->HasCameraNeutral() &&
0719         negative2->HasCameraNeutral())
0720     {
0721         if (negative1->CameraNeutral() != negative2->CameraNeutral())
0722             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CameraNeutral");
0723     }
0724 
0725     if (negative1->HasCameraWhiteXY() &&
0726         negative2->HasCameraWhiteXY())
0727     {
0728         if (negative1->CameraWhiteXY() != negative2->CameraWhiteXY())
0729             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CameraWhiteXY");
0730     }
0731 
0732     if (!AreSame(negative1->ChromaBlurRadius().As_real64(), negative2->ChromaBlurRadius().As_real64()))
0733         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ChromaBlurRadius: %1 %2").arg(negative1->ChromaBlurRadius().As_real64()).arg(negative2->ChromaBlurRadius().As_real64());
0734 
0735     if (negative1->ColorChannels() != negative2->ColorChannels())
0736         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ColorChannels: %1 %2").arg(negative1->ColorChannels()).arg(negative2->ColorChannels());
0737 
0738     if (negative1->ColorimetricReference() != negative2->ColorimetricReference())
0739         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ColorimetricReference: %1 %2").arg(negative1->ColorimetricReference()).arg(negative2->ColorimetricReference());
0740 
0741     //if (!AreSame(negative1->DefaultCropOriginH().As_real64(), negative2->DefaultCropOriginH().As_real64()))
0742     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropOriginH: %1 %2").arg(negative1->DefaultCropOriginH().As_real64()).arg(negative2->DefaultCropOriginH().As_real64());
0743 
0744     //if (!AreSame(negative1->DefaultCropOriginV().As_real64(), negative2->DefaultCropOriginV().As_real64()))
0745     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropOriginV: %1 %2").arg(negative1->DefaultCropOriginV().As_real64()).arg(negative2->DefaultCropOriginV().As_real64());
0746 
0747     //if (!AreSame(negative1->DefaultCropSizeH().As_real64(), negative2->DefaultCropSizeH().As_real64()))
0748     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropSizeH: %1 %2").arg(negative1->DefaultCropSizeH().As_real64()).arg(negative2->DefaultCropSizeH().As_real64());
0749 
0750     //if (!AreSame(negative1->DefaultCropSizeV().As_real64(), negative2->DefaultCropSizeV().As_real64()))
0751     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultCropSizeV: %1 %2").arg(negative1->DefaultCropSizeV().As_real64()).arg(negative2->DefaultCropSizeV().As_real64());
0752 
0753     if (negative1->DefaultScale() != negative2->DefaultScale())
0754         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultScale: %1 %2").arg(negative1->DefaultScale()).arg(negative2->DefaultScale());
0755 
0756     if (!AreSame(negative1->DefaultScaleH().As_real64(), negative2->DefaultScaleH().As_real64()))
0757         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultScaleH: %1 %2").arg(negative1->DefaultScaleH().As_real64()).arg(negative2->DefaultScaleH().As_real64());
0758 
0759     if (!AreSame(negative1->DefaultScaleV().As_real64(), negative2->DefaultScaleV().As_real64()))
0760         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultScaleV: %1 %2").arg(negative1->DefaultScaleV().As_real64()).arg(negative2->DefaultScaleV().As_real64());
0761 
0762     //if (negative1->DefaultFinalHeight() != negative2->DefaultFinalHeight())
0763     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultFinalHeight: %1 %2").arg(negative1->DefaultFinalHeight()).arg(negative2->DefaultFinalHeight());
0764 
0765     //if (negative1->DefaultFinalWidth() != negative2->DefaultFinalWidth())
0766     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    DefaultFinalWidth: %1 %2").arg(negative1->DefaultFinalWidth()).arg(negative2->DefaultFinalWidth());
0767 
0768     if (negative1->HasBaseOrientation() != negative2->HasBaseOrientation())
0769         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    HasBaseOrientation: %1 %2").arg(negative1->HasBaseOrientation()).arg(negative2->HasBaseOrientation());
0770 
0771     if (negative1->HasCameraNeutral() != negative2->HasCameraNeutral())
0772         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    HasCameraNeutral: %1 %2").arg(negative1->HasCameraNeutral()).arg(negative2->HasCameraNeutral());
0773 
0774     if (negative1->HasCameraWhiteXY() != negative2->HasCameraWhiteXY())
0775         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    HasCameraWhiteXY: %1 %2").arg(negative1->HasCameraWhiteXY()).arg(negative2->HasCameraWhiteXY());
0776 
0777     if (negative1->HasNoiseProfile() != negative2->HasNoiseProfile())
0778         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    HasNoiseProfile: %1 %2").arg(negative1->HasNoiseProfile()).arg(negative2->HasNoiseProfile());
0779 
0780     if (negative1->HasOriginalRawFileName() != negative2->HasOriginalRawFileName())
0781         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    HasOriginalRawFileName: %1 %2").arg(negative1->HasOriginalRawFileName()).arg(negative2->HasOriginalRawFileName());
0782 
0783     if (negative1->IsMakerNoteSafe() != negative2->IsMakerNoteSafe())
0784         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    IsMakerNoteSafe: %1 %2").arg(negative1->IsMakerNoteSafe()).arg(negative2->IsMakerNoteSafe());
0785 
0786     if (negative1->IsMonochrome() != negative2->IsMonochrome())
0787         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    IsMonochrome: %1 %2").arg(negative1->IsMonochrome()).arg(negative2->IsMonochrome());
0788 
0789     if (negative1->LinearResponseLimit() != negative2->LinearResponseLimit())
0790         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LinearResponseLimit: %1 %2").arg(negative1->LinearResponseLimit()).arg(negative2->LinearResponseLimit());
0791 
0792     if (negative1->LocalName() != negative2->LocalName())
0793         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    LocalName: %1 %2").arg(QLatin1String(negative1->LocalName().Get())).arg(QLatin1String(negative2->LocalName().Get()));
0794 
0795     if (negative1->MakerNoteLength() != negative2->MakerNoteLength())
0796         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    MakerNoteLength: %1 %2").arg(negative1->MakerNoteLength()).arg(negative2->MakerNoteLength());
0797 
0798     if (negative1->ModelName() != negative2->ModelName())
0799         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ModelName: %1 %2").arg(QLatin1String(negative1->ModelName().Get())).arg(QLatin1String(negative2->ModelName().Get()));
0800 
0801     if (!AreSame(negative1->NoiseReductionApplied().As_real64(), negative2->NoiseReductionApplied().As_real64()))
0802         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    NoiseReductionApplied: %1 %2").arg(negative1->NoiseReductionApplied().As_real64()).arg(negative2->NoiseReductionApplied().As_real64());
0803 
0804     //if (negative1->Orientation() != negative2->Orientation())
0805     //    qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    Orientation: %1 %2").arg(negative1->Orientation()).arg(negative2->Orientation());
0806 
0807     if (negative1->OriginalRawFileDataLength() != negative2->OriginalRawFileDataLength())
0808         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OriginalRawFileDataLength: %1 %2").arg(negative1->OriginalRawFileDataLength()).arg(negative2->OriginalRawFileDataLength());
0809 
0810     if (0 != memcmp(negative1->OriginalRawFileDigest().data, negative2->OriginalRawFileDigest().data, 16 * sizeof(uint8)))
0811         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OriginalRawFileDigest");
0812 
0813     if (negative1->OriginalRawFileName() != negative2->OriginalRawFileName())
0814         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    OriginalRawFileName: %1 %2").arg(QLatin1String(negative1->OriginalRawFileName().Get())).arg(QLatin1String(negative2->OriginalRawFileName().Get()));
0815 
0816     if (negative1->PixelAspectRatio() != negative2->PixelAspectRatio())
0817         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PixelAspectRatio: %1 %2").arg(negative1->PixelAspectRatio()).arg(negative2->PixelAspectRatio());
0818 
0819     if (negative1->PrivateLength() != negative2->PrivateLength())
0820         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    PrivateLength: %1 %2").arg(negative1->PrivateLength()).arg(negative2->PrivateLength());
0821 
0822     if (negative1->ProfileCount() != negative2->ProfileCount())
0823         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ProfileCount: %1 %2").arg(negative1->ProfileCount()).arg(negative2->ProfileCount());
0824 
0825     if (negative1->RawDataUniqueID().Collapse32() != negative2->RawDataUniqueID().Collapse32())
0826         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RawDataUniqueID");
0827 
0828     if (negative1->RawImageDigest().Collapse32() != negative2->RawImageDigest().Collapse32())
0829         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RawImageDigest");
0830 
0831     if (negative1->RawToFullScaleH() != negative2->RawToFullScaleH())
0832         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RawToFullScaleH: %1 %2").arg(negative1->RawToFullScaleH()).arg(negative2->RawToFullScaleH());
0833 
0834     if (negative1->RawToFullScaleV() != negative2->RawToFullScaleV())
0835         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    RawToFullScaleV: %1 %2").arg(negative1->RawToFullScaleV()).arg(negative2->RawToFullScaleV());
0836 
0837     if (negative1->ShadowScale() != negative2->ShadowScale())
0838         qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ShadowScale: %1 %2").arg(negative1->ShadowScale()).arg(negative2->ShadowScale());
0839 
0840     //if (negative1->SquareHeight() != negative2->SquareHeight())
0841     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SquareHeight: %1 %2").arg(negative1->SquareHeight()).arg(negative2->SquareHeight());
0842 
0843     //if (negative1->SquareWidth() != negative2->SquareWidth())
0844     //  qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    SquareWidth: %1 %2").arg(negative1->SquareWidth()).arg(negative2->SquareWidth());
0845 
0846     const dng_mosaic_info* mosaicInfo1 = negative1->GetMosaicInfo();
0847     const dng_mosaic_info* mosaicInfo2 = negative2->GetMosaicInfo();
0848 
0849     if ((mosaicInfo1 != nullptr) && (mosaicInfo2 != nullptr))
0850     {
0851         if (mosaicInfo1->fBayerGreenSplit != mosaicInfo2->fBayerGreenSplit)
0852             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    BayerGreenSplit: %1 %2").arg(mosaicInfo1->fBayerGreenSplit).arg(mosaicInfo2->fBayerGreenSplit);
0853 
0854         if (mosaicInfo1->fCFALayout != mosaicInfo2->fCFALayout)
0855             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFALayout: %1 %2").arg(mosaicInfo1->fCFALayout).arg(mosaicInfo2->fCFALayout);
0856 
0857         if (0 != memcmp(mosaicInfo1->fCFAPattern, mosaicInfo2->fCFAPattern, kMaxCFAPattern * kMaxCFAPattern * sizeof(uint8)))
0858             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFAPattern");
0859 
0860         if (mosaicInfo1->fCFAPatternSize != mosaicInfo2->fCFAPatternSize)
0861             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFAPatternSize: %1,%2 %3,%4").arg(mosaicInfo1->fCFAPatternSize.h).arg(mosaicInfo1->fCFAPatternSize.v).arg(mosaicInfo2->fCFAPatternSize.h).arg(mosaicInfo2->fCFAPatternSize.v);
0862 
0863         if (0 != memcmp(mosaicInfo1->fCFAPlaneColor, mosaicInfo2->fCFAPlaneColor, kMaxColorPlanes * sizeof(uint8)))
0864             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    CFAPlaneColor");
0865 
0866         if (mosaicInfo1->fColorPlanes != mosaicInfo2->fColorPlanes)
0867             qCDebug(DIGIKAM_TESTS_LOG).noquote() << QString::fromLatin1("    ColorPlanes: %1 %2").arg(mosaicInfo1->fColorPlanes).arg(mosaicInfo2->fColorPlanes);
0868     }
0869 }
0870 
0871 int main(int argc, char** argv)
0872 {
0873     try
0874     {
0875         QCoreApplication app(argc, argv);
0876 
0877         if (argc == 1)
0878         {
0879             qCDebug(DIGIKAM_TESTS_LOG) << ""
0880                         "dngcompare - DNG comparison tool"
0881                         "Usage: %s [options] <dngfile1> <dngfile2>"
0882                      << argv[0];
0883 
0884             return -1;
0885         }
0886 
0887         char* const fileName1 = argv[1];
0888         char* const fileName2 = argv[2];
0889 
0890         dng_xmp_sdk::InitializeSDK();
0891 
0892         dng_file_stream stream1(fileName1);
0893         dng_host host1;
0894         host1.SetKeepOriginalFile(true);
0895 
0896         dng_info info1;
0897         AutoPtr<dng_negative> negative1;
0898         {
0899             info1.Parse(host1, stream1);
0900             info1.PostParse(host1);
0901 
0902             if (!info1.IsValidDNG())
0903             {
0904                 return dng_error_bad_format;
0905             }
0906 
0907             negative1.Reset(host1.Make_dng_negative());
0908             negative1->Parse(host1, stream1, info1);
0909             negative1->PostParse(host1, stream1, info1);
0910         }
0911 
0912         dng_file_stream stream2(fileName2);
0913         dng_host host2;
0914         host2.SetKeepOriginalFile(true);
0915 
0916         dng_info info2;
0917         AutoPtr<dng_negative> negative2;
0918         {
0919             info2.Parse(host2, stream2);
0920             info2.PostParse(host2);
0921 
0922             if (!info2.IsValidDNG())
0923             {
0924                 return dng_error_bad_format;
0925             }
0926 
0927             negative2.Reset(host2.Make_dng_negative());
0928             negative2->Parse(host2, stream2, info2);
0929             negative2->PostParse(host2, stream2, info2);
0930         }
0931 
0932         negative1->SynchronizeMetadata();
0933         negative2->SynchronizeMetadata();
0934 
0935         dng_exif* const exif1 = negative1->GetExif();
0936         dng_exif* const exif2 = negative2->GetExif();
0937 
0938         qCDebug(DIGIKAM_TESTS_LOG) << " Exif";
0939         compareExif(exif1, exif2);
0940 
0941         qCDebug(DIGIKAM_TESTS_LOG) << " Main Ifd";
0942         compareIfd(info1.fIFD[info1.fMainIndex], info2.fIFD[info1.fMainIndex]);
0943 
0944         qCDebug(DIGIKAM_TESTS_LOG) << " Negative";
0945         compareNegative(negative1.Get(), negative2.Get());
0946 
0947         dng_xmp_sdk::TerminateSDK();
0948 
0949         return 0;
0950     }
0951 
0952     catch (const dng_exception& exception)
0953     {
0954         int ret = exception.ErrorCode();
0955         qCCritical(DIGIKAM_TESTS_LOG) << "DNGWriter: DNG SDK exception code (" << ret << ")";
0956 
0957         return (-1);
0958     }
0959 
0960     catch (...)
0961     {
0962         qCCritical(DIGIKAM_TESTS_LOG) << "DNGWriter: DNG SDK exception code unknow";
0963 
0964         return (-1);
0965     }
0966 }