├── .gitignore ├── libdng ├── dng-sdk │ └── source │ │ ├── dng_utils.cpp │ │ ├── dng_point.cpp │ │ ├── dng_fast_module.h │ │ ├── dng_uncopyable.h │ │ ├── dng_tag_types.h │ │ ├── dng_tag_types.cpp │ │ ├── dng_globals.cpp │ │ ├── dng_tone_curve.h │ │ ├── dng_bottlenecks.cpp │ │ ├── dng_string_list.h │ │ ├── dng_lossless_jpeg.h │ │ ├── dng_spline.h │ │ ├── dng_temperature.h │ │ ├── dng_file_stream.h │ │ ├── dng_jpeg_image.h │ │ ├── dng_xy_coord.cpp │ │ ├── dng_simple_image.h │ │ ├── dng_errors.h │ │ ├── dng_sdk_limits.h │ │ ├── dng_globals.h │ │ ├── dng_memory_stream.h │ │ ├── dng_tone_curve.cpp │ │ ├── dng_rational.cpp │ │ ├── dng_types.h │ │ ├── dng_rational.h │ │ ├── dng_classes.h │ │ ├── dng_string_list.cpp │ │ ├── dng_local_string.h │ │ ├── dng_tile_iterator.h │ │ ├── dng_mutex.h │ │ ├── dng_assertions.h │ │ ├── dng_1d_table.h │ │ ├── dng_file_stream.cpp │ │ ├── dng_opcode_list.h │ │ ├── dng_xy_coord.h │ │ ├── dng_ref_counted_block.cpp │ │ ├── dng_string.h │ │ ├── dng_rect.cpp │ │ ├── dng_filter_task.cpp │ │ ├── dng_1d_function.cpp │ │ ├── dng_1d_table.cpp │ │ ├── dng_color_spec.h │ │ ├── dng_iptc.h │ │ ├── dng_simple_image.cpp │ │ └── dng_orientation.h ├── md5 │ ├── CMakeLists.txt │ └── MD5.h ├── CMakeLists.txt ├── xmp-sdk │ ├── build │ │ └── XMP_BuildInfo.h │ ├── source │ │ ├── PerfUtils.hpp │ │ ├── IOUtils.hpp │ │ ├── ExpatAdapter.hpp │ │ ├── XMP_ProgressTracker.hpp │ │ ├── XMPFiles_IO.hpp │ │ ├── Endian.h │ │ ├── IOUtils.cpp │ │ └── UnicodeInlines.incl_cpp │ ├── BSD-License.txt │ ├── public │ │ └── include │ │ │ ├── XMP_Version.h │ │ │ ├── XMP.incl_cpp │ │ │ ├── client-glue │ │ │ └── WXMPIterator.hpp │ │ │ └── XMP.hpp │ ├── CMakeLists.txt │ └── XMPCore │ │ └── source │ │ └── XMPIterator.hpp ├── dnghost.h └── dnghost.cpp ├── CMakeLists.txt ├── raw2dng ├── config.h.cmake ├── raw2dng.h ├── vendorProcessors │ ├── FujiProcessor.h │ ├── variousVendorProcessor.h │ ├── ILCE7processor.h │ ├── DNGprocessor.h │ ├── FujiProcessor.cpp │ └── DNGprocessor.cpp ├── CMakeLists.txt ├── rawConverter.h └── negativeProcessor.h ├── README.md ├── COPYRIGHT └── cmake-modules ├── FindExiv2.cmake └── FindLibRaw.cmake /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | raw2dng/config.h 3 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_utils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fimagena/raw2dng/HEAD/libdng/dng-sdk/source/dng_utils.cpp -------------------------------------------------------------------------------- /libdng/md5/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ======================================================= 2 | # MD5 source code. 3 | 4 | ADD_LIBRARY( md5 STATIC MD5.cpp ) 5 | TARGET_COMPILE_OPTIONS( md5 PRIVATE -w ) 6 | TARGET_INCLUDE_DIRECTORIES( md5 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) 7 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT( raw2dng ) 2 | 3 | CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) 4 | 5 | # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked 6 | SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules") 7 | 8 | ADD_COMPILE_OPTIONS( -Wall ) 9 | 10 | ADD_SUBDIRECTORY( libdng ) 11 | ADD_SUBDIRECTORY( raw2dng ) 12 | -------------------------------------------------------------------------------- /raw2dng/config.h.cmake: -------------------------------------------------------------------------------- 1 | 2 | // the configured options and settings for raw2dng 3 | #define RAW2DNG_VERSION_MAJOR @RAW2DNG_VERSION_MAJOR@ 4 | #define RAW2DNG_VERSION_MINOR @RAW2DNG_VERSION_MINOR@ 5 | #define RAW2DNG_VERSION_PATCH @RAW2DNG_VERSION_PATCH@ 6 | 7 | #define RAW2DNG_VERSION_MAKE(a,b,c) #a"."#b"."#c 8 | #define _RAW2DNG_VERSION_MAKE(a,b,c) RAW2DNG_VERSION_MAKE(a,b,c) 9 | #define RAW2DNG_VERSION_STR _RAW2DNG_VERSION_MAKE(RAW2DNG_VERSION_MAJOR,RAW2DNG_VERSION_MINOR,RAW2DNG_VERSION_PATCH) 10 | -------------------------------------------------------------------------------- /libdng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(md5) 2 | ADD_SUBDIRECTORY(xmp-sdk) 3 | ADD_SUBDIRECTORY(dng-sdk) 4 | 5 | FIND_PACKAGE(Threads) 6 | 7 | # ======================================================= 8 | # libdng source code 9 | 10 | ADD_LIBRARY( dng STATIC ${CMAKE_CURRENT_SOURCE_DIR}/dnghost.cpp ) 11 | 12 | TARGET_INCLUDE_DIRECTORIES( dng INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) 13 | TARGET_COMPILE_DEFINITIONS( dng PRIVATE -DkLocalUseThreads=1 ) 14 | TARGET_COMPILE_OPTIONS( dng PRIVATE -fexceptions -std=c++11 ) 15 | 16 | TARGET_LINK_LIBRARIES( dng dng-sdk ${CMAKE_THREAD_LIBS_INIT} ) 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # raw2dng 2 | Linux utility for converting raw photo files into DNG, TIFF and JPEG formats. 3 | 4 | While this will happily convert most raw formats, it is especially optimised 5 | for Sony's A7 (ILCE-7) camera. For that camera it produces identical output 6 | to Adobe's DNG converter (not bit-wise but metadata), including decoding the 7 | build-in lens correction profiles, etc. 8 | 9 | **Compile:** `cmake`, `make`, `make install` 10 | 11 | **Dependencies:** 12 | - libexiv2 (tested with v0.25) 13 | - libraw (tested with 0.17.1) 14 | - Adobe's DNG and XMP SDKs (included in source tree - v1.4 / v201412) 15 | - libexpat 16 | - libjpeg 17 | - zlib 18 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_point.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_point.h" 10 | 11 | /*****************************************************************************/ 12 | 13 | // Currently all inlined. 14 | 15 | /*****************************************************************************/ 16 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/build/XMP_BuildInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef __XMP_BuildInfo_h__ 2 | #define __XMP_BuildInfo_h__ 1 3 | 4 | /* 5 | // ================================================================================================= 6 | // Copyright 2002 Adobe Systems Incorporated 7 | // All Rights Reserved. 8 | // 9 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 10 | // of the Adobe license agreement accompanying it. 11 | // ================================================================================================= 12 | */ 13 | 14 | #define kXMP_Copyright Copyright (c) 2013 15 | #define kXMP_CopyrightStr "Copyright (c) 2013" 16 | 17 | #endif /* __XMP_BuildInfo_h__ */ 18 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | ** raw2dng: DNG converter library ** 2 | 3 | Copyright (C) 2015 Fimagena (fimagena at gmail dot com) 4 | 5 | raw2dng is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU Library General Public License as 7 | published by the Free Software Foundation; either version 2 of 8 | the License, or (at your option) any later version. 9 | 10 | raw2dng uses code from dngconvert (https://github.com/jmue/dngconvert), copyright 11 | 2011 by Jens Mueller (tschensinger at gmx dot de) 12 | 13 | raw2dng uses code from dng_threaded_host.cpp -- Sandy McGuffog CornerFix utility 14 | (http://sourceforge.net/projects/cornerfix, sandy dot cornerfix at gmail dot com), 15 | dng_threaded_host.cpp is copyright 2007-2011, by Sandy McGuffog and Contributors. 16 | 17 | raw2dng uses code from dngwriter.cpp -- KDE Kipi-plugins dngconverter utility 18 | (https://projects.kde.org/projects/extragear/graphics/kipi-plugins) utility, 19 | dngwriter.cpp is Copyright 2008-2010 by Gilles Caulier 20 | and Jens Mueller 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_fast_module.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Include file to set optimization to highest level for performance-critical routines. 11 | * Normal files should have otpimization set to normal level to save code size as there is less 12 | * cache pollution this way. 13 | */ 14 | 15 | /*****************************************************************************/ 16 | 17 | // Include this file in modules that contain routines that should be as fast 18 | // as possible, even at the expense of slight code size increases. 19 | 20 | /*****************************************************************************/ 21 | 22 | #ifdef _MSC_VER 23 | #pragma optimize ("t", on) 24 | #endif 25 | 26 | /*****************************************************************************/ 27 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_uncopyable.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2012-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_uncopyable__ 10 | #define __dng_uncopyable__ 11 | 12 | /*****************************************************************************/ 13 | 14 | // Virtual base class to prevent object copies. 15 | 16 | class dng_uncopyable 17 | { 18 | 19 | protected: 20 | 21 | dng_uncopyable () 22 | { 23 | } 24 | 25 | ~dng_uncopyable () 26 | { 27 | } 28 | 29 | private: 30 | 31 | dng_uncopyable (const dng_uncopyable &); 32 | 33 | dng_uncopyable & operator= (const dng_uncopyable &); 34 | 35 | }; 36 | 37 | /*****************************************************************************/ 38 | 39 | #endif // __dng_uncopyable__ 40 | 41 | /*****************************************************************************/ 42 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_tag_types.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_tag_types__ 10 | #define __dng_tag_types__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_types.h" 15 | 16 | /*****************************************************************************/ 17 | 18 | enum 19 | { 20 | ttByte = 1, 21 | ttAscii, 22 | ttShort, 23 | ttLong, 24 | ttRational, 25 | ttSByte, 26 | ttUndefined, 27 | ttSShort, 28 | ttSLong, 29 | ttSRational, 30 | ttFloat, 31 | ttDouble, 32 | ttIFD, 33 | ttUnicode, 34 | ttComplex 35 | }; 36 | 37 | /*****************************************************************************/ 38 | 39 | uint32 TagTypeSize (uint32 tagType); 40 | 41 | /*****************************************************************************/ 42 | 43 | #endif 44 | 45 | /*****************************************************************************/ 46 | -------------------------------------------------------------------------------- /raw2dng/raw2dng.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2017 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | void raw2dng(std::string rawFilename, std::string outFilename, std::string dcpFilename, bool embedOriginal); 25 | void raw2tiff(std::string rawFilename, std::string outFilename, std::string dcpFilename); 26 | void raw2jpeg(std::string rawFilename, std::string outFilename, std::string dcpFilename); 27 | 28 | void registerPublisher(std::function function); 29 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_tag_types.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_tag_types.h" 10 | 11 | /*****************************************************************************/ 12 | 13 | uint32 TagTypeSize (uint32 tagType) 14 | { 15 | 16 | switch (tagType) 17 | { 18 | 19 | case ttByte: 20 | case ttAscii: 21 | case ttSByte: 22 | case ttUndefined: 23 | { 24 | return 1; 25 | } 26 | 27 | case ttShort: 28 | case ttSShort: 29 | case ttUnicode: 30 | { 31 | return 2; 32 | } 33 | 34 | case ttLong: 35 | case ttSLong: 36 | case ttFloat: 37 | case ttIFD: 38 | { 39 | return 4; 40 | } 41 | 42 | case ttRational: 43 | case ttDouble: 44 | case ttSRational: 45 | case ttComplex: 46 | { 47 | return 8; 48 | } 49 | 50 | default: 51 | break; 52 | 53 | } 54 | 55 | return 0; 56 | 57 | } 58 | 59 | /*****************************************************************************/ 60 | -------------------------------------------------------------------------------- /libdng/dnghost.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the dngconvert project 2 | Copyright (C) 2011 Jens Mueller 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either 7 | version 2 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "dng_host.h" 23 | 24 | class DngHost : public dng_host { 25 | public: 26 | DngHost(dng_memory_allocator *allocator = NULL, dng_abort_sniffer *sniffer = NULL) {} 27 | ~DngHost(void) {} 28 | 29 | public: 30 | virtual void PerformAreaTask(dng_area_task &task, const dng_rect &area, dng_area_task_progress *progress = NULL); 31 | }; 32 | -------------------------------------------------------------------------------- /raw2dng/vendorProcessors/FujiProcessor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "../negativeProcessor.h" 22 | 23 | 24 | // TODO/FIXME: Fuji support is currently broken! 25 | 26 | class FujiProcessor : public NegativeProcessor { 27 | friend class NegativeProcessor; 28 | 29 | public: 30 | void setDNGPropertiesFromRaw(); 31 | void buildDNGImage(); 32 | 33 | protected: 34 | FujiProcessor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage); 35 | 36 | bool m_fujiRotate90; 37 | }; 38 | -------------------------------------------------------------------------------- /raw2dng/vendorProcessors/variousVendorProcessor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "../negativeProcessor.h" 22 | 23 | 24 | class VariousVendorProcessor : public NegativeProcessor { 25 | friend class NegativeProcessor; 26 | 27 | public: 28 | void setDNGPropertiesFromRaw(); 29 | void setExifFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 30 | 31 | protected: 32 | VariousVendorProcessor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage); 33 | }; 34 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/PerfUtils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __PerfUtils_hpp__ 2 | #define __PerfUtils_hpp__ 1 3 | 4 | // ================================================================================================= 5 | // Copyright 2006 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | #include "public/include/XMP_Environment.h" 13 | 14 | #if XMP_MacBuild 15 | #include 16 | #elif XMP_WinBuild 17 | #include 18 | #elif XMP_UNIXBuild | XMP_iOSBuild 19 | #include 20 | #endif 21 | 22 | namespace PerfUtils { 23 | 24 | #if XMP_WinBuild 25 | // typedef LARGE_INTEGER MomentValue; 26 | typedef LONGLONG MomentValue; 27 | static const MomentValue kZeroMoment = 0; 28 | #elif XMP_UNIXBuild 29 | typedef struct timespec MomentValue; 30 | static const MomentValue kZeroMoment = {0, 0}; 31 | #elif XMP_iOSBuild | XMP_MacBuild 32 | typedef uint64_t MomentValue; 33 | static const MomentValue kZeroMoment = 0; 34 | #endif 35 | 36 | const char * GetTimerInfo(); 37 | 38 | MomentValue NoteThisMoment(); 39 | 40 | double GetElapsedSeconds ( MomentValue start, MomentValue finish ); 41 | 42 | }; // PerfUtils 43 | 44 | #endif // __PerfUtils_hpp__ 45 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/IOUtils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __IOUtils_hpp__ 2 | #define __IOUtils_hpp__ 1 3 | 4 | // ================================================================================================= 5 | // Copyright 2013 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | 13 | #include "public/include/XMP_Environment.h" 14 | #include "public/include/XMP_Const.h" 15 | 16 | #include "source/XMP_LibUtils.hpp" 17 | 18 | //Helper class for common IO function 19 | class IOUtils 20 | { 21 | public: 22 | // Returns the list of folders or files matching particular string format in the given Directory 23 | static void GetMatchingChildren ( XMP_StringVector & matchingChildList, const XMP_VarString & rootPath, 24 | const XMP_StringVector & regExStringVec, XMP_Bool includeFolders, XMP_Bool includeFiles, XMP_Bool prefixRootPath ); 25 | 26 | // Returns the list of folders or files matching particular string format in the given Directory 27 | static void GetMatchingChildren ( XMP_StringVector & matchingChildList, const XMP_VarString & rootPath, 28 | const XMP_VarString & regExpStr, XMP_Bool includeFolders, XMP_Bool includeFiles, XMP_Bool prefixRootPath ); 29 | }; 30 | 31 | #endif // __IOUtils_hpp__ 32 | -------------------------------------------------------------------------------- /raw2dng/vendorProcessors/ILCE7processor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "../negativeProcessor.h" 22 | 23 | 24 | class ILCE7processor : public NegativeProcessor { 25 | friend class NegativeProcessor; 26 | 27 | public: 28 | void setDNGPropertiesFromRaw(); 29 | void setExifFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 30 | void setXmpFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 31 | 32 | protected: 33 | ILCE7processor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage); 34 | 35 | dng_memory_stream* createDNGPrivateTag(); 36 | }; 37 | -------------------------------------------------------------------------------- /raw2dng/vendorProcessors/DNGprocessor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "../negativeProcessor.h" 22 | 23 | 24 | class DNGprocessor : public NegativeProcessor { 25 | friend class NegativeProcessor; 26 | 27 | public: 28 | void setDNGPropertiesFromRaw(); 29 | void setCameraProfile(const char *dcpFilename); 30 | void setExifFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 31 | void setXmpFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 32 | void backupProprietaryData(); 33 | void buildDNGImage(); 34 | 35 | protected: 36 | DNGprocessor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage); 37 | }; 38 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_globals.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_globals.h" 10 | #include "dng_simd_type.h" 11 | 12 | /*****************************************************************************/ 13 | 14 | #if qDNGValidate 15 | 16 | bool gVerbose = false; 17 | 18 | uint32 gDumpLineLimit = 100; 19 | 20 | #endif 21 | 22 | /******************************************************************************/ 23 | 24 | bool gDNGUseFakeTimeZonesInXMP = false; 25 | 26 | /*****************************************************************************/ 27 | 28 | bool gDNGShowTimers = true; 29 | 30 | /*****************************************************************************/ 31 | 32 | uint32 gDNGStreamBlockSize = 4096; 33 | 34 | uint32 gDNGMaxStreamBufferSize = 1024 * 1024; 35 | 36 | /*****************************************************************************/ 37 | 38 | bool gImagecore = false; 39 | 40 | bool gPrintTimings = false; 41 | 42 | bool gPrintAsserts = true; 43 | 44 | bool gBreakOnAsserts = true; 45 | 46 | /*****************************************************************************/ 47 | 48 | // This is declared in dng_simd_type.h 49 | 50 | SIMDType gDNGMaxSIMD = Scalar; 51 | 52 | /*****************************************************************************/ 53 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/BSD-License.txt: -------------------------------------------------------------------------------- 1 | The BSD License 2 | 3 | Copyright (c) 1999 - 2014, Adobe Systems Incorporated 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or 7 | without modification, are permitted provided that the following 8 | conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name of Adobe Systems Incorporated, nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_tone_curve.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2007-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Representation of 1-dimensional tone curve. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_tone_curve__ 16 | #define __dng_tone_curve__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_classes.h" 21 | #include "dng_memory.h" 22 | #include "dng_point.h" 23 | 24 | /*****************************************************************************/ 25 | 26 | class dng_tone_curve 27 | { 28 | 29 | public: 30 | 31 | dng_std_vector fCoord; 32 | 33 | public: 34 | 35 | dng_tone_curve (); 36 | 37 | bool operator== (const dng_tone_curve &curve) const; 38 | 39 | bool operator!= (const dng_tone_curve &curve) const 40 | { 41 | return !(*this == curve); 42 | } 43 | 44 | void SetNull (); 45 | 46 | bool IsNull () const; 47 | 48 | void SetInvalid (); 49 | 50 | bool IsValid () const; 51 | 52 | void Solve (dng_spline_solver &solver) const; 53 | 54 | }; 55 | 56 | /*****************************************************************************/ 57 | 58 | #endif 59 | 60 | /*****************************************************************************/ 61 | -------------------------------------------------------------------------------- /libdng/md5/MD5.h: -------------------------------------------------------------------------------- 1 | #ifndef __MD5_h__ 2 | #define __MD5_h__ 3 | 4 | /* 5 | * This is the header file for the MD5 message-digest algorithm. 6 | * The algorithm is due to Ron Rivest. This code was 7 | * written by Colin Plumb in 1993, no copyright is claimed. 8 | * This code is in the public domain; do with it what you wish. 9 | * 10 | * Equivalent code is available from RSA Data Security, Inc. 11 | * This code has been tested against that, and is equivalent, 12 | * except that you don't need to include two pages of legalese 13 | * with every copy. 14 | * 15 | * To compute the message digest of a chunk of bytes, declare an 16 | * MD5_CTX structure, pass it to MD5Init, call MD5Update as 17 | * needed on buffers full of bytes, and then call MD5Final, which 18 | * will fill a supplied 16-byte array with the digest. 19 | * 20 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 21 | * header definitions; now uses stuff from dpkg's config.h 22 | * - Ian Jackson . 23 | * Still in the public domain. 24 | */ 25 | 26 | #include 27 | 28 | #ifndef _MSC_VER 29 | #include 30 | #else 31 | /* MSVC doesn't provide C99 types, but it has MS specific variants */ 32 | typedef unsigned __int32 uint32_t; 33 | #endif 34 | 35 | typedef unsigned char md5byte; 36 | typedef uint32_t UWORD32; 37 | 38 | struct MD5_CTX { 39 | UWORD32 buf[4]; 40 | UWORD32 bytes[2]; 41 | UWORD32 in[16]; 42 | }; 43 | 44 | extern void MD5Init(struct MD5_CTX *context); 45 | extern void MD5Update(struct MD5_CTX *context, md5byte const *buf, unsigned len); 46 | extern void MD5Final(unsigned char digest[16], struct MD5_CTX *context); 47 | extern void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_bottlenecks.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_bottlenecks.h" 10 | 11 | #include "dng_reference.h" 12 | 13 | /*****************************************************************************/ 14 | 15 | dng_suite gDNGSuite = 16 | { 17 | RefZeroBytes, 18 | RefCopyBytes, 19 | RefSwapBytes16, 20 | RefSwapBytes32, 21 | RefSetArea8, 22 | RefSetArea, 23 | RefSetArea, 24 | RefCopyArea8, 25 | RefCopyArea16, 26 | RefCopyArea32, 27 | RefCopyArea8_16, 28 | RefCopyArea8_S16, 29 | RefCopyArea8_32, 30 | RefCopyArea16_S16, 31 | RefCopyArea16_32, 32 | RefCopyArea8_R32, 33 | RefCopyArea16_R32, 34 | RefCopyAreaS16_R32, 35 | RefCopyAreaR32_8, 36 | RefCopyAreaR32_16, 37 | RefCopyAreaR32_S16, 38 | RefRepeatArea8, 39 | RefRepeatArea16, 40 | RefRepeatArea32, 41 | RefShiftRight16, 42 | RefBilinearRow16, 43 | RefBilinearRow32, 44 | RefBaselineABCtoRGB, 45 | RefBaselineABCDtoRGB, 46 | RefBaselineHueSatMap, 47 | RefBaselineRGBtoGray, 48 | RefBaselineRGBtoRGB, 49 | RefBaseline1DTable, 50 | RefBaselineRGBTone, 51 | RefResampleDown16, 52 | RefResampleDown32, 53 | RefResampleAcross16, 54 | RefResampleAcross32, 55 | RefEqualBytes, 56 | RefEqualArea8, 57 | RefEqualArea16, 58 | RefEqualArea32, 59 | RefVignetteMask16, 60 | RefVignette16, 61 | RefVignette32, 62 | RefMapArea16, 63 | RefBaselineMapPoly32 64 | }; 65 | 66 | /*****************************************************************************/ 67 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_string_list.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_string_list__ 10 | #define __dng_string_list__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_classes.h" 15 | #include "dng_types.h" 16 | #include "dng_uncopyable.h" 17 | 18 | /*****************************************************************************/ 19 | 20 | class dng_string_list: private dng_uncopyable 21 | { 22 | 23 | private: 24 | 25 | uint32 fCount; 26 | 27 | uint32 fAllocated; 28 | 29 | dng_string **fList; 30 | 31 | public: 32 | 33 | dng_string_list (); 34 | 35 | ~dng_string_list (); 36 | 37 | uint32 Count () const 38 | { 39 | return fCount; 40 | } 41 | 42 | dng_string & operator[] (uint32 index) 43 | { 44 | return *(fList [index]); 45 | } 46 | 47 | const dng_string & operator[] (uint32 index) const 48 | { 49 | return *(fList [index]); 50 | } 51 | 52 | void Allocate (uint32 minSize); 53 | 54 | void Insert (uint32 index, 55 | const dng_string &s); 56 | 57 | void Append (const dng_string &s) 58 | { 59 | Insert (Count (), s); 60 | } 61 | 62 | bool Contains (const dng_string &s) const; 63 | 64 | void Clear (); 65 | 66 | }; 67 | 68 | /*****************************************************************************/ 69 | 70 | #endif 71 | 72 | /*****************************************************************************/ 73 | -------------------------------------------------------------------------------- /raw2dng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # add the automatically determined parts of the RPATH 2 | # which point to directories outside the build tree to the install RPATH 3 | SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 4 | 5 | # The version number. 6 | SET(RAW2DNG_VERSION_MAJOR 1) 7 | SET(RAW2DNG_VERSION_MINOR 2) 8 | SET(RAW2DNG_VERSION_PATCH 2) 9 | 10 | # configure a header file to pass some of the CMake settings 11 | # to the source code 12 | CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" 13 | "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) 14 | 15 | SET( EXIV2_MIN_VERSION "0.27" ) 16 | FIND_PACKAGE( Exiv2 ) 17 | INCLUDE_DIRECTORIES( ${EXIV2_INCLUDE_DIR} ) 18 | ADD_DEFINITIONS( ${EXIV2_DEFINITIONS}) 19 | 20 | SET( LIBRAW_MIN_VERSION "0.17" ) 21 | FIND_PACKAGE( LibRaw ) 22 | INCLUDE_DIRECTORIES( ${LIBRAW_INCLUDE_DIR} ) 23 | ADD_DEFINITIONS(${LIBRAW_DEFINITIONS}) 24 | 25 | FIND_PACKAGE( ZLIB ) 26 | INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} ) 27 | ADD_DEFINITIONS( ${ZLIB_DEFINITIONS} ) 28 | 29 | INCLUDE_DIRECTORIES( ${raw2dng_SOURCE_DIR}/libdng 30 | ${raw2dng_SOURCE_DIR}/libdng/dng-sdk/source 31 | ${CMAKE_CURRENT_BINARY_DIR} ) 32 | 33 | ADD_EXECUTABLE( raw2dng 34 | ${CMAKE_CURRENT_SOURCE_DIR}/raw2dng.cpp 35 | ${CMAKE_CURRENT_SOURCE_DIR}/negativeProcessor.cpp 36 | ${CMAKE_CURRENT_SOURCE_DIR}/rawConverter.cpp 37 | ${CMAKE_CURRENT_SOURCE_DIR}/vendorProcessors/DNGprocessor.cpp 38 | ${CMAKE_CURRENT_SOURCE_DIR}/vendorProcessors/ILCE7processor.cpp 39 | ${CMAKE_CURRENT_SOURCE_DIR}/vendorProcessors/FujiProcessor.cpp 40 | ${CMAKE_CURRENT_SOURCE_DIR}/vendorProcessors/variousVendorProcessor.cpp ) 41 | 42 | TARGET_LINK_LIBRARIES( raw2dng dng ${ZLIB_LIBRARIES} ${LIBRAW_LIBRARIES} ${EXIV2_LIBRARIES} ) 43 | TARGET_COMPILE_OPTIONS( raw2dng PRIVATE -fexceptions -std=c++11 ) 44 | 45 | INSTALL(TARGETS raw2dng DESTINATION bin) 46 | -------------------------------------------------------------------------------- /raw2dng/rawConverter.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "negativeProcessor.h" 22 | 23 | #include 24 | #include 25 | 26 | #include "dng_auto_ptr.h" 27 | #include "dng_preview.h" 28 | #include "dng_string.h" 29 | #include "dng_date_time.h" 30 | 31 | 32 | class RawConverter { 33 | public: 34 | RawConverter(); 35 | virtual ~RawConverter(); 36 | 37 | void openRawFile(const std::string rawFilename); 38 | void buildNegative(const std::string dcpFilename); 39 | void embedRaw(const std::string rawFilename); 40 | void renderImage(); 41 | void renderPreviews(); 42 | 43 | void writeDng (const std::string outFilename); 44 | void writeTiff(const std::string outFilename); 45 | void writeJpeg(const std::string outFilename); 46 | 47 | static void registerPublisher(std::function function); 48 | 49 | private: 50 | AutoPtr m_host; 51 | AutoPtr m_negProcessor; 52 | AutoPtr m_previewList; 53 | 54 | dng_string m_appName, m_appVersion; 55 | dng_date_time_info m_dateTimeNow; 56 | 57 | static std::function m_publishFunction; 58 | }; 59 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_lossless_jpeg.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Functions for encoding and decoding lossless JPEG format. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_lossless_jpeg__ 16 | #define __dng_lossless_jpeg__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_classes.h" 21 | #include "dng_types.h" 22 | 23 | /*****************************************************************************/ 24 | 25 | class dng_spooler 26 | { 27 | 28 | protected: 29 | 30 | virtual ~dng_spooler () 31 | { 32 | } 33 | 34 | public: 35 | 36 | virtual void Spool (const void *data, 37 | uint32 count) = 0; 38 | 39 | }; 40 | 41 | /*****************************************************************************/ 42 | 43 | void DecodeLosslessJPEG (dng_stream &stream, 44 | dng_spooler &spooler, 45 | uint32 minDecodedSize, 46 | uint32 maxDecodedSize, 47 | bool bug16, 48 | uint64 endOfData); 49 | 50 | /*****************************************************************************/ 51 | 52 | void EncodeLosslessJPEG (const uint16 *srcData, 53 | uint32 srcRows, 54 | uint32 srcCols, 55 | uint32 srcChannels, 56 | uint32 srcBitDepth, 57 | int32 srcRowStep, 58 | int32 srcColStep, 59 | dng_stream &stream); 60 | 61 | /*****************************************************************************/ 62 | 63 | #endif 64 | 65 | /*****************************************************************************/ 66 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_spline.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_spline__ 10 | #define __dng_spline__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_1d_function.h" 15 | #include "dng_memory.h" 16 | 17 | /*****************************************************************************/ 18 | 19 | inline real64 EvaluateSplineSegment (real64 x, 20 | real64 x0, 21 | real64 y0, 22 | real64 s0, 23 | real64 x1, 24 | real64 y1, 25 | real64 s1) 26 | { 27 | 28 | real64 A = x1 - x0; 29 | 30 | real64 B = (x - x0) / A; 31 | 32 | real64 C = (x1 - x) / A; 33 | 34 | real64 D = ((y0 * (2.0 - C + B) + (s0 * A * B)) * (C * C)) + 35 | ((y1 * (2.0 - B + C) - (s1 * A * C)) * (B * B)); 36 | 37 | return D; 38 | 39 | } 40 | 41 | /*****************************************************************************/ 42 | 43 | class dng_spline_solver: public dng_1d_function 44 | { 45 | 46 | protected: 47 | 48 | dng_std_vector X; 49 | dng_std_vector Y; 50 | 51 | dng_std_vector S; 52 | 53 | public: 54 | 55 | dng_spline_solver (); 56 | 57 | virtual ~dng_spline_solver (); 58 | 59 | void Reset (); 60 | 61 | void Add (real64 x, real64 y); 62 | 63 | virtual void Solve (); 64 | 65 | virtual bool IsIdentity () const; 66 | 67 | virtual real64 Evaluate (real64 x) const; 68 | 69 | }; 70 | 71 | /*****************************************************************************/ 72 | 73 | #endif 74 | 75 | /*****************************************************************************/ 76 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/ExpatAdapter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __ExpatAdapter_hpp__ 2 | #define __ExpatAdapter_hpp__ 3 | 4 | // ================================================================================================= 5 | // Copyright 2005 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | #include "public/include/XMP_Environment.h" // ! Must be the first #include! 13 | #include "source/XMLParserAdapter.hpp" 14 | 15 | // ================================================================================================= 16 | // Derived XML parser adapter for Expat. 17 | // ================================================================================================= 18 | 19 | #ifndef BanAllEntityUsage 20 | #define BanAllEntityUsage 0 21 | #endif 22 | 23 | struct XML_ParserStruct; // ! Hack to avoid exposing expat.h to all clients. 24 | typedef struct XML_ParserStruct *XML_Parser; 25 | 26 | class ExpatAdapter : public XMLParserAdapter { 27 | public: 28 | 29 | XML_Parser parser; 30 | XMP_NamespaceTable * registeredNamespaces; 31 | 32 | #if BanAllEntityUsage 33 | bool isAborted; 34 | #endif 35 | 36 | #if XMP_DebugBuild 37 | size_t elemNesting; 38 | #endif 39 | 40 | static const bool kUseGlobalNamespaces = true; 41 | static const bool kUseLocalNamespaces = false; 42 | 43 | ExpatAdapter ( bool useGlobalNamespaces ); 44 | virtual ~ExpatAdapter(); 45 | 46 | void ParseBuffer ( const void * buffer, size_t length, bool last = true ); 47 | 48 | private: 49 | 50 | ExpatAdapter() : registeredNamespaces(0) {}; // ! Force use of constructor with namespace parameter. 51 | 52 | }; 53 | 54 | extern "C" ExpatAdapter * 55 | XMP_PUBLIC XMP_NewExpatAdapter ( bool useGlobalNamespaces ); 56 | 57 | // ================================================================================================= 58 | 59 | #endif // __ExpatAdapter_hpp__ 60 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_temperature.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Representation of color temperature and offset (tint) using black body 11 | * radiator definition. 12 | */ 13 | 14 | #ifndef __dng_temperature__ 15 | #define __dng_temperature__ 16 | 17 | /*****************************************************************************/ 18 | 19 | #include "dng_classes.h" 20 | #include "dng_types.h" 21 | 22 | /*****************************************************************************/ 23 | 24 | class dng_temperature 25 | { 26 | 27 | private: 28 | 29 | real64 fTemperature; 30 | 31 | real64 fTint; 32 | 33 | public: 34 | 35 | dng_temperature () 36 | 37 | : fTemperature (0.0) 38 | , fTint (0.0) 39 | 40 | { 41 | } 42 | 43 | dng_temperature (real64 temperature, 44 | real64 tint) 45 | 46 | : fTemperature (temperature) 47 | , fTint (tint ) 48 | 49 | { 50 | 51 | } 52 | 53 | dng_temperature (const dng_xy_coord &xy) 54 | 55 | : fTemperature (0.0) 56 | , fTint (0.0) 57 | 58 | { 59 | Set_xy_coord (xy); 60 | } 61 | 62 | void SetTemperature (real64 temperature) 63 | { 64 | fTemperature = temperature; 65 | } 66 | 67 | real64 Temperature () const 68 | { 69 | return fTemperature; 70 | } 71 | 72 | void SetTint (real64 tint) 73 | { 74 | fTint = tint; 75 | } 76 | 77 | real64 Tint () const 78 | { 79 | return fTint; 80 | } 81 | 82 | void Set_xy_coord (const dng_xy_coord &xy); 83 | 84 | dng_xy_coord Get_xy_coord () const; 85 | 86 | }; 87 | 88 | /*****************************************************************************/ 89 | 90 | #endif 91 | 92 | /*****************************************************************************/ 93 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_file_stream.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Simple, portable, file read/write support. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_file_stream__ 16 | #define __dng_file_stream__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_stream.h" 21 | 22 | /*****************************************************************************/ 23 | 24 | /// \brief A stream to/from a disk file. See dng_stream for read/write interface 25 | 26 | class dng_file_stream: public dng_stream 27 | { 28 | 29 | private: 30 | 31 | FILE *fFile; 32 | 33 | public: 34 | 35 | /// Open a stream on a file. 36 | /// \param filename Pathname in platform synax. 37 | /// \param output Set to true if writing, false otherwise. 38 | /// \param bufferSize size of internal buffer to use. Defaults to 4k. 39 | 40 | dng_file_stream (const char *filename, 41 | bool output = false, 42 | uint32 bufferSize = kDefaultBufferSize); 43 | 44 | #if qWinOS 45 | 46 | dng_file_stream (const wchar_t *filename, 47 | bool output = false, 48 | uint32 bufferSize = kDefaultBufferSize); 49 | 50 | #endif // qWinOS 51 | 52 | virtual ~dng_file_stream (); 53 | 54 | protected: 55 | 56 | virtual uint64 DoGetLength (); 57 | 58 | virtual void DoRead (void *data, 59 | uint32 count, 60 | uint64 offset); 61 | 62 | virtual void DoWrite (const void *data, 63 | uint32 count, 64 | uint64 offset); 65 | 66 | }; 67 | 68 | /*****************************************************************************/ 69 | 70 | #endif 71 | 72 | /*****************************************************************************/ 73 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_jpeg_image.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2011-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_jpeg_image__ 10 | #define __dng_jpeg_image__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_auto_ptr.h" 15 | #include "dng_memory.h" 16 | #include "dng_point.h" 17 | 18 | /*****************************************************************************/ 19 | 20 | typedef AutoPtr dng_jpeg_image_tile_ptr; 21 | 22 | /*****************************************************************************/ 23 | 24 | class dng_jpeg_image 25 | { 26 | 27 | public: 28 | 29 | dng_point fImageSize; 30 | 31 | dng_point fTileSize; 32 | 33 | bool fUsesStrips; 34 | 35 | AutoPtr fJPEGTables; 36 | 37 | AutoArray fJPEGData; 38 | 39 | public: 40 | 41 | dng_jpeg_image (); 42 | 43 | uint32 TilesAcross () const 44 | { 45 | if (fTileSize.h) 46 | { 47 | return (fImageSize.h + fTileSize.h - 1) / fTileSize.h; 48 | } 49 | else 50 | { 51 | return 0; 52 | } 53 | } 54 | 55 | uint32 TilesDown () const 56 | { 57 | if (fTileSize.v) 58 | { 59 | return (fImageSize.v + fTileSize.v - 1) / fTileSize.v; 60 | } 61 | else 62 | { 63 | return 0; 64 | } 65 | } 66 | 67 | uint32 TileCount () const 68 | { 69 | return TilesAcross () * TilesDown (); 70 | } 71 | 72 | void Encode (dng_host &host, 73 | const dng_negative &negative, 74 | dng_image_writer &writer, 75 | const dng_image &image); 76 | 77 | dng_fingerprint FindDigest (dng_host &host) const; 78 | 79 | }; 80 | 81 | /*****************************************************************************/ 82 | 83 | #endif 84 | 85 | /*****************************************************************************/ 86 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_xy_coord.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_xy_coord.h" 10 | 11 | #include "dng_matrix.h" 12 | #include "dng_utils.h" 13 | 14 | /******************************************************************************/ 15 | 16 | dng_xy_coord XYZtoXY (const dng_vector_3 &coord) 17 | { 18 | 19 | real64 X = coord [0]; 20 | real64 Y = coord [1]; 21 | real64 Z = coord [2]; 22 | 23 | real64 total = X + Y + Z; 24 | 25 | if (total > 0.0) 26 | { 27 | 28 | return dng_xy_coord (X / total, 29 | Y / total); 30 | 31 | } 32 | 33 | return D50_xy_coord (); 34 | 35 | } 36 | 37 | /*****************************************************************************/ 38 | 39 | dng_vector_3 XYtoXYZ (const dng_xy_coord &coord) 40 | { 41 | 42 | dng_xy_coord temp = coord; 43 | 44 | // Restrict xy coord to someplace inside the range of real xy coordinates. 45 | // This prevents math from doing strange things when users specify 46 | // extreme temperature/tint coordinates. 47 | 48 | temp.x = Pin_real64 (0.000001, temp.x, 0.999999); 49 | temp.y = Pin_real64 (0.000001, temp.y, 0.999999); 50 | 51 | if (temp.x + temp.y > 0.999999) 52 | { 53 | real64 scale = 0.999999 / (temp.x + temp.y); 54 | temp.x *= scale; 55 | temp.y *= scale; 56 | } 57 | 58 | return dng_vector_3 (temp.x / temp.y, 59 | 1.0, 60 | (1.0 - temp.x - temp.y) / temp.y); 61 | 62 | } 63 | 64 | /*****************************************************************************/ 65 | 66 | dng_xy_coord PCStoXY () 67 | { 68 | 69 | return D50_xy_coord (); 70 | 71 | } 72 | 73 | /*****************************************************************************/ 74 | 75 | dng_vector_3 PCStoXYZ () 76 | { 77 | 78 | return XYtoXYZ (PCStoXY ()); 79 | 80 | } 81 | 82 | /*****************************************************************************/ 83 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_simple_image.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_simple_image__ 10 | #define __dng_simple_image__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_auto_ptr.h" 15 | #include "dng_image.h" 16 | #include "dng_pixel_buffer.h" 17 | 18 | /*****************************************************************************/ 19 | 20 | /// dng_image derived class with simple Trim and Rotate functionality. 21 | 22 | class dng_simple_image : public dng_image 23 | { 24 | 25 | protected: 26 | 27 | dng_pixel_buffer fBuffer; 28 | 29 | AutoPtr fMemory; 30 | 31 | dng_memory_allocator &fAllocator; 32 | 33 | public: 34 | 35 | dng_simple_image (const dng_rect &bounds, 36 | uint32 planes, 37 | uint32 pixelType, 38 | dng_memory_allocator &allocator); 39 | 40 | virtual ~dng_simple_image (); 41 | 42 | virtual dng_image * Clone () const; 43 | 44 | /// Setter for pixel type. 45 | 46 | virtual void SetPixelType (uint32 pixelType); 47 | 48 | /// Trim image data outside of given bounds. Memory is not reallocated or freed. 49 | 50 | virtual void Trim (const dng_rect &r); 51 | 52 | /// Rotate image according to orientation. 53 | 54 | virtual void Rotate (const dng_orientation &orientation); 55 | 56 | /// Get the buffer for direct processing. (Unique to dng_simple_image.) 57 | 58 | void GetPixelBuffer (dng_pixel_buffer &buffer) 59 | { 60 | buffer = fBuffer; 61 | } 62 | 63 | protected: 64 | 65 | virtual void AcquireTileBuffer (dng_tile_buffer &buffer, 66 | const dng_rect &area, 67 | bool dirty) const; 68 | 69 | }; 70 | 71 | /*****************************************************************************/ 72 | 73 | #endif 74 | 75 | /*****************************************************************************/ 76 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/public/include/XMP_Version.h: -------------------------------------------------------------------------------- 1 | #ifndef __XMP_Version_h__ 2 | #define __XMP_Version_h__ 1 3 | 4 | /* --------------------------------------------------------------------------------------------- */ 5 | /* ** IMPORTANT ** This file must be usable by strict ANSI C compilers. No "//" comments, etc. */ 6 | /* --------------------------------------------------------------------------------------------- */ 7 | 8 | /* 9 | // ================================================================================================= 10 | // Copyright 2002 Adobe Systems Incorporated 11 | // All Rights Reserved. 12 | // 13 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 14 | // of the Adobe license agreement accompanying it. 15 | // ================================================================================================= 16 | */ 17 | 18 | /* ============================================================================================= */ 19 | /** 20 | XMP Toolkit Version Information 21 | 22 | Version information for the XMP toolkit is stored in the executable and available through a runtime 23 | call, SXMPMeta::GetVersionInfo. In addition a static version number is defined in this 24 | header. The information in the executable or returned by SXMPMeta::GetVersionInfo is about 25 | the implementation internals, it is runtime version information. The values defined in this header 26 | describe the version of the API used at client compile time. They do not necessarily relate to the 27 | runtime version. 28 | 29 | Important: Do not display the static values defined here to users as the version of XMP in use. Do 30 | not base runtime decisions on just this static version. It is OK to compare the static and runtime 31 | versions. 32 | 33 | */ 34 | /* ============================================================================================= */ 35 | 36 | #define XMPCORE_API_VERSION_MAJOR 5 37 | #define XMPCORE_API_VERSION_MINOR 5 38 | #define XMPCORE_API_VERSION_MICRO 0 39 | 40 | #define XMPCORE_API_VERSION 5.5.0 41 | #define XMPCORE_API_VERSION_STRING "5.5.0" 42 | 43 | #define XMPFILES_API_VERSION_MAJOR 5 44 | #define XMPFILES_API_VERSION_MINOR 6 45 | #define XMPFILES_API_VERSION_MICRO 0 46 | 47 | #define XMPFILES_API_VERSION 5.6.0 48 | #define XMPFILES_API_VERSION_STRING "5.6.0" 49 | 50 | /* ============================================================================================= */ 51 | 52 | #endif /* __XMP_Version_h__ */ 53 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_errors.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Error code values. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_errors__ 16 | #define __dng_errors__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_types.h" 21 | 22 | /*****************************************************************************/ 23 | 24 | /// Type for all errors used in DNG SDK. Generally held inside a dng_exception. 25 | 26 | typedef int32 dng_error_code; 27 | 28 | enum 29 | { 30 | dng_error_none = 0, //!< No error. Success. 31 | dng_error_unknown = 100000, //!< Logic or program error or other unclassifiable error. 32 | dng_error_not_yet_implemented, //!< Functionality requested is not yet implemented. 33 | dng_error_silent, //!< An error which should not be signalled to user. 34 | dng_error_user_canceled, //!< Processing stopped by user (or host application) request 35 | dng_error_host_insufficient, //!< Necessary host functionality is not present. 36 | dng_error_memory, //!< Out of memory. 37 | dng_error_bad_format, //!< File format is not valid. 38 | dng_error_matrix_math, //!< Matrix has wrong shape, is badly conditioned, or similar problem. 39 | dng_error_open_file, //!< Could not open file. 40 | dng_error_read_file, //!< Error reading file. 41 | dng_error_write_file, //!< Error writing file. 42 | dng_error_end_of_file, //!< Unexpected end of file. 43 | dng_error_file_is_damaged, //!< File is damaged in some way. 44 | dng_error_image_too_big_dng, //!< Image is too big to save as DNG. 45 | dng_error_image_too_big_tiff, //!< Image is too big to save as TIFF. 46 | dng_error_unsupported_dng, //!< DNG version is unsupported. 47 | dng_error_overflow //!< Arithmetic overflow. 48 | }; 49 | 50 | /*****************************************************************************/ 51 | 52 | #endif 53 | 54 | /*****************************************************************************/ 55 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/XMP_ProgressTracker.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __XMP_ProgressTracker_hpp__ 2 | #define __XMP_ProgressTracker_hpp__ 1 3 | 4 | // ================================================================================================= 5 | // ADOBE SYSTEMS INCORPORATED 6 | // Copyright 2012 Adobe Systems Incorporated 7 | // All Rights Reserved 8 | // 9 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 10 | // of the Adobe license agreement accompanying it. 11 | // ================================================================================================= 12 | 13 | #include "public/include/XMP_Environment.h" // ! XMP_Environment.h must be the first included header. 14 | 15 | #include "public/include/XMP_Const.h" 16 | 17 | #include "source/PerfUtils.hpp" 18 | 19 | // ================================================================================================= 20 | 21 | class XMP_ProgressTracker { 22 | public: 23 | 24 | struct CallbackInfo { 25 | 26 | XMP_ProgressReportWrapper wrapperProc; 27 | XMP_ProgressReportProc clientProc; 28 | void * context; 29 | float interval; 30 | bool sendStartStop; 31 | 32 | void Clear() { this->wrapperProc = 0; this->clientProc = 0; 33 | this->context = 0; this->interval = 1.0; this->sendStartStop = false; }; 34 | CallbackInfo() { this->Clear(); }; 35 | CallbackInfo ( XMP_ProgressReportWrapper _wrapperProc, XMP_ProgressReportProc _clientProc, 36 | void * _context, float _interval, bool _sendStartStop ) 37 | : wrapperProc(_wrapperProc), clientProc(_clientProc), 38 | context(_context), interval(_interval), sendStartStop(_sendStartStop) {}; 39 | 40 | }; 41 | 42 | XMP_ProgressTracker ( const CallbackInfo & _cbInfo ); 43 | 44 | void BeginWork ( float _totalWork = 0.0 ); 45 | void AddTotalWork ( float workIncrement ); 46 | void AddWorkDone ( float workIncrement ); 47 | void WorkComplete(); 48 | 49 | bool WorkInProgress() { return this->workInProgress; }; 50 | 51 | ~XMP_ProgressTracker() {}; 52 | 53 | private: 54 | 55 | XMP_ProgressTracker() { this->Clear(); }; // Hidden on purpose. 56 | 57 | void Clear(); 58 | void NotifyClient ( bool isStartStop = false ); 59 | 60 | CallbackInfo cbInfo; 61 | bool workInProgress; 62 | float totalWork, workDone; 63 | PerfUtils::MomentValue startTime, prevTime; 64 | 65 | }; // XMP_ProgressTracker 66 | 67 | // ================================================================================================= 68 | 69 | #endif // __XMP_ProgressTracker_hpp__ 70 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FIND_PACKAGE( EXPAT ) 2 | INCLUDE_DIRECTORIES( ${EXPAT_INCLUDE_DIR} ) 3 | ADD_DEFINITIONS(${EXPAT_DEFINITIONS}) 4 | 5 | # ======================================================= 6 | # XMP SDK source code. 7 | 8 | ADD_LIBRARY( xmp-sdk STATIC 9 | ${CMAKE_CURRENT_SOURCE_DIR}/source/Host_IO-POSIX.cpp 10 | # ${CMAKE_CURRENT_SOURCE_DIR}/source/Host_IO-Win.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/source/IOUtils.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/source/PerfUtils.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/source/SafeStringAPIs.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/source/UnicodeConversions.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/source/XIO.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/source/XML_Node.cpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/source/XMP_LibUtils.cpp 18 | ${CMAKE_CURRENT_SOURCE_DIR}/source/XMP_ProgressTracker.cpp 19 | ${CMAKE_CURRENT_SOURCE_DIR}/source/XMPFiles_IO.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/ExpatAdapter.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/ParseRDF.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/WXMPIterator.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/WXMPMeta.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/WXMPUtils.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPCore_Impl.cpp 26 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPIterator.cpp 27 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPMeta-GetSet.cpp 28 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPMeta-Parse.cpp 29 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPMeta-Serialize.cpp 30 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPMeta.cpp 31 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPUtils-FileInfo.cpp 32 | ${CMAKE_CURRENT_SOURCE_DIR}/XMPCore/source/XMPUtils.cpp ) 33 | 34 | TARGET_INCLUDE_DIRECTORIES( xmp-sdk PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/public/include 35 | PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) 36 | TARGET_COMPILE_DEFINITIONS( xmp-sdk PUBLIC 37 | -DUNIX_ENV=1 # Windows is -DWIN_ENV=1 38 | # -XMP_64=1 # manually set 64-bit 39 | ) 40 | TARGET_COMPILE_OPTIONS( xmp-sdk PRIVATE -w ) 41 | 42 | TARGET_LINK_LIBRARIES( xmp-sdk PRIVATE md5 ${EXPAT_LIBRARIES} ) 43 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_sdk_limits.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Collection of constants detailing maximum values used in processing in the DNG SDK. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_sdk_limits__ 16 | #define __dng_sdk_limits__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_types.h" 21 | 22 | /*****************************************************************************/ 23 | 24 | /// The maximum number of previews (in addition to the main IFD's thumbnail) 25 | /// that we support embedded in a DNG. 26 | 27 | const uint32 kMaxDNGPreviews = 20; 28 | 29 | /// The maximum number of SubIFDs that will be parsed. 30 | 31 | const uint32 kMaxSubIFDs = kMaxDNGPreviews + 1; 32 | 33 | /// The maximum number of chained IFDs that will be parsed. 34 | 35 | const uint32 kMaxChainedIFDs = 10; 36 | 37 | /// The maximum number of samples per pixel. 38 | 39 | const uint32 kMaxSamplesPerPixel = 4; 40 | 41 | /// Maximum number of color planes. 42 | 43 | const uint32 kMaxColorPlanes = kMaxSamplesPerPixel; 44 | 45 | /// The maximum size of a CFA repeating pattern. 46 | 47 | const uint32 kMaxCFAPattern = 8; 48 | 49 | /// The maximum size of a black level repeating pattern. 50 | 51 | const uint32 kMaxBlackPattern = 8; 52 | 53 | /// The maximum number of masked area rectangles. 54 | 55 | const uint32 kMaxMaskedAreas = 4; 56 | 57 | /// The maximum image size supported (pixels per side). 58 | 59 | const uint32 kMaxImageSide = 65000; 60 | 61 | /// The maximum number of tone curve points supported. 62 | 63 | const uint32 kMaxToneCurvePoints = 8192; 64 | 65 | /// Maximum number of MP threads for dng_area_task operations. 66 | 67 | #if qDNG64Bit 68 | const uint32 kMaxMPThreads = 128; // EP! Needs much larger max! 69 | #else 70 | const uint32 kMaxMPThreads = 8; 71 | #endif 72 | 73 | /// Maximum supported value of Stage3BlackLevelNormalized. 74 | 75 | const real64 kMaxStage3BlackLevelNormalized = 0.2; 76 | 77 | /*****************************************************************************/ 78 | 79 | #endif 80 | 81 | /*****************************************************************************/ 82 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/public/include/XMP.incl_cpp: -------------------------------------------------------------------------------- 1 | #ifndef __XMP_incl_cpp__ 2 | #define __XMP_incl_cpp__ 1 3 | 4 | // ================================================================================================= 5 | // ADOBE SYSTEMS INCORPORATED 6 | // Copyright 2002 Adobe Systems Incorporated 7 | // All Rights Reserved 8 | // 9 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 10 | // of the Adobe license agreement accompanying it. 11 | // ================================================================================================= 12 | 13 | // ================================================================================================ 14 | /// \file XMP.incl_cpp 15 | /// \brief Overall client glue file for the XMP toolkit. 16 | /// 17 | /// This is an overall client source file of XMP toolkit glue, the only XMP-specific one that 18 | /// clients should build in projects. This ensures that all of the client-side glue code for the 19 | /// XMP toolkit gets compiled. 20 | /// 21 | /// You cannot compile this file directly, because the template's string type must be declared and 22 | /// only the client can do that. Instead, include this in some other source file. For example, 23 | /// to use std::string you only need these two lines: 24 | /// 25 | /// \code 26 | /// #include 27 | /// #include "XMP.incl_cpp" 28 | /// \endcode 29 | 30 | 31 | #include "XMP.hpp" // ! This must be the first include! 32 | 33 | #define XMP_ClientBuild 1 34 | 35 | #if XMP_WinBuild 36 | #if XMP_DebugBuild 37 | #pragma warning ( push, 4 ) 38 | #else 39 | #pragma warning ( push, 3 ) 40 | #endif 41 | 42 | #pragma warning ( disable : 4127 ) // conditional expression is constant 43 | #pragma warning ( disable : 4189 ) // local variable is initialized but not referenced 44 | #pragma warning ( disable : 4702 ) // unreachable code 45 | #pragma warning ( disable : 4800 ) // forcing value to bool 'true' or 'false' (performance warning) 46 | #endif 47 | 48 | #if defined ( TXMP_STRING_TYPE ) && (! TXMP_EXPAND_INLINE) 49 | 50 | // We're using a single out of line instantiation. Do it here. 51 | 52 | #include "client-glue/TXMPMeta.incl_cpp" 53 | #include "client-glue/TXMPIterator.incl_cpp" 54 | #include "client-glue/TXMPUtils.incl_cpp" 55 | template class TXMPMeta ; 56 | template class TXMPIterator ; 57 | template class TXMPUtils ; 58 | #if XMP_INCLUDE_XMPFILES 59 | #include "client-glue/TXMPFiles.incl_cpp" 60 | template class TXMPFiles ; 61 | #endif 62 | 63 | #endif 64 | 65 | #if XMP_WinBuild 66 | #pragma warning ( pop ) 67 | #endif 68 | 69 | #endif // __XMP_incl_cpp__ 70 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_globals.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Definitions of global variables controling DNG SDK behavior. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_globals__ 16 | #define __dng_globals__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_flags.h" 21 | #include "dng_types.h" 22 | 23 | /*****************************************************************************/ 24 | 25 | #if qDNGValidate 26 | 27 | /// When validation (qValidate) is turned on, this global enables verbose 28 | /// output about DNG tags and other properties. 29 | 30 | extern bool gVerbose; 31 | 32 | /// When validation (qValidate) is turned on, and verbose mode (gVerbose) is 33 | /// enabled, limits the number of lines of text that are dumped for each tag. 34 | 35 | extern uint32 gDumpLineLimit; 36 | 37 | #endif 38 | 39 | /*****************************************************************************/ 40 | 41 | // Print out results from dng_timers? 42 | 43 | extern bool gDNGShowTimers; 44 | 45 | /******************************************************************************/ 46 | 47 | // MWG says don't use fake time zones in XMP, but there is some 48 | // old software that requires them to work correctly. 49 | 50 | extern bool gDNGUseFakeTimeZonesInXMP; 51 | 52 | /*****************************************************************************/ 53 | 54 | // Stream block size. Choose a size that the OS likes for file system 55 | // efficent read/write alignment. 56 | 57 | extern uint32 gDNGStreamBlockSize; 58 | 59 | // Maximum stream buffer size to use on large reads and writes. 60 | 61 | extern uint32 gDNGMaxStreamBufferSize; 62 | 63 | /*****************************************************************************/ 64 | 65 | // Are we running as part of the imagecore library? 66 | 67 | extern bool gImagecore; 68 | 69 | // Print out timing info for area tasks? 70 | 71 | extern bool gPrintTimings; 72 | 73 | // Print assert messages? 74 | 75 | extern bool gPrintAsserts; 76 | 77 | // Break into debugger on asserts? 78 | 79 | extern bool gBreakOnAsserts; 80 | 81 | /*****************************************************************************/ 82 | 83 | #endif 84 | 85 | /*****************************************************************************/ 86 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_memory_stream.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Stream abstraction to/from in-memory data. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_memory_stream__ 16 | #define __dng_memory_stream__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_stream.h" 21 | 22 | /*****************************************************************************/ 23 | 24 | /// \brief A dng_stream which can be read from or written to memory. 25 | /// 26 | /// Stream is populated via writing and either read or accessed by asking for contents as a pointer. 27 | 28 | class dng_memory_stream: public dng_stream 29 | { 30 | 31 | protected: 32 | 33 | dng_memory_allocator &fAllocator; 34 | 35 | uint32 fPageSize; 36 | 37 | uint32 fPageCount; 38 | uint32 fPagesAllocated; 39 | 40 | dng_memory_block **fPageList; 41 | 42 | uint64 fMemoryStreamLength; 43 | 44 | uint64 fLengthLimit; 45 | 46 | public: 47 | 48 | /// Construct a new memory-based stream. 49 | /// \param allocator Allocator to use to allocate memory in stream as needed. 50 | /// \param sniffer If non-NULL used to check for user cancellation. 51 | /// \param pageSize Unit of allocation for data stored in stream. 52 | 53 | dng_memory_stream (dng_memory_allocator &allocator, 54 | dng_abort_sniffer *sniffer = NULL, 55 | uint32 pageSize = 64 * 1024); 56 | 57 | virtual ~dng_memory_stream (); 58 | 59 | /// Sets a maximum length limit. 60 | 61 | void SetLengthLimit (uint64 limit) 62 | { 63 | fLengthLimit = limit; 64 | } 65 | 66 | /// Copy a specified number of bytes to a target stream. 67 | /// \param dstStream The target stream. 68 | /// \param count The number of bytes to copy. 69 | 70 | virtual void CopyToStream (dng_stream &dstStream, 71 | uint64 count); 72 | 73 | protected: 74 | 75 | virtual uint64 DoGetLength (); 76 | 77 | virtual void DoRead (void *data, 78 | uint32 count, 79 | uint64 offset); 80 | 81 | virtual void DoSetLength (uint64 length); 82 | 83 | virtual void DoWrite (const void *data, 84 | uint32 count, 85 | uint64 offset); 86 | 87 | }; 88 | 89 | /*****************************************************************************/ 90 | 91 | #endif 92 | 93 | /*****************************************************************************/ 94 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_tone_curve.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2007-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_tone_curve.h" 10 | 11 | #include "dng_assertions.h" 12 | #include "dng_spline.h" 13 | #include "dng_utils.h" 14 | 15 | /******************************************************************************/ 16 | 17 | dng_tone_curve::dng_tone_curve () 18 | 19 | : fCoord () 20 | 21 | { 22 | 23 | SetNull (); 24 | 25 | } 26 | 27 | /******************************************************************************/ 28 | 29 | bool dng_tone_curve::operator== (const dng_tone_curve &curve) const 30 | { 31 | 32 | return fCoord == curve.fCoord; 33 | 34 | } 35 | 36 | /******************************************************************************/ 37 | 38 | void dng_tone_curve::SetNull () 39 | { 40 | 41 | fCoord.resize (2); 42 | 43 | fCoord [0].h = 0.0; 44 | fCoord [0].v = 0.0; 45 | 46 | fCoord [1].h = 1.0; 47 | fCoord [1].v = 1.0; 48 | 49 | } 50 | 51 | /******************************************************************************/ 52 | 53 | bool dng_tone_curve::IsNull () const 54 | { 55 | 56 | dng_tone_curve temp; 57 | 58 | return (*this == temp); 59 | 60 | } 61 | 62 | /******************************************************************************/ 63 | 64 | void dng_tone_curve::SetInvalid () 65 | { 66 | 67 | fCoord.clear (); 68 | 69 | } 70 | 71 | /******************************************************************************/ 72 | 73 | bool dng_tone_curve::IsValid () const 74 | { 75 | 76 | if (fCoord.size () < 2) 77 | { 78 | 79 | return false; 80 | 81 | } 82 | 83 | for (uint32 j = 0; j < fCoord.size (); j++) 84 | { 85 | 86 | if (fCoord [j] . h < 0.0 || fCoord [j] . h > 1.0 || 87 | fCoord [j] . v < 0.0 || fCoord [j] . v > 1.0) 88 | { 89 | 90 | return false; 91 | 92 | } 93 | 94 | if (j > 0) 95 | { 96 | 97 | if (fCoord [j] . h <= fCoord [j - 1] . h) 98 | { 99 | 100 | return false; 101 | 102 | } 103 | 104 | } 105 | 106 | } 107 | 108 | return true; 109 | 110 | } 111 | 112 | /******************************************************************************/ 113 | 114 | void dng_tone_curve::Solve (dng_spline_solver &solver) const 115 | { 116 | 117 | solver.Reset (); 118 | 119 | for (uint32 index = 0; index < fCoord.size (); index++) 120 | { 121 | 122 | solver.Add (fCoord [index].h, 123 | fCoord [index].v); 124 | 125 | } 126 | 127 | solver.Solve (); 128 | 129 | } 130 | 131 | /*****************************************************************************/ 132 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/public/include/client-glue/WXMPIterator.hpp: -------------------------------------------------------------------------------- 1 | #if ! __WXMPIterator_hpp__ 2 | #define __WXMPIterator_hpp__ 1 3 | 4 | // ================================================================================================= 5 | // Copyright 2002 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | #include "client-glue/WXMP_Common.hpp" 13 | 14 | #if __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | // ================================================================================================= 19 | 20 | #define zXMPIterator_PropCTor_1(xmpRef,schemaNS,propName,options) \ 21 | WXMPIterator_PropCTor_1 ( xmpRef, schemaNS, propName, options, &wResult ); 22 | 23 | #define zXMPIterator_TableCTor_1(schemaNS,propName,options) \ 24 | WXMPIterator_TableCTor_1 ( schemaNS, propName, options, &wResult ); 25 | 26 | 27 | #define zXMPIterator_Next_1(schemaNS,propPath,propValue,options,SetClientString) \ 28 | WXMPIterator_Next_1 ( this->iterRef, schemaNS, propPath, propValue, options, SetClientString, &wResult ); 29 | 30 | #define zXMPIterator_Skip_1(options) \ 31 | WXMPIterator_Skip_1 ( this->iterRef, options, &wResult ); 32 | 33 | // ------------------------------------------------------------------------------------------------- 34 | 35 | extern void 36 | XMP_PUBLIC WXMPIterator_PropCTor_1 ( XMPMetaRef xmpRef, 37 | XMP_StringPtr schemaNS, 38 | XMP_StringPtr propName, 39 | XMP_OptionBits options, 40 | WXMP_Result * wResult ); 41 | 42 | extern void 43 | XMP_PUBLIC WXMPIterator_TableCTor_1 ( XMP_StringPtr schemaNS, 44 | XMP_StringPtr propName, 45 | XMP_OptionBits options, 46 | WXMP_Result * wResult ); 47 | 48 | extern void 49 | XMP_PUBLIC WXMPIterator_IncrementRefCount_1 ( XMPIteratorRef iterRef ); 50 | 51 | extern void 52 | XMP_PUBLIC WXMPIterator_DecrementRefCount_1 ( XMPIteratorRef iterRef ); 53 | 54 | extern void 55 | XMP_PUBLIC WXMPIterator_Next_1 ( XMPIteratorRef iterRef, 56 | void * schemaNS, 57 | void * propPath, 58 | void * propValue, 59 | XMP_OptionBits * options, 60 | SetClientStringProc SetClientString, 61 | WXMP_Result * wResult ); 62 | 63 | extern void 64 | XMP_PUBLIC WXMPIterator_Skip_1 ( XMPIteratorRef iterRef, 65 | XMP_OptionBits options, 66 | WXMP_Result * wResult ); 67 | 68 | // ================================================================================================= 69 | 70 | #if __cplusplus 71 | } /* extern "C" */ 72 | #endif 73 | 74 | #endif // __WXMPIterator_hpp__ 75 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_rational.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_rational.h" 10 | 11 | #include "dng_utils.h" 12 | 13 | /*****************************************************************************/ 14 | 15 | real64 dng_srational::As_real64 () const 16 | { 17 | 18 | if (d) 19 | return (real64) n / (real64) d; 20 | 21 | else 22 | return 0.0; 23 | 24 | } 25 | 26 | /*****************************************************************************/ 27 | 28 | void dng_srational::Set_real64 (real64 x, int32 dd) 29 | { 30 | 31 | if (x == 0.0) 32 | { 33 | 34 | *this = dng_srational (0, 1); 35 | 36 | } 37 | 38 | if (dd == 0) 39 | { 40 | 41 | real64 y = Abs_real64 (x); 42 | 43 | if (y >= 32768.0) 44 | { 45 | dd = 1; 46 | } 47 | 48 | else if (y >= 1.0) 49 | { 50 | dd = 32768; 51 | } 52 | 53 | else 54 | { 55 | dd = 32768 * 32768; 56 | } 57 | 58 | } 59 | 60 | *this = dng_srational (Round_int32 (x * dd), dd); 61 | 62 | } 63 | 64 | /*****************************************************************************/ 65 | 66 | void dng_srational::ReduceByFactor (int32 factor) 67 | { 68 | 69 | while (n % factor == 0 && 70 | d % factor == 0 && 71 | d >= factor) 72 | { 73 | n /= factor; 74 | d /= factor; 75 | } 76 | 77 | } 78 | 79 | /*****************************************************************************/ 80 | 81 | real64 dng_urational::As_real64 () const 82 | { 83 | 84 | if (d) 85 | return (real64) n / (real64) d; 86 | 87 | else 88 | return 0.0; 89 | 90 | } 91 | 92 | /*****************************************************************************/ 93 | 94 | void dng_urational::Set_real64 (real64 x, uint32 dd) 95 | { 96 | 97 | if (x <= 0.0) 98 | { 99 | 100 | *this = dng_urational (0, 1); 101 | 102 | } 103 | 104 | if (dd == 0) 105 | { 106 | 107 | if (x >= 32768.0) 108 | { 109 | dd = 1; 110 | } 111 | 112 | else if (x >= 1.0) 113 | { 114 | dd = 32768; 115 | } 116 | 117 | else 118 | { 119 | dd = 32768 * 32768; 120 | } 121 | 122 | } 123 | 124 | *this = dng_urational (Round_uint32 (x * dd), dd); 125 | 126 | } 127 | 128 | /*****************************************************************************/ 129 | 130 | void dng_urational::ReduceByFactor (uint32 factor) 131 | { 132 | 133 | while (n % factor == 0 && 134 | d % factor == 0 && 135 | d >= factor) 136 | { 137 | n /= factor; 138 | d /= factor; 139 | } 140 | 141 | } 142 | 143 | /*****************************************************************************/ 144 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_types.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_types__ 10 | #define __dng_types__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_flags.h" 15 | 16 | /*****************************************************************************/ 17 | 18 | // Standard integer types. 19 | 20 | #ifdef _MSC_VER 21 | #include 22 | #endif 23 | 24 | #include 25 | 26 | /*****************************************************************************/ 27 | 28 | #if qDNGUseStdInt || 1 29 | 30 | typedef int8_t int8; 31 | typedef int16_t int16; 32 | typedef int32_t int32; 33 | typedef int64_t int64; 34 | 35 | typedef uint8_t uint8; 36 | typedef uint16_t uint16; 37 | typedef uint32_t uint32; 38 | typedef uint64_t uint64; 39 | 40 | #else 41 | 42 | typedef signed char int8; 43 | typedef signed short int16; 44 | #if __LP64__ 45 | typedef signed int int32; 46 | #else 47 | typedef signed long int32; 48 | #endif 49 | typedef signed long long int64; 50 | 51 | typedef unsigned char uint8; 52 | typedef unsigned short uint16; 53 | /*Some Mac OS X 10.5 SDK headers already define uint32.*/ 54 | #ifndef _UINT32 55 | #if __LP64__ 56 | typedef unsigned int uint32; 57 | #else 58 | typedef unsigned long uint32; 59 | #endif 60 | #define _UINT32 61 | #endif 62 | typedef unsigned long long uint64; 63 | 64 | #endif 65 | 66 | typedef uintptr_t uintptr; 67 | 68 | /*****************************************************************************/ 69 | 70 | typedef float real32; 71 | typedef double real64; 72 | 73 | /*****************************************************************************/ 74 | 75 | /// \def Build a Macintosh style four-character constant in a compiler safe way. 76 | 77 | #define DNG_CHAR4(a,b,c,d) ((((uint32) a) << 24) |\ 78 | (((uint32) b) << 16) |\ 79 | (((uint32) c) << 8) |\ 80 | (((uint32) d) )) 81 | 82 | /*****************************************************************************/ 83 | 84 | #include 85 | #include 86 | #include 87 | #include 88 | #include 89 | 90 | /*****************************************************************************/ 91 | 92 | // Visual Studio now prefers _hypot to hypot 93 | 94 | #ifdef _MSC_VER 95 | 96 | #ifdef hypot 97 | #undef hypot 98 | #endif 99 | 100 | #define hypot _hypot 101 | 102 | #endif 103 | 104 | /*****************************************************************************/ 105 | 106 | #endif 107 | 108 | /*****************************************************************************/ 109 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_rational.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Signed and unsigned rational data types. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_rational__ 16 | #define __dng_rational__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_types.h" 21 | 22 | /*****************************************************************************/ 23 | 24 | class dng_srational 25 | { 26 | 27 | public: 28 | 29 | int32 n; // Numerator 30 | int32 d; // Denominator 31 | 32 | public: 33 | 34 | dng_srational () 35 | : n (0) 36 | , d (0) 37 | { 38 | } 39 | 40 | dng_srational (int32 nn, int32 dd) 41 | : n (nn) 42 | , d (dd) 43 | { 44 | } 45 | 46 | void Clear () 47 | { 48 | n = 0; 49 | d = 0; 50 | } 51 | 52 | bool IsValid () const 53 | { 54 | return d != 0; 55 | } 56 | 57 | bool NotValid () const 58 | { 59 | return !IsValid (); 60 | } 61 | 62 | bool operator== (const dng_srational &r) const 63 | { 64 | return (n == r.n) && 65 | (d == r.d); 66 | } 67 | 68 | bool operator!= (const dng_srational &r) const 69 | { 70 | return !(*this == r); 71 | } 72 | 73 | real64 As_real64 () const; 74 | 75 | void Set_real64 (real64 x, int32 dd = 0); 76 | 77 | void ReduceByFactor (int32 factor); 78 | 79 | }; 80 | 81 | /*****************************************************************************/ 82 | 83 | class dng_urational 84 | { 85 | 86 | public: 87 | 88 | uint32 n; // Numerator 89 | uint32 d; // Denominator 90 | 91 | public: 92 | 93 | dng_urational () 94 | : n (0) 95 | , d (0) 96 | { 97 | } 98 | 99 | dng_urational (uint32 nn, uint32 dd) 100 | : n (nn) 101 | , d (dd) 102 | { 103 | } 104 | 105 | void Clear () 106 | { 107 | n = 0; 108 | d = 0; 109 | } 110 | 111 | bool IsValid () const 112 | { 113 | return d != 0; 114 | } 115 | 116 | bool NotValid () const 117 | { 118 | return !IsValid (); 119 | } 120 | 121 | bool operator== (const dng_urational &r) const 122 | { 123 | return (n == r.n) && 124 | (d == r.d); 125 | } 126 | 127 | bool operator!= (const dng_urational &r) const 128 | { 129 | return !(*this == r); 130 | } 131 | 132 | real64 As_real64 () const; 133 | 134 | void Set_real64 (real64 x, uint32 dd = 0); 135 | 136 | void ReduceByFactor (uint32 factor); 137 | 138 | }; 139 | 140 | /*****************************************************************************/ 141 | 142 | #endif 143 | 144 | /*****************************************************************************/ 145 | -------------------------------------------------------------------------------- /raw2dng/negativeProcessor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | class LibRaw; 27 | 28 | const char* getDngErrorMessage(int errorCode); 29 | 30 | class NegativeProcessor { 31 | public: 32 | static NegativeProcessor* createProcessor(AutoPtr &host, const char *filename); 33 | virtual ~NegativeProcessor(); 34 | 35 | dng_negative* getNegative() {return m_negative.Get();} 36 | 37 | // Different raw/DNG processing stages - usually called in this sequence 38 | virtual void setDNGPropertiesFromRaw(); 39 | virtual void setCameraProfile(const char *dcpFilename); 40 | virtual void setExifFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 41 | virtual void setXmpFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion); 42 | virtual void backupProprietaryData(); 43 | virtual void buildDNGImage(); 44 | virtual void embedOriginalRaw(const char *rawFilename); 45 | 46 | protected: 47 | NegativeProcessor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage); 48 | 49 | virtual dng_memory_stream* createDNGPrivateTag(); 50 | 51 | // helper functions 52 | bool getInterpretedRawExifTag(const char* exifTagName, int32 component, uint32* value); 53 | 54 | bool getRawExifTag(const char* exifTagName, dng_string* value); 55 | bool getRawExifTag(const char* exifTagName, dng_date_time_info* value); 56 | bool getRawExifTag(const char* exifTagName, int32 component, dng_srational* rational); 57 | bool getRawExifTag(const char* exifTagName, int32 component, dng_urational* rational); 58 | bool getRawExifTag(const char* exifTagName, int32 component, uint32* value); 59 | 60 | int getRawExifTag(const char* exifTagName, uint32* valueArray, int32 maxFill); 61 | int getRawExifTag(const char* exifTagName, int16* valueArray, int32 maxFill); 62 | int getRawExifTag(const char* exifTagName, dng_urational* valueArray, int32 maxFill); 63 | 64 | bool getRawExifTag(const char* exifTagName, long* size, unsigned char** data); 65 | 66 | // Source: Raw-file 67 | AutoPtr m_RawProcessor; 68 | Exiv2::Image::AutoPtr m_RawImage; 69 | Exiv2::ExifData m_RawExif; 70 | Exiv2::XmpData m_RawXmp; 71 | 72 | // Target: DNG-file 73 | AutoPtr &m_host; 74 | AutoPtr m_negative; 75 | }; 76 | -------------------------------------------------------------------------------- /cmake-modules/FindExiv2.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the Exiv2 library 2 | # 3 | # EXIV2_MIN_VERSION - You can set this variable to the minimum version you need 4 | # before doing FIND_PACKAGE(Exiv2). The default is 0.12. 5 | # 6 | # Once done this will define 7 | # 8 | # EXIV2_FOUND - system has libexiv2 9 | # EXIV2_INCLUDE_DIR - the libexiv2 include directory 10 | # EXIV2_LIBRARIES - Link these to use libexiv2 11 | # EXIV2_DEFINITIONS - Compiler switches required for using libexiv2 12 | # 13 | # The minimum required version of Exiv2 can be specified using the 14 | # standard syntax, e.g. find_package(Exiv2 0.17) 15 | # 16 | # For compatiblity, also the variable EXIV2_MIN_VERSION can be set to the minimum version 17 | # you need before doing FIND_PACKAGE(Exiv2). The default is 0.12. 18 | 19 | # Copyright (c) 2010, Alexander Neundorf, 20 | # Copyright (c) 2008, Gilles Caulier, 21 | # 22 | # Redistribution and use is allowed according to the terms of the BSD license. 23 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 24 | 25 | # Support EXIV2_MIN_VERSION for compatibility: 26 | if(NOT Exiv2_FIND_VERSION) 27 | set(Exiv2_FIND_VERSION "${EXIV2_MIN_VERSION}") 28 | endif(NOT Exiv2_FIND_VERSION) 29 | 30 | # the minimum version of exiv2 we require 31 | if(NOT Exiv2_FIND_VERSION) 32 | set(Exiv2_FIND_VERSION "0.12") 33 | endif(NOT Exiv2_FIND_VERSION) 34 | 35 | 36 | if (NOT WIN32) 37 | # use pkg-config to get the directories and then use these values 38 | # in the FIND_PATH() and FIND_LIBRARY() calls 39 | find_package(PkgConfig) 40 | pkg_check_modules(PC_EXIV2 QUIET exiv2) 41 | set(EXIV2_DEFINITIONS ${PC_EXIV2_CFLAGS_OTHER}) 42 | endif (NOT WIN32) 43 | 44 | 45 | find_path(EXIV2_INCLUDE_DIR NAMES exiv2/exif.hpp 46 | HINTS 47 | ${PC_EXIV2_INCLUDEDIR} 48 | ${PC_EXIV2_INCLUDE_DIRS} 49 | ) 50 | 51 | find_library(EXIV2_LIBRARY NAMES exiv2 libexiv2 52 | HINTS 53 | ${PC_EXIV2_LIBDIR} 54 | ${PC_EXIV2_LIBRARY_DIRS} 55 | ) 56 | 57 | 58 | # Get the version number from exiv2/version.hpp and store it in the cache: 59 | if(EXIV2_INCLUDE_DIR AND NOT EXIV2_VERSION) 60 | file(READ ${EXIV2_INCLUDE_DIR}/exiv2/exv_conf.h EXIV2_VERSION_CONTENT) 61 | string(REGEX MATCH "#define EXIV2_MAJOR_VERSION +\\( *([0-9]+) *\\)" _dummy "${EXIV2_VERSION_CONTENT}") 62 | set(EXIV2_VERSION_MAJOR "${CMAKE_MATCH_1}") 63 | 64 | string(REGEX MATCH "#define EXIV2_MINOR_VERSION +\\( *([0-9]+) *\\)" _dummy "${EXIV2_VERSION_CONTENT}") 65 | set(EXIV2_VERSION_MINOR "${CMAKE_MATCH_1}") 66 | 67 | string(REGEX MATCH "#define EXIV2_PATCH_VERSION +\\( *([0-9]+) *\\)" _dummy "${EXIV2_VERSION_CONTENT}") 68 | set(EXIV2_VERSION_PATCH "${CMAKE_MATCH_1}") 69 | 70 | set(EXIV2_VERSION "${EXIV2_VERSION_MAJOR}.${EXIV2_VERSION_MINOR}.${EXIV2_VERSION_PATCH}" CACHE STRING "Version number of Exiv2" FORCE) 71 | endif(EXIV2_INCLUDE_DIR AND NOT EXIV2_VERSION) 72 | 73 | set(EXIV2_LIBRARIES "${EXIV2_LIBRARY}") 74 | 75 | include(FindPackageHandleStandardArgs) 76 | find_package_handle_standard_args(Exiv2 REQUIRED_VARS EXIV2_LIBRARY EXIV2_INCLUDE_DIR 77 | VERSION_VAR EXIV2_VERSION) 78 | 79 | mark_as_advanced(EXIV2_INCLUDE_DIR EXIV2_LIBRARY) 80 | 81 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_classes.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /*** \file 10 | * Forward class declarations to avoid having to include many .h files in most places. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_classes__ 16 | #define __dng_classes__ 17 | 18 | /*****************************************************************************/ 19 | 20 | class dng_1d_function; 21 | class dng_1d_table; 22 | class dng_abort_sniffer; 23 | class dng_area_task; 24 | class dng_area_task_progress; 25 | class dng_base_tile_iterator; 26 | class dng_basic_tag_set; 27 | class dng_big_table; 28 | class dng_camera_profile; 29 | class dng_camera_profile_id; 30 | class dng_camera_profile_info; 31 | class dng_color_space; 32 | class dng_color_spec; 33 | class dng_date_time; 34 | class dng_date_time_info; 35 | class dng_exif; 36 | class dng_fingerprint; 37 | class dng_host; 38 | class dng_hue_sat_map; 39 | class dng_ifd; 40 | class dng_image; 41 | class dng_image_preview; 42 | class dng_image_writer; 43 | class dng_info; 44 | class dng_iptc; 45 | class dng_jpeg_image; 46 | class dng_jpeg_preview; 47 | class dng_linearization_info; 48 | class dng_local_string; 49 | class dng_look_table; 50 | class dng_matrix; 51 | class dng_matrix_3by3; 52 | class dng_matrix_4by3; 53 | class dng_md5_printer; 54 | class dng_memory_allocator; 55 | class dng_memory_block; 56 | class dng_memory_data; 57 | class dng_memory_stream; 58 | class dng_metadata; 59 | class dng_mosaic_info; 60 | class dng_mutex; 61 | class dng_noise_function; 62 | class dng_noise_profile; 63 | class dng_opcode; 64 | class dng_opcode_list; 65 | class dng_orientation; 66 | class dng_negative; 67 | class dng_pixel_buffer; 68 | class dng_point; 69 | class dng_point_real64; 70 | class dng_preview; 71 | class dng_preview_info; 72 | class dng_preview_list; 73 | class dng_raw_preview; 74 | class dng_read_image; 75 | class dng_rect; 76 | class dng_rect_real64; 77 | class dng_ref_counted_block; 78 | class dng_render; 79 | class dng_resample_function; 80 | class dng_resolution; 81 | class dng_rgb_table; 82 | class dng_set_minimum_priority; 83 | class dng_shared; 84 | class dng_spline_solver; 85 | class dng_srational; 86 | class dng_stream; 87 | class dng_string; 88 | class dng_string_list; 89 | class dng_tiff_directory; 90 | class dng_tile_buffer; 91 | class dng_time_zone; 92 | class dng_tone_curve; 93 | class dng_urational; 94 | class dng_vector; 95 | class dng_vector_3; 96 | class dng_xmp; 97 | class dng_xmp_sdk; 98 | class dng_xy_coord; 99 | 100 | /*****************************************************************************/ 101 | 102 | struct dng_xmp_namespace; 103 | 104 | /*****************************************************************************/ 105 | 106 | #endif 107 | 108 | /*****************************************************************************/ 109 | -------------------------------------------------------------------------------- /cmake-modules/FindLibRaw.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the LibRaw library 2 | # 3 | # LIBRAW_MIN_VERSION - You can set this variable to the minimum version you need 4 | # before doing FIND_PACKAGE(LibRaw). The default is 0.13. 5 | # 6 | # Once done this will define 7 | # 8 | # LIBRAW_FOUND - system has LibRaw 9 | # LIBRAW_INCLUDE_DIR - the LibRaw include directory 10 | # LIBRAW_LIBRARIES - Link these to use LibRaw 11 | # LIBRAW_DEFINITIONS - Compiler switches required for using LibRaw 12 | # 13 | # The minimum required version of LibRaw can be specified using the 14 | # standard syntax, e.g. find_package(LibRaw 0.13) 15 | # 16 | # For compatiblity, also the variable LIBRAW_MIN_VERSION can be set to the minimum version 17 | # you need before doing FIND_PACKAGE(LibRaw). The default is 0.13. 18 | 19 | # Copyright (c) 2010, Alexander Neundorf, 20 | # Copyright (c) 2008, Gilles Caulier, 21 | # 22 | # Redistribution and use is allowed according to the terms of the BSD license. 23 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 24 | 25 | # Support LIBRAW_MIN_VERSION for compatibility: 26 | if(NOT LibRaw_FIND_VERSION) 27 | set(LibRaw_FIND_VERSION "${LIBRAW_MIN_VERSION}") 28 | endif(NOT LibRaw_FIND_VERSION) 29 | 30 | # the minimum version of LibRaw we require 31 | if(NOT LibRaw_FIND_VERSION) 32 | set(LibRaw_FIND_VERSION "0.13") 33 | endif(NOT LibRaw_FIND_VERSION) 34 | 35 | 36 | if (NOT WIN32) 37 | # use pkg-config to get the directories and then use these values 38 | # in the FIND_PATH() and FIND_LIBRARY() calls 39 | find_package(PkgConfig) 40 | pkg_check_modules(PC_LIBRAW QUIET libraw) 41 | set(LIBRAW_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER}) 42 | endif (NOT WIN32) 43 | 44 | 45 | find_path(LIBRAW_INCLUDE_DIR NAMES libraw/libraw.h 46 | HINTS 47 | ${PC_LIBRAW_INCLUDEDIR} 48 | ${PC_LIBRAW_INCLUDE_DIRS} 49 | ) 50 | 51 | find_library(LIBRAW_LIBRARY NAMES libraw raw 52 | HINTS 53 | ${PC_LIBRAW_LIBDIR} 54 | ${PC_LIBRAW_LIBRARY_DIRS} 55 | ) 56 | 57 | 58 | # Get the version number from libraw/libraw_version.h and store it in the cache: 59 | if(LIBRAW_INCLUDE_DIR AND NOT LIBRAW_VERSION) 60 | file(READ ${LIBRAW_INCLUDE_DIR}/libraw/libraw_version.h LIBRAW_VERSION_CONTENT) 61 | string(REGEX MATCH "#define LIBRAW_MAJOR_VERSION +([0-9]+) *" _dummy "${LIBRAW_VERSION_CONTENT}") 62 | set(LIBRAW_VERSION_MAJOR "${CMAKE_MATCH_1}") 63 | 64 | string(REGEX MATCH "#define LIBRAW_MINOR_VERSION +([0-9]+) *" _dummy "${LIBRAW_VERSION_CONTENT}") 65 | set(LIBRAW_VERSION_MINOR "${CMAKE_MATCH_1}") 66 | 67 | string(REGEX MATCH "#define LIBRAW_PATCH_VERSION +([0-9]+) *" _dummy "${LIBRAW_VERSION_CONTENT}") 68 | set(LIBRAW_VERSION_PATCH "${CMAKE_MATCH_1}") 69 | 70 | set(LIBRAW_VERSION "${LIBRAW_VERSION_MAJOR}.${LIBRAW_VERSION_MINOR}.${LIBRAW_VERSION_PATCH}" CACHE STRING "Version number of LibRaw" FORCE) 71 | endif(LIBRAW_INCLUDE_DIR AND NOT LIBRAW_VERSION) 72 | 73 | set(LIBRAW_LIBRARIES "${LIBRAW_LIBRARY}") 74 | 75 | include(FindPackageHandleStandardArgs) 76 | find_package_handle_standard_args(LibRaw REQUIRED_VARS LIBRAW_LIBRARY LIBRAW_INCLUDE_DIR 77 | VERSION_VAR LIBRAW_VERSION) 78 | 79 | mark_as_advanced(LIBRAW_INCLUDE_DIR LIBRAW_LIBRARY) 80 | 81 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_string_list.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_string_list.h" 10 | 11 | #include "dng_bottlenecks.h" 12 | #include "dng_exceptions.h" 13 | #include "dng_string.h" 14 | #include "dng_utils.h" 15 | 16 | /*****************************************************************************/ 17 | 18 | dng_string_list::dng_string_list () 19 | 20 | : fCount (0) 21 | , fAllocated (0) 22 | , fList (NULL) 23 | 24 | { 25 | 26 | } 27 | 28 | /*****************************************************************************/ 29 | 30 | dng_string_list::~dng_string_list () 31 | { 32 | 33 | Clear (); 34 | 35 | } 36 | 37 | /*****************************************************************************/ 38 | 39 | void dng_string_list::Allocate (uint32 minSize) 40 | { 41 | 42 | if (fAllocated < minSize) 43 | { 44 | 45 | uint32 newSize = Max_uint32 (minSize, fAllocated * 2); 46 | 47 | dng_string **list = (dng_string **) 48 | malloc (newSize * sizeof (dng_string *)); 49 | 50 | if (!list) 51 | { 52 | 53 | ThrowMemoryFull (); 54 | 55 | } 56 | 57 | if (fCount) 58 | { 59 | 60 | memcpy (list, fList, fCount * (uint32) sizeof (dng_string *)); 61 | 62 | } 63 | 64 | if (fList) 65 | { 66 | 67 | free (fList); 68 | 69 | } 70 | 71 | fList = list; 72 | 73 | fAllocated = newSize; 74 | 75 | } 76 | 77 | } 78 | 79 | /*****************************************************************************/ 80 | 81 | void dng_string_list::Insert (uint32 index, 82 | const dng_string &s) 83 | { 84 | 85 | Allocate (fCount + 1); 86 | 87 | dng_string *ss = new dng_string (s); 88 | 89 | if (!ss) 90 | { 91 | 92 | ThrowMemoryFull (); 93 | 94 | } 95 | 96 | fCount++; 97 | 98 | for (uint32 j = fCount - 1; j > index; j--) 99 | { 100 | 101 | fList [j] = fList [j - 1]; 102 | 103 | } 104 | 105 | fList [index] = ss; 106 | 107 | } 108 | 109 | /*****************************************************************************/ 110 | 111 | bool dng_string_list::Contains (const dng_string &s) const 112 | { 113 | 114 | for (uint32 j = 0; j < fCount; j++) 115 | { 116 | 117 | if ((*this) [j] == s) 118 | { 119 | 120 | return true; 121 | 122 | } 123 | 124 | } 125 | 126 | return false; 127 | 128 | } 129 | 130 | /*****************************************************************************/ 131 | 132 | void dng_string_list::Clear () 133 | { 134 | 135 | if (fList) 136 | { 137 | 138 | for (uint32 index = 0; index < fCount; index++) 139 | { 140 | 141 | delete fList [index]; 142 | 143 | } 144 | 145 | free (fList); 146 | 147 | fList = NULL; 148 | 149 | } 150 | 151 | fCount = 0; 152 | fAllocated = 0; 153 | 154 | } 155 | 156 | /*****************************************************************************/ 157 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_local_string.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2015-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_local_string__ 10 | #define __dng_local_string__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_classes.h" 15 | #include "dng_string.h" 16 | #include "dng_types.h" 17 | 18 | #include 19 | 20 | /*****************************************************************************/ 21 | 22 | class dng_local_string 23 | { 24 | 25 | private: 26 | 27 | dng_string fDefaultText; 28 | 29 | struct dictionary_entry 30 | { 31 | 32 | dng_string fLanguage; 33 | 34 | dng_string fTranslation; 35 | 36 | dictionary_entry (const dng_string &language, 37 | const dng_string &translation) 38 | 39 | : fLanguage (language) 40 | , fTranslation (translation) 41 | 42 | { 43 | 44 | } 45 | 46 | }; 47 | 48 | std::vector fDictionary; 49 | 50 | public: 51 | 52 | dng_local_string (); 53 | 54 | dng_local_string (const dng_string &s); 55 | 56 | ~dng_local_string (); 57 | 58 | void Clear (); 59 | 60 | void SetDefaultText (const dng_string &s); 61 | 62 | void AddTranslation (const dng_string &language, 63 | const dng_string &translation); 64 | 65 | void Set (const char *s); 66 | 67 | const dng_string & DefaultText () const 68 | { 69 | return fDefaultText; 70 | } 71 | 72 | dng_string & DefaultText () 73 | { 74 | return fDefaultText; 75 | } 76 | 77 | uint32 TranslationCount () const 78 | { 79 | return (uint32) fDictionary.size (); 80 | } 81 | 82 | const dng_string & Language (uint32 index) const 83 | { 84 | return fDictionary [index] . fLanguage; 85 | } 86 | 87 | const dng_string & Translation (uint32 index) const 88 | { 89 | return fDictionary [index] . fTranslation; 90 | } 91 | 92 | const dng_string & LocalText (const dng_string &locale) const; 93 | 94 | bool IsEmpty () const 95 | { 96 | return DefaultText ().IsEmpty (); 97 | } 98 | 99 | bool NotEmpty () const 100 | { 101 | return !IsEmpty (); 102 | } 103 | 104 | bool operator== (const dng_local_string &s) const; 105 | 106 | bool operator!= (const dng_local_string &s) const 107 | { 108 | return !(*this == s); 109 | } 110 | 111 | void Truncate (uint32 maxBytes); 112 | 113 | }; 114 | 115 | /*****************************************************************************/ 116 | 117 | #endif 118 | 119 | /*****************************************************************************/ 120 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_tile_iterator.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_tile_iterator__ 10 | #define __dng_tile_iterator__ 11 | 12 | /*****************************************************************************/ 13 | 14 | #include "dng_classes.h" 15 | #include "dng_point.h" 16 | #include "dng_rect.h" 17 | #include "dng_types.h" 18 | 19 | #include 20 | 21 | /*****************************************************************************/ 22 | 23 | class dng_base_tile_iterator 24 | { 25 | 26 | public: 27 | 28 | virtual ~dng_base_tile_iterator () 29 | { 30 | } 31 | 32 | virtual bool GetOneTile (dng_rect &tile) = 0; 33 | 34 | }; 35 | 36 | /*****************************************************************************/ 37 | 38 | class dng_tile_iterator: public dng_base_tile_iterator 39 | { 40 | 41 | protected: 42 | 43 | dng_rect fArea; 44 | 45 | int32 fTileWidth; 46 | int32 fTileHeight; 47 | 48 | int32 fTileTop; 49 | int32 fTileLeft; 50 | 51 | int32 fRowLeft; 52 | 53 | int32 fLeftPage; 54 | int32 fRightPage; 55 | 56 | int32 fTopPage; 57 | int32 fBottomPage; 58 | 59 | int32 fHorizontalPage; 60 | int32 fVerticalPage; 61 | 62 | public: 63 | 64 | dng_tile_iterator (const dng_image &image, 65 | const dng_rect &area); 66 | 67 | dng_tile_iterator (const dng_point &tileSize, 68 | const dng_rect &area); 69 | 70 | dng_tile_iterator (const dng_rect &tile, 71 | const dng_rect &area); 72 | 73 | virtual ~dng_tile_iterator () 74 | { 75 | } 76 | 77 | virtual bool GetOneTile (dng_rect &tile); 78 | 79 | private: 80 | 81 | void Initialize (const dng_rect &tile, 82 | const dng_rect &area); 83 | 84 | }; 85 | 86 | /*****************************************************************************/ 87 | 88 | typedef dng_tile_iterator dng_tile_forward_iterator; 89 | 90 | /*****************************************************************************/ 91 | 92 | class dng_tile_reverse_iterator: public dng_base_tile_iterator 93 | { 94 | 95 | public: 96 | 97 | std::vector fTiles; 98 | 99 | size_t fIndex; 100 | 101 | public: 102 | 103 | dng_tile_reverse_iterator (const dng_image &image, 104 | const dng_rect &area); 105 | 106 | dng_tile_reverse_iterator (const dng_point &tileSize, 107 | const dng_rect &area); 108 | 109 | dng_tile_reverse_iterator (const dng_rect &tile, 110 | const dng_rect &area); 111 | 112 | virtual ~dng_tile_reverse_iterator () 113 | { 114 | } 115 | 116 | virtual bool GetOneTile (dng_rect &tile); 117 | 118 | private: 119 | 120 | void Initialize (dng_tile_iterator &iterator); 121 | 122 | }; 123 | 124 | /*****************************************************************************/ 125 | 126 | #endif 127 | 128 | /*****************************************************************************/ 129 | -------------------------------------------------------------------------------- /raw2dng/vendorProcessors/FujiProcessor.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015-2017 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | 18 | This file uses code from dngconvert from Jens Mueller and others 19 | (https://github.com/jmue/dngconvert) - Copyright (C) 2011 Jens 20 | Mueller (tschensinger at gmx dot de) 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | 27 | #include "FujiProcessor.h" 28 | 29 | 30 | // TODO/FIXME: Fuji support is currently broken! 31 | 32 | FujiProcessor::FujiProcessor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage) 33 | : NegativeProcessor(host, rawProcessor, rawImage) { 34 | m_fujiRotate90 = (2 == m_RawProcessor->COLOR(0, 1)) && (1 == m_RawProcessor->COLOR(1, 0)); 35 | } 36 | 37 | 38 | void FujiProcessor::setDNGPropertiesFromRaw() { 39 | NegativeProcessor::setDNGPropertiesFromRaw(); 40 | 41 | libraw_image_sizes_t *sizes = &m_RawProcessor->imgdata.sizes; 42 | libraw_iparams_t *iparams = &m_RawProcessor->imgdata.idata; 43 | 44 | // ----------------------------------------------------------------------------------------- 45 | // Orientation 46 | 47 | if (m_fujiRotate90) m_negative->SetBaseOrientation(m_negative->BaseOrientation() + dng_orientation::Mirror90CCW()); 48 | 49 | // ----------------------------------------------------------------------------------------- 50 | // Mosaic 51 | 52 | if (iparams->colors != 4) m_negative->SetFujiMosaic(0); 53 | 54 | // ----------------------------------------------------------------------------------------- 55 | // Default scale and crop/active area 56 | 57 | if (m_fujiRotate90) { 58 | m_negative->SetDefaultScale(dng_urational(sizes->iheight, sizes->height), dng_urational(sizes->iwidth, sizes->width)); 59 | m_negative->SetActiveArea(dng_rect(sizes->top_margin, sizes->left_margin, 60 | sizes->top_margin + sizes->width, sizes->left_margin + sizes->height)); 61 | 62 | if (iparams->filters != 0) { 63 | m_negative->SetDefaultCropOrigin(8, 8); 64 | m_negative->SetDefaultCropSize(sizes->height - 16, sizes->width - 16); 65 | } 66 | else { 67 | m_negative->SetDefaultCropOrigin(0, 0); 68 | m_negative->SetDefaultCropSize(sizes->height, sizes->width); 69 | } 70 | } 71 | } 72 | 73 | 74 | void FujiProcessor::buildDNGImage() { 75 | NegativeProcessor::buildDNGImage(); 76 | 77 | // TODO: FIXME 78 | /* if (m_fujiRotate90) { 79 | dng_rect rotatedRect(dngImage->fBounds.W(), dngImage->fBounds.H()); 80 | dngImage->fBounds = rotatedRect; 81 | }*/ 82 | } 83 | 84 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/XMPFiles_IO.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __XMPFiles_IO_hpp__ 2 | #define __XMPFiles_IO_hpp__ 1 3 | 4 | // ================================================================================================= 5 | // ADOBE SYSTEMS INCORPORATED 6 | // Copyright 2010 Adobe Systems Incorporated 7 | // All Rights Reserved 8 | // 9 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 10 | // of the Adobe license agreement accompanying it. 11 | // ================================================================================================= 12 | 13 | #include "public/include/XMP_Environment.h" // ! XMP_Environment.h must be the first included header. 14 | 15 | #include "public/include/XMP_Const.h" 16 | #include "public/include/XMP_IO.hpp" 17 | 18 | #include "source/Host_IO.hpp" 19 | #include "source/XMP_ProgressTracker.hpp" 20 | #include "XMP_LibUtils.hpp" 21 | 22 | #include 23 | 24 | // ================================================================================================= 25 | 26 | class XMPFiles_IO : public XMP_IO { 27 | // Implementation class for I/O inside XMPFiles, uses host O/S file services. All of the common 28 | // functions behave as described for XMP_IO. Use openReadOnly and openReadWrite constants from 29 | // Host_IO for the readOnly parameter to the constructors. 30 | public: 31 | static XMPFiles_IO * New_XMPFiles_IO( 32 | const char * filePath, 33 | bool readOnly, 34 | GenericErrorCallback * _errorCallback = 0, 35 | XMP_ProgressTracker * _progressTracker = 0); 36 | 37 | XMPFiles_IO(Host_IO::FileRef hostFile, 38 | const char * filePath, 39 | bool readOnly, 40 | GenericErrorCallback* _errorCallback = 0, 41 | XMP_ProgressTracker * _progressTracker = 0); 42 | 43 | virtual ~XMPFiles_IO(); 44 | 45 | XMP_Uns32 Read(void * buffer, XMP_Uns32 count, bool readAll = false); 46 | 47 | void Write(const void * buffer, XMP_Uns32 count); 48 | 49 | XMP_Int64 Seek(XMP_Int64 offset, SeekMode mode); 50 | 51 | XMP_Int64 Length(); 52 | 53 | void Truncate(XMP_Int64 length); 54 | 55 | XMP_IO * DeriveTemp(); 56 | void AbsorbTemp(); 57 | void DeleteTemp(); 58 | 59 | void SetProgressTracker(XMP_ProgressTracker * _progressTracker) { 60 | this->progressTracker = _progressTracker; 61 | }; 62 | 63 | void SetErrorCallback(GenericErrorCallback & _errorCallback) { 64 | this->errorCallback = &_errorCallback; 65 | }; 66 | 67 | void Close(); // Not part of XMP_IO, added here to let errors propagate. 68 | 69 | private: 70 | bool readOnly; 71 | std::string filePath; 72 | Host_IO::FileRef fileRef; 73 | XMP_Int64 currOffset; 74 | XMP_Int64 currLength; 75 | bool isTemp; 76 | XMPFiles_IO * derivedTemp; 77 | 78 | XMP_ProgressTracker * progressTracker; // ! Owned by the XMPFiles object! 79 | GenericErrorCallback * errorCallback; // ! Owned by the XMPFiles object! 80 | 81 | // Hidden on purpose. 82 | XMPFiles_IO() 83 | : fileRef(Host_IO::noFileRef) 84 | , isTemp(false) 85 | , derivedTemp(0) 86 | , progressTracker(0) {}; 87 | 88 | // The copy constructor and assignment operators are private to prevent client use. Allowing 89 | // them would require shared I/O state between XMPFiles_IO objects. 90 | XMPFiles_IO(const XMPFiles_IO & original); 91 | void operator = (const XMP_IO & in); 92 | void operator = (const XMPFiles_IO & in); 93 | }; 94 | 95 | // ================================================================================================= 96 | 97 | #endif // __XMPFiles_IO_hpp__ 98 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_mutex.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_mutex__ 10 | #define __dng_mutex__ 11 | 12 | /******************************************************************************/ 13 | 14 | #include "dng_flags.h" 15 | #include "dng_types.h" 16 | #include "dng_uncopyable.h" 17 | 18 | #if qDNGThreadSafe 19 | #include "dng_pthread.h" 20 | #endif 21 | 22 | #include 23 | 24 | typedef std::mutex dng_std_mutex; 25 | typedef std::lock_guard dng_lock_std_mutex; 26 | typedef std::unique_lock dng_unique_lock; 27 | 28 | // We should try to phase out use of dng_mutex over time. 29 | // 30 | // Note that dng_mutex differs from dng_std_mutex (std::mutex) in that 31 | // dng_mutex supports recursive locking (hierarchical mutex). 32 | 33 | /******************************************************************************/ 34 | 35 | class dng_mutex: private dng_uncopyable 36 | { 37 | 38 | public: 39 | 40 | enum 41 | { 42 | kDNGMutexLevelLeaf = 0x70000000u, 43 | kDNGMutexLevelIgnore = 0x7FFFFFFFu 44 | }; 45 | 46 | dng_mutex (const char *mutexName, 47 | uint32 mutexLevel = kDNGMutexLevelLeaf); 48 | 49 | virtual ~dng_mutex (); 50 | 51 | void Lock (); 52 | 53 | void Unlock (); 54 | 55 | const char *MutexName () const; 56 | 57 | protected: 58 | 59 | #if qDNGThreadSafe 60 | 61 | pthread_mutex_t fPthreadMutex; 62 | 63 | const uint32 fMutexLevel; 64 | 65 | uint32 fRecursiveLockCount; 66 | 67 | dng_mutex *fPrevHeldMutex; 68 | 69 | const char * const fMutexName; 70 | 71 | friend class dng_condition; 72 | 73 | #endif 74 | 75 | }; 76 | 77 | /*****************************************************************************/ 78 | 79 | class dng_lock_mutex: private dng_uncopyable 80 | { 81 | 82 | private: 83 | 84 | dng_mutex *fMutex; 85 | 86 | public: 87 | 88 | dng_lock_mutex (dng_mutex *mutex); 89 | 90 | dng_lock_mutex (dng_mutex &mutex); 91 | 92 | ~dng_lock_mutex (); 93 | 94 | }; 95 | 96 | /*****************************************************************************/ 97 | 98 | class dng_unlock_mutex: private dng_uncopyable 99 | { 100 | 101 | private: 102 | 103 | dng_mutex *fMutex; 104 | 105 | public: 106 | 107 | dng_unlock_mutex (dng_mutex *mutex); 108 | 109 | dng_unlock_mutex (dng_mutex &mutex); 110 | 111 | ~dng_unlock_mutex (); 112 | 113 | }; 114 | 115 | /*****************************************************************************/ 116 | 117 | class dng_condition: private dng_uncopyable 118 | { 119 | 120 | public: 121 | 122 | dng_condition (); 123 | 124 | ~dng_condition (); 125 | 126 | bool Wait (dng_mutex &mutex, double timeoutSecs = -1.0); 127 | 128 | void Signal (); 129 | 130 | void Broadcast (); 131 | 132 | protected: 133 | 134 | 135 | #if qDNGThreadSafe 136 | pthread_cond_t fPthreadCondition; 137 | #endif // qDNGThreadSafe 138 | 139 | }; 140 | 141 | /*****************************************************************************/ 142 | 143 | #endif 144 | 145 | /*****************************************************************************/ 146 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_assertions.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Conditionally compiled assertion check support. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_assertions__ 16 | #define __dng_assertions__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_exceptions.h" 21 | #include "dng_flags.h" 22 | 23 | /*****************************************************************************/ 24 | 25 | #if qDNGDebug 26 | 27 | /// Platform-specific function to display an assert. 28 | 29 | void dng_show_message (const char *s); 30 | 31 | /// Show a formatted error message. 32 | 33 | void dng_show_message_f (const char *fmt, ...); 34 | 35 | #endif 36 | 37 | /*****************************************************************************/ 38 | 39 | #ifndef DNG_ASSERT 40 | 41 | #if qDNGDebug 42 | 43 | /// Conditionally compiled macro to check an assertion and display a message if 44 | /// it fails and assertions are compiled in via qDNGDebug 45 | /// \param x Predicate which must be true. 46 | /// \param y String to display if x is not true. 47 | 48 | #define DNG_ASSERT(x,y) { if (!(x)) dng_show_message (y); } 49 | 50 | #else 51 | 52 | /// Conditionally compiled macro to check an assertion and display a message if 53 | /// it fails and assertions are compiled in via qDNGDebug 54 | /// \param x Predicate which must be true. 55 | /// \param y String to display if x is not true. 56 | 57 | #define DNG_ASSERT(x,y) 58 | 59 | #endif 60 | #endif 61 | 62 | /*****************************************************************************/ 63 | 64 | #ifndef DNG_REQUIRE 65 | 66 | #if qDNGDebug 67 | 68 | /// Conditionally compiled macro to check an assertion, display a message, and throw 69 | /// an exception if it fails and assertions are compiled in via qDNGDebug 70 | /// \param condition Predicate which must be true. 71 | /// \param msg String to display if condition is not true. 72 | 73 | #define DNG_REQUIRE(condition,msg) \ 74 | do \ 75 | { \ 76 | \ 77 | if (!(condition)) \ 78 | { \ 79 | \ 80 | DNG_ASSERT(condition, msg); \ 81 | \ 82 | ThrowProgramError (msg); \ 83 | \ 84 | } \ 85 | \ 86 | } \ 87 | while (0) 88 | 89 | #else 90 | 91 | /// Conditionally compiled macro to check an assertion, display a message, and throw 92 | /// an exception if it fails and assertions are compiled in via qDNGDebug 93 | /// \param condition Predicate which must be true. 94 | /// \param msg String to display if condition is not true. 95 | 96 | #define DNG_REQUIRE(condition,msg) \ 97 | do \ 98 | { \ 99 | \ 100 | if (!(condition)) \ 101 | { \ 102 | \ 103 | ThrowProgramError (msg); \ 104 | \ 105 | } \ 106 | \ 107 | } \ 108 | while (0) 109 | 110 | #endif 111 | #endif 112 | 113 | /*****************************************************************************/ 114 | 115 | #ifndef DNG_REPORT 116 | 117 | /// Macro to display an informational message 118 | /// \param x String to display. 119 | 120 | #define DNG_REPORT(x) DNG_ASSERT (false, x) 121 | 122 | #endif 123 | 124 | /*****************************************************************************/ 125 | 126 | #endif 127 | 128 | /*****************************************************************************/ 129 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_1d_table.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Definition of a lookup table based 1D floating-point to floating-point function abstraction using linear interpolation. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_1d_table__ 16 | #define __dng_1d_table__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_assertions.h" 21 | #include "dng_auto_ptr.h" 22 | #include "dng_classes.h" 23 | #include "dng_types.h" 24 | #include "dng_uncopyable.h" 25 | 26 | /*****************************************************************************/ 27 | 28 | /// \brief A 1D floating-point lookup table using linear interpolation. 29 | 30 | class dng_1d_table: private dng_uncopyable 31 | { 32 | 33 | public: 34 | 35 | /// Constant denoting minimum size of table. 36 | 37 | static const uint32 kMinTableSize = 512; 38 | 39 | private: 40 | 41 | /// Constant denoting default size of table. 42 | 43 | static const uint32 kDefaultTableSize = 4096; 44 | 45 | protected: 46 | 47 | AutoPtr fBuffer; 48 | 49 | real32 *fTable; 50 | 51 | const uint32 fTableCount; 52 | 53 | public: 54 | 55 | /// Table constructor. count must be a power of two 56 | /// and at least kMinTableSize. 57 | 58 | explicit dng_1d_table (uint32 count = kDefaultTableSize); 59 | 60 | virtual ~dng_1d_table (); 61 | 62 | /// Number of table entries. 63 | 64 | uint32 Count () const 65 | { 66 | return fTableCount; 67 | } 68 | 69 | /// Set up table, initialize entries using functiion. 70 | /// This method can throw an exception, e.g. if there is not enough memory. 71 | /// \param allocator Memory allocator from which table memory is allocated. 72 | /// \param function Table is initialized with values of finction.Evalluate(0.0) to function.Evaluate(1.0). 73 | /// \param subSample If true, only sample the function a limited number of times and interpolate. 74 | 75 | void Initialize (dng_memory_allocator &allocator, 76 | const dng_1d_function &function, 77 | bool subSample = false); 78 | 79 | /// Lookup and interpolate mapping for an input. 80 | /// \param x value from 0.0 to 1.0 used as input for mapping 81 | /// \retval Approximation of function.Evaluate(x) 82 | 83 | real32 Interpolate (real32 x) const 84 | { 85 | 86 | real32 y = x * (real32) fTableCount; 87 | 88 | int32 index = (int32) y; 89 | 90 | // Enable vectorization by using DNG_ASSERT instead of DNG_REQUIRE 91 | DNG_ASSERT(!(index < 0 || index >(int32) fTableCount), "dng_1d_table::Interpolate parameter out of range"); 92 | 93 | real32 z = (real32) index; 94 | 95 | real32 fract = y - z; 96 | 97 | return fTable [index ] * (1.0f - fract) + 98 | fTable [index + 1] * ( fract); 99 | 100 | } 101 | 102 | /// Direct access function for table data. 103 | 104 | const real32 * Table () const 105 | { 106 | return fTable; 107 | } 108 | 109 | /// Expand the table to a 16-bit to 16-bit table. 110 | 111 | void Expand16 (uint16 *table16) const; 112 | 113 | private: 114 | 115 | void SubDivide (const dng_1d_function &function, 116 | uint32 lower, 117 | uint32 upper, 118 | real32 maxDelta); 119 | 120 | }; 121 | 122 | /*****************************************************************************/ 123 | 124 | #endif 125 | 126 | /*****************************************************************************/ 127 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_file_stream.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_file_stream.h" 10 | 11 | #include "dng_exceptions.h" 12 | 13 | /*****************************************************************************/ 14 | 15 | dng_file_stream::dng_file_stream (const char *filename, 16 | bool output, 17 | uint32 bufferSize) 18 | 19 | : dng_stream ((dng_abort_sniffer *) NULL, 20 | bufferSize, 21 | 0) 22 | 23 | , fFile (NULL) 24 | 25 | { 26 | 27 | fFile = fopen (filename, output ? "wb" : "rb"); 28 | 29 | if (!fFile) 30 | { 31 | 32 | #if qDNGValidate 33 | 34 | ReportError ("Unable to open file", 35 | filename); 36 | 37 | ThrowSilentError (); 38 | 39 | #else 40 | 41 | ThrowOpenFile (); 42 | 43 | #endif 44 | 45 | } 46 | 47 | } 48 | 49 | /*****************************************************************************/ 50 | 51 | #if qWinOS 52 | 53 | /*****************************************************************************/ 54 | 55 | dng_file_stream::dng_file_stream (const wchar_t *filename, 56 | bool output, 57 | uint32 bufferSize) 58 | 59 | : dng_stream ((dng_abort_sniffer *) NULL, 60 | bufferSize, 61 | 0) 62 | 63 | , fFile (NULL) 64 | 65 | { 66 | 67 | fFile = _wfopen (filename, output ? L"wb" : L"rb"); 68 | 69 | if (!fFile) 70 | { 71 | 72 | #if qDNGValidate 73 | 74 | char filenameCString[256]; 75 | 76 | size_t returnCount; 77 | 78 | wcstombs_s (&returnCount, 79 | filenameCString, 80 | 256, 81 | filename, 82 | _TRUNCATE); 83 | 84 | ReportError ("Unable to open file", 85 | filenameCString); 86 | 87 | ThrowSilentError (); 88 | 89 | #else 90 | 91 | ThrowOpenFile (); 92 | 93 | #endif // qDNGValidate 94 | 95 | } 96 | 97 | } 98 | 99 | /*****************************************************************************/ 100 | 101 | #endif // qWinOS 102 | 103 | /*****************************************************************************/ 104 | 105 | dng_file_stream::~dng_file_stream () 106 | { 107 | 108 | if (fFile) 109 | { 110 | fclose (fFile); 111 | fFile = NULL; 112 | } 113 | 114 | } 115 | 116 | /*****************************************************************************/ 117 | 118 | uint64 dng_file_stream::DoGetLength () 119 | { 120 | 121 | if (fseek (fFile, 0, SEEK_END) != 0) 122 | { 123 | 124 | ThrowReadFile (); 125 | 126 | } 127 | 128 | return (uint64) ftell (fFile); 129 | 130 | } 131 | 132 | /*****************************************************************************/ 133 | 134 | void dng_file_stream::DoRead (void *data, 135 | uint32 count, 136 | uint64 offset) 137 | { 138 | 139 | if (fseek (fFile, (long) offset, SEEK_SET) != 0) 140 | { 141 | 142 | ThrowReadFile (); 143 | 144 | } 145 | 146 | uint32 bytesRead = (uint32) fread (data, 1, count, fFile); 147 | 148 | if (bytesRead != count) 149 | { 150 | 151 | ThrowReadFile (); 152 | 153 | } 154 | 155 | } 156 | 157 | /*****************************************************************************/ 158 | 159 | void dng_file_stream::DoWrite (const void *data, 160 | uint32 count, 161 | uint64 offset) 162 | { 163 | 164 | if (fseek (fFile, (uint32) offset, SEEK_SET) != 0) 165 | { 166 | 167 | ThrowWriteFile (); 168 | 169 | } 170 | 171 | uint32 bytesWritten = (uint32) fwrite (data, 1, count, fFile); 172 | 173 | if (bytesWritten != count) 174 | { 175 | 176 | ThrowWriteFile (); 177 | 178 | } 179 | 180 | } 181 | 182 | /*****************************************************************************/ 183 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/Endian.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * ADOBE SYSTEMS INCORPORATED 4 | * Copyright 2010 Adobe Systems Incorporated 5 | * All Rights Reserved 6 | * 7 | * NOTICE: Adobe permits you to use, modify, and distribute this file in 8 | * accordance with the terms of the Adobe license agreement accompanying it. 9 | * 10 | **************************************************************************/ 11 | 12 | #ifndef _Endian_h_ 13 | #define _Endian_h_ 1 14 | 15 | #include "public/include/XMP_Environment.h" // ! This must be the first include. 16 | #include "public/include/XMP_Const.h" 17 | #include "source/EndianUtils.hpp" 18 | 19 | class IEndian 20 | { 21 | public: 22 | virtual ~IEndian() {}; 23 | 24 | virtual XMP_Uns16 getUns16 ( const void* value ) const = 0; 25 | virtual XMP_Uns32 getUns32 ( const void* value ) const = 0; 26 | virtual XMP_Uns64 getUns64 ( const void* value ) const = 0; 27 | virtual float getFloat ( const void* value ) const = 0; 28 | virtual double getDouble ( const void* value ) const = 0; 29 | 30 | virtual void putUns16 ( XMP_Uns16 value, void* dest ) const = 0; 31 | virtual void putUns32 ( XMP_Uns32 value, void* dest ) const = 0; 32 | virtual void putUns64 ( XMP_Uns64 value, void* dest ) const = 0; 33 | virtual void putFloat ( float value, void* dest ) const = 0; 34 | virtual void putDouble ( double value, void* dest ) const = 0; 35 | }; 36 | 37 | 38 | class LittleEndian : public IEndian 39 | { 40 | private: 41 | // Private Constructors / operators to prevent direkt creation 42 | LittleEndian() {}; 43 | LittleEndian( const LittleEndian& ) {}; 44 | LittleEndian& operator=( const LittleEndian& ) { return *this; }; 45 | 46 | public: 47 | // Singleton Factory 48 | static const LittleEndian& getInstance() 49 | { 50 | // Singleton instance (on Stack) 51 | static LittleEndian instance; 52 | 53 | return instance; 54 | } 55 | 56 | virtual XMP_Uns16 getUns16 ( const void* value ) const { return GetUns16LE( value ); } 57 | virtual XMP_Uns32 getUns32 ( const void* value ) const { return GetUns32LE( value ); } 58 | virtual XMP_Uns64 getUns64 ( const void* value ) const { return GetUns64LE( value ); } 59 | virtual float getFloat ( const void* value ) const { return GetFloatLE( value ); } 60 | virtual double getDouble ( const void* value ) const { return GetDoubleLE( value ); } 61 | 62 | virtual void putUns16 ( XMP_Uns16 value, void* dest ) const { PutUns16LE( value, dest ); } 63 | virtual void putUns32 ( XMP_Uns32 value, void* dest ) const { PutUns32LE( value, dest ); } 64 | virtual void putUns64 ( XMP_Uns64 value, void* dest ) const { PutUns64LE( value, dest ); } 65 | virtual void putFloat ( float value, void* dest ) const { PutFloatLE( value, dest ); } 66 | virtual void putDouble ( double value, void* dest ) const { PutDoubleLE( value, dest ); } 67 | }; // LittleEndian 68 | 69 | 70 | class BigEndian : public IEndian 71 | { 72 | private: 73 | // Private Constructors / operators to prevent direkt creation 74 | BigEndian() {}; 75 | BigEndian( const BigEndian& ) {}; 76 | BigEndian& operator=( const BigEndian& ) { return *this; }; 77 | 78 | public: 79 | // Singleton Factory 80 | static const BigEndian& getInstance() 81 | { 82 | // Singleton instance (on Stack) 83 | static BigEndian instance; 84 | 85 | return instance; 86 | } 87 | 88 | virtual XMP_Uns16 getUns16 ( const void* value ) const { return GetUns16BE( value ); } 89 | virtual XMP_Uns32 getUns32 ( const void* value ) const { return GetUns32BE( value ); } 90 | virtual XMP_Uns64 getUns64 ( const void* value ) const { return GetUns64BE( value ); } 91 | virtual float getFloat ( const void* value ) const { return GetFloatBE( value ); } 92 | virtual double getDouble ( const void* value ) const { return GetDoubleBE( value ); } 93 | 94 | virtual void putUns16 ( XMP_Uns16 value, void* dest ) const { PutUns16BE( value, dest ); } 95 | virtual void putUns32 ( XMP_Uns32 value, void* dest ) const { PutUns32BE( value, dest ); } 96 | virtual void putUns64 ( XMP_Uns64 value, void* dest ) const { PutUns64BE( value, dest ); } 97 | virtual void putFloat ( float value, void* dest ) const { PutFloatBE( value, dest ); } 98 | virtual void putDouble ( double value, void* dest ) const { PutDoubleBE( value, dest ); } 99 | }; // BigEndian 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_opcode_list.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2008-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * List of opcodes. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_opcode_list__ 16 | #define __dng_opcode_list__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_auto_ptr.h" 21 | #include "dng_classes.h" 22 | #include "dng_opcodes.h" 23 | #include "dng_uncopyable.h" 24 | 25 | #include 26 | 27 | /*****************************************************************************/ 28 | 29 | /// A list of opcodes. 30 | 31 | class dng_opcode_list: private dng_uncopyable 32 | { 33 | 34 | private: 35 | 36 | dng_std_vector fList; 37 | 38 | bool fAlwaysApply; 39 | 40 | uint32 fStage; 41 | 42 | public: 43 | 44 | /// Create an empty opcode list for the specific image stage (1, 2, or 3). 45 | 46 | dng_opcode_list (uint32 stage); 47 | 48 | ~dng_opcode_list (); 49 | 50 | /// Is the opcode list empty? 51 | 52 | bool IsEmpty () const 53 | { 54 | return fList.size () == 0; 55 | } 56 | 57 | /// Does the list contain at least 1 opcode? 58 | 59 | bool NotEmpty () const 60 | { 61 | return !IsEmpty (); 62 | } 63 | 64 | /// Should the opcode list always be applied to the image? 65 | 66 | bool AlwaysApply () const 67 | { 68 | return fAlwaysApply && NotEmpty (); 69 | } 70 | 71 | /// Set internal flag to indicate this opcode list should always be 72 | /// applied. 73 | 74 | void SetAlwaysApply () 75 | { 76 | fAlwaysApply = true; 77 | } 78 | 79 | /// The number of opcodes in this list. 80 | 81 | uint32 Count () const 82 | { 83 | return (uint32) fList.size (); 84 | } 85 | 86 | /// Retrieve read/write opcode by index (must be in the range 0 to Count 87 | /// () - 1). 88 | 89 | dng_opcode & Entry (uint32 index) 90 | { 91 | return *fList [index]; 92 | } 93 | 94 | /// Retrieve read-only opcode by index (must be in the range 0 to Count 95 | /// () - 1). 96 | 97 | const dng_opcode & Entry (uint32 index) const 98 | { 99 | return *fList [index]; 100 | } 101 | 102 | /// Remove all opcodes from the list. 103 | 104 | void Clear (); 105 | 106 | /// Swap two opcode lists. 107 | 108 | void Swap (dng_opcode_list &otherList); 109 | 110 | /// Return minimum DNG version required to support all opcodes in this 111 | /// list. If includeOptional is set to true, then this calculation will 112 | /// include optional opcodes. 113 | 114 | uint32 MinVersion (bool includeOptional) const; 115 | 116 | /// Apply this opcode list to the specified image with corresponding 117 | /// negative. 118 | 119 | void Apply (dng_host &host, 120 | dng_negative &negative, 121 | AutoPtr &image); 122 | 123 | /// Append the specified opcode to this list. 124 | 125 | void Append (AutoPtr &opcode); 126 | 127 | /// Serialize this opcode list to a block of memory. The caller is 128 | /// responsible for deleting this block. 129 | 130 | dng_memory_block * Spool (dng_host &host) const; 131 | 132 | /// Write a fingerprint of this opcode list to the specified stream. 133 | 134 | void FingerprintToStream (dng_stream &stream) const; 135 | 136 | /// Read an opcode list from the specified stream, starting at the 137 | /// specified offset (streamOffset, in bytes). byteCount is provided for 138 | /// error checking purposes. A bad format exception 139 | /// will be thrown if the length of the opcode stream does not exactly 140 | /// match byteCount. 141 | 142 | void Parse (dng_host &host, 143 | dng_stream &stream, 144 | uint32 byteCount, 145 | uint64 streamOffset); 146 | 147 | }; 148 | 149 | /*****************************************************************************/ 150 | 151 | #endif 152 | 153 | /*****************************************************************************/ 154 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_xy_coord.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Representation of colors in xy and XYZ coordinates. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_xy_coord__ 16 | #define __dng_xy_coord__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_classes.h" 21 | #include "dng_types.h" 22 | 23 | /*****************************************************************************/ 24 | 25 | class dng_xy_coord 26 | { 27 | 28 | public: 29 | 30 | real64 x; 31 | real64 y; 32 | 33 | public: 34 | 35 | dng_xy_coord () 36 | : x (0.0) 37 | , y (0.0) 38 | { 39 | } 40 | 41 | dng_xy_coord (real64 xx, real64 yy) 42 | : x (xx) 43 | , y (yy) 44 | { 45 | } 46 | 47 | void Clear () 48 | { 49 | x = 0.0; 50 | y = 0.0; 51 | } 52 | 53 | bool IsValid () const 54 | { 55 | return x > 0.0 && 56 | y > 0.0; 57 | } 58 | 59 | bool NotValid () const 60 | { 61 | return !IsValid (); 62 | } 63 | 64 | bool operator== (const dng_xy_coord &coord) const 65 | { 66 | return coord.x == x && 67 | coord.y == y; 68 | } 69 | 70 | bool operator!= (const dng_xy_coord &coord) const 71 | { 72 | return !(*this == coord); 73 | } 74 | 75 | }; 76 | 77 | /*****************************************************************************/ 78 | 79 | inline dng_xy_coord operator+ (const dng_xy_coord &A, 80 | const dng_xy_coord &B) 81 | { 82 | 83 | dng_xy_coord C; 84 | 85 | C.x = A.x + B.x; 86 | C.y = A.y + B.y; 87 | 88 | return C; 89 | 90 | } 91 | 92 | /*****************************************************************************/ 93 | 94 | inline dng_xy_coord operator- (const dng_xy_coord &A, 95 | const dng_xy_coord &B) 96 | { 97 | 98 | dng_xy_coord C; 99 | 100 | C.x = A.x - B.x; 101 | C.y = A.y - B.y; 102 | 103 | return C; 104 | 105 | } 106 | 107 | /*****************************************************************************/ 108 | 109 | inline dng_xy_coord operator* (real64 scale, 110 | const dng_xy_coord &A) 111 | { 112 | 113 | dng_xy_coord B; 114 | 115 | B.x = A.x * scale; 116 | B.y = A.y * scale; 117 | 118 | return B; 119 | 120 | } 121 | 122 | /******************************************************************************/ 123 | 124 | inline real64 operator* (const dng_xy_coord &A, 125 | const dng_xy_coord &B) 126 | { 127 | 128 | return A.x * B.x + 129 | A.y * B.y; 130 | 131 | } 132 | 133 | /*****************************************************************************/ 134 | 135 | // Standard xy coordinate constants. 136 | 137 | inline dng_xy_coord StdA_xy_coord () 138 | { 139 | return dng_xy_coord (0.4476, 0.4074); 140 | } 141 | 142 | inline dng_xy_coord D50_xy_coord () 143 | { 144 | return dng_xy_coord (0.3457, 0.3585); 145 | } 146 | 147 | inline dng_xy_coord D55_xy_coord () 148 | { 149 | return dng_xy_coord (0.3324, 0.3474); 150 | } 151 | 152 | inline dng_xy_coord D65_xy_coord () 153 | { 154 | return dng_xy_coord (0.3127, 0.3290); 155 | } 156 | 157 | inline dng_xy_coord D75_xy_coord () 158 | { 159 | return dng_xy_coord (0.2990, 0.3149); 160 | } 161 | 162 | /*****************************************************************************/ 163 | 164 | // Convert between xy coordinates and XYZ coordinates. 165 | 166 | dng_xy_coord XYZtoXY (const dng_vector_3 &coord); 167 | 168 | dng_vector_3 XYtoXYZ (const dng_xy_coord &coord); 169 | 170 | /*****************************************************************************/ 171 | 172 | // Returns the ICC XYZ profile connection space white point. 173 | 174 | dng_xy_coord PCStoXY (); 175 | 176 | dng_vector_3 PCStoXYZ (); 177 | 178 | /*****************************************************************************/ 179 | 180 | #endif 181 | 182 | /*****************************************************************************/ 183 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_ref_counted_block.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include 10 | 11 | #include "dng_ref_counted_block.h" 12 | 13 | #include "dng_exceptions.h" 14 | 15 | /*****************************************************************************/ 16 | 17 | dng_ref_counted_block::dng_ref_counted_block () 18 | 19 | : fBuffer (NULL) 20 | 21 | { 22 | 23 | } 24 | 25 | /*****************************************************************************/ 26 | 27 | dng_ref_counted_block::dng_ref_counted_block (uint32 size) 28 | 29 | : fBuffer (NULL) 30 | 31 | { 32 | 33 | Allocate (size); 34 | 35 | } 36 | 37 | /*****************************************************************************/ 38 | 39 | dng_ref_counted_block::~dng_ref_counted_block () 40 | { 41 | 42 | Clear (); 43 | 44 | } 45 | 46 | /*****************************************************************************/ 47 | 48 | void dng_ref_counted_block::Allocate (uint32 size) 49 | { 50 | 51 | Clear (); 52 | 53 | if (size) 54 | { 55 | 56 | fBuffer = malloc (size + sizeof (header)); 57 | 58 | if (!fBuffer) 59 | { 60 | 61 | ThrowMemoryFull (); 62 | 63 | } 64 | 65 | new (fBuffer) header (size); 66 | 67 | } 68 | 69 | } 70 | 71 | /*****************************************************************************/ 72 | 73 | void dng_ref_counted_block::Clear () 74 | { 75 | 76 | if (fBuffer) 77 | { 78 | 79 | bool doFree = false; 80 | 81 | header *blockHeader = (struct header *)fBuffer; 82 | 83 | { 84 | 85 | dng_lock_std_mutex lock (blockHeader->fMutex); 86 | 87 | if (--blockHeader->fRefCount == 0) 88 | doFree = true; 89 | 90 | } 91 | 92 | if (doFree) 93 | { 94 | 95 | blockHeader->~header (); 96 | 97 | free (fBuffer); 98 | 99 | } 100 | 101 | fBuffer = NULL; 102 | 103 | } 104 | 105 | } 106 | 107 | /*****************************************************************************/ 108 | 109 | dng_ref_counted_block::dng_ref_counted_block (const dng_ref_counted_block &data) 110 | 111 | : fBuffer (NULL) 112 | 113 | { 114 | 115 | header *blockHeader = (struct header *) data.fBuffer; 116 | 117 | if (blockHeader) 118 | { 119 | 120 | dng_lock_std_mutex lock (blockHeader->fMutex); 121 | 122 | blockHeader->fRefCount++; 123 | 124 | fBuffer = blockHeader; 125 | 126 | } 127 | 128 | } 129 | 130 | /*****************************************************************************/ 131 | 132 | dng_ref_counted_block & dng_ref_counted_block::operator= (const dng_ref_counted_block &data) 133 | { 134 | 135 | if (this != &data) 136 | { 137 | 138 | Clear (); 139 | 140 | header *blockHeader = (struct header *) data.fBuffer; 141 | 142 | if (blockHeader) 143 | { 144 | 145 | dng_lock_std_mutex lock (blockHeader->fMutex); 146 | 147 | blockHeader->fRefCount++; 148 | 149 | fBuffer = blockHeader; 150 | 151 | } 152 | 153 | } 154 | 155 | return *this; 156 | 157 | } 158 | 159 | /*****************************************************************************/ 160 | 161 | void dng_ref_counted_block::EnsureWriteable () 162 | { 163 | 164 | if (fBuffer) 165 | { 166 | 167 | header *possiblySharedHeader = (header *) fBuffer; 168 | 169 | { 170 | 171 | dng_lock_std_mutex lock (possiblySharedHeader->fMutex); 172 | 173 | if (possiblySharedHeader->fRefCount > 1) 174 | { 175 | 176 | fBuffer = NULL; 177 | 178 | Allocate ((uint32)possiblySharedHeader->fSize); 179 | 180 | memcpy (Buffer (), 181 | ((char *)possiblySharedHeader) + sizeof (struct header), // could just do + 1 w/o cast, but this makes the type mixing more explicit 182 | possiblySharedHeader->fSize); 183 | 184 | possiblySharedHeader->fRefCount--; 185 | 186 | } 187 | 188 | } 189 | 190 | } 191 | 192 | } 193 | 194 | /*****************************************************************************/ 195 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_string.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Text string representation. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_string__ 16 | #define __dng_string__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_types.h" 21 | #include "dng_memory.h" 22 | 23 | /*****************************************************************************/ 24 | 25 | class dng_string 26 | { 27 | 28 | private: 29 | 30 | // Always stored internally as a UTF-8 encoded string. 31 | 32 | dng_memory_data fData; 33 | 34 | public: 35 | 36 | dng_string (); 37 | 38 | dng_string (const dng_string &s); 39 | 40 | dng_string & operator= (const dng_string &s); 41 | 42 | ~dng_string (); 43 | 44 | const char * Get () const; 45 | 46 | bool IsASCII () const; 47 | 48 | void Set (const char *s); 49 | 50 | void Set_ASCII (const char *s); 51 | 52 | void Set_UTF8 (const char *s); 53 | 54 | uint32 Get_SystemEncoding (dng_memory_data &buffer) const; 55 | 56 | void Set_SystemEncoding (const char *s); 57 | 58 | bool ValidSystemEncoding () const; 59 | 60 | void Set_JIS_X208_1990 (const char *s); 61 | 62 | static uint32 DecodeUTF8 (const char *&s, 63 | uint32 maxBytes = 6, 64 | bool *isValid = NULL); 65 | 66 | static bool IsUTF8 (const char *s); 67 | 68 | void Set_UTF8_or_System (const char *s); 69 | 70 | uint32 Get_UTF16 (dng_memory_data &buffer) const; 71 | 72 | void Set_UTF16 (const uint16 *s); 73 | 74 | void Clear (); 75 | 76 | void Truncate (uint32 maxBytes); 77 | 78 | bool TrimTrailingBlanks (); 79 | 80 | bool TrimLeadingBlanks (); 81 | 82 | bool IsEmpty () const; 83 | 84 | bool NotEmpty () const 85 | { 86 | return !IsEmpty (); 87 | } 88 | 89 | uint32 Length () const; 90 | 91 | bool operator== (const dng_string &s) const; 92 | 93 | bool operator!= (const dng_string &s) const 94 | { 95 | return !(*this == s); 96 | } 97 | 98 | // A utility for doing case insensitive comparisons on strings... 99 | 100 | static bool Matches (const char *t, 101 | const char *s, 102 | bool case_sensitive = false); 103 | 104 | // ...wrapped up for use with dng_string. 105 | 106 | bool Matches (const char *s, 107 | bool case_sensitive = false) const; 108 | 109 | bool StartsWith (const char *s, 110 | bool case_sensitive = false) const; 111 | 112 | bool EndsWith (const char *s, 113 | bool case_sensitive = false) const; 114 | 115 | bool Contains (const char *s, 116 | bool case_sensitive = false, 117 | int32 *match_offset = NULL) const; 118 | 119 | bool Replace (const char *old_string, 120 | const char *new_string, 121 | bool case_sensitive = true); 122 | 123 | void ReplaceChars (char oldChar, 124 | char newChar); 125 | 126 | bool TrimLeading (const char *s, 127 | bool case_sensitive = false); 128 | 129 | void Append (const char *s); 130 | 131 | void SetUppercase (); 132 | 133 | void SetLowercase (); 134 | 135 | void SetLineEndings (char ending); 136 | 137 | void SetLineEndingsToNewLines () 138 | { 139 | SetLineEndings ('\n'); 140 | } 141 | 142 | void SetLineEndingsToReturns () 143 | { 144 | SetLineEndings ('\r'); 145 | } 146 | 147 | void StripLowASCII (); 148 | 149 | void ForceASCII (); 150 | 151 | int32 Compare (const dng_string &s, 152 | bool digitsAsNumber = true) const; 153 | 154 | // A utility to convert fields of numbers into comma separated numbers. 155 | 156 | void NormalizeAsCommaSeparatedNumbers (); 157 | 158 | }; 159 | 160 | /*****************************************************************************/ 161 | 162 | #endif 163 | 164 | /*****************************************************************************/ 165 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/public/include/XMP.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __XMP_hpp__ 2 | #define __XMP_hpp__ 1 3 | 4 | // ================================================================================================= 5 | // Copyright 2002 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | // ================================================================================================ 13 | /// \file XMP.hpp 14 | /// \brief Overall header file for the XMP Toolkit 15 | /// 16 | /// This is an overall header file, the only one that C++ clients should include. 17 | /// 18 | /// The full client API is in the \c TXMPMeta.hpp, \c TXMPIterator.hpp, \c TXMPUtils.hpp headers. 19 | /// Read these for information, but do not include them directly. The \c TXMP... classes are C++ 20 | /// template classes that must be instantiated with a string class such as \c std::string. The 21 | /// string class is used to return text strings for property values, serialized XMP, and so on. 22 | /// Clients must also compile \c XMP.incl_cpp to ensure that all client-side glue code is generated. 23 | /// This should be done by including it in exactly one client source file. 24 | /// 25 | /// There are two C preprocessor macros that simplify use of the templates: 26 | /// 27 | /// \li \c TXMP_STRING_TYPE - Define this as the string class to use with the template. You will get 28 | /// the template headers included and typedefs (\c SXMPMeta, and so on) to use in your code. 29 | /// 30 | /// \li \c TXMP_EXPAND_INLINE - Define this as 1 if you want to have the template functions expanded 31 | /// inline in your code. Leave it undefined, or defined as 0, to use out-of-line instantiations of 32 | /// the template functions. Compiling \c XMP.incl_cpp generates explicit out-of-line 33 | /// instantiations if \c TXMP_EXPAND_INLINE is off. 34 | /// 35 | /// The template parameter, class \c tStringObj, must have the following member functions (which 36 | /// match those for \c std::string): 37 | /// 38 | ///
39 | ///  tStringObj& assign ( const char * str, size_t len )
40 | ///  size_t size() const
41 | ///  const char * c_str() const
42 | /// 
43 | /// 44 | /// The string class must be suitable for at least UTF-8. This is the encoding used for all general 45 | /// values, and is the default encoding for serialized XMP. The string type must also be suitable 46 | /// for UTF-16 or UTF-32 if those serialization encodings are used. This mainly means tolerating 47 | /// embedded 0 bytes, which \c std::string does. 48 | // ================================================================================================ 49 | 50 | /// /c XMP_Environment.h must be the first included header. 51 | #include "XMP_Environment.h" 52 | 53 | #include "XMP_Version.h" 54 | #include "XMP_Const.h" 55 | 56 | #if XMP_WinBuild 57 | #if XMP_DebugBuild 58 | #pragma warning ( push, 4 ) 59 | #else 60 | #pragma warning ( push, 3 ) 61 | #endif 62 | #pragma warning ( disable : 4702 ) // unreachable code 63 | #pragma warning ( disable : 4800 ) // forcing value to bool 'true' or 'false' (performance warning) 64 | #endif 65 | 66 | #if defined ( TXMP_STRING_TYPE ) 67 | 68 | #include "TXMPMeta.hpp" 69 | #include "TXMPIterator.hpp" 70 | #include "TXMPUtils.hpp" 71 | typedef class TXMPMeta SXMPMeta; // For client convenience. 72 | typedef class TXMPIterator SXMPIterator; 73 | typedef class TXMPUtils SXMPUtils; 74 | #if TXMP_EXPAND_INLINE 75 | #error "TXMP_EXPAND_INLINE is not working at present. Please don't use it." 76 | #include "client-glue/TXMPMeta.incl_cpp" 77 | #include "client-glue/TXMPIterator.incl_cpp" 78 | #include "client-glue/TXMPUtils.incl_cpp" 79 | #include "client-glue/TXMPFiles.incl_cpp" 80 | #endif 81 | 82 | #if XMP_INCLUDE_XMPFILES 83 | #include "TXMPFiles.hpp" // ! Needs typedef for SXMPMeta. 84 | typedef class TXMPFiles SXMPFiles; 85 | #if TXMP_EXPAND_INLINE 86 | #include "client-glue/TXMPFiles.incl_cpp" 87 | #endif 88 | #endif 89 | 90 | #endif // TXMP_STRING_TYPE 91 | 92 | #if XMP_WinBuild 93 | #pragma warning ( pop ) 94 | #endif 95 | 96 | // ================================================================================================= 97 | 98 | #endif // __XMP_hpp__ 99 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_rect.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_rect.h" 10 | 11 | #include "dng_utils.h" 12 | 13 | /*****************************************************************************/ 14 | 15 | bool dng_rect::operator== (const dng_rect &rect) const 16 | { 17 | 18 | return (rect.t == t) && 19 | (rect.l == l) && 20 | (rect.b == b) && 21 | (rect.r == r); 22 | 23 | } 24 | 25 | /*****************************************************************************/ 26 | 27 | bool dng_rect::IsZero () const 28 | { 29 | 30 | return (t == 0) && (l == 0) && (b == 0) && (r == 0); 31 | 32 | } 33 | 34 | /*****************************************************************************/ 35 | 36 | bool dng_rect_real64::operator== (const dng_rect_real64 &rect) const 37 | { 38 | 39 | return (rect.t == t) && 40 | (rect.l == l) && 41 | (rect.b == b) && 42 | (rect.r == r); 43 | 44 | } 45 | 46 | /*****************************************************************************/ 47 | 48 | bool dng_rect_real64::IsZero () const 49 | { 50 | 51 | return (t == 0.0) && (l == 0.0) && (b == 0.0) && (r == 0.0); 52 | 53 | } 54 | 55 | /*****************************************************************************/ 56 | 57 | dng_rect operator& (const dng_rect &a, 58 | const dng_rect &b) 59 | { 60 | 61 | dng_rect c; 62 | 63 | c.t = Max_int32 (a.t, b.t); 64 | c.l = Max_int32 (a.l, b.l); 65 | 66 | c.b = Min_int32 (a.b, b.b); 67 | c.r = Min_int32 (a.r, b.r); 68 | 69 | if (c.IsEmpty ()) 70 | { 71 | 72 | c = dng_rect (); 73 | 74 | } 75 | 76 | return c; 77 | 78 | } 79 | 80 | /*****************************************************************************/ 81 | 82 | dng_rect operator| (const dng_rect &a, 83 | const dng_rect &b) 84 | { 85 | 86 | if (a.IsEmpty ()) 87 | { 88 | return b; 89 | } 90 | 91 | if (b.IsEmpty ()) 92 | { 93 | return a; 94 | } 95 | 96 | dng_rect c; 97 | 98 | c.t = Min_int32 (a.t, b.t); 99 | c.l = Min_int32 (a.l, b.l); 100 | 101 | c.b = Max_int32 (a.b, b.b); 102 | c.r = Max_int32 (a.r, b.r); 103 | 104 | return c; 105 | 106 | } 107 | 108 | /*****************************************************************************/ 109 | 110 | dng_rect_real64 operator& (const dng_rect_real64 &a, 111 | const dng_rect_real64 &b) 112 | { 113 | 114 | dng_rect_real64 c; 115 | 116 | c.t = Max_real64 (a.t, b.t); 117 | c.l = Max_real64 (a.l, b.l); 118 | 119 | c.b = Min_real64 (a.b, b.b); 120 | c.r = Min_real64 (a.r, b.r); 121 | 122 | if (c.IsEmpty ()) 123 | { 124 | 125 | c = dng_rect_real64 (); 126 | 127 | } 128 | 129 | return c; 130 | 131 | } 132 | 133 | /*****************************************************************************/ 134 | 135 | dng_rect_real64 operator| (const dng_rect_real64 &a, 136 | const dng_rect_real64 &b) 137 | { 138 | 139 | if (a.IsEmpty ()) 140 | { 141 | return b; 142 | } 143 | 144 | if (b.IsEmpty ()) 145 | { 146 | return a; 147 | } 148 | 149 | dng_rect_real64 c; 150 | 151 | c.t = Min_real64 (a.t, b.t); 152 | c.l = Min_real64 (a.l, b.l); 153 | 154 | c.b = Max_real64 (a.b, b.b); 155 | c.r = Max_real64 (a.r, b.r); 156 | 157 | return c; 158 | 159 | } 160 | 161 | /*****************************************************************************/ 162 | 163 | dng_rect_real64 Bounds (const dng_point_real64 &a, 164 | const dng_point_real64 &b, 165 | const dng_point_real64 &c, 166 | const dng_point_real64 &d) 167 | { 168 | 169 | real64 xMin = Min_real64 (a.h, Min_real64 (b.h, Min_real64 (c.h, d.h))); 170 | real64 xMax = Max_real64 (a.h, Max_real64 (b.h, Max_real64 (c.h, d.h))); 171 | 172 | real64 yMin = Min_real64 (a.v, Min_real64 (b.v, Min_real64 (c.v, d.v))); 173 | real64 yMax = Max_real64 (a.v, Max_real64 (b.v, Max_real64 (c.v, d.v))); 174 | 175 | return dng_rect_real64 (yMin, 176 | xMin, 177 | yMax, 178 | xMax); 179 | 180 | } 181 | 182 | /*****************************************************************************/ 183 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/IOUtils.cpp: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // ADOBE SYSTEMS INCORPORATED 3 | // Copyright 2013 Adobe Systems Incorporated 4 | // All Rights Reserved 5 | // 6 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 7 | // of the Adobe license agreement accompanying it. 8 | // ================================================================================================= 9 | 10 | #include "source/IOUtils.hpp" 11 | #include "source/Host_IO.hpp" 12 | 13 | #include 14 | 15 | // ================================================================================================= 16 | // ListAllChildren 17 | // ================================================================================================= 18 | 19 | static void ListAllChildren( XMP_StringPtr folderPath, XMP_StringVector & list, XMP_Bool listFolders, XMP_Bool listFiles, XMP_Bool sortList ) 20 | { 21 | try 22 | { 23 | Host_IO::AutoFolder af; 24 | af.folder = Host_IO::OpenFolder ( folderPath ); 25 | if ( af.folder != Host_IO::noFolderRef ) 26 | { 27 | std::string resourceName; 28 | 29 | while ( Host_IO::GetNextChild ( af.folder, &resourceName ) == true ) 30 | { 31 | 32 | XMP_Bool addPath = false; 33 | if ( listFolders && listFiles ) { 34 | addPath = true; 35 | } 36 | else if ( listFolders ) 37 | { 38 | if ( Host_IO::GetChildMode ( folderPath, resourceName.c_str() ) == Host_IO::kFMode_IsFolder ) 39 | addPath = true; 40 | } 41 | else if ( listFiles ) 42 | { 43 | if ( Host_IO::GetChildMode ( folderPath, resourceName.c_str() ) == Host_IO::kFMode_IsFile ) 44 | addPath = true; 45 | } 46 | 47 | if ( addPath ) 48 | list.push_back ( resourceName ); 49 | } 50 | } 51 | } catch ( XMP_Error & ) { 52 | // do nothing 53 | } 54 | if ( sortList ) 55 | std::sort ( list.begin(), list.end() ); 56 | } 57 | 58 | 59 | // ================================================================================================= 60 | // GetMatchingChildren 61 | // ================================================================================================= 62 | 63 | void IOUtils::GetMatchingChildren ( XMP_StringVector & matchingChildList, const XMP_VarString & rootPath, 64 | const XMP_StringVector & regExStringVec, XMP_Bool includeFolders, XMP_Bool includeFiles, XMP_Bool prefixRootPath ) 65 | { 66 | try 67 | { 68 | XMP_StringVector listOfAllResources; 69 | ListAllChildren (rootPath.c_str(), listOfAllResources, includeFolders, includeFiles, true); 70 | 71 | XMP_Bool matchRequired = !regExStringVec.empty(); 72 | if ( matchRequired ) 73 | { 74 | size_t childCount = listOfAllResources.size(); 75 | for ( size_t index = 0; index < childCount; index++ ) 76 | { 77 | XMP_Bool match = false; 78 | size_t regExpCount = regExStringVec.size(); 79 | for ( size_t index2 = 0; index2 < regExpCount; index2++ ) 80 | { 81 | XMP_RegExp regexObj ( regExStringVec[index2].c_str() ); 82 | match = regexObj.Match ( listOfAllResources[index].c_str() ); 83 | 84 | if ( match ) 85 | { 86 | if ( prefixRootPath ) 87 | { 88 | std::string fullPath = rootPath; 89 | if (fullPath[fullPath.length() - 1] != kDirChar ) 90 | fullPath += kDirChar; 91 | fullPath += listOfAllResources[index]; 92 | matchingChildList.push_back ( fullPath ); 93 | } 94 | else 95 | matchingChildList.push_back ( listOfAllResources[index] ); 96 | break; 97 | } 98 | } 99 | } 100 | } 101 | } catch ( XMP_Error & ) { 102 | // do nothing 103 | } 104 | } // GetMatchingChildren 105 | 106 | // ================================================================================================= 107 | // GetMatchingChildren 108 | // ================================================================================================= 109 | 110 | void IOUtils::GetMatchingChildren ( XMP_StringVector & matchingChildList, const XMP_VarString & rootPath, 111 | const XMP_VarString & regExpStr, XMP_Bool includeFolders, XMP_Bool includeFiles, XMP_Bool prefixRootPath ) 112 | { 113 | XMP_StringVector regExpStringVec; 114 | regExpStringVec.push_back ( regExpStr ); 115 | return GetMatchingChildren ( matchingChildList, rootPath, regExpStringVec, includeFolders, includeFiles, prefixRootPath ); 116 | } // GetMatchingChildren 117 | 118 | // ================================================================================================= 119 | -------------------------------------------------------------------------------- /libdng/dnghost.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the dngconvert project 2 | Copyright (C) 2011 Jens Mueller 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either 7 | version 2 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02110-1301, USA. 18 | 19 | This file uses code from dng_threaded_host.cpp -- Sandy McGuffog CornerFix utility 20 | (http://sourceforge.net/projects/cornerfix, sandy dot cornerfix at gmail dot com), 21 | dng_threaded_host.cpp is copyright 2007-2011, by Sandy McGuffog and Contributors. 22 | */ 23 | 24 | #include "dnghost.h" 25 | #include "dng_abort_sniffer.h" 26 | #include "dng_area_task.h" 27 | #include "dng_rect.h" 28 | 29 | #ifndef kLocalUseThreads 30 | #define kLocalUseThreads 1 31 | #endif 32 | 33 | #if !kLocalUseThreads 34 | 35 | void DngHost::PerformAreaTask(dng_area_task &task, const dng_rect &area) { 36 | dng_area_task::Perform(task, area, &Allocator (), Sniffer ()); 37 | } 38 | 39 | #else 40 | 41 | #include 42 | #include 43 | #include 44 | #include "dng_sdk_limits.h" 45 | 46 | static std::exception_ptr threadException = nullptr; 47 | 48 | static void executeAreaThread(std::reference_wrapper task, uint32 threadIndex, const dng_rect &threadArea, const dng_point &tileSize, dng_abort_sniffer *sniffer) { 49 | try { task.get().ProcessOnThread(threadIndex, threadArea, tileSize, sniffer, NULL); } 50 | catch (...) { threadException = std::current_exception(); } 51 | } 52 | 53 | 54 | void DngHost::PerformAreaTask(dng_area_task &task, const dng_rect &area, dng_area_task_progress *progress) { 55 | dng_point tileSize(task.FindTileSize(area)); 56 | 57 | // Now we need to do some resource allocation 58 | // We start by assuming one tile per thread, and work our way up 59 | uint32 vTilesinArea = area.H() / tileSize.v; if ((area.H() - (vTilesinArea * tileSize.v)) > 0) vTilesinArea++; 60 | uint32 hTilesinArea = area.W() / tileSize.h; if ((area.W() - (hTilesinArea * tileSize.h)) > 0) hTilesinArea++; 61 | 62 | int vTilesPerThread = 1, hTilesPerThread = 1; 63 | // Ensure we don't exceed maxThreads for this task 64 | while (((vTilesinArea + vTilesPerThread - 1) / vTilesPerThread) * ((hTilesinArea + hTilesPerThread - 1) / hTilesPerThread) > kMaxMPThreads) { 65 | // Here we want to increase the number of tiles per thread; so do we do that in the V or H dimension? 66 | if ((vTilesinArea / vTilesPerThread) > (hTilesinArea / hTilesPerThread)) vTilesPerThread++; 67 | else hTilesPerThread++; 68 | } 69 | 70 | task.Start(Min_uint32(task.MaxThreads (), kMaxMPThreads), area, tileSize, &Allocator (), Sniffer ()); 71 | 72 | std::vector areaThreads; 73 | threadException = nullptr; 74 | 75 | dng_rect threadArea(area.t, area.l, area.t + (vTilesPerThread * tileSize.v), area.l + (hTilesPerThread * tileSize.h)); 76 | for (uint32 vIndex = 0; vIndex < vTilesinArea; vIndex += vTilesPerThread) { 77 | 78 | for (uint32 hIndex = 0; hIndex < hTilesinArea; hIndex += hTilesPerThread) { 79 | try { areaThreads.push_back(std::thread(executeAreaThread, std::ref(task), areaThreads.size(), threadArea, tileSize, Sniffer ())); } 80 | catch (...) { executeAreaThread(task, areaThreads.size(), threadArea, tileSize, Sniffer ()); } 81 | 82 | threadArea.l = threadArea.r; 83 | threadArea.r = Min_int32(threadArea.r + (hTilesPerThread * tileSize.h), area.r); 84 | } 85 | 86 | threadArea.t = threadArea.b; 87 | threadArea.l = area.l; 88 | threadArea.b = Min_int32(threadArea.b + (vTilesPerThread * tileSize.v), area.b); 89 | threadArea.r = area.l + (hTilesPerThread * tileSize.h); 90 | } 91 | 92 | for (auto& areaThread : areaThreads) areaThread.join(); 93 | if (threadException) std::rethrow_exception(threadException); 94 | 95 | task.Finish(Min_uint32(task.MaxThreads(), kMaxMPThreads)); 96 | } 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_filter_task.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_filter_task.h" 10 | 11 | #include "dng_bottlenecks.h" 12 | #include "dng_exceptions.h" 13 | #include "dng_image.h" 14 | #include "dng_memory.h" 15 | #include "dng_tag_types.h" 16 | #include "dng_tag_values.h" 17 | #include "dng_utils.h" 18 | 19 | /*****************************************************************************/ 20 | 21 | dng_filter_task::dng_filter_task (const char *name, 22 | const dng_image &srcImage, 23 | dng_image &dstImage) 24 | 25 | : dng_area_task (name) 26 | 27 | , fSrcImage (srcImage) 28 | , fDstImage (dstImage) 29 | 30 | , fSrcPlane (0 ) 31 | , fSrcPlanes (srcImage.Planes ()) 32 | , fSrcPixelType (srcImage.PixelType ()) 33 | 34 | , fDstPlane (0 ) 35 | , fDstPlanes (dstImage.Planes ()) 36 | , fDstPixelType (dstImage.PixelType ()) 37 | 38 | , fSrcRepeat (1, 1) 39 | , fSrcTileSize (0, 0) 40 | 41 | { 42 | 43 | } 44 | 45 | /*****************************************************************************/ 46 | 47 | dng_filter_task::~dng_filter_task () 48 | { 49 | 50 | } 51 | 52 | /*****************************************************************************/ 53 | 54 | void dng_filter_task::Start (uint32 threadCount, 55 | const dng_rect & /* dstArea */, 56 | const dng_point &tileSize, 57 | dng_memory_allocator *allocator, 58 | dng_abort_sniffer * /* sniffer */) 59 | { 60 | 61 | fSrcTileSize = SrcTileSize (tileSize); 62 | 63 | uint32 srcBufferSize = ComputeBufferSize (fSrcPixelType, 64 | fSrcTileSize, 65 | fSrcPlanes, 66 | padSIMDBytes); 67 | 68 | uint32 dstBufferSize = ComputeBufferSize (fDstPixelType, 69 | tileSize, 70 | fDstPlanes, 71 | padSIMDBytes); 72 | 73 | for (uint32 threadIndex = 0; threadIndex < threadCount; threadIndex++) 74 | { 75 | 76 | fSrcBuffer [threadIndex] . Reset (allocator->Allocate (srcBufferSize)); 77 | 78 | fDstBuffer [threadIndex] . Reset (allocator->Allocate (dstBufferSize)); 79 | 80 | // Zero buffers so any pad bytes have defined values. 81 | 82 | DoZeroBytes (fSrcBuffer [threadIndex]->Buffer (), 83 | fSrcBuffer [threadIndex]->LogicalSize ()); 84 | 85 | DoZeroBytes (fDstBuffer [threadIndex]->Buffer (), 86 | fDstBuffer [threadIndex]->LogicalSize ()); 87 | 88 | } 89 | 90 | } 91 | 92 | /*****************************************************************************/ 93 | 94 | void dng_filter_task::Process (uint32 threadIndex, 95 | const dng_rect &area, 96 | dng_abort_sniffer * /* sniffer */) 97 | { 98 | 99 | // Find source area for this destination area. 100 | 101 | dng_rect srcArea = SrcArea (area); 102 | 103 | // Safety check. 104 | 105 | int32 src_area_w; 106 | int32 src_area_h; 107 | 108 | if (!ConvertUint32ToInt32 (srcArea.W (), 109 | &src_area_w) || 110 | !ConvertUint32ToInt32 (srcArea.H (), 111 | &src_area_h) || 112 | src_area_w > fSrcTileSize.h || 113 | src_area_h > fSrcTileSize.v) 114 | { 115 | 116 | ThrowMemoryFull ("Area exceeds tile size."); 117 | 118 | } 119 | 120 | // Setup srcBuffer. 121 | 122 | dng_pixel_buffer srcBuffer (srcArea, 123 | fSrcPlane, 124 | fSrcPlanes, 125 | fSrcPixelType, 126 | pcRowInterleavedAlignSIMD, 127 | fSrcBuffer [threadIndex]->Buffer ()); 128 | 129 | // Setup dstBuffer. 130 | 131 | dng_pixel_buffer dstBuffer (area, 132 | fDstPlane, 133 | fDstPlanes, 134 | fDstPixelType, 135 | pcRowInterleavedAlignSIMD, 136 | fDstBuffer [threadIndex]->Buffer ()); 137 | 138 | // Get source pixels. 139 | 140 | fSrcImage.Get (srcBuffer, 141 | dng_image::edge_repeat, 142 | fSrcRepeat.v, 143 | fSrcRepeat.h); 144 | 145 | // Process area. 146 | 147 | ProcessArea (threadIndex, 148 | srcBuffer, 149 | dstBuffer); 150 | 151 | // Save result pixels. 152 | 153 | fDstImage.Put (dstBuffer); 154 | 155 | } 156 | 157 | /*****************************************************************************/ 158 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_1d_function.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_1d_function.h" 10 | 11 | #include "dng_utils.h" 12 | 13 | /*****************************************************************************/ 14 | 15 | dng_1d_function::~dng_1d_function () 16 | { 17 | 18 | } 19 | 20 | /*****************************************************************************/ 21 | 22 | bool dng_1d_function::IsIdentity () const 23 | { 24 | 25 | return false; 26 | 27 | } 28 | 29 | /*****************************************************************************/ 30 | 31 | real64 dng_1d_function::EvaluateInverse (real64 y) const 32 | { 33 | 34 | const uint32 kMaxIterations = 30; 35 | const real64 kNearZero = 1.0e-10; 36 | 37 | real64 x0 = 0.0; 38 | real64 y0 = Evaluate (x0); 39 | 40 | real64 x1 = 1.0; 41 | real64 y1 = Evaluate (x1); 42 | 43 | for (uint32 iteration = 0; iteration < kMaxIterations; iteration++) 44 | { 45 | 46 | if (Abs_real64 (y1 - y0) < kNearZero) 47 | { 48 | break; 49 | } 50 | 51 | real64 x2 = Pin_real64 (0.0, 52 | x1 + (y - y1) * (x1 - x0) / (y1 - y0), 53 | 1.0); 54 | 55 | real64 y2 = Evaluate (x2); 56 | 57 | x0 = x1; 58 | y0 = y1; 59 | 60 | x1 = x2; 61 | y1 = y2; 62 | 63 | } 64 | 65 | return x1; 66 | 67 | } 68 | 69 | /*****************************************************************************/ 70 | 71 | bool dng_1d_identity::IsIdentity () const 72 | { 73 | 74 | return true; 75 | 76 | } 77 | 78 | /*****************************************************************************/ 79 | 80 | real64 dng_1d_identity::Evaluate (real64 x) const 81 | { 82 | 83 | return x; 84 | 85 | } 86 | 87 | /*****************************************************************************/ 88 | 89 | real64 dng_1d_identity::EvaluateInverse (real64 x) const 90 | { 91 | 92 | return x; 93 | 94 | } 95 | 96 | /*****************************************************************************/ 97 | 98 | const dng_1d_function & dng_1d_identity::Get () 99 | { 100 | 101 | static dng_1d_identity static_function; 102 | 103 | return static_function; 104 | 105 | } 106 | 107 | /*****************************************************************************/ 108 | 109 | dng_1d_concatenate::dng_1d_concatenate (const dng_1d_function &function1, 110 | const dng_1d_function &function2) 111 | 112 | : fFunction1 (function1) 113 | , fFunction2 (function2) 114 | 115 | { 116 | 117 | } 118 | 119 | /*****************************************************************************/ 120 | 121 | bool dng_1d_concatenate::IsIdentity () const 122 | { 123 | 124 | return fFunction1.IsIdentity () && 125 | fFunction2.IsIdentity (); 126 | 127 | } 128 | 129 | /*****************************************************************************/ 130 | 131 | real64 dng_1d_concatenate::Evaluate (real64 x) const 132 | { 133 | 134 | real64 y = Pin_real64 (0.0, fFunction1.Evaluate (x), 1.0); 135 | 136 | return fFunction2.Evaluate (y); 137 | 138 | } 139 | 140 | /*****************************************************************************/ 141 | 142 | real64 dng_1d_concatenate::EvaluateInverse (real64 x) const 143 | { 144 | 145 | real64 y = fFunction2.EvaluateInverse (x); 146 | 147 | return fFunction1.EvaluateInverse (y); 148 | 149 | } 150 | 151 | /*****************************************************************************/ 152 | 153 | dng_1d_inverse::dng_1d_inverse (const dng_1d_function &f) 154 | 155 | : fFunction (f) 156 | 157 | { 158 | 159 | } 160 | 161 | /*****************************************************************************/ 162 | 163 | bool dng_1d_inverse::IsIdentity () const 164 | { 165 | 166 | return fFunction.IsIdentity (); 167 | 168 | } 169 | 170 | /*****************************************************************************/ 171 | 172 | real64 dng_1d_inverse::Evaluate (real64 x) const 173 | { 174 | 175 | return fFunction.EvaluateInverse (x); 176 | 177 | } 178 | 179 | /*****************************************************************************/ 180 | 181 | real64 dng_1d_inverse::EvaluateInverse (real64 y) const 182 | { 183 | 184 | return fFunction.Evaluate (y); 185 | 186 | } 187 | 188 | /*****************************************************************************/ 189 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_1d_table.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_1d_table.h" 10 | 11 | #include "dng_1d_function.h" 12 | #include "dng_assertions.h" 13 | #include "dng_memory.h" 14 | #include "dng_utils.h" 15 | 16 | /*****************************************************************************/ 17 | 18 | dng_1d_table::dng_1d_table (uint32 count) 19 | 20 | : fBuffer () 21 | , fTable (NULL) 22 | , fTableCount (count) 23 | 24 | { 25 | 26 | DNG_REQUIRE (count >= kMinTableSize, 27 | "count must be at least kMinTableSize"); 28 | 29 | DNG_REQUIRE ((count & (count - 1)) == 0, 30 | "count must be power of 2"); 31 | 32 | } 33 | 34 | /*****************************************************************************/ 35 | 36 | dng_1d_table::~dng_1d_table () 37 | { 38 | 39 | } 40 | 41 | /*****************************************************************************/ 42 | 43 | void dng_1d_table::SubDivide (const dng_1d_function &function, 44 | uint32 lower, 45 | uint32 upper, 46 | real32 maxDelta) 47 | { 48 | 49 | uint32 range = upper - lower; 50 | 51 | bool subDivide = (range > (fTableCount >> 8)); 52 | 53 | if (!subDivide) 54 | { 55 | 56 | real32 delta = Abs_real32 (fTable [upper] - 57 | fTable [lower]); 58 | 59 | if (delta > maxDelta) 60 | { 61 | 62 | subDivide = true; 63 | 64 | } 65 | 66 | } 67 | 68 | if (subDivide) 69 | { 70 | 71 | uint32 middle = (lower + upper) >> 1; 72 | 73 | fTable [middle] = (real32) function.Evaluate (middle * (1.0 / (real64) fTableCount)); 74 | 75 | if (range > 2) 76 | { 77 | 78 | SubDivide (function, lower, middle, maxDelta); 79 | 80 | SubDivide (function, middle, upper, maxDelta); 81 | 82 | } 83 | 84 | } 85 | 86 | else 87 | { 88 | 89 | real64 y0 = fTable [lower]; 90 | real64 y1 = fTable [upper]; 91 | 92 | real64 delta = (y1 - y0) / (real64) range; 93 | 94 | for (uint32 j = lower + 1; j < upper; j++) 95 | { 96 | 97 | y0 += delta; 98 | 99 | fTable [j] = (real32) y0; 100 | 101 | } 102 | 103 | } 104 | 105 | } 106 | 107 | /*****************************************************************************/ 108 | 109 | void dng_1d_table::Initialize (dng_memory_allocator &allocator, 110 | const dng_1d_function &function, 111 | bool subSample) 112 | { 113 | 114 | fBuffer.Reset (allocator.Allocate ((fTableCount + 2) * sizeof (real32))); 115 | 116 | fTable = fBuffer->Buffer_real32 (); 117 | 118 | if (subSample) 119 | { 120 | 121 | fTable [0 ] = (real32) function.Evaluate (0.0); 122 | fTable [fTableCount] = (real32) function.Evaluate (1.0); 123 | 124 | real32 maxDelta = Max_real32 (Abs_real32 (fTable [fTableCount] - 125 | fTable [0 ]), 1.0f) * 126 | (1.0f / 256.0f); 127 | 128 | SubDivide (function, 129 | 0, 130 | fTableCount, 131 | maxDelta); 132 | 133 | } 134 | 135 | else 136 | { 137 | 138 | for (uint32 j = 0; j <= fTableCount; j++) 139 | { 140 | 141 | real64 x = j * (1.0 / (real64) fTableCount); 142 | 143 | real64 y = function.Evaluate (x); 144 | 145 | fTable [j] = (real32) y; 146 | 147 | } 148 | 149 | } 150 | 151 | fTable [fTableCount + 1] = fTable [fTableCount]; 152 | 153 | } 154 | 155 | /*****************************************************************************/ 156 | 157 | void dng_1d_table::Expand16 (uint16 *table16) const 158 | { 159 | 160 | real64 step = (real64) fTableCount / 65535.0; 161 | 162 | real64 y0 = fTable [0]; 163 | real64 y1 = fTable [1]; 164 | 165 | real64 base = y0 * 65535.0 + 0.5; 166 | real64 slope = (y1 - y0) * 65535.0; 167 | 168 | uint32 index = 1; 169 | real64 fract = 0.0; 170 | 171 | for (uint32 j = 0; j < 0x10000; j++) 172 | { 173 | 174 | table16 [j] = (uint16) (base + slope * fract); 175 | 176 | fract += step; 177 | 178 | if (fract > 1.0) 179 | { 180 | 181 | index += 1; 182 | fract -= 1.0; 183 | 184 | y0 = y1; 185 | y1 = fTable [index]; 186 | 187 | base = y0 * 65535.0 + 0.5; 188 | slope = (y1 - y0) * 65535.0; 189 | 190 | } 191 | 192 | } 193 | 194 | } 195 | 196 | /*****************************************************************************/ 197 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_color_spec.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Class for holding a specific color transform. 11 | */ 12 | 13 | #ifndef __dng_color_spec__ 14 | #define __dng_color_spec__ 15 | 16 | /*****************************************************************************/ 17 | 18 | #include "dng_classes.h" 19 | #include "dng_matrix.h" 20 | #include "dng_types.h" 21 | #include "dng_xy_coord.h" 22 | 23 | /*****************************************************************************/ 24 | 25 | /// \brief Compute a 3x3 matrix which maps colors from white point white1 to 26 | /// white point white2 27 | /// 28 | /// Uses linearized Bradford adaptation matrix to compute a mapping from 29 | /// colors measured with one white point (white1) to another (white2). 30 | 31 | dng_matrix_3by3 MapWhiteMatrix (const dng_xy_coord &white1, 32 | const dng_xy_coord &white2); 33 | 34 | /*****************************************************************************/ 35 | 36 | /// Color transform taking into account white point and camera calibration and 37 | /// individual calibration from DNG negative. 38 | 39 | class dng_color_spec 40 | { 41 | 42 | private: 43 | 44 | uint32 fChannels; 45 | 46 | real64 fTemperature1; 47 | real64 fTemperature2; 48 | 49 | dng_matrix fColorMatrix1; 50 | dng_matrix fColorMatrix2; 51 | 52 | dng_matrix fForwardMatrix1; 53 | dng_matrix fForwardMatrix2; 54 | 55 | dng_matrix fReductionMatrix1; 56 | dng_matrix fReductionMatrix2; 57 | 58 | dng_matrix fCameraCalibration1; 59 | dng_matrix fCameraCalibration2; 60 | 61 | dng_matrix fAnalogBalance; 62 | 63 | dng_xy_coord fWhiteXY; 64 | 65 | dng_vector fCameraWhite; 66 | dng_matrix fCameraToPCS; 67 | 68 | dng_matrix fPCStoCamera; 69 | 70 | public: 71 | 72 | /// Read calibration info from DNG negative and construct a 73 | /// dng_color_spec. 74 | 75 | dng_color_spec (const dng_negative &negative, 76 | const dng_camera_profile *profile); 77 | 78 | virtual ~dng_color_spec () 79 | { 80 | } 81 | 82 | /// Number of channels used for this color transform. Three 83 | /// for most cameras. 84 | 85 | uint32 Channels () const 86 | { 87 | return fChannels; 88 | } 89 | 90 | /// Setter for white point. Value is as XY colorspace coordinate. 91 | /// \param white White point to set as an XY value. 92 | 93 | void SetWhiteXY (const dng_xy_coord &white); 94 | 95 | /// Getter for white point. Value is as XY colorspace coordinate. 96 | /// \retval XY value of white point. 97 | 98 | const dng_xy_coord & WhiteXY () const; 99 | 100 | /// Return white point in camera native color coordinates. 101 | /// \retval A dng_vector with components ranging from 0.0 to 1.0 102 | /// that is normalized such that one component is equal to 1.0 . 103 | 104 | const dng_vector & CameraWhite () const; 105 | 106 | /// Getter for camera to Profile Connection Space color transform. 107 | /// \retval A transform that takes into account all camera calibration 108 | /// transforms and white point. 109 | 110 | const dng_matrix & CameraToPCS () const; 111 | 112 | /// Getter for Profile Connection Space to camera color transform. 113 | /// \retval A transform that takes into account all camera calibration 114 | /// transforms and white point. 115 | 116 | const dng_matrix & PCStoCamera () const; 117 | 118 | /// Return the XY value to use for SetWhiteXY for a given camera color 119 | /// space coordinate as the white point. 120 | /// \param neutral A camera color space value to use for white point. 121 | /// Components range from 0.0 to 1.0 and should be normalized such that 122 | /// the largest value is 1.0 . 123 | /// \retval White point in XY space that makes neutral map to this 124 | /// XY value as closely as possible. 125 | 126 | dng_xy_coord NeutralToXY (const dng_vector &neutral); 127 | 128 | private: 129 | 130 | dng_matrix FindXYZtoCamera (const dng_xy_coord &white, 131 | dng_matrix *forwardMatrix = NULL, 132 | dng_matrix *reductionMatrix = NULL, 133 | dng_matrix *cameraCalibration = NULL); 134 | 135 | }; 136 | 137 | /*****************************************************************************/ 138 | 139 | #endif 140 | 141 | /*****************************************************************************/ 142 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_iptc.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | /** \file 10 | * Support for IPTC metadata within DNG files. 11 | */ 12 | 13 | /*****************************************************************************/ 14 | 15 | #ifndef __dng_iptc__ 16 | #define __dng_iptc__ 17 | 18 | /*****************************************************************************/ 19 | 20 | #include "dng_date_time.h" 21 | #include "dng_string.h" 22 | #include "dng_string_list.h" 23 | 24 | /*****************************************************************************/ 25 | 26 | /// \brief Class for reading and holding IPTC metadata associated with a DNG file. 27 | /// 28 | /// See the \ref spec_iptc "IPTC specification" 29 | /// for information on member fields of this class. 30 | 31 | class dng_iptc 32 | { 33 | 34 | public: 35 | 36 | dng_string fTitle; 37 | 38 | int32 fUrgency; 39 | 40 | dng_string fCategory; 41 | 42 | dng_string_list fSupplementalCategories; 43 | 44 | dng_string_list fKeywords; 45 | 46 | dng_string fInstructions; 47 | 48 | dng_date_time_info fDateTimeCreated; 49 | 50 | dng_date_time_info fDigitalCreationDateTime; 51 | 52 | dng_string_list fAuthors; 53 | 54 | dng_string fAuthorsPosition; 55 | 56 | dng_string fCity; 57 | dng_string fState; 58 | dng_string fCountry; 59 | dng_string fCountryCode; 60 | 61 | dng_string fLocation; 62 | 63 | dng_string fTransmissionReference; 64 | 65 | dng_string fHeadline; 66 | 67 | dng_string fCredit; 68 | 69 | dng_string fSource; 70 | 71 | dng_string fCopyrightNotice; 72 | 73 | dng_string fDescription; 74 | dng_string fDescriptionWriter; 75 | 76 | protected: 77 | 78 | enum DataSet 79 | { 80 | kRecordVersionSet = 0, 81 | kObjectNameSet = 5, 82 | kUrgencySet = 10, 83 | kCategorySet = 15, 84 | kSupplementalCategoriesSet = 20, 85 | kKeywordsSet = 25, 86 | kSpecialInstructionsSet = 40, 87 | kDateCreatedSet = 55, 88 | kTimeCreatedSet = 60, 89 | kDigitalCreationDateSet = 62, 90 | kDigitalCreationTimeSet = 63, 91 | kBylineSet = 80, 92 | kBylineTitleSet = 85, 93 | kCitySet = 90, 94 | kSublocationSet = 92, 95 | kProvinceStateSet = 95, 96 | kCountryCodeSet = 100, 97 | kCountryNameSet = 101, 98 | kOriginalTransmissionReferenceSet = 103, 99 | kHeadlineSet = 105, 100 | kCreditSet = 110, 101 | kSourceSet = 115, 102 | kCopyrightNoticeSet = 116, 103 | kCaptionSet = 120, 104 | kCaptionWriterSet = 122 105 | }; 106 | 107 | enum CharSet 108 | { 109 | kCharSetUnknown = 0, 110 | kCharSetUTF8 = 1 111 | }; 112 | 113 | public: 114 | 115 | dng_iptc (); 116 | 117 | virtual ~dng_iptc (); 118 | 119 | /// Test if IPTC metadata exists. 120 | /// \retval true if no IPTC metadata exists for this DNG. 121 | 122 | bool IsEmpty () const; 123 | 124 | /// Test if IPTC metadata exists. 125 | /// \retval true if IPTC metadata exists for this DNG. 126 | 127 | bool NotEmpty () const 128 | { 129 | return !IsEmpty (); 130 | } 131 | 132 | /// Parse a complete block of IPTC data. 133 | /// \param blockData The block of IPTC data. 134 | /// \param blockSize Size in bytes of data block. 135 | /// \param offsetInOriginalFile Used to enable certain file patching operations such as updating date/time in place. 136 | 137 | void Parse (const void *blockData, 138 | uint32 blockSize, 139 | uint64 offsetInOriginalFile); 140 | 141 | /// Serialize IPTC data to a memory block. 142 | /// \param allocator Memory allocator used to acquire memory block. 143 | /// \param padForTIFF Forces length of block to be a multiple of four bytes in accordance with TIFF standard. 144 | /// \retval Memory block 145 | 146 | dng_memory_block * Spool (dng_memory_allocator &allocator, 147 | bool padForTIFF); 148 | 149 | protected: 150 | 151 | void ParseString (dng_stream &stream, 152 | dng_string &s, 153 | CharSet charSet); 154 | 155 | void SpoolString (dng_stream &stream, 156 | const dng_string &s, 157 | uint8 dataSet, 158 | uint32 maxChars, 159 | CharSet charSet); 160 | 161 | }; 162 | 163 | /*****************************************************************************/ 164 | 165 | #endif 166 | 167 | /*****************************************************************************/ 168 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/XMPCore/source/XMPIterator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __XMPIterator_hpp__ 2 | #define __XMPIterator_hpp__ 3 | 4 | // ================================================================================================= 5 | // Copyright 2003 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | #include "public/include/XMP_Environment.h" 13 | #include "public/include/XMP_Const.h" 14 | #include "XMPCore/source/XMPMeta.hpp" 15 | 16 | // ================================================================================================= 17 | 18 | struct IterNode; 19 | typedef std::vector < IterNode > IterOffspring; 20 | typedef IterOffspring::iterator IterPos; 21 | 22 | typedef std::pair < IterPos, IterPos > IterPosPair; 23 | typedef std::vector < IterPosPair > IterPosStack; 24 | 25 | enum { // Values for the visitStage field, used to decide how to proceed past a node. 26 | kIter_BeforeVisit = 0, // Have not visited this node at all. 27 | kIter_VisitSelf = 1, // Have visited this node and returned its value/options portion. 28 | kIter_VisitQualifiers = 2, // In the midst of visiting this node's qualifiers. 29 | kIter_VisitChildren = 3 // In the midst of visiting this node's children. 30 | }; 31 | 32 | struct IterNode { 33 | 34 | XMP_OptionBits options; 35 | XMP_VarString fullPath; 36 | size_t leafOffset; 37 | IterOffspring children, qualifiers; 38 | XMP_Uns8 visitStage; 39 | #if 0 // *** XMP_DebugBuild 40 | XMP_StringPtr _pathPtr, _leafPtr; // *** Not working, need operator=? 41 | #endif 42 | 43 | IterNode() : options(0), leafOffset(0), visitStage(kIter_BeforeVisit) 44 | { 45 | #if 0 // *** XMP_DebugBuild 46 | _pathPtr = _leafPtr = 0; 47 | #endif 48 | }; 49 | 50 | IterNode ( XMP_OptionBits _options, const XMP_VarString& _fullPath, size_t _leafOffset ) 51 | : options(_options), fullPath(_fullPath), leafOffset(_leafOffset), visitStage(kIter_BeforeVisit) 52 | { 53 | #if 0 // *** XMP_DebugBuild 54 | _pathPtr = fullPath.c_str(); 55 | _leafPtr = _pathPtr + leafOffset; 56 | #endif 57 | }; 58 | 59 | }; 60 | 61 | struct IterInfo { 62 | 63 | XMP_OptionBits options; 64 | const XMPMeta * xmpObj; 65 | XMP_VarString currSchema; 66 | IterPos currPos, endPos; 67 | IterPosStack ancestors; 68 | IterNode tree; 69 | #if 0 // *** XMP_DebugBuild 70 | XMP_StringPtr _schemaPtr; // *** Not working, need operator=? 71 | #endif 72 | 73 | IterInfo() : options(0), xmpObj(0) 74 | { 75 | #if 0 // *** XMP_DebugBuild 76 | _schemaPtr = 0; 77 | #endif 78 | }; 79 | 80 | IterInfo ( XMP_OptionBits _options, const XMPMeta * _xmpObj ) : options(_options), xmpObj(_xmpObj) 81 | { 82 | #if 0 // *** XMP_DebugBuild 83 | _schemaPtr = 0; 84 | #endif 85 | }; 86 | 87 | }; 88 | 89 | // ================================================================================================= 90 | 91 | class XMPIterator { 92 | public: 93 | 94 | static bool 95 | Initialize(); // ! For internal use only! 96 | 97 | static void 98 | Terminate() RELEASE_NO_THROW; // ! For internal use only! 99 | 100 | XMPIterator ( const XMPMeta & xmpObj, // Construct a property iterator. 101 | XMP_StringPtr schemaNS, 102 | XMP_StringPtr propName, 103 | XMP_OptionBits options ); 104 | 105 | XMPIterator ( XMP_StringPtr schemaNS, // Construct a table iterator. 106 | XMP_StringPtr propName, 107 | XMP_OptionBits options ); 108 | 109 | virtual ~XMPIterator() RELEASE_NO_THROW; 110 | 111 | bool 112 | Next ( XMP_StringPtr * schemaNS, 113 | XMP_StringLen * nsSize, 114 | XMP_StringPtr * propPath, 115 | XMP_StringLen * pathSize, 116 | XMP_StringPtr * propValue, 117 | XMP_StringLen * valueSize, 118 | XMP_OptionBits * propOptions ); 119 | 120 | void 121 | Skip ( XMP_OptionBits options ); 122 | 123 | // ! Expose so that wrappers and file static functions can see the data. 124 | 125 | XMP_Int32 clientRefs; // ! Must be signed to allow decrement from 0. 126 | XMP_ReadWriteLock lock; 127 | 128 | IterInfo info; 129 | 130 | private: 131 | 132 | // ! These are hidden on purpose: 133 | XMPIterator() : clientRefs(0) 134 | { XMP_Throw ( "Call to hidden constructor", kXMPErr_InternalFailure ); }; 135 | XMPIterator ( const XMPIterator & /* original */ ) : clientRefs(0) 136 | { XMP_Throw ( "Call to hidden constructor", kXMPErr_InternalFailure ); }; 137 | void operator= ( const XMPIterator & /* rhs */ ) 138 | { XMP_Throw ( "Call to hidden operator=", kXMPErr_InternalFailure ); }; 139 | 140 | }; 141 | 142 | // ================================================================================================= 143 | 144 | #endif // __XMPIterator_hpp__ 145 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_simple_image.cpp: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #include "dng_simple_image.h" 10 | 11 | #include "dng_memory.h" 12 | #include "dng_orientation.h" 13 | #include "dng_tag_types.h" 14 | #include "dng_tag_values.h" 15 | 16 | /*****************************************************************************/ 17 | 18 | dng_simple_image::dng_simple_image (const dng_rect &bounds, 19 | uint32 planes, 20 | uint32 pixelType, 21 | dng_memory_allocator &allocator) 22 | 23 | : dng_image (bounds, 24 | planes, 25 | pixelType) 26 | 27 | , fBuffer () 28 | , fMemory () 29 | , fAllocator (allocator) 30 | 31 | { 32 | 33 | uint32 bytes = ComputeBufferSize (pixelType, 34 | bounds.Size (), 35 | planes, 36 | padSIMDBytes); 37 | 38 | fMemory.Reset (allocator.Allocate (bytes)); 39 | 40 | fBuffer = dng_pixel_buffer (bounds, 41 | 0, 42 | planes, 43 | pixelType, 44 | pcInterleaved, 45 | fMemory->Buffer ()); 46 | 47 | } 48 | 49 | /*****************************************************************************/ 50 | 51 | dng_simple_image::~dng_simple_image () 52 | { 53 | 54 | } 55 | 56 | /*****************************************************************************/ 57 | 58 | dng_image * dng_simple_image::Clone () const 59 | { 60 | 61 | AutoPtr result (new dng_simple_image (Bounds (), 62 | Planes (), 63 | PixelType (), 64 | fAllocator)); 65 | 66 | result->fBuffer.CopyArea (fBuffer, 67 | Bounds (), 68 | 0, 69 | Planes ()); 70 | 71 | return result.Release (); 72 | 73 | } 74 | 75 | /*****************************************************************************/ 76 | 77 | void dng_simple_image::SetPixelType (uint32 pixelType) 78 | { 79 | 80 | dng_image::SetPixelType (pixelType); 81 | 82 | fBuffer.fPixelType = pixelType; 83 | 84 | } 85 | 86 | /*****************************************************************************/ 87 | 88 | void dng_simple_image::Trim (const dng_rect &r) 89 | { 90 | 91 | fBounds.t = 0; 92 | fBounds.l = 0; 93 | 94 | fBounds.b = r.H (); 95 | fBounds.r = r.W (); 96 | 97 | fBuffer.fData = fBuffer.DirtyPixel (r.t, r.l); 98 | 99 | fBuffer.fArea = fBounds; 100 | 101 | } 102 | 103 | /*****************************************************************************/ 104 | 105 | void dng_simple_image::Rotate (const dng_orientation &orientation) 106 | { 107 | 108 | int32 originH = fBounds.l; 109 | int32 originV = fBounds.t; 110 | 111 | int32 colStep = fBuffer.fColStep; 112 | int32 rowStep = fBuffer.fRowStep; 113 | 114 | uint32 width = fBounds.W (); 115 | uint32 height = fBounds.H (); 116 | 117 | if (orientation.FlipH ()) 118 | { 119 | 120 | originH += width - 1; 121 | 122 | colStep = -colStep; 123 | 124 | } 125 | 126 | if (orientation.FlipV ()) 127 | { 128 | 129 | originV += height - 1; 130 | 131 | rowStep = -rowStep; 132 | 133 | } 134 | 135 | if (orientation.FlipD ()) 136 | { 137 | 138 | int32 temp = colStep; 139 | 140 | colStep = rowStep; 141 | rowStep = temp; 142 | 143 | width = fBounds.H (); 144 | height = fBounds.W (); 145 | 146 | } 147 | 148 | fBuffer.fData = fBuffer.DirtyPixel (originV, originH); 149 | 150 | fBuffer.fColStep = colStep; 151 | fBuffer.fRowStep = rowStep; 152 | 153 | fBounds.r = fBounds.l + width; 154 | fBounds.b = fBounds.t + height; 155 | 156 | fBuffer.fArea = fBounds; 157 | 158 | } 159 | 160 | /*****************************************************************************/ 161 | 162 | void dng_simple_image::AcquireTileBuffer (dng_tile_buffer &buffer, 163 | const dng_rect &area, 164 | bool dirty) const 165 | { 166 | 167 | buffer.fArea = area; 168 | 169 | buffer.fPlane = fBuffer.fPlane; 170 | buffer.fPlanes = fBuffer.fPlanes; 171 | buffer.fRowStep = fBuffer.fRowStep; 172 | buffer.fColStep = fBuffer.fColStep; 173 | buffer.fPlaneStep = fBuffer.fPlaneStep; 174 | buffer.fPixelType = fBuffer.fPixelType; 175 | buffer.fPixelSize = fBuffer.fPixelSize; 176 | 177 | buffer.fData = (void *) fBuffer.ConstPixel (buffer.fArea.t, 178 | buffer.fArea.l, 179 | buffer.fPlane); 180 | 181 | buffer.fDirty = dirty; 182 | 183 | } 184 | 185 | /*****************************************************************************/ 186 | -------------------------------------------------------------------------------- /libdng/dng-sdk/source/dng_orientation.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | // Copyright 2006-2019 Adobe Systems Incorporated 3 | // All Rights Reserved. 4 | // 5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | // accordance with the terms of the Adobe license agreement accompanying it. 7 | /*****************************************************************************/ 8 | 9 | #ifndef __dng_orientation__ 10 | #define __dng_orientation__ 11 | 12 | /******************************************************************************/ 13 | 14 | #include "dng_matrix.h" 15 | #include "dng_types.h" 16 | 17 | /******************************************************************************/ 18 | 19 | class dng_orientation 20 | { 21 | 22 | private: 23 | 24 | // We internally use an orientation encoding ("Adobe") that is 25 | // different than the TIFF orientation encoding ("TIFF"). 26 | 27 | uint32 fAdobeOrientation; 28 | 29 | public: 30 | 31 | enum 32 | { 33 | kNormal = 0, 34 | kRotate90CW = 1, 35 | kRotate180 = 2, 36 | kRotate90CCW = 3, 37 | kMirror = 4, 38 | kMirror90CW = 5, 39 | kMirror180 = 6, 40 | kMirror90CCW = 7, 41 | kUnknown = 8 42 | }; 43 | 44 | dng_orientation () 45 | 46 | : fAdobeOrientation (kNormal) 47 | 48 | { 49 | } 50 | 51 | void SetAdobe (uint32 adobe) 52 | { 53 | fAdobeOrientation = adobe; 54 | } 55 | 56 | uint32 GetAdobe () const 57 | { 58 | return fAdobeOrientation; 59 | } 60 | 61 | void SetTIFF (uint32 tiff); 62 | 63 | uint32 GetTIFF () const; 64 | 65 | static dng_orientation AdobeToDNG (uint32 adobe) 66 | { 67 | 68 | dng_orientation result; 69 | 70 | result.SetAdobe (adobe); 71 | 72 | return result; 73 | 74 | } 75 | 76 | static dng_orientation TIFFtoDNG (uint32 tiff) 77 | { 78 | 79 | dng_orientation result; 80 | 81 | result.SetTIFF (tiff); 82 | 83 | return result; 84 | 85 | } 86 | 87 | static dng_orientation Normal () 88 | { 89 | return AdobeToDNG (kNormal); 90 | } 91 | 92 | static dng_orientation Rotate90CW () 93 | { 94 | return AdobeToDNG (kRotate90CW); 95 | } 96 | 97 | static dng_orientation Rotate180 () 98 | { 99 | return AdobeToDNG (kRotate180); 100 | } 101 | 102 | static dng_orientation Rotate90CCW () 103 | { 104 | return AdobeToDNG (kRotate90CCW); 105 | } 106 | 107 | static dng_orientation Mirror () 108 | { 109 | return AdobeToDNG (kMirror); 110 | } 111 | 112 | static dng_orientation Mirror90CW () 113 | { 114 | return AdobeToDNG (kMirror90CW); 115 | } 116 | 117 | static dng_orientation Mirror180 () 118 | { 119 | return AdobeToDNG (kMirror180); 120 | } 121 | 122 | static dng_orientation Mirror90CCW () 123 | { 124 | return AdobeToDNG (kMirror90CCW); 125 | } 126 | 127 | static dng_orientation Unknown () 128 | { 129 | return AdobeToDNG (kUnknown); 130 | } 131 | 132 | bool IsValid () const 133 | { 134 | return fAdobeOrientation < kUnknown; 135 | } 136 | 137 | bool NotValid () const 138 | { 139 | return !IsValid (); 140 | } 141 | 142 | bool FlipD () const; 143 | 144 | bool FlipH () const; 145 | 146 | bool FlipV () const; 147 | 148 | bool operator== (const dng_orientation &b) const 149 | { 150 | return fAdobeOrientation == b.fAdobeOrientation; 151 | } 152 | 153 | bool operator!= (const dng_orientation &b) const 154 | { 155 | return !(*this == b); 156 | } 157 | 158 | dng_orientation operator- () const; 159 | 160 | dng_orientation operator+ (const dng_orientation &b) const; 161 | 162 | dng_orientation operator- (const dng_orientation &b) const 163 | { 164 | return (*this) + (-b); 165 | } 166 | 167 | void operator+= (const dng_orientation &b) 168 | { 169 | *this = *this + b; 170 | } 171 | 172 | void operator-= (const dng_orientation &b) 173 | { 174 | *this = *this - b; 175 | } 176 | 177 | // If horizontalFirstRow is true, then the x (horizontal h) component 178 | // of the transform will be in the first row of the resulting matrix, 179 | // and the y (vertical v) component will be in the second row. 180 | // 181 | // If horizontalFirstRow is false, then the y (vertical v) component 182 | // of the transform will be in the first row of the resulting matrix, 183 | // and the x (horizontal h) component will be in the second row. 184 | 185 | bool CalcForwardMatrix3by3 (dng_matrix &matrix, 186 | bool horizontalFirstRow) const; 187 | 188 | bool CalcForwardMatrix4by4 (dng_matrix &matrix, 189 | bool horizontalFirstRow) const; 190 | 191 | }; 192 | 193 | /******************************************************************************/ 194 | 195 | #endif 196 | 197 | /******************************************************************************/ 198 | -------------------------------------------------------------------------------- /libdng/xmp-sdk/source/UnicodeInlines.incl_cpp: -------------------------------------------------------------------------------- 1 | #ifndef __UnicodeInlines_incl_cpp__ 2 | #define __UnicodeInlines_incl_cpp__ 3 | 4 | // ================================================================================================= 5 | // Copyright 2004 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 9 | // of the Adobe license agreement accompanying it. 10 | // ================================================================================================= 11 | 12 | #include "source/UnicodeConversions.hpp" 13 | 14 | // ================================================================================================= 15 | // Inner loop utilities that need to be inlined. 16 | // ================================================================================================= 17 | 18 | static inline XMP_Uns32 GetCodePoint ( const XMP_Uns8 ** utf8Str_io ) 19 | { 20 | const XMP_Uns8 * u8Ptr = *utf8Str_io; 21 | XMP_Uns32 cp; 22 | size_t u8Len; 23 | CodePoint_from_UTF8 ( u8Ptr, 4, &cp, &u8Len ); // Throws an exception for errors. 24 | *utf8Str_io = u8Ptr + u8Len; 25 | return cp; 26 | } 27 | 28 | // ================================================================================================= 29 | 30 | static inline bool IsStartChar_ASCII ( XMP_Uns32 cp ) 31 | { 32 | // ASCII starting characters for an XML name. 33 | if ( (('a' <= cp) && (cp <= 'z')) || (('A' <= cp) && (cp <= 'Z')) || (cp == '_') ) return true; 34 | return false; 35 | } 36 | 37 | // ------------------------------------------------------------------------------------------------- 38 | 39 | static inline bool IsStartChar_NonASCII ( XMP_Uns32 cp ) 40 | { 41 | // Non-ASCII starting characters for an XML name. 42 | 43 | if ( ((0xC0 <= cp) && (cp <= 0xD6)) || ((0xD8 <= cp) && (cp <= 0xF6)) ) return true; 44 | if ( ((0xF8 <= cp) && (cp <= 0x2FF)) || ((0x370 <= cp) && (cp <= 0x37D)) ) return true; 45 | 46 | if ( ((0x37F <= cp) && (cp <= 0x1FFF)) || ((0x200C <= cp) && (cp <= 0x200D)) ) return true; 47 | if ( ((0x2070 <= cp) && (cp <= 0x218F)) || ((0x2C00 <= cp) && (cp <= 0x2FEF)) ) return true; 48 | if ( ((0x3001 <= cp) && (cp <= 0xD7FF)) || ((0xF900 <= cp) && (cp <= 0xFDCF)) ) return true; 49 | if ( ((0xFDF0 <= cp) && (cp <= 0xFFFD)) || ((0x10000 <= cp) && (cp <= 0xEFFFF)) ) return true; 50 | 51 | return false; 52 | 53 | } 54 | 55 | // ------------------------------------------------------------------------------------------------- 56 | 57 | static inline bool IsOtherChar_ASCII ( XMP_Uns32 cp ) 58 | { 59 | // ASCII following characters for an XML name. 60 | if ( (('0' <= cp) && (cp <= '9')) || (cp == '-') || (cp == '.') ) return true; 61 | return false; 62 | } 63 | 64 | // ------------------------------------------------------------------------------------------------- 65 | 66 | static inline bool IsOtherChar_NonASCII ( XMP_Uns32 cp ) 67 | { 68 | // Non-ASCII following characters for an XML name. 69 | if ( (cp == 0xB7) || ((0x300 <= cp) && (cp <= 0x36F)) || ((0x203F <= cp) && (cp <= 0x2040)) ) return true; 70 | return false; 71 | } 72 | 73 | // ------------------------------------------------------------------------------------------------- 74 | 75 | static inline void VerifyUTF8 ( XMP_StringPtr str ) 76 | { 77 | const XMP_Uns8 * utf8Str = (XMP_Uns8*)str; 78 | while ( *utf8Str != 0 ) { 79 | while ( (*utf8Str != 0) && (*utf8Str < 0x80) ) ++utf8Str; 80 | if ( *utf8Str >= 0x80 ) (void) GetCodePoint ( &utf8Str ); // Throws for bad UTF-8. 81 | } 82 | } 83 | 84 | // ------------------------------------------------------------------------------------------------- 85 | 86 | static inline void VerifySimpleXMLName ( XMP_StringPtr _nameStart, XMP_StringPtr _nameEnd ) 87 | { 88 | 89 | const XMP_Uns8 * nameStart = (const XMP_Uns8 *) _nameStart; 90 | const XMP_Uns8 * nameEnd = (const XMP_Uns8 *) _nameEnd; 91 | const XMP_Uns8 * namePos = nameStart; 92 | XMP_Uns32 cp; 93 | 94 | // The first character is more restricted. 95 | 96 | if ( nameStart >= nameEnd ) XMP_Throw ( "Empty XML name", kXMPErr_BadXPath ); 97 | 98 | cp = *namePos; 99 | if ( cp < 0x80 ) { 100 | ++namePos; 101 | if ( ! IsStartChar_ASCII(cp) ) goto NameError; 102 | } else { 103 | cp = GetCodePoint ( &namePos ); 104 | if ( ! IsStartChar_NonASCII(cp) ) goto NameError; 105 | } 106 | 107 | // Check the rest of the name. 108 | 109 | while ( namePos < nameEnd ) { 110 | cp = *namePos; 111 | if ( cp < 0x80 ) { 112 | ++namePos; 113 | if ( (! IsStartChar_ASCII(cp)) && (! IsOtherChar_ASCII(cp)) ) goto NameError; 114 | } else { 115 | cp = GetCodePoint ( &namePos ); 116 | if ( (! IsStartChar_NonASCII(cp)) && (! IsOtherChar_NonASCII(cp)) ) goto NameError; 117 | } 118 | } 119 | 120 | return; 121 | 122 | NameError: 123 | XMP_Throw ( "Bad XML name", kXMPErr_BadXPath ); 124 | 125 | } // VerifySimpleXMLName 126 | 127 | // ================================================================================================= 128 | 129 | #endif // __UnicodeInlines_incl_cpp__ 130 | -------------------------------------------------------------------------------- /raw2dng/vendorProcessors/DNGprocessor.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2015 Fimagena 2 | 3 | This library is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU Library General Public 5 | License as published by the Free Software Foundation; either 6 | version 2 of the License, or (at your option) any later version. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #include "DNGprocessor.h" 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | 31 | DNGprocessor::DNGprocessor(AutoPtr &host, LibRaw *rawProcessor, Exiv2::Image::AutoPtr &rawImage) 32 | : NegativeProcessor(host, rawProcessor, rawImage) { 33 | // ----------------------------------------------------------------------------------------- 34 | // Re-read source DNG using DNG SDK - we're ignoring the LibRaw/Exiv2 data structures from now on 35 | 36 | std::string file(m_RawImage->io().path()); 37 | 38 | try { 39 | dng_file_stream stream(file.c_str()); 40 | 41 | dng_info info; 42 | info.Parse(*(m_host.Get()), stream); 43 | info.PostParse(*(m_host.Get())); 44 | if (!info.IsValidDNG()) throw dng_exception(dng_error_bad_format); 45 | 46 | m_negative->Parse(*(m_host.Get()), stream, info); 47 | m_negative->PostParse(*(m_host.Get()), stream, info); 48 | m_negative->ReadStage1Image(*(m_host.Get()), stream, info); 49 | m_negative->ReadTransparencyMask(*(m_host.Get()), stream, info); 50 | m_negative->ValidateRawImageDigest(*(m_host.Get())); 51 | } 52 | catch (const dng_exception &except) {throw except;} 53 | catch (...) {throw dng_exception(dng_error_unknown);} 54 | } 55 | 56 | 57 | void DNGprocessor::setDNGPropertiesFromRaw() { 58 | // ----------------------------------------------------------------------------------------- 59 | // Raw filename 60 | 61 | std::string file(m_RawImage->io().path()); 62 | size_t found = std::min(file.rfind("\\"), file.rfind("/")); 63 | if (found != std::string::npos) file = file.substr(found + 1, file.length() - found - 1); 64 | m_negative->SetOriginalRawFileName(file.c_str()); 65 | } 66 | 67 | 68 | void DNGprocessor::setCameraProfile(const char *dcpFilename) { 69 | AutoPtr prof(new dng_camera_profile); 70 | 71 | if (strlen(dcpFilename) > 0) { 72 | dng_file_stream profStream(dcpFilename); 73 | if (!prof->ParseExtended(profStream)) 74 | throw std::runtime_error("Could not parse supplied camera profile file!"); 75 | m_negative->AddProfile(prof); 76 | } 77 | else { 78 | // ----------------------------------------------------------------------------------------- 79 | // Don't do anything, since we're using whatever's already in the DNG 80 | } 81 | } 82 | 83 | 84 | void DNGprocessor::setExifFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion) { 85 | // ----------------------------------------------------------------------------------------- 86 | // We use whatever's in the source DNG and just update date and software 87 | 88 | dng_exif *negExif = m_negative->GetExif(); 89 | negExif->fDateTime = dateTimeNow; 90 | negExif->fSoftware = appNameVersion; 91 | } 92 | 93 | 94 | void DNGprocessor::setXmpFromRaw(const dng_date_time_info &dateTimeNow, const dng_string &appNameVersion) { 95 | // ----------------------------------------------------------------------------------------- 96 | // We use whatever's in the source DNG and just update some base tags 97 | 98 | dng_xmp *negXmp = m_negative->GetXMP(); 99 | negXmp->UpdateDateTime(dateTimeNow); 100 | negXmp->UpdateMetadataDate(dateTimeNow); 101 | negXmp->SetString(XMP_NS_XAP, "CreatorTool", appNameVersion); 102 | negXmp->Set(XMP_NS_DC, "format", "image/dng"); 103 | negXmp->SetString(XMP_NS_PHOTOSHOP, "DateCreated", m_negative->GetExif()->fDateTimeOriginal.Encode_ISO_8601()); 104 | } 105 | 106 | 107 | void DNGprocessor::backupProprietaryData() { 108 | // ----------------------------------------------------------------------------------------- 109 | // No-op, we use whatever's in the source DNG 110 | } 111 | 112 | 113 | void DNGprocessor::buildDNGImage() { 114 | // ----------------------------------------------------------------------------------------- 115 | // No-op, since we've already read the stage 1 image 116 | } 117 | --------------------------------------------------------------------------------