6
6
// accordance with the terms of the Adobe license agreement accompanying it.
7
7
/*****************************************************************************/
9
/* $Id: //mondo/dng_sdk_1_2/dng_sdk/source/dng_shared.cpp#2 $ */
10
/* $DateTime: 2008/04/02 14:06:57 $ */
11
/* $Change: 440485 $ */
9
/* $Id: //mondo/dng_sdk_1_3/dng_sdk/source/dng_shared.cpp#1 $ */
10
/* $DateTime: 2009/06/22 05:04:49 $ */
11
/* $Change: 578634 $ */
12
12
/* $Author: tknoll $ */
14
14
/*****************************************************************************/
16
16
#include "dng_shared.h"
17
18
#include "dng_camera_profile.h"
18
19
#include "dng_exceptions.h"
19
20
#include "dng_globals.h"
1163
1166
DumpHexAscii (stream, fIPTC_NAA_Count);
1170
// Compute and output the digest.
1172
dng_memory_data buffer (fIPTC_NAA_Count);
1174
stream.SetReadPosition (fIPTC_NAA_Offset);
1176
stream.Get (buffer.Buffer (), fIPTC_NAA_Count);
1178
const uint8 *data = buffer.Buffer_uint8 ();
1180
uint32 count = fIPTC_NAA_Count;
1182
// Method 1: Counting all bytes (this is correct).
1186
dng_md5_printer printer;
1188
printer.Process (data, count);
1190
printf ("IPTCDigest: ");
1192
DumpFingerprint (printer.Result ());
1198
// Method 2: Ignoring zero padding.
1204
while ((removed < 3) && (count > 0) && (data [count - 1] == 0))
1213
dng_md5_printer printer;
1215
printer.Process (data, count);
1217
printf ("IPTCDigest (ignoring zero padding): ");
1219
DumpFingerprint (printer.Result ());
1753
case tcNoiseProfile:
1756
if (!CheckTagType (parentCode, tagCode, tagType, ttDouble))
1759
// Must be an even, positive number of doubles in a noise profile.
1761
if (!tagCount || (tagCount & 1))
1764
// Determine number of planes (i.e., half the number of doubles).
1766
const uint32 numPlanes = Pin_uint32 (0,
1770
// Parse the noise function parameters.
1772
std::vector<dng_noise_function> noiseFunctions;
1774
for (uint32 i = 0; i < numPlanes; i++)
1777
const real64 scale = stream.TagValue_real64 (tagType);
1778
const real64 offset = stream.TagValue_real64 (tagType);
1780
noiseFunctions.push_back (dng_noise_function (scale, offset));
1784
// Store the noise profile.
1786
fNoiseProfile = dng_noise_profile (noiseFunctions);
1795
printf ("NoiseProfile:\n");
1797
printf (" Planes: %u\n", numPlanes);
1799
for (uint32 plane = 0; plane < numPlanes; plane++)
1802
printf (" Noise function for plane %u: scale = %.8lf, offset = %.8lf\n",
1804
noiseFunctions [plane].Scale (),
1805
noiseFunctions [plane].Offset ());
1693
1817
case tcBaselineSharpness:
2584
2708
fBaselineSharpness = dng_urational (1, 1);
2712
// Check NoiseProfile.
2714
if (!fNoiseProfile.IsValid () && fNoiseProfile.NumFunctions () != 0)
2719
ReportWarning ("Invalid NoiseProfile");
2723
fNoiseProfile = dng_noise_profile ();
2588
2727
// Check LinearResponseLimit.