mirror of
https://github.com/opencv/opencv.git
synced 2025-06-06 17:03:18 +08:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
commit
11b020b9f9
8
3rdparty/openexr/AUTHORS.openexr
vendored
8
3rdparty/openexr/AUTHORS.openexr
vendored
@ -8,6 +8,10 @@ Paul Schneider <paultschneider@mac.com>
|
|||||||
Bill Anderson <wja@ilm.com>
|
Bill Anderson <wja@ilm.com>
|
||||||
Wojciech Jarosz <wjarosz@ucsd.edu>
|
Wojciech Jarosz <wjarosz@ucsd.edu>
|
||||||
Andrew Kunz <akunz@ilm.com>
|
Andrew Kunz <akunz@ilm.com>
|
||||||
|
Piotr Stanczyk <pstanczyk@ilm.com>
|
||||||
|
Peter Hillman <peterh@weta.co.nz>
|
||||||
|
Nick Porcino <nick.porcino@gmail.com>
|
||||||
|
Kimball Thurston
|
||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
-------------
|
-------------
|
||||||
@ -20,6 +24,10 @@ Rodrigo Damazio <rdamazio@lsi.usp.br>
|
|||||||
Greg Ward <gward@lmi.net>
|
Greg Ward <gward@lmi.net>
|
||||||
Joseph Goldstone <joseph@lp.com>
|
Joseph Goldstone <joseph@lp.com>
|
||||||
Loren Carpenter, Pixar Animation Studios
|
Loren Carpenter, Pixar Animation Studios
|
||||||
|
Nicholas Yue <yue.nicholas@gmail.com>
|
||||||
|
Yunfeng Bai (ILM)
|
||||||
|
Pascal Jette (Autodesk)
|
||||||
|
Karl Rasche, DreamWorks Animation <Karl.Rasche@dreamworks.com>
|
||||||
|
|
||||||
Win32 build system:
|
Win32 build system:
|
||||||
-------------------
|
-------------------
|
||||||
|
82
3rdparty/openexr/CMakeLists.txt
vendored
82
3rdparty/openexr/CMakeLists.txt
vendored
@ -5,15 +5,75 @@
|
|||||||
|
|
||||||
project(openexr CXX)
|
project(openexr CXX)
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
if(APPLE)
|
if(NOT HAVE_CXX11)
|
||||||
set(HAVE_POSIX_SEMAPHORES 0) # Unnamed semaphores are not supported: https://github.com/opencv/opencv/issues/9361
|
ocv_check_compiler_flag(CXX "-std=c++11" HAVE_STD_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
|
||||||
|
if(HAVE_STD_CXX11)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
else()
|
else()
|
||||||
include(CheckIncludeFile)
|
if(BUILD_OPENEXR)
|
||||||
check_include_file(semaphore.h HAVE_POSIX_SEMAPHORES)
|
message(WARNING "OpenCV: builtin OpenEXR requires C++11 support. OpenEXR is disabled.")
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set(ILMBASE_VERSION_MAJOR "2")
|
||||||
|
set(ILMBASE_VERSION_MINOR "3")
|
||||||
|
set(ILMBASE_VERSION_PATCH "0")
|
||||||
|
|
||||||
|
set(ILMBASE_VERSION "${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH}")
|
||||||
|
set(ILMBASE_VERSION_API ${ILMBASE_VERSION_MAJOR}_${ILMBASE_VERSION_MINOR})
|
||||||
|
|
||||||
|
set(OPENEXR_VERSION_MAJOR "2")
|
||||||
|
set(OPENEXR_VERSION_MINOR "3")
|
||||||
|
set(OPENEXR_VERSION_PATCH "0")
|
||||||
|
|
||||||
|
set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}.${OPENEXR_VERSION_MINOR}.${OPENEXR_VERSION_PATCH}")
|
||||||
|
set(OPENEXR_VERSION_API ${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR})
|
||||||
|
|
||||||
|
set(OPENEXR_VERSION "${OPENEXR_VERSION}" PARENT_SCOPE)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(HAVE_COMPLETE_IOMANIP 1)
|
||||||
|
set(OPENEXR_IMF_HAVE_COMPLETE_IOMANIP 1)
|
||||||
|
set(PLATFORM_WINDOWS 1)
|
||||||
|
elseif(APPLE)
|
||||||
|
set(HAVE_POSIX_SEMAPHORES 0) # Unnamed semaphores are not supported: https://github.com/opencv/opencv/issues/9361
|
||||||
|
if(DARWIN)
|
||||||
|
set(OPENEXR_IMF_HAVE_DARWIN 1)
|
||||||
|
endif()
|
||||||
|
elseif(UNIX)
|
||||||
|
include(CheckIncludeFile)
|
||||||
|
check_include_file(semaphore.h HAVE_POSIX_SEMAPHORES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ILMBASE_VERSION_API "opencv")
|
||||||
|
set(ILMBASE_INTERNAL_NAMESPACE_CUSTOM 1)
|
||||||
|
set(IMATH_INTERNAL_NAMESPACE "Imath_${ILMBASE_VERSION_API}")
|
||||||
|
set(IEX_INTERNAL_NAMESPACE "Iex_${ILMBASE_VERSION_API}")
|
||||||
|
set(ILMTHREAD_INTERNAL_NAMESPACE "IlmThread_${ILMBASE_VERSION_API}")
|
||||||
|
|
||||||
|
set(ILMBASE_NAMESPACE_CUSTOM 0)
|
||||||
|
set(IMATH_NAMESPACE "Imath")
|
||||||
|
set(IEX_NAMESPACE "Iex")
|
||||||
|
set(ILMTHREAD_NAMESPACE "IlmThread")
|
||||||
|
set(ILMBASE_VERSION_STRING "\"${ILMBASE_VERSION}\"" )
|
||||||
|
set(ILMBASE_PACKAGE_STRING "\"IlmBase ${ILMBASE_VERSION}\"" )
|
||||||
|
|
||||||
|
|
||||||
|
set(OPENEXR_VERSION_API "opencv")
|
||||||
|
set(OPENEXR_IMF_INTERNAL_NAMESPACE_CUSTOM 1)
|
||||||
|
set(OPENEXR_IMF_INTERNAL_NAMESPACE "Imf_${ILMBASE_VERSION_API}")
|
||||||
|
set(OPENEXR_IMF_NAMESPACE_CUSTOM 0)
|
||||||
|
set(OPENEXR_IMF_NAMESPACE "Imf")
|
||||||
|
|
||||||
|
set(OPENEXR_VERSION_STRING "\"${OPENEXR_VERSION}\"" )
|
||||||
|
set(OPENEXR_PACKAGE_STRING "\"OpenEXR ${OPENEXR_VERSION}\"" )
|
||||||
|
|
||||||
|
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/IlmBaseConfig.h.cmakein"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/IlmBaseConfig.h.cmakein"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h" @ONLY)
|
"${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h" @ONLY)
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenEXRConfig.h.cmakein"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenEXRConfig.h.cmakein"
|
||||||
@ -23,7 +83,8 @@ set(OPENEXR_INCLUDE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Half"
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Iex"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Iex"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/IlmThread"
|
"${CMAKE_CURRENT_SOURCE_DIR}/IlmThread"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/Imath"
|
"${CMAKE_CURRENT_SOURCE_DIR}/Imath"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/IlmImf")
|
"${CMAKE_CURRENT_SOURCE_DIR}/IlmImf"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
ocv_include_directories("${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS} ${OPENEXR_INCLUDE_PATHS})
|
ocv_include_directories("${CMAKE_CURRENT_BINARY_DIR}" ${ZLIB_INCLUDE_DIRS} ${OPENEXR_INCLUDE_PATHS})
|
||||||
|
|
||||||
@ -31,8 +92,6 @@ file(GLOB lib_srcs Half/half.cpp Iex/*.cpp IlmThread/*.cpp Imath/*.cpp IlmImf/*.
|
|||||||
file(GLOB lib_hdrs Half/*.h Iex/Iex*.h IlmThread/IlmThread*.h Imath/Imath*.h IlmImf/*.h)
|
file(GLOB lib_hdrs Half/*.h Iex/Iex*.h IlmThread/IlmThread*.h Imath/Imath*.h IlmImf/*.h)
|
||||||
list(APPEND lib_hdrs "${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h" "${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfig.h")
|
list(APPEND lib_hdrs "${CMAKE_CURRENT_BINARY_DIR}/IlmBaseConfig.h" "${CMAKE_CURRENT_BINARY_DIR}/OpenEXRConfig.h")
|
||||||
|
|
||||||
ocv_list_filterout(lib_srcs IlmImf/b44ExpLogTable.cpp)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
ocv_list_filterout(lib_srcs Posix.*cpp)
|
ocv_list_filterout(lib_srcs Posix.*cpp)
|
||||||
else()
|
else()
|
||||||
@ -46,6 +105,10 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused -Wsign-compare -Wundef -W
|
|||||||
-Wdeprecated-declarations -Wmisleading-indentation -Wdeprecated
|
-Wdeprecated-declarations -Wmisleading-indentation -Wdeprecated
|
||||||
-Wsuggest-override -Winconsistent-missing-override
|
-Wsuggest-override -Winconsistent-missing-override
|
||||||
-Wimplicit-fallthrough
|
-Wimplicit-fallthrough
|
||||||
|
-Wtautological-compare # clang
|
||||||
|
-Wmissing-prototypes # gcc/clang
|
||||||
|
-Wreorder
|
||||||
|
-Wunused-result
|
||||||
)
|
)
|
||||||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess)
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wclass-memaccess)
|
||||||
@ -82,7 +145,6 @@ if(NOT BUILD_SHARED_LIBS)
|
|||||||
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ocv_install_3rdparty_licenses(openexr LICENSE AUTHORS.ilmbase AUTHORS.openexr fix_msvc2013_errors.patch)
|
ocv_install_3rdparty_licenses(openexr LICENSE AUTHORS.ilmbase AUTHORS.openexr)
|
||||||
|
|
||||||
set(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATHS} PARENT_SCOPE)
|
set(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATHS} PARENT_SCOPE)
|
||||||
set(OPENEXR_VERSION "1.7.1" PARENT_SCOPE)
|
|
||||||
|
27
3rdparty/openexr/ChangeLog.ilmbase
vendored
27
3rdparty/openexr/ChangeLog.ilmbase
vendored
@ -1,3 +1,30 @@
|
|||||||
|
Version 2.x.x
|
||||||
|
* Bumped version to track OpenEXR
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
|
||||||
|
Version 2.0.1
|
||||||
|
* Bumped version to track OpenEXR
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
|
||||||
|
Version 2.0.0
|
||||||
|
* Bumped version to track OpenEXR
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Numerous minor fixes, missing includes etc
|
||||||
|
|
||||||
|
Version 1.1.0.beta.1
|
||||||
|
* Added new module PyIlmBase : python bindings for IlmBase
|
||||||
|
(Nick Rasmussen)
|
||||||
|
* Added git specific files
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Minor fixes for newer gcc versions and OS X.
|
||||||
|
(misc)
|
||||||
|
* Preparation for OpenEXR v2 release { remove message for final release }
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Updated the so verison to 10
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Initial use of the CMake build system
|
||||||
|
(Nicholas Yue)
|
||||||
|
|
||||||
Version 1.0.3
|
Version 1.0.3
|
||||||
* Added support for enabling/disabling large stack optimisations, used in
|
* Added support for enabling/disabling large stack optimisations, used in
|
||||||
halfFunction.h.
|
halfFunction.h.
|
||||||
|
40
3rdparty/openexr/ChangeLog.openexr
vendored
40
3rdparty/openexr/ChangeLog.openexr
vendored
@ -1,5 +1,43 @@
|
|||||||
|
Version 2.0.1
|
||||||
|
* Temporarily turning off optimisation code path
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Added additional tests for future optimisation refactoring
|
||||||
|
(Piotr Stanczyk / Peter Hillman)
|
||||||
|
* Fixes for StringVectors
|
||||||
|
(Peter Hillman)
|
||||||
|
* Additional checks for type mismatches
|
||||||
|
(Peter Hillman)
|
||||||
|
* Fix for Composite Deep Scanline
|
||||||
|
(Brendan Bolles)
|
||||||
|
|
||||||
|
Version 2.0.0
|
||||||
|
* Updated Documentation
|
||||||
|
(Peter Hillman)
|
||||||
|
* Updated Namespacing mechanism
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Fixes for succd & predd
|
||||||
|
(Peter Hillman)
|
||||||
|
* Fixes for FPE control registers
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Additional checks and tests on DeepImages, scanlines and tiles
|
||||||
|
(Peter Hillman)
|
||||||
|
* Folded in Autodesk read optimisations for RGB(A) files
|
||||||
|
(Pascal Jette, Peter Hillman)
|
||||||
|
* Updated the bootstrap scripts to use libtoolize if glibtoolize isn't available on darwin.
|
||||||
|
(Nick Rasmussen)
|
||||||
|
* Numerous minor fixes, missing includes etc
|
||||||
|
|
||||||
|
Version 2.0.0.beta.1:
|
||||||
|
* Please read the separate file for v2 additions and changes.
|
||||||
|
* Added git specific files
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Updated the so verison to 20
|
||||||
|
(Piotr Stanczyk)
|
||||||
|
* Initial use of the CMake build system
|
||||||
|
(Nicholas Yue)
|
||||||
|
|
||||||
Version 1.7.1:
|
Version 1.7.1:
|
||||||
* Updated the .so verison to 7.
|
* Updated the .so verison to 7.
|
||||||
(Piotr Stanczyk)
|
(Piotr Stanczyk)
|
||||||
|
|
||||||
Version 1.7.0:
|
Version 1.7.0:
|
||||||
|
128
3rdparty/openexr/Half/eLut.h
vendored
128
3rdparty/openexr/Half/eLut.h
vendored
@ -4,68 +4,68 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
{
|
{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 1024, 2048, 3072, 4096, 5120, 6144, 7168,
|
0, 1024, 2048, 3072, 4096, 5120, 6144, 7168,
|
||||||
8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360,
|
8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360,
|
||||||
16384, 17408, 18432, 19456, 20480, 21504, 22528, 23552,
|
16384, 17408, 18432, 19456, 20480, 21504, 22528, 23552,
|
||||||
24576, 25600, 26624, 27648, 28672, 29696, 0, 0,
|
24576, 25600, 26624, 27648, 28672, 29696, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 33792, 34816, 35840, 36864, 37888, 38912, 39936,
|
0, 33792, 34816, 35840, 36864, 37888, 38912, 39936,
|
||||||
40960, 41984, 43008, 44032, 45056, 46080, 47104, 48128,
|
40960, 41984, 43008, 44032, 45056, 46080, 47104, 48128,
|
||||||
49152, 50176, 51200, 52224, 53248, 54272, 55296, 56320,
|
49152, 50176, 51200, 52224, 53248, 54272, 55296, 56320,
|
||||||
57344, 58368, 59392, 60416, 61440, 62464, 0, 0,
|
57344, 58368, 59392, 60416, 61440, 62464, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
|
243
3rdparty/openexr/Half/half.cpp
vendored
243
3rdparty/openexr/Half/half.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -53,11 +53,10 @@ using namespace std;
|
|||||||
// Lookup tables for half-to-float and float-to-half conversion
|
// Lookup tables for half-to-float and float-to-half conversion
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
HALF_EXPORT_CONST half::uif half::_toFloat[1 << 16] =
|
HALF_EXPORT const half::uif half::_toFloat[1 << 16] =
|
||||||
#include "toFloat.h"
|
#include "toFloat.h"
|
||||||
HALF_EXPORT_CONST unsigned short half::_eLut[1 << 9] =
|
HALF_EXPORT const unsigned short half::_eLut[1 << 9] =
|
||||||
#include "eLut.h"
|
#include "eLut.h"
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
// Overflow handler for float-to-half conversion;
|
// Overflow handler for float-to-half conversion;
|
||||||
@ -65,14 +64,14 @@ HALF_EXPORT_CONST unsigned short half::_eLut[1 << 9] =
|
|||||||
// which may be trapped by the operating system.
|
// which may be trapped by the operating system.
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
|
||||||
float
|
HALF_EXPORT float
|
||||||
half::overflow ()
|
half::overflow ()
|
||||||
{
|
{
|
||||||
volatile float f = 1e10;
|
volatile float f = 1e10;
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
f *= f; // this will overflow before
|
f *= f; // this will overflow before
|
||||||
// the forloop terminates
|
// the forloop terminates
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +81,7 @@ half::overflow ()
|
|||||||
// zeroes, denormalized numbers and exponent overflows.
|
// zeroes, denormalized numbers and exponent overflows.
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
short
|
HALF_EXPORT short
|
||||||
half::convert (int i)
|
half::convert (int i)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@ -95,9 +94,9 @@ half::convert (int i)
|
|||||||
// of float and half (127 versus 15).
|
// of float and half (127 versus 15).
|
||||||
//
|
//
|
||||||
|
|
||||||
register int s = (i >> 16) & 0x00008000;
|
int s = (i >> 16) & 0x00008000;
|
||||||
register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
|
int e = ((i >> 23) & 0x000000ff) - (127 - 15);
|
||||||
register int m = i & 0x007fffff;
|
int m = i & 0x007fffff;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now reassemble s, e and m into a half:
|
// Now reassemble s, e and m into a half:
|
||||||
@ -105,115 +104,115 @@ half::convert (int i)
|
|||||||
|
|
||||||
if (e <= 0)
|
if (e <= 0)
|
||||||
{
|
{
|
||||||
if (e < -10)
|
if (e < -10)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// E is less than -10. The absolute value of f is
|
// E is less than -10. The absolute value of f is
|
||||||
// less than HALF_MIN (f may be a small normalized
|
// less than HALF_MIN (f may be a small normalized
|
||||||
// float, a denormalized float or a zero).
|
// float, a denormalized float or a zero).
|
||||||
//
|
//
|
||||||
// We convert f to a half zero with the same sign as f.
|
// We convert f to a half zero with the same sign as f.
|
||||||
//
|
//
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// E is between -10 and 0. F is a normalized float
|
// E is between -10 and 0. F is a normalized float
|
||||||
// whose magnitude is less than HALF_NRM_MIN.
|
// whose magnitude is less than HALF_NRM_MIN.
|
||||||
//
|
//
|
||||||
// We convert f to a denormalized half.
|
// We convert f to a denormalized half.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add an explicit leading 1 to the significand.
|
// Add an explicit leading 1 to the significand.
|
||||||
//
|
//
|
||||||
|
|
||||||
m = m | 0x00800000;
|
m = m | 0x00800000;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Round to m to the nearest (10+e)-bit value (with e between
|
// Round to m to the nearest (10+e)-bit value (with e between
|
||||||
// -10 and 0); in case of a tie, round to the nearest even value.
|
// -10 and 0); in case of a tie, round to the nearest even value.
|
||||||
//
|
//
|
||||||
// Rounding may cause the significand to overflow and make
|
// Rounding may cause the significand to overflow and make
|
||||||
// our number normalized. Because of the way a half's bits
|
// our number normalized. Because of the way a half's bits
|
||||||
// are laid out, we don't have to treat this case separately;
|
// are laid out, we don't have to treat this case separately;
|
||||||
// the code below will handle it correctly.
|
// the code below will handle it correctly.
|
||||||
//
|
//
|
||||||
|
|
||||||
int t = 14 - e;
|
int t = 14 - e;
|
||||||
int a = (1 << (t - 1)) - 1;
|
int a = (1 << (t - 1)) - 1;
|
||||||
int b = (m >> t) & 1;
|
int b = (m >> t) & 1;
|
||||||
|
|
||||||
m = (m + a + b) >> t;
|
m = (m + a + b) >> t;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assemble the half from s, e (zero) and m.
|
// Assemble the half from s, e (zero) and m.
|
||||||
//
|
//
|
||||||
|
|
||||||
return s | m;
|
return s | m;
|
||||||
}
|
}
|
||||||
else if (e == 0xff - (127 - 15))
|
else if (e == 0xff - (127 - 15))
|
||||||
{
|
{
|
||||||
if (m == 0)
|
if (m == 0)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// F is an infinity; convert f to a half
|
// F is an infinity; convert f to a half
|
||||||
// infinity with the same sign as f.
|
// infinity with the same sign as f.
|
||||||
//
|
//
|
||||||
|
|
||||||
return s | 0x7c00;
|
return s | 0x7c00;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// F is a NAN; we produce a half NAN that preserves
|
||||||
|
// the sign bit and the 10 leftmost bits of the
|
||||||
|
// significand of f, with one exception: If the 10
|
||||||
|
// leftmost bits are all zero, the NAN would turn
|
||||||
|
// into an infinity, so we have to set at least one
|
||||||
|
// bit in the significand.
|
||||||
|
//
|
||||||
|
|
||||||
|
m >>= 13;
|
||||||
|
return s | 0x7c00 | m | (m == 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// F is a NAN; we produce a half NAN that preserves
|
// E is greater than zero. F is a normalized float.
|
||||||
// the sign bit and the 10 leftmost bits of the
|
// We try to convert f to a normalized half.
|
||||||
// significand of f, with one exception: If the 10
|
//
|
||||||
// leftmost bits are all zero, the NAN would turn
|
|
||||||
// into an infinity, so we have to set at least one
|
|
||||||
// bit in the significand.
|
|
||||||
//
|
|
||||||
|
|
||||||
m >>= 13;
|
//
|
||||||
return s | 0x7c00 | m | (m == 0);
|
// Round to m to the nearest 10-bit value. In case of
|
||||||
}
|
// a tie, round to the nearest even value.
|
||||||
}
|
//
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// E is greater than zero. F is a normalized float.
|
|
||||||
// We try to convert f to a normalized half.
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
m = m + 0x00000fff + ((m >> 13) & 1);
|
||||||
// Round to m to the nearest 10-bit value. In case of
|
|
||||||
// a tie, round to the nearest even value.
|
|
||||||
//
|
|
||||||
|
|
||||||
m = m + 0x00000fff + ((m >> 13) & 1);
|
if (m & 0x00800000)
|
||||||
|
{
|
||||||
|
m = 0; // overflow in significand,
|
||||||
|
e += 1; // adjust exponent
|
||||||
|
}
|
||||||
|
|
||||||
if (m & 0x00800000)
|
//
|
||||||
{
|
// Handle exponent overflow
|
||||||
m = 0; // overflow in significand,
|
//
|
||||||
e += 1; // adjust exponent
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
if (e > 30)
|
||||||
// Handle exponent overflow
|
{
|
||||||
//
|
overflow (); // Cause a hardware floating point overflow;
|
||||||
|
return s | 0x7c00; // if this returns, the half becomes an
|
||||||
|
} // infinity with the same sign as f.
|
||||||
|
|
||||||
if (e > 30)
|
//
|
||||||
{
|
// Assemble the half from s, e and m.
|
||||||
overflow (); // Cause a hardware floating point overflow;
|
//
|
||||||
return s | 0x7c00; // if this returns, the half becomes an
|
|
||||||
} // infinity with the same sign as f.
|
|
||||||
|
|
||||||
//
|
return s | (e << 10) | (m >> 13);
|
||||||
// Assemble the half from s, e and m.
|
|
||||||
//
|
|
||||||
|
|
||||||
return s | (e << 10) | (m >> 13);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +221,7 @@ half::convert (int i)
|
|||||||
// Stream I/O operators
|
// Stream I/O operators
|
||||||
//---------------------
|
//---------------------
|
||||||
|
|
||||||
ostream &
|
HALF_EXPORT ostream &
|
||||||
operator << (ostream &os, half h)
|
operator << (ostream &os, half h)
|
||||||
{
|
{
|
||||||
os << float (h);
|
os << float (h);
|
||||||
@ -230,7 +229,7 @@ operator << (ostream &os, half h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
istream &
|
HALF_EXPORT istream &
|
||||||
operator >> (istream &is, half &h)
|
operator >> (istream &is, half &h)
|
||||||
{
|
{
|
||||||
float f;
|
float f;
|
||||||
@ -245,22 +244,22 @@ operator >> (istream &is, half &h)
|
|||||||
// floats and halfs, mostly for debugging
|
// floats and halfs, mostly for debugging
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
|
||||||
void
|
HALF_EXPORT void
|
||||||
printBits (ostream &os, half h)
|
printBits (ostream &os, half h)
|
||||||
{
|
{
|
||||||
unsigned short b = h.bits();
|
unsigned short b = h.bits();
|
||||||
|
|
||||||
for (int i = 15; i >= 0; i--)
|
for (int i = 15; i >= 0; i--)
|
||||||
{
|
{
|
||||||
os << (((b >> i) & 1)? '1': '0');
|
os << (((b >> i) & 1)? '1': '0');
|
||||||
|
|
||||||
if (i == 15 || i == 10)
|
if (i == 15 || i == 10)
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
HALF_EXPORT void
|
||||||
printBits (ostream &os, float f)
|
printBits (ostream &os, float f)
|
||||||
{
|
{
|
||||||
half::uif x;
|
half::uif x;
|
||||||
@ -268,32 +267,32 @@ printBits (ostream &os, float f)
|
|||||||
|
|
||||||
for (int i = 31; i >= 0; i--)
|
for (int i = 31; i >= 0; i--)
|
||||||
{
|
{
|
||||||
os << (((x.i >> i) & 1)? '1': '0');
|
os << (((x.i >> i) & 1)? '1': '0');
|
||||||
|
|
||||||
if (i == 31 || i == 23)
|
if (i == 31 || i == 23)
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
HALF_EXPORT void
|
||||||
printBits (char c[19], half h)
|
printBits (char c[19], half h)
|
||||||
{
|
{
|
||||||
unsigned short b = h.bits();
|
unsigned short b = h.bits();
|
||||||
|
|
||||||
for (int i = 15, j = 0; i >= 0; i--, j++)
|
for (int i = 15, j = 0; i >= 0; i--, j++)
|
||||||
{
|
{
|
||||||
c[j] = (((b >> i) & 1)? '1': '0');
|
c[j] = (((b >> i) & 1)? '1': '0');
|
||||||
|
|
||||||
if (i == 15 || i == 10)
|
if (i == 15 || i == 10)
|
||||||
c[++j] = ' ';
|
c[++j] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
c[18] = 0;
|
c[18] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
HALF_EXPORT void
|
||||||
printBits (char c[35], float f)
|
printBits (char c[35], float f)
|
||||||
{
|
{
|
||||||
half::uif x;
|
half::uif x;
|
||||||
@ -301,10 +300,10 @@ printBits (char c[35], float f)
|
|||||||
|
|
||||||
for (int i = 31, j = 0; i >= 0; i--, j++)
|
for (int i = 31, j = 0; i >= 0; i--, j++)
|
||||||
{
|
{
|
||||||
c[j] = (((x.i >> i) & 1)? '1': '0');
|
c[j] = (((x.i >> i) & 1)? '1': '0');
|
||||||
|
|
||||||
if (i == 31 || i == 23)
|
if (i == 31 || i == 23)
|
||||||
c[++j] = ' ';
|
c[++j] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
c[34] = 0;
|
c[34] = 0;
|
||||||
|
189
3rdparty/openexr/Half/half.h
vendored
189
3rdparty/openexr/Half/half.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -85,21 +85,10 @@
|
|||||||
#ifndef _HALF_H_
|
#ifndef _HALF_H_
|
||||||
#define _HALF_H_
|
#define _HALF_H_
|
||||||
|
|
||||||
|
#include "halfExport.h" // for definition of HALF_EXPORT
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if defined(OPENEXR_DLL)
|
class half
|
||||||
#if defined(HALF_EXPORTS)
|
|
||||||
#define HALF_EXPORT __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define HALF_EXPORT __declspec(dllimport)
|
|
||||||
#endif
|
|
||||||
#define HALF_EXPORT_CONST
|
|
||||||
#else
|
|
||||||
#define HALF_EXPORT
|
|
||||||
#define HALF_EXPORT_CONST const
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class HALF_EXPORT half
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -208,45 +197,47 @@ class HALF_EXPORT half
|
|||||||
// Access to the internal representation
|
// Access to the internal representation
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
|
|
||||||
unsigned short bits () const;
|
HALF_EXPORT unsigned short bits () const;
|
||||||
void setBits (unsigned short bits);
|
HALF_EXPORT void setBits (unsigned short bits);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
union uif
|
union uif
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static short convert (int i);
|
HALF_EXPORT static short convert (int i);
|
||||||
static float overflow ();
|
HALF_EXPORT static float overflow ();
|
||||||
|
|
||||||
unsigned short _h;
|
unsigned short _h;
|
||||||
|
|
||||||
static HALF_EXPORT_CONST uif _toFloat[1 << 16];
|
HALF_EXPORT static const uif _toFloat[1 << 16];
|
||||||
static HALF_EXPORT_CONST unsigned short _eLut[1 << 9];
|
HALF_EXPORT static const unsigned short _eLut[1 << 9];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
// Stream I/O
|
// Stream I/O
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
HALF_EXPORT std::ostream & operator << (std::ostream &os, half h);
|
HALF_EXPORT std::ostream & operator << (std::ostream &os, half h);
|
||||||
HALF_EXPORT std::istream & operator >> (std::istream &is, half &h);
|
HALF_EXPORT std::istream & operator >> (std::istream &is, half &h);
|
||||||
|
|
||||||
|
|
||||||
//----------
|
//----------
|
||||||
// Debugging
|
// Debugging
|
||||||
//----------
|
//----------
|
||||||
|
|
||||||
HALF_EXPORT void printBits (std::ostream &os, half h);
|
HALF_EXPORT void printBits (std::ostream &os, half h);
|
||||||
HALF_EXPORT void printBits (std::ostream &os, float f);
|
HALF_EXPORT void printBits (std::ostream &os, float f);
|
||||||
HALF_EXPORT void printBits (char c[19], half h);
|
HALF_EXPORT void printBits (char c[19], half h);
|
||||||
HALF_EXPORT void printBits (char c[35], float f);
|
HALF_EXPORT void printBits (char c[35], float f);
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -266,7 +257,7 @@ HALF_EXPORT void printBits (char c[35], float f);
|
|||||||
#define HALF_MAX 65504.0f // Largest positive half
|
#define HALF_MAX 65504.0f // Largest positive half
|
||||||
|
|
||||||
#define HALF_EPSILON 0.00097656f // Smallest positive e for which
|
#define HALF_EPSILON 0.00097656f // Smallest positive e for which
|
||||||
// half (1.0 + e) != half (1.0)
|
// half (1.0 + e) != half (1.0)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define HALF_MIN 5.96046448e-08 // Smallest positive half
|
#define HALF_MIN 5.96046448e-08 // Smallest positive half
|
||||||
@ -276,35 +267,39 @@ HALF_EXPORT void printBits (char c[35], float f);
|
|||||||
#define HALF_MAX 65504.0 // Largest positive half
|
#define HALF_MAX 65504.0 // Largest positive half
|
||||||
|
|
||||||
#define HALF_EPSILON 0.00097656 // Smallest positive e for which
|
#define HALF_EPSILON 0.00097656 // Smallest positive e for which
|
||||||
// half (1.0 + e) != half (1.0)
|
// half (1.0 + e) != half (1.0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define HALF_MANT_DIG 11 // Number of digits in mantissa
|
#define HALF_MANT_DIG 11 // Number of digits in mantissa
|
||||||
// (significand + hidden leading 1)
|
// (significand + hidden leading 1)
|
||||||
|
|
||||||
#define HALF_DIG 2 // Number of base 10 digits that
|
#define HALF_DIG 2 // Number of base 10 digits that
|
||||||
// can be represented without change
|
// can be represented without change
|
||||||
|
|
||||||
|
#define HALF_DECIMAL_DIG 5 // Number of base-10 digits that are
|
||||||
|
// necessary to uniquely represent all
|
||||||
|
// distinct values
|
||||||
|
|
||||||
#define HALF_RADIX 2 // Base of the exponent
|
#define HALF_RADIX 2 // Base of the exponent
|
||||||
|
|
||||||
#define HALF_MIN_EXP -13 // Minimum negative integer such that
|
#define HALF_MIN_EXP -13 // Minimum negative integer such that
|
||||||
// HALF_RADIX raised to the power of
|
// HALF_RADIX raised to the power of
|
||||||
// one less than that integer is a
|
// one less than that integer is a
|
||||||
// normalized half
|
// normalized half
|
||||||
|
|
||||||
#define HALF_MAX_EXP 16 // Maximum positive integer such that
|
#define HALF_MAX_EXP 16 // Maximum positive integer such that
|
||||||
// HALF_RADIX raised to the power of
|
// HALF_RADIX raised to the power of
|
||||||
// one less than that integer is a
|
// one less than that integer is a
|
||||||
// normalized half
|
// normalized half
|
||||||
|
|
||||||
#define HALF_MIN_10_EXP -4 // Minimum positive integer such
|
#define HALF_MIN_10_EXP -4 // Minimum positive integer such
|
||||||
// that 10 raised to that power is
|
// that 10 raised to that power is
|
||||||
// a normalized half
|
// a normalized half
|
||||||
|
|
||||||
#define HALF_MAX_10_EXP 4 // Maximum positive integer such
|
#define HALF_MAX_10_EXP 4 // Maximum positive integer such
|
||||||
// that 10 raised to that power is
|
// that 10 raised to that power is
|
||||||
// a normalized half
|
// a normalized half
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -317,9 +312,9 @@ HALF_EXPORT void printBits (char c[35], float f);
|
|||||||
// floating point number, whose bits are arranged as follows:
|
// floating point number, whose bits are arranged as follows:
|
||||||
//
|
//
|
||||||
// 31 (msb)
|
// 31 (msb)
|
||||||
// |
|
// |
|
||||||
// | 30 23
|
// | 30 23
|
||||||
// | | |
|
// | | |
|
||||||
// | | | 22 0 (lsb)
|
// | | | 22 0 (lsb)
|
||||||
// | | | | |
|
// | | | | |
|
||||||
// X XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
|
// X XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX
|
||||||
@ -363,7 +358,7 @@ HALF_EXPORT void printBits (char c[35], float f);
|
|||||||
// Here is the bit-layout for a half number, h:
|
// Here is the bit-layout for a half number, h:
|
||||||
//
|
//
|
||||||
// 15 (msb)
|
// 15 (msb)
|
||||||
// |
|
// |
|
||||||
// | 14 10
|
// | 14 10
|
||||||
// | | |
|
// | | |
|
||||||
// | | | 9 0 (lsb)
|
// | | | 9 0 (lsb)
|
||||||
@ -443,53 +438,53 @@ half::half (float f)
|
|||||||
|
|
||||||
if (f == 0)
|
if (f == 0)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Common special case - zero.
|
// Common special case - zero.
|
||||||
// Preserve the zero's sign bit.
|
// Preserve the zero's sign bit.
|
||||||
//
|
//
|
||||||
|
|
||||||
_h = (x.i >> 16);
|
_h = (x.i >> 16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// We extract the combined sign and exponent, e, from our
|
// We extract the combined sign and exponent, e, from our
|
||||||
// floating-point number, f. Then we convert e to the sign
|
// floating-point number, f. Then we convert e to the sign
|
||||||
// and exponent of the half number via a table lookup.
|
// and exponent of the half number via a table lookup.
|
||||||
//
|
//
|
||||||
// For the most common case, where a normalized half is produced,
|
// For the most common case, where a normalized half is produced,
|
||||||
// the table lookup returns a non-zero value; in this case, all
|
// the table lookup returns a non-zero value; in this case, all
|
||||||
// we have to do is round f's significand to 10 bits and combine
|
// we have to do is round f's significand to 10 bits and combine
|
||||||
// the result with e.
|
// the result with e.
|
||||||
//
|
//
|
||||||
// For all other cases (overflow, zeroes, denormalized numbers
|
// For all other cases (overflow, zeroes, denormalized numbers
|
||||||
// resulting from underflow, infinities and NANs), the table
|
// resulting from underflow, infinities and NANs), the table
|
||||||
// lookup returns zero, and we call a longer, non-inline function
|
// lookup returns zero, and we call a longer, non-inline function
|
||||||
// to do the float-to-half conversion.
|
// to do the float-to-half conversion.
|
||||||
//
|
//
|
||||||
|
|
||||||
register int e = (x.i >> 23) & 0x000001ff;
|
int e = (x.i >> 23) & 0x000001ff;
|
||||||
|
|
||||||
e = _eLut[e];
|
e = _eLut[e];
|
||||||
|
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Simple case - round the significand, m, to 10
|
// Simple case - round the significand, m, to 10
|
||||||
// bits and combine it with the sign and exponent.
|
// bits and combine it with the sign and exponent.
|
||||||
//
|
//
|
||||||
|
|
||||||
register int m = x.i & 0x007fffff;
|
int m = x.i & 0x007fffff;
|
||||||
_h = e + ((m + 0x00000fff + ((m >> 13) & 1)) >> 13);
|
_h = (unsigned short)(e + ((m + 0x00000fff + ((m >> 13) & 1)) >> 13));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Difficult case - call a function.
|
// Difficult case - call a function.
|
||||||
//
|
//
|
||||||
|
|
||||||
_h = convert (x.i);
|
_h = convert (x.i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +512,7 @@ half::round (unsigned int n) const
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (n >= 10)
|
if (n >= 10)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disassemble h into the sign, s,
|
// Disassemble h into the sign, s,
|
||||||
@ -544,13 +539,13 @@ half::round (unsigned int n) const
|
|||||||
|
|
||||||
if (e >= 0x7c00)
|
if (e >= 0x7c00)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Overflow occurred -- truncate instead of rounding.
|
// Overflow occurred -- truncate instead of rounding.
|
||||||
//
|
//
|
||||||
|
|
||||||
e = _h;
|
e = _h;
|
||||||
e >>= 10 - n;
|
e >>= 10 - n;
|
||||||
e <<= 10 - n;
|
e <<= 10 - n;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -568,7 +563,7 @@ half::round (unsigned int n) const
|
|||||||
// Other inline functions
|
// Other inline functions
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
|
||||||
inline half
|
inline half
|
||||||
half::operator - () const
|
half::operator - () const
|
||||||
{
|
{
|
||||||
half h;
|
half h;
|
||||||
@ -657,7 +652,7 @@ half::operator /= (float f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
half::isFinite () const
|
half::isFinite () const
|
||||||
{
|
{
|
||||||
unsigned short e = (_h >> 10) & 0x001f;
|
unsigned short e = (_h >> 10) & 0x001f;
|
||||||
@ -707,7 +702,7 @@ half::isInfinity () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
half::isNegative () const
|
half::isNegative () const
|
||||||
{
|
{
|
||||||
return (_h & 0x8000) != 0;
|
return (_h & 0x8000) != 0;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2008, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
@ -32,23 +32,20 @@
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef HALFEXPORT_H
|
||||||
|
#define HALFEXPORT_H
|
||||||
|
|
||||||
|
#if defined(OPENEXR_DLL)
|
||||||
#ifndef INCLUDED_IMATHGLU_H
|
#if defined(HALF_EXPORTS)
|
||||||
#define INCLUDED_IMATHGLU_H
|
#define HALF_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
#include <GL/gl.h>
|
#define HALF_EXPORT __declspec(dllimport)
|
||||||
#include <GL/glu.h>
|
#endif
|
||||||
|
#define HALF_EXPORT_CONST
|
||||||
#include "ImathVec.h"
|
#else
|
||||||
|
#define HALF_EXPORT
|
||||||
inline
|
#define HALF_EXPORT_CONST const
|
||||||
void
|
|
||||||
gluLookAt(const Imath::V3f &pos, const Imath::V3f &interest, const Imath::V3f &up)
|
|
||||||
{
|
|
||||||
gluLookAt(pos.x, pos.y, pos.z,
|
|
||||||
interest.x, interest.y, interest.z,
|
|
||||||
up.x, up.y, up.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef HALFEXPORT_H
|
||||||
|
|
65
3rdparty/openexr/Half/halfFunction.h
vendored
65
3rdparty/openexr/Half/halfFunction.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -85,10 +85,10 @@
|
|||||||
|
|
||||||
#include "half.h"
|
#include "half.h"
|
||||||
|
|
||||||
#include <IlmBaseConfig.h>
|
#include "IlmBaseConfig.h"
|
||||||
#ifndef ILMBASE_HAVE_LARGE_STACK
|
#ifndef ILMBASE_HAVE_LARGE_STACK
|
||||||
#include <string.h> // need this for memset
|
#include <string.h> // need this for memset
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
@ -105,17 +105,17 @@ class halfFunction
|
|||||||
|
|
||||||
template <class Function>
|
template <class Function>
|
||||||
halfFunction (Function f,
|
halfFunction (Function f,
|
||||||
half domainMin = -HALF_MAX,
|
half domainMin = -HALF_MAX,
|
||||||
half domainMax = HALF_MAX,
|
half domainMax = HALF_MAX,
|
||||||
T defaultValue = 0,
|
T defaultValue = 0,
|
||||||
T posInfValue = 0,
|
T posInfValue = 0,
|
||||||
T negInfValue = 0,
|
T negInfValue = 0,
|
||||||
T nanValue = 0);
|
T nanValue = 0);
|
||||||
|
|
||||||
#ifndef ILMBASE_HAVE_LARGE_STACK
|
#ifndef ILMBASE_HAVE_LARGE_STACK
|
||||||
~halfFunction () { delete [] _lut; }
|
~halfFunction () { delete [] _lut; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
// Evaluation
|
// Evaluation
|
||||||
//-----------
|
//-----------
|
||||||
@ -123,6 +123,7 @@ class halfFunction
|
|||||||
T operator () (half x) const;
|
T operator () (half x) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef ILMBASE_HAVE_LARGE_STACK
|
#ifdef ILMBASE_HAVE_LARGE_STACK
|
||||||
T _lut[1 << 16];
|
T _lut[1 << 16];
|
||||||
#else
|
#else
|
||||||
@ -138,31 +139,31 @@ class halfFunction
|
|||||||
template <class T>
|
template <class T>
|
||||||
template <class Function>
|
template <class Function>
|
||||||
halfFunction<T>::halfFunction (Function f,
|
halfFunction<T>::halfFunction (Function f,
|
||||||
half domainMin,
|
half domainMin,
|
||||||
half domainMax,
|
half domainMax,
|
||||||
T defaultValue,
|
T defaultValue,
|
||||||
T posInfValue,
|
T posInfValue,
|
||||||
T negInfValue,
|
T negInfValue,
|
||||||
T nanValue)
|
T nanValue)
|
||||||
{
|
{
|
||||||
#ifndef ILMBASE_HAVE_LARGE_STACK
|
#ifndef ILMBASE_HAVE_LARGE_STACK
|
||||||
_lut = new T[1<<16];
|
_lut = new T[1<<16];
|
||||||
memset (_lut, 0 , (1<<16) * sizeof(T));
|
memset (_lut, 0 , (1<<16) * sizeof(T));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < (1 << 16); i++)
|
for (int i = 0; i < (1 << 16); i++)
|
||||||
{
|
{
|
||||||
half x;
|
half x;
|
||||||
x.setBits (i);
|
x.setBits (i);
|
||||||
|
|
||||||
if (x.isNan())
|
if (x.isNan())
|
||||||
_lut[i] = nanValue;
|
_lut[i] = nanValue;
|
||||||
else if (x.isInfinity())
|
else if (x.isInfinity())
|
||||||
_lut[i] = x.isNegative()? negInfValue: posInfValue;
|
_lut[i] = x.isNegative()? negInfValue: posInfValue;
|
||||||
else if (x < domainMin || x > domainMax)
|
else if (x < domainMin || x > domainMax)
|
||||||
_lut[i] = defaultValue;
|
_lut[i] = defaultValue;
|
||||||
else
|
else
|
||||||
_lut[i] = f (x);
|
_lut[i] = f (x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
3rdparty/openexr/Half/halfLimits.h
vendored
17
3rdparty/openexr/Half/halfLimits.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -94,6 +94,15 @@ class numeric_limits <half>
|
|||||||
static const bool traps = true;
|
static const bool traps = true;
|
||||||
static const bool tinyness_before = false;
|
static const bool tinyness_before = false;
|
||||||
static const float_round_style round_style = round_to_nearest;
|
static const float_round_style round_style = round_to_nearest;
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
|
||||||
|
// C++11 additions.
|
||||||
|
static constexpr int max_digits10 = HALF_DECIMAL_DIG;
|
||||||
|
static half lowest () {return -HALF_MAX;}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
164
3rdparty/openexr/Half/toFloat.cpp
vendored
164
3rdparty/openexr/Half/toFloat.cpp
vendored
@ -1,164 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
|
||||||
// Digital Ltd. LLC
|
|
||||||
//
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above
|
|
||||||
// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
// in the documentation and/or other materials provided with the
|
|
||||||
// distribution.
|
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
|
||||||
// its contributors may be used to endorse or promote products derived
|
|
||||||
// from this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// toFloat
|
|
||||||
//
|
|
||||||
// A program to generate the lookup table for half-to-float
|
|
||||||
// conversion needed by class half.
|
|
||||||
// The program loops over all 65536 possible half numbers,
|
|
||||||
// converts each of them to a float, and prints the result.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
//---------------------------------------------------
|
|
||||||
// Interpret an unsigned short bit pattern as a half,
|
|
||||||
// and convert that half to the corresponding float's
|
|
||||||
// bit pattern.
|
|
||||||
//---------------------------------------------------
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
halfToFloat (unsigned short y)
|
|
||||||
{
|
|
||||||
|
|
||||||
int s = (y >> 15) & 0x00000001;
|
|
||||||
int e = (y >> 10) & 0x0000001f;
|
|
||||||
int m = y & 0x000003ff;
|
|
||||||
|
|
||||||
if (e == 0)
|
|
||||||
{
|
|
||||||
if (m == 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Plus or minus zero
|
|
||||||
//
|
|
||||||
|
|
||||||
return s << 31;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Denormalized number -- renormalize it
|
|
||||||
//
|
|
||||||
|
|
||||||
while (!(m & 0x00000400))
|
|
||||||
{
|
|
||||||
m <<= 1;
|
|
||||||
e -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
e += 1;
|
|
||||||
m &= ~0x00000400;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (e == 31)
|
|
||||||
{
|
|
||||||
if (m == 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Positive or negative infinity
|
|
||||||
//
|
|
||||||
|
|
||||||
return (s << 31) | 0x7f800000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Nan -- preserve sign and significand bits
|
|
||||||
//
|
|
||||||
|
|
||||||
return (s << 31) | 0x7f800000 | (m << 13);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Normalized number
|
|
||||||
//
|
|
||||||
|
|
||||||
e = e + (127 - 15);
|
|
||||||
m = m << 13;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Assemble s, e and m.
|
|
||||||
//
|
|
||||||
|
|
||||||
return (s << 31) | (e << 23) | m;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------
|
|
||||||
// Main - prints the half-to-float lookup table
|
|
||||||
//---------------------------------------------
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
cout.precision (9);
|
|
||||||
cout.setf (ios_base::hex, ios_base::basefield);
|
|
||||||
|
|
||||||
cout << "//\n"
|
|
||||||
"// This is an automatically generated file.\n"
|
|
||||||
"// Do not edit.\n"
|
|
||||||
"//\n\n";
|
|
||||||
|
|
||||||
cout << "{\n ";
|
|
||||||
|
|
||||||
const int iMax = (1 << 16);
|
|
||||||
|
|
||||||
for (int i = 0; i < iMax; i++)
|
|
||||||
{
|
|
||||||
cout << "{0x" << setfill ('0') << setw (8) << halfToFloat (i) << "}, ";
|
|
||||||
|
|
||||||
if (i % 4 == 3)
|
|
||||||
{
|
|
||||||
cout << "\n";
|
|
||||||
|
|
||||||
if (i < iMax - 1)
|
|
||||||
cout << " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "};\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
8
3rdparty/openexr/Iex/Iex.h
vendored
8
3rdparty/openexr/Iex/Iex.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
118
3rdparty/openexr/Iex/IexBaseExc.cpp
vendored
118
3rdparty/openexr/Iex/IexBaseExc.cpp
vendored
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -40,19 +40,27 @@
|
|||||||
//
|
//
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "IexExport.h"
|
||||||
#include "IexBaseExc.h"
|
#include "IexBaseExc.h"
|
||||||
|
#include "IexMacros.h"
|
||||||
|
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Iex {
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
StackTracer currentStackTracer = 0;
|
StackTracer currentStackTracer = 0;
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setStackTracer (StackTracer stackTracer)
|
setStackTracer (StackTracer stackTracer)
|
||||||
{
|
{
|
||||||
currentStackTracer = stackTracer;
|
currentStackTracer = stackTracer;
|
||||||
@ -67,7 +75,7 @@ stackTracer ()
|
|||||||
|
|
||||||
|
|
||||||
BaseExc::BaseExc (const char* s) throw () :
|
BaseExc::BaseExc (const char* s) throw () :
|
||||||
std::string (s? s: ""),
|
_message (s? s: ""),
|
||||||
_stackTrace (currentStackTracer? currentStackTracer(): "")
|
_stackTrace (currentStackTracer? currentStackTracer(): "")
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
@ -75,7 +83,7 @@ BaseExc::BaseExc (const char* s) throw () :
|
|||||||
|
|
||||||
|
|
||||||
BaseExc::BaseExc (const std::string &s) throw () :
|
BaseExc::BaseExc (const std::string &s) throw () :
|
||||||
std::string (s),
|
_message (s),
|
||||||
_stackTrace (currentStackTracer? currentStackTracer(): "")
|
_stackTrace (currentStackTracer? currentStackTracer(): "")
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
@ -83,7 +91,7 @@ BaseExc::BaseExc (const std::string &s) throw () :
|
|||||||
|
|
||||||
|
|
||||||
BaseExc::BaseExc (std::stringstream &s) throw () :
|
BaseExc::BaseExc (std::stringstream &s) throw () :
|
||||||
std::string (s.str()),
|
_message (s.str()),
|
||||||
_stackTrace (currentStackTracer? currentStackTracer(): "")
|
_stackTrace (currentStackTracer? currentStackTracer(): "")
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
@ -91,7 +99,7 @@ BaseExc::BaseExc (std::stringstream &s) throw () :
|
|||||||
|
|
||||||
|
|
||||||
BaseExc::BaseExc (const BaseExc &be) throw () :
|
BaseExc::BaseExc (const BaseExc &be) throw () :
|
||||||
std::string (be),
|
_message (be._message),
|
||||||
_stackTrace (be._stackTrace)
|
_stackTrace (be._stackTrace)
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
@ -107,23 +115,99 @@ BaseExc::~BaseExc () throw ()
|
|||||||
const char *
|
const char *
|
||||||
BaseExc::what () const throw ()
|
BaseExc::what () const throw ()
|
||||||
{
|
{
|
||||||
return c_str();
|
return _message.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BaseExc &
|
BaseExc &
|
||||||
BaseExc::assign (std::stringstream &s)
|
BaseExc::assign (std::stringstream &s)
|
||||||
{
|
{
|
||||||
std::string::assign (s.str());
|
_message.assign (s.str());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseExc &
|
BaseExc &
|
||||||
BaseExc::append (std::stringstream &s)
|
BaseExc::append (std::stringstream &s)
|
||||||
{
|
{
|
||||||
std::string::append (s.str());
|
_message.append (s.str());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string &
|
||||||
|
BaseExc::message() const
|
||||||
|
{
|
||||||
|
return _message;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseExc &
|
||||||
|
BaseExc::operator = (std::stringstream &s)
|
||||||
|
{
|
||||||
|
return assign (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseExc &
|
||||||
|
BaseExc::operator += (std::stringstream &s)
|
||||||
|
{
|
||||||
|
return append (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseExc &
|
||||||
|
BaseExc::assign (const char *s)
|
||||||
|
{
|
||||||
|
_message.assign(s);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Iex
|
BaseExc &
|
||||||
|
BaseExc::operator = (const char *s)
|
||||||
|
{
|
||||||
|
return assign(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseExc &
|
||||||
|
BaseExc::append (const char *s)
|
||||||
|
{
|
||||||
|
_message.append(s);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseExc &
|
||||||
|
BaseExc::operator += (const char *s)
|
||||||
|
{
|
||||||
|
return append(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const std::string &
|
||||||
|
BaseExc::stackTrace () const
|
||||||
|
{
|
||||||
|
return _stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
|
||||||
|
#pragma optimize("", off)
|
||||||
|
void
|
||||||
|
iex_debugTrap()
|
||||||
|
{
|
||||||
|
if (0 != getenv("IEXDEBUGTHROW"))
|
||||||
|
::DebugBreak();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void
|
||||||
|
iex_debugTrap()
|
||||||
|
{
|
||||||
|
// how to in Linux?
|
||||||
|
if (0 != ::getenv("IEXDEBUGTHROW"))
|
||||||
|
__builtin_trap();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
199
3rdparty/openexr/Iex/IexBaseExc.h
vendored
199
3rdparty/openexr/Iex/IexBaseExc.h
vendored
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -33,10 +33,11 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef INCLUDED_IEXBASEEXC_H
|
#ifndef INCLUDED_IEXBASEEXC_H
|
||||||
#define INCLUDED_IEXBASEEXC_H
|
#define INCLUDED_IEXBASEEXC_H
|
||||||
|
|
||||||
|
#include "IexNamespace.h"
|
||||||
|
#include "IexExport.h"
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
//
|
//
|
||||||
@ -49,18 +50,14 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace Iex {
|
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
|
|
||||||
// Tell MS VC++ to suppress exception specification warnings
|
|
||||||
#pragma warning(disable:4290)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
// Our most basic exception class
|
// Our most basic exception class
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
|
|
||||||
class BaseExc: public std::string, public std::exception
|
class BaseExc: public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -68,29 +65,29 @@ class BaseExc: public std::string, public std::exception
|
|||||||
// Constructors and destructor
|
// Constructors and destructor
|
||||||
//----------------------------
|
//----------------------------
|
||||||
|
|
||||||
BaseExc (const char *s = 0) throw(); // std::string (s)
|
IEX_EXPORT BaseExc (const char *s = 0) throw(); // std::string (s)
|
||||||
BaseExc (const std::string &s) throw(); // std::string (s)
|
IEX_EXPORT BaseExc (const std::string &s) throw(); // std::string (s)
|
||||||
BaseExc (std::stringstream &s) throw(); // std::string (s.str())
|
IEX_EXPORT BaseExc (std::stringstream &s) throw(); // std::string (s.str())
|
||||||
|
|
||||||
BaseExc (const BaseExc &be) throw();
|
IEX_EXPORT BaseExc (const BaseExc &be) throw();
|
||||||
virtual ~BaseExc () throw ();
|
IEX_EXPORT virtual ~BaseExc () throw ();
|
||||||
|
|
||||||
//--------------------------------------------
|
//---------------------------------------------------
|
||||||
// what() method -- e.what() returns e.c_str()
|
// what() method -- e.what() returns _message.c_str()
|
||||||
//--------------------------------------------
|
//---------------------------------------------------
|
||||||
|
|
||||||
virtual const char * what () const throw ();
|
IEX_EXPORT virtual const char * what () const throw ();
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Convenient methods to change the exception's text
|
// Convenient methods to change the exception's text
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
BaseExc & assign (std::stringstream &s); // assign (s.str())
|
IEX_EXPORT BaseExc & assign (std::stringstream &s); // assign (s.str())
|
||||||
BaseExc & operator = (std::stringstream &s);
|
IEX_EXPORT BaseExc & operator = (std::stringstream &s);
|
||||||
|
|
||||||
BaseExc & append (std::stringstream &s); // append (s.str())
|
IEX_EXPORT BaseExc & append (std::stringstream &s); // append (s.str())
|
||||||
BaseExc & operator += (std::stringstream &s);
|
IEX_EXPORT BaseExc & operator += (std::stringstream &s);
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -98,12 +95,17 @@ class BaseExc: public std::string, public std::exception
|
|||||||
// the definitions above.
|
// the definitions above.
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
BaseExc & assign (const char *s);
|
IEX_EXPORT BaseExc & assign (const char *s);
|
||||||
BaseExc & operator = (const char *s);
|
IEX_EXPORT BaseExc & operator = (const char *s);
|
||||||
|
|
||||||
BaseExc & append (const char *s);
|
IEX_EXPORT BaseExc & append (const char *s);
|
||||||
BaseExc & operator += (const char *s);
|
IEX_EXPORT BaseExc & operator += (const char *s);
|
||||||
|
|
||||||
|
//---------------------------------------------------
|
||||||
|
// Access to the string representation of the message
|
||||||
|
//---------------------------------------------------
|
||||||
|
|
||||||
|
IEX_EXPORT const std::string & message () const;
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// Stack trace for the point at which the exception
|
// Stack trace for the point at which the exception
|
||||||
@ -112,11 +114,12 @@ class BaseExc: public std::string, public std::exception
|
|||||||
// has been installed (see below, setStackTracer()).
|
// has been installed (see below, setStackTracer()).
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
const std::string & stackTrace () const;
|
IEX_EXPORT const std::string & stackTrace () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string _stackTrace;
|
std::string _message;
|
||||||
|
std::string _stackTrace;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -125,55 +128,59 @@ class BaseExc: public std::string, public std::exception
|
|||||||
// class derived directly or indirectly from BaseExc:
|
// class derived directly or indirectly from BaseExc:
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
#define DEFINE_EXC(name, base) \
|
#define DEFINE_EXC_EXP(exp, name, base) \
|
||||||
class name: public base \
|
class name: public base \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
name (const char* text=0) throw(): base (text) {} \
|
exp name() throw(): base (0) {} \
|
||||||
name (const std::string &text) throw(): base (text) {} \
|
exp name (const char* text) throw(): base (text) {} \
|
||||||
name (std::stringstream &text) throw(): base (text) {} \
|
exp name (const std::string &text) throw(): base (text) {} \
|
||||||
|
exp name (std::stringstream &text) throw(): base (text) {} \
|
||||||
|
exp ~name() throw() { } \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For backward compatibility.
|
||||||
|
#define DEFINE_EXC(name, base) DEFINE_EXC_EXP(, name, base)
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Some exceptions which should be useful in most programs
|
// Some exceptions which should be useful in most programs
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
DEFINE_EXC_EXP (IEX_EXPORT, ArgExc, BaseExc) // Invalid arguments to a function call
|
||||||
|
|
||||||
DEFINE_EXC (ArgExc, BaseExc) // Invalid arguments to a function call
|
DEFINE_EXC_EXP (IEX_EXPORT, LogicExc, BaseExc) // General error in a program's logic,
|
||||||
|
// for example, a function was called
|
||||||
|
// in a context where the call does
|
||||||
|
// not make sense.
|
||||||
|
|
||||||
DEFINE_EXC (LogicExc, BaseExc) // General error in a program's logic,
|
DEFINE_EXC_EXP (IEX_EXPORT, InputExc, BaseExc) // Invalid input data, e.g. from a file
|
||||||
// for example, a function was called
|
|
||||||
// in a context where the call does
|
|
||||||
// not make sense.
|
|
||||||
|
|
||||||
DEFINE_EXC (InputExc, BaseExc) // Invalid input data, e.g. from a file
|
DEFINE_EXC_EXP (IEX_EXPORT, IoExc, BaseExc) // Input or output operation failed
|
||||||
|
|
||||||
DEFINE_EXC (IoExc, BaseExc) // Input or output operation failed
|
DEFINE_EXC_EXP (IEX_EXPORT, MathExc, BaseExc) // Arithmetic exception; more specific
|
||||||
|
// exceptions derived from this class
|
||||||
|
// are defined in ExcMath.h
|
||||||
|
|
||||||
DEFINE_EXC (MathExc, BaseExc) // Arithmetic exception; more specific
|
DEFINE_EXC_EXP (IEX_EXPORT, ErrnoExc, BaseExc) // Base class for exceptions corresponding
|
||||||
// exceptions derived from this class
|
// to errno values (see errno.h); more
|
||||||
// are defined in ExcMath.h
|
// specific exceptions derived from this
|
||||||
|
// class are defined in ExcErrno.h
|
||||||
|
|
||||||
DEFINE_EXC (ErrnoExc, BaseExc) // Base class for exceptions corresponding
|
DEFINE_EXC_EXP (IEX_EXPORT, NoImplExc, BaseExc) // Missing method exception e.g. from a
|
||||||
// to errno values (see errno.h); more
|
// call to a method that is only partially
|
||||||
// specific exceptions derived from this
|
// or not at all implemented. A reminder
|
||||||
// class are defined in ExcErrno.h
|
// to lazy software people to get back
|
||||||
|
// to work.
|
||||||
|
|
||||||
DEFINE_EXC (NoImplExc, BaseExc) // Missing method exception e.g. from a
|
DEFINE_EXC_EXP (IEX_EXPORT, NullExc, BaseExc) // A pointer is inappropriately null.
|
||||||
// call to a method that is only partially
|
|
||||||
// or not at all implemented. A reminder
|
|
||||||
// to lazy software people to get back
|
|
||||||
// to work.
|
|
||||||
|
|
||||||
DEFINE_EXC (NullExc, BaseExc) // A pointer is inappropriately null.
|
DEFINE_EXC_EXP (IEX_EXPORT, TypeExc, BaseExc) // An object is an inappropriate type,
|
||||||
|
// i.e. a dynamnic_cast failed.
|
||||||
DEFINE_EXC (TypeExc, BaseExc) // An object is an inappropriate type,
|
|
||||||
// i.e. a dynamnic_cast failed.
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Stack-tracing support:
|
// Stack-tracing support:
|
||||||
//
|
//
|
||||||
// setStackTracer(st)
|
// setStackTracer(st)
|
||||||
//
|
//
|
||||||
// installs a stack-tracing routine, st, which will be called from
|
// installs a stack-tracing routine, st, which will be called from
|
||||||
@ -194,73 +201,15 @@ DEFINE_EXC (TypeExc, BaseExc) // An object is an inappropriate type,
|
|||||||
//
|
//
|
||||||
// returns a pointer to the current stack-tracing routine, or 0
|
// returns a pointer to the current stack-tracing routine, or 0
|
||||||
// if there is no current stack stack-tracing routine.
|
// if there is no current stack stack-tracing routine.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
typedef std::string (* StackTracer) ();
|
typedef std::string (* StackTracer) ();
|
||||||
|
|
||||||
void setStackTracer (StackTracer stackTracer);
|
IEX_EXPORT void setStackTracer (StackTracer stackTracer);
|
||||||
StackTracer stackTracer ();
|
IEX_EXPORT StackTracer stackTracer ();
|
||||||
|
|
||||||
|
|
||||||
//-----------------
|
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
// Inline functions
|
|
||||||
//-----------------
|
|
||||||
|
|
||||||
inline BaseExc &
|
#endif // INCLUDED_IEXBASEEXC_H
|
||||||
BaseExc::operator = (std::stringstream &s)
|
|
||||||
{
|
|
||||||
return assign (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline BaseExc &
|
|
||||||
BaseExc::operator += (std::stringstream &s)
|
|
||||||
{
|
|
||||||
return append (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline BaseExc &
|
|
||||||
BaseExc::assign (const char *s)
|
|
||||||
{
|
|
||||||
std::string::assign(s);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline BaseExc &
|
|
||||||
BaseExc::operator = (const char *s)
|
|
||||||
{
|
|
||||||
return assign(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline BaseExc &
|
|
||||||
BaseExc::append (const char *s)
|
|
||||||
{
|
|
||||||
std::string::append(s);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline BaseExc &
|
|
||||||
BaseExc::operator += (const char *s)
|
|
||||||
{
|
|
||||||
return append(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const std::string &
|
|
||||||
BaseExc::stackTrace () const
|
|
||||||
{
|
|
||||||
return _stackTrace;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
|
|
||||||
#pragma warning(default:4290)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace Iex
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
16
3rdparty/openexr/Iex/IexErrnoExc.h
vendored
16
3rdparty/openexr/Iex/IexErrnoExc.h
vendored
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -45,8 +45,7 @@
|
|||||||
|
|
||||||
#include "IexBaseExc.h"
|
#include "IexBaseExc.h"
|
||||||
|
|
||||||
namespace Iex {
|
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
DEFINE_EXC (EpermExc, ErrnoExc)
|
DEFINE_EXC (EpermExc, ErrnoExc)
|
||||||
DEFINE_EXC (EnoentExc, ErrnoExc)
|
DEFINE_EXC (EnoentExc, ErrnoExc)
|
||||||
@ -204,7 +203,6 @@ DEFINE_EXC (EcantextentExc, ErrnoExc)
|
|||||||
DEFINE_EXC (EinvaltimeExc, ErrnoExc)
|
DEFINE_EXC (EinvaltimeExc, ErrnoExc)
|
||||||
DEFINE_EXC (EdestroyedExc, ErrnoExc)
|
DEFINE_EXC (EdestroyedExc, ErrnoExc)
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
} // namespace Iex
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
51
3rdparty/openexr/Iex/IexExport.h
vendored
Normal file
51
3rdparty/openexr/Iex/IexExport.h
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef IEXEXPORT_H
|
||||||
|
#define IEXEXPORT_H
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if defined(OPENEXR_DLL)
|
||||||
|
#if defined(IEX_EXPORTS)
|
||||||
|
#define IEX_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define IEX_EXPORT __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#define IEX_EXPORT_CONST
|
||||||
|
#else
|
||||||
|
#define IEX_EXPORT
|
||||||
|
#define IEX_EXPORT_CONST const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef IEXEXPORT_H
|
||||||
|
|
229
3rdparty/openexr/Iex/IexForward.h
vendored
Normal file
229
3rdparty/openexr/Iex/IexForward.h
vendored
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IEXFORWARD_H
|
||||||
|
#define INCLUDED_IEXFORWARD_H
|
||||||
|
|
||||||
|
#include "IexNamespace.h"
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
//
|
||||||
|
// Base exceptions.
|
||||||
|
//
|
||||||
|
|
||||||
|
class BaseExc;
|
||||||
|
class ArgExc;
|
||||||
|
class LogicExc;
|
||||||
|
class InputExc;
|
||||||
|
class IoExc;
|
||||||
|
class MathExc;
|
||||||
|
class ErrnoExc;
|
||||||
|
class NoImplExc;
|
||||||
|
class NullExc;
|
||||||
|
class TypeExc;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Math exceptions.
|
||||||
|
//
|
||||||
|
|
||||||
|
class OverflowExc;
|
||||||
|
class UnderflowExc;
|
||||||
|
class DivzeroExc;
|
||||||
|
class InexactExc;
|
||||||
|
class InvalidFpOpExc;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Errno exceptions.
|
||||||
|
//
|
||||||
|
|
||||||
|
class EpermExc;
|
||||||
|
class EnoentExc;
|
||||||
|
class EsrchExc;
|
||||||
|
class EintrExc;
|
||||||
|
class EioExc;
|
||||||
|
class EnxioExc;
|
||||||
|
class E2bigExc;
|
||||||
|
class EnoexecExc;
|
||||||
|
class EbadfExc;
|
||||||
|
class EchildExc;
|
||||||
|
class EagainExc;
|
||||||
|
class EnomemExc;
|
||||||
|
class EaccesExc;
|
||||||
|
class EfaultExc;
|
||||||
|
class EnotblkExc;
|
||||||
|
class EbusyExc;
|
||||||
|
class EexistExc;
|
||||||
|
class ExdevExc;
|
||||||
|
class EnodevExc;
|
||||||
|
class EnotdirExc;
|
||||||
|
class EisdirExc;
|
||||||
|
class EinvalExc;
|
||||||
|
class EnfileExc;
|
||||||
|
class EmfileExc;
|
||||||
|
class EnottyExc;
|
||||||
|
class EtxtbsyExc;
|
||||||
|
class EfbigExc;
|
||||||
|
class EnospcExc;
|
||||||
|
class EspipeExc;
|
||||||
|
class ErofsExc;
|
||||||
|
class EmlinkExc;
|
||||||
|
class EpipeExc;
|
||||||
|
class EdomExc;
|
||||||
|
class ErangeExc;
|
||||||
|
class EnomsgExc;
|
||||||
|
class EidrmExc;
|
||||||
|
class EchrngExc;
|
||||||
|
class El2nsyncExc;
|
||||||
|
class El3hltExc;
|
||||||
|
class El3rstExc;
|
||||||
|
class ElnrngExc;
|
||||||
|
class EunatchExc;
|
||||||
|
class EnocsiExc;
|
||||||
|
class El2hltExc;
|
||||||
|
class EdeadlkExc;
|
||||||
|
class EnolckExc;
|
||||||
|
class EbadeExc;
|
||||||
|
class EbadrExc;
|
||||||
|
class ExfullExc;
|
||||||
|
class EnoanoExc;
|
||||||
|
class EbadrqcExc;
|
||||||
|
class EbadsltExc;
|
||||||
|
class EdeadlockExc;
|
||||||
|
class EbfontExc;
|
||||||
|
class EnostrExc;
|
||||||
|
class EnodataExc;
|
||||||
|
class EtimeExc;
|
||||||
|
class EnosrExc;
|
||||||
|
class EnonetExc;
|
||||||
|
class EnopkgExc;
|
||||||
|
class EremoteExc;
|
||||||
|
class EnolinkExc;
|
||||||
|
class EadvExc;
|
||||||
|
class EsrmntExc;
|
||||||
|
class EcommExc;
|
||||||
|
class EprotoExc;
|
||||||
|
class EmultihopExc;
|
||||||
|
class EbadmsgExc;
|
||||||
|
class EnametoolongExc;
|
||||||
|
class EoverflowExc;
|
||||||
|
class EnotuniqExc;
|
||||||
|
class EbadfdExc;
|
||||||
|
class EremchgExc;
|
||||||
|
class ElibaccExc;
|
||||||
|
class ElibbadExc;
|
||||||
|
class ElibscnExc;
|
||||||
|
class ElibmaxExc;
|
||||||
|
class ElibexecExc;
|
||||||
|
class EilseqExc;
|
||||||
|
class EnosysExc;
|
||||||
|
class EloopExc;
|
||||||
|
class ErestartExc;
|
||||||
|
class EstrpipeExc;
|
||||||
|
class EnotemptyExc;
|
||||||
|
class EusersExc;
|
||||||
|
class EnotsockExc;
|
||||||
|
class EdestaddrreqExc;
|
||||||
|
class EmsgsizeExc;
|
||||||
|
class EprototypeExc;
|
||||||
|
class EnoprotooptExc;
|
||||||
|
class EprotonosupportExc;
|
||||||
|
class EsocktnosupportExc;
|
||||||
|
class EopnotsuppExc;
|
||||||
|
class EpfnosupportExc;
|
||||||
|
class EafnosupportExc;
|
||||||
|
class EaddrinuseExc;
|
||||||
|
class EaddrnotavailExc;
|
||||||
|
class EnetdownExc;
|
||||||
|
class EnetunreachExc;
|
||||||
|
class EnetresetExc;
|
||||||
|
class EconnabortedExc;
|
||||||
|
class EconnresetExc;
|
||||||
|
class EnobufsExc;
|
||||||
|
class EisconnExc;
|
||||||
|
class EnotconnExc;
|
||||||
|
class EshutdownExc;
|
||||||
|
class EtoomanyrefsExc;
|
||||||
|
class EtimedoutExc;
|
||||||
|
class EconnrefusedExc;
|
||||||
|
class EhostdownExc;
|
||||||
|
class EhostunreachExc;
|
||||||
|
class EalreadyExc;
|
||||||
|
class EinprogressExc;
|
||||||
|
class EstaleExc;
|
||||||
|
class EioresidExc;
|
||||||
|
class EucleanExc;
|
||||||
|
class EnotnamExc;
|
||||||
|
class EnavailExc;
|
||||||
|
class EisnamExc;
|
||||||
|
class EremoteioExc;
|
||||||
|
class EinitExc;
|
||||||
|
class EremdevExc;
|
||||||
|
class EcanceledExc;
|
||||||
|
class EnolimfileExc;
|
||||||
|
class EproclimExc;
|
||||||
|
class EdisjointExc;
|
||||||
|
class EnologinExc;
|
||||||
|
class EloginlimExc;
|
||||||
|
class EgrouploopExc;
|
||||||
|
class EnoattachExc;
|
||||||
|
class EnotsupExc;
|
||||||
|
class EnoattrExc;
|
||||||
|
class EdircorruptedExc;
|
||||||
|
class EdquotExc;
|
||||||
|
class EnfsremoteExc;
|
||||||
|
class EcontrollerExc;
|
||||||
|
class EnotcontrollerExc;
|
||||||
|
class EenqueuedExc;
|
||||||
|
class EnotenqueuedExc;
|
||||||
|
class EjoinedExc;
|
||||||
|
class EnotjoinedExc;
|
||||||
|
class EnoprocExc;
|
||||||
|
class EmustrunExc;
|
||||||
|
class EnotstoppedExc;
|
||||||
|
class EclockcpuExc;
|
||||||
|
class EinvalstateExc;
|
||||||
|
class EnoexistExc;
|
||||||
|
class EendofminorExc;
|
||||||
|
class EbufsizeExc;
|
||||||
|
class EemptyExc;
|
||||||
|
class EnointrgroupExc;
|
||||||
|
class EinvalmodeExc;
|
||||||
|
class EcantextentExc;
|
||||||
|
class EinvaltimeExc;
|
||||||
|
class EdestroyedExc;
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif // INCLUDED_IEXFORWARD_H
|
96
3rdparty/openexr/Iex/IexMacros.h
vendored
96
3rdparty/openexr/Iex/IexMacros.h
vendored
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002-2018, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -52,16 +52,22 @@
|
|||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// THROW (InputExc, "Syntax error in line " << line ", " << file << ".");
|
// THROW (InputExc, "Syntax error in line " << line ", " << file << ".");
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define THROW(type, text) \
|
#include "IexExport.h"
|
||||||
do \
|
#include "IexForward.h"
|
||||||
{ \
|
|
||||||
std::stringstream s; \
|
IEX_EXPORT void iex_debugTrap();
|
||||||
s << text; \
|
|
||||||
throw type (s); \
|
#define THROW(type, text) \
|
||||||
} \
|
do \
|
||||||
|
{ \
|
||||||
|
iex_debugTrap(); \
|
||||||
|
std::stringstream _iex_throw_s; \
|
||||||
|
_iex_throw_s << text; \
|
||||||
|
throw type (_iex_throw_s); \
|
||||||
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
@ -88,22 +94,22 @@
|
|||||||
// }
|
// }
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define APPEND_EXC(exc, text) \
|
#define APPEND_EXC(exc, text) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
std::stringstream s; \
|
std::stringstream _iex_append_s; \
|
||||||
s << text; \
|
_iex_append_s << text; \
|
||||||
exc.append (s); \
|
exc.append (_iex_append_s); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
#define REPLACE_EXC(exc, text) \
|
#define REPLACE_EXC(exc, text) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
std::stringstream s; \
|
std::stringstream _iex_replace_s; \
|
||||||
s << text; \
|
_iex_replace_s << text; \
|
||||||
exc.assign (s); \
|
exc.assign (_iex_replace_s); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
@ -117,13 +123,13 @@
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
#define THROW_ERRNO(text) \
|
#define THROW_ERRNO(text) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
std::stringstream s; \
|
std::stringstream _iex_throw_errno_s; \
|
||||||
s << text; \
|
_iex_throw_errno_s << text; \
|
||||||
::Iex::throwErrnoExc (s.str()); \
|
::IEX_NAMESPACE::throwErrnoExc (_iex_throw_errno_s.str()); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
@ -132,17 +138,33 @@
|
|||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// ASSERT (ptr != NULL, NullExc, "Null pointer" );
|
// ASSERT (ptr != 0, NullExc, "Null pointer" );
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
#define ASSERT(assertion, type, text) \
|
#define ASSERT(assertion, type, text) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if ((assertion) == false) \
|
if( bool(assertion) == false ) \
|
||||||
THROW (type, text); \
|
{ \
|
||||||
|
THROW( type, text ); \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
//-------------------------------------------------------------
|
||||||
|
// A macro to throw an IEX_NAMESPACE::LogicExc if an assertion is false,
|
||||||
|
// with the text composed from the source code file, line number,
|
||||||
|
// and assertion argument text.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// LOGIC_ASSERT (i < n);
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------
|
||||||
|
#define LOGIC_ASSERT(assertion) \
|
||||||
|
ASSERT(assertion, \
|
||||||
|
IEX_NAMESPACE::LogicExc, \
|
||||||
|
__FILE__ << "(" << __LINE__ << "): logical assertion failed: " << #assertion )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
17
3rdparty/openexr/Iex/IexMathExc.h
vendored
17
3rdparty/openexr/Iex/IexMathExc.h
vendored
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "IexBaseExc.h"
|
#include "IexBaseExc.h"
|
||||||
|
|
||||||
namespace Iex {
|
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// Exception classess which correspond to specific floating
|
// Exception classess which correspond to specific floating
|
||||||
@ -52,7 +52,6 @@ DEFINE_EXC (DivzeroExc, MathExc) // Division by zero
|
|||||||
DEFINE_EXC (InexactExc, MathExc) // Inexact result
|
DEFINE_EXC (InexactExc, MathExc) // Inexact result
|
||||||
DEFINE_EXC (InvalidFpOpExc, MathExc) // Invalid operation
|
DEFINE_EXC (InvalidFpOpExc, MathExc) // Invalid operation
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
} // namespace Iex
|
#endif // INCLUDED_IEXMATHEXC_H
|
||||||
|
|
||||||
#endif
|
|
||||||
|
112
3rdparty/openexr/Iex/IexNamespace.h
vendored
Normal file
112
3rdparty/openexr/Iex/IexNamespace.h
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IEXNAMESPACE_H
|
||||||
|
#define INCLUDED_IEXNAMESPACE_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// The purpose of this file is to make it possible to specify an
|
||||||
|
// IEX_INTERNAL_NAMESPACE as a preprocessor definition and have all of the
|
||||||
|
// Iex symbols defined within that namespace rather than the standard
|
||||||
|
// Iex namespace. Those symbols are made available to client code through
|
||||||
|
// the IEX_NAMESPACE in addition to the IEX_INTERNAL_NAMESPACE.
|
||||||
|
//
|
||||||
|
// To ensure source code compatibility, the IEX_NAMESPACE defaults to Iex
|
||||||
|
// and then "using namespace IEX_INTERNAL_NAMESPACE;" brings all of the
|
||||||
|
// declarations from the IEX_INTERNAL_NAMESPACE into the IEX_NAMESPACE. This
|
||||||
|
// means that client code can continue to use syntax like Iex::BaseExc, but
|
||||||
|
// at link time it will resolve to a mangled symbol based on the
|
||||||
|
// IEX_INTERNAL_NAMESPACE.
|
||||||
|
//
|
||||||
|
// As an example, if one needed to build against a newer version of Iex and
|
||||||
|
// have it run alongside an older version in the same application, it is now
|
||||||
|
// possible to use an internal namespace to prevent collisions between the
|
||||||
|
// older versions of Iex symbols and the newer ones. To do this, the
|
||||||
|
// following could be defined at build time:
|
||||||
|
//
|
||||||
|
// IEX_INTERNAL_NAMESPACE = Iex_v2
|
||||||
|
//
|
||||||
|
// This means that declarations inside Iex headers look like this (after the
|
||||||
|
// preprocessor has done its work):
|
||||||
|
//
|
||||||
|
// namespace Iex_v2 {
|
||||||
|
// ...
|
||||||
|
// class declarations
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// namespace Iex {
|
||||||
|
// using namespace Iex_v2;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Open Source version of this file pulls in the IlmBaseConfig.h file
|
||||||
|
// for the configure time options.
|
||||||
|
//
|
||||||
|
#include "IlmBaseConfig.h"
|
||||||
|
|
||||||
|
#ifndef IEX_NAMESPACE
|
||||||
|
#define IEX_NAMESPACE Iex
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IEX_INTERNAL_NAMESPACE
|
||||||
|
#define IEX_INTERNAL_NAMESPACE IEX_NAMESPACE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// We need to be sure that we import the internal namespace into the public one.
|
||||||
|
// To do this, we use the small bit of code below which initially defines
|
||||||
|
// IEX_INTERNAL_NAMESPACE (so it can be referenced) and then defines
|
||||||
|
// IEX_NAMESPACE and pulls the internal symbols into the public namespace.
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace IEX_INTERNAL_NAMESPACE {}
|
||||||
|
namespace IEX_NAMESPACE {
|
||||||
|
using namespace IEX_INTERNAL_NAMESPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// There are identical pairs of HEADER/SOURCE ENTER/EXIT macros so that
|
||||||
|
// future extension to the namespace mechanism is possible without changing
|
||||||
|
// project source code.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define IEX_INTERNAL_NAMESPACE_HEADER_ENTER namespace IEX_INTERNAL_NAMESPACE {
|
||||||
|
#define IEX_INTERNAL_NAMESPACE_HEADER_EXIT }
|
||||||
|
|
||||||
|
#define IEX_INTERNAL_NAMESPACE_SOURCE_ENTER namespace IEX_INTERNAL_NAMESPACE {
|
||||||
|
#define IEX_INTERNAL_NAMESPACE_SOURCE_EXIT }
|
||||||
|
|
||||||
|
#endif // INCLUDED_IEXNAMESPACE_H
|
666
3rdparty/openexr/Iex/IexThrowErrnoExc.cpp
vendored
666
3rdparty/openexr/Iex/IexThrowErrnoExc.cpp
vendored
File diff suppressed because it is too large
Load Diff
25
3rdparty/openexr/Iex/IexThrowErrnoExc.h
vendored
25
3rdparty/openexr/Iex/IexThrowErrnoExc.h
vendored
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -44,8 +44,9 @@
|
|||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
#include "IexBaseExc.h"
|
#include "IexBaseExc.h"
|
||||||
|
#include "IexExport.h"
|
||||||
|
|
||||||
namespace Iex {
|
IEX_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -56,7 +57,7 @@ namespace Iex {
|
|||||||
// "%T" have been replaced with the output of strerror(oserror()).
|
// "%T" have been replaced with the output of strerror(oserror()).
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// If opening file /tmp/output failed with an ENOENT error code,
|
// If opening file /tmp/output failed with an ENOENT error code,
|
||||||
// calling
|
// calling
|
||||||
//
|
//
|
||||||
@ -87,10 +88,10 @@ namespace Iex {
|
|||||||
//
|
//
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
void throwErrnoExc (const std::string &txt, int errnum);
|
IEX_EXPORT void throwErrnoExc(const std::string &txt, int errnum);
|
||||||
void throwErrnoExc (const std::string &txt = "%T." /*, int errnum = oserror() */);
|
IEX_EXPORT void throwErrnoExc(const std::string &txt);
|
||||||
|
IEX_EXPORT void throwErrnoExc();
|
||||||
|
|
||||||
|
IEX_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
} // namespace Iex
|
#endif // INCLUDED_IEXTHROWERRNOEXC_H
|
||||||
|
|
||||||
#endif
|
|
||||||
|
63
3rdparty/openexr/IlmBaseConfig.h.cmakein
vendored
63
3rdparty/openexr/IlmBaseConfig.h.cmakein
vendored
@ -1,3 +1,15 @@
|
|||||||
|
#cmakedefine PLATFORM_WINDOWS
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define and set to 1 if the target system has c++11/14 support
|
||||||
|
// and you want IlmBase to NOT use it's features
|
||||||
|
//
|
||||||
|
|
||||||
|
#cmakedefine01 ILMBASE_FORCE_CXX03
|
||||||
|
#if ILMBASE_FORCE_CXX03 == 0
|
||||||
|
#undef ILMBASE_FORCE_CXX03
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define and set to 1 if the target system has POSIX thread support
|
// Define and set to 1 if the target system has POSIX thread support
|
||||||
// and you want IlmBase to use it for multithreaded file I/O.
|
// and you want IlmBase to use it for multithreaded file I/O.
|
||||||
@ -13,18 +25,59 @@
|
|||||||
|
|
||||||
#cmakedefine01 HAVE_POSIX_SEMAPHORES
|
#cmakedefine01 HAVE_POSIX_SEMAPHORES
|
||||||
|
|
||||||
#undef HAVE_UCONTEXT_H
|
|
||||||
|
#cmakedefine HAVE_UCONTEXT_H
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Dealing with FPEs
|
||||||
|
//
|
||||||
|
#cmakedefine01 ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define and set to 1 if the target system has support for large
|
// Define and set to 1 if the target system has support for large
|
||||||
// stack sizes.
|
// stack sizes.
|
||||||
//
|
//
|
||||||
|
|
||||||
#undef ILMBASE_HAVE_LARGE_STACK
|
#cmakedefine ILMBASE_HAVE_LARGE_STACK
|
||||||
|
|
||||||
|
//
|
||||||
|
// Current (internal) library namepace name and corresponding public
|
||||||
|
// client namespaces.
|
||||||
|
//
|
||||||
|
#define ILMBASE_INTERNAL_NAMESPACE_CUSTOM @ILMBASE_INTERNAL_NAMESPACE_CUSTOM@
|
||||||
|
#define IMATH_INTERNAL_NAMESPACE @IMATH_INTERNAL_NAMESPACE@
|
||||||
|
#define IEX_INTERNAL_NAMESPACE @IEX_INTERNAL_NAMESPACE@
|
||||||
|
#define ILMTHREAD_INTERNAL_NAMESPACE @ILMTHREAD_INTERNAL_NAMESPACE@
|
||||||
|
|
||||||
|
#define ILMBASE_NAMESPACE_CUSTOM @ILMBASE_NAMESPACE_CUSTOM@
|
||||||
|
#define IMATH_NAMESPACE @IMATH_NAMESPACE@
|
||||||
|
#define IEX_NAMESPACE @IEX_NAMESPACE@
|
||||||
|
#define ILMTHREAD_NAMESPACE @ILMTHREAD_NAMESPACE@
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Version string for runtime access
|
// Define and set to 1 if the target system has support for large
|
||||||
|
// stack sizes.
|
||||||
//
|
//
|
||||||
#define ILMBASE_VERSION_STRING "1.0.3"
|
|
||||||
#define ILMBASE_PACKAGE_STRING "IlmBase 1.0.3"
|
#cmakedefine ILMBASE_HAVE_LARGE_STACK
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Version information
|
||||||
|
//
|
||||||
|
#define ILMBASE_VERSION_STRING @ILMBASE_VERSION_STRING@
|
||||||
|
#define ILMBASE_PACKAGE_STRING @ILMBASE_PACKAGE_STRING@
|
||||||
|
|
||||||
|
#define ILMBASE_VERSION_MAJOR @ILMBASE_VERSION_MAJOR@
|
||||||
|
#define ILMBASE_VERSION_MINOR @ILMBASE_VERSION_MINOR@
|
||||||
|
#define ILMBASE_VERSION_PATCH @ILMBASE_VERSION_PATCH@
|
||||||
|
|
||||||
|
// Version as a single hex number, e.g. 0x01000300 == 1.0.3
|
||||||
|
#define ILMBASE_VERSION_HEX ((ILMBASE_VERSION_MAJOR << 24) | \
|
||||||
|
(ILMBASE_VERSION_MINOR << 16) | \
|
||||||
|
(ILMBASE_VERSION_PATCH << 8))
|
||||||
|
|
||||||
|
|
||||||
|
199
3rdparty/openexr/IlmImf/ImfAcesFile.cpp
vendored
199
3rdparty/openexr/IlmImf/ImfAcesFile.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -35,30 +35,31 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ACES image file I/O.
|
// ACES image file I/O.
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAcesFile.h>
|
#include <ImfAcesFile.h>
|
||||||
#include <ImfRgbaFile.h>
|
#include <ImfRgbaFile.h>
|
||||||
#include <ImfStandardAttributes.h>
|
#include <ImfStandardAttributes.h>
|
||||||
#include <Iex.h>
|
#include <Iex.h>
|
||||||
#include <algorithm> // for std::max()
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Imath;
|
using namespace IMATH_NAMESPACE;
|
||||||
using namespace Iex;
|
using namespace IEX_NAMESPACE;
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
const Chromaticities &
|
const Chromaticities &
|
||||||
acesChromaticities ()
|
acesChromaticities ()
|
||||||
{
|
{
|
||||||
static const Chromaticities acesChr
|
static const Chromaticities acesChr
|
||||||
(V2f (0.73470, 0.26530), // red
|
(V2f (0.73470, 0.26530), // red
|
||||||
V2f (0.00000, 1.00000), // green
|
V2f (0.00000, 1.00000), // green
|
||||||
V2f (0.00010, -0.07700), // blue
|
V2f (0.00010, -0.07700), // blue
|
||||||
V2f (0.32168, 0.33767)); // white
|
V2f (0.32168, 0.33767)); // white
|
||||||
|
|
||||||
return acesChr;
|
return acesChr;
|
||||||
}
|
}
|
||||||
@ -102,10 +103,10 @@ checkCompression (Compression compression)
|
|||||||
case NO_COMPRESSION:
|
case NO_COMPRESSION:
|
||||||
case PIZ_COMPRESSION:
|
case PIZ_COMPRESSION:
|
||||||
case B44A_COMPRESSION:
|
case B44A_COMPRESSION:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ArgExc ("Invalid compression type for ACES file.");
|
throw ArgExc ("Invalid compression type for ACES file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,16 +128,16 @@ AcesOutputFile::AcesOutputFile
|
|||||||
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
||||||
|
|
||||||
_data->rgbaFile = new RgbaOutputFile (name.c_str(),
|
_data->rgbaFile = new RgbaOutputFile (name.c_str(),
|
||||||
newHeader,
|
newHeader,
|
||||||
rgbaChannels,
|
rgbaChannels,
|
||||||
numThreads);
|
numThreads);
|
||||||
|
|
||||||
_data->rgbaFile->setYCRounding (7, 6);
|
_data->rgbaFile->setYCRounding (7, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AcesOutputFile::AcesOutputFile
|
AcesOutputFile::AcesOutputFile
|
||||||
(OStream &os,
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
||||||
const Header &header,
|
const Header &header,
|
||||||
RgbaChannels rgbaChannels,
|
RgbaChannels rgbaChannels,
|
||||||
int numThreads)
|
int numThreads)
|
||||||
@ -150,9 +151,9 @@ AcesOutputFile::AcesOutputFile
|
|||||||
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
||||||
|
|
||||||
_data->rgbaFile = new RgbaOutputFile (os,
|
_data->rgbaFile = new RgbaOutputFile (os,
|
||||||
header,
|
header,
|
||||||
rgbaChannels,
|
rgbaChannels,
|
||||||
numThreads);
|
numThreads);
|
||||||
|
|
||||||
_data->rgbaFile->setYCRounding (7, 6);
|
_data->rgbaFile->setYCRounding (7, 6);
|
||||||
}
|
}
|
||||||
@ -160,11 +161,11 @@ AcesOutputFile::AcesOutputFile
|
|||||||
|
|
||||||
AcesOutputFile::AcesOutputFile
|
AcesOutputFile::AcesOutputFile
|
||||||
(const std::string &name,
|
(const std::string &name,
|
||||||
const Imath::Box2i &displayWindow,
|
const IMATH_NAMESPACE::Box2i &displayWindow,
|
||||||
const Imath::Box2i &dataWindow,
|
const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
RgbaChannels rgbaChannels,
|
RgbaChannels rgbaChannels,
|
||||||
float pixelAspectRatio,
|
float pixelAspectRatio,
|
||||||
const Imath::V2f screenWindowCenter,
|
const IMATH_NAMESPACE::V2f screenWindowCenter,
|
||||||
float screenWindowWidth,
|
float screenWindowWidth,
|
||||||
LineOrder lineOrder,
|
LineOrder lineOrder,
|
||||||
Compression compression,
|
Compression compression,
|
||||||
@ -175,20 +176,20 @@ AcesOutputFile::AcesOutputFile
|
|||||||
checkCompression (compression);
|
checkCompression (compression);
|
||||||
|
|
||||||
Header newHeader (displayWindow,
|
Header newHeader (displayWindow,
|
||||||
dataWindow.isEmpty()? displayWindow: dataWindow,
|
dataWindow.isEmpty()? displayWindow: dataWindow,
|
||||||
pixelAspectRatio,
|
pixelAspectRatio,
|
||||||
screenWindowCenter,
|
screenWindowCenter,
|
||||||
screenWindowWidth,
|
screenWindowWidth,
|
||||||
lineOrder,
|
lineOrder,
|
||||||
compression);
|
compression);
|
||||||
|
|
||||||
addChromaticities (newHeader, acesChromaticities());
|
addChromaticities (newHeader, acesChromaticities());
|
||||||
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
||||||
|
|
||||||
_data->rgbaFile = new RgbaOutputFile (name.c_str(),
|
_data->rgbaFile = new RgbaOutputFile (name.c_str(),
|
||||||
newHeader,
|
newHeader,
|
||||||
rgbaChannels,
|
rgbaChannels,
|
||||||
numThreads);
|
numThreads);
|
||||||
|
|
||||||
_data->rgbaFile->setYCRounding (7, 6);
|
_data->rgbaFile->setYCRounding (7, 6);
|
||||||
}
|
}
|
||||||
@ -200,7 +201,7 @@ AcesOutputFile::AcesOutputFile
|
|||||||
int height,
|
int height,
|
||||||
RgbaChannels rgbaChannels,
|
RgbaChannels rgbaChannels,
|
||||||
float pixelAspectRatio,
|
float pixelAspectRatio,
|
||||||
const Imath::V2f screenWindowCenter,
|
const IMATH_NAMESPACE::V2f screenWindowCenter,
|
||||||
float screenWindowWidth,
|
float screenWindowWidth,
|
||||||
LineOrder lineOrder,
|
LineOrder lineOrder,
|
||||||
Compression compression,
|
Compression compression,
|
||||||
@ -211,20 +212,20 @@ AcesOutputFile::AcesOutputFile
|
|||||||
checkCompression (compression);
|
checkCompression (compression);
|
||||||
|
|
||||||
Header newHeader (width,
|
Header newHeader (width,
|
||||||
height,
|
height,
|
||||||
pixelAspectRatio,
|
pixelAspectRatio,
|
||||||
screenWindowCenter,
|
screenWindowCenter,
|
||||||
screenWindowWidth,
|
screenWindowWidth,
|
||||||
lineOrder,
|
lineOrder,
|
||||||
compression);
|
compression);
|
||||||
|
|
||||||
addChromaticities (newHeader, acesChromaticities());
|
addChromaticities (newHeader, acesChromaticities());
|
||||||
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
addAdoptedNeutral (newHeader, acesChromaticities().white);
|
||||||
|
|
||||||
_data->rgbaFile = new RgbaOutputFile (name.c_str(),
|
_data->rgbaFile = new RgbaOutputFile (name.c_str(),
|
||||||
newHeader,
|
newHeader,
|
||||||
rgbaChannels,
|
rgbaChannels,
|
||||||
numThreads);
|
numThreads);
|
||||||
|
|
||||||
_data->rgbaFile->setYCRounding (7, 6);
|
_data->rgbaFile->setYCRounding (7, 6);
|
||||||
}
|
}
|
||||||
@ -236,7 +237,7 @@ AcesOutputFile::~AcesOutputFile ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AcesOutputFile::setFrameBuffer
|
AcesOutputFile::setFrameBuffer
|
||||||
(const Rgba *base,
|
(const Rgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
@ -246,14 +247,14 @@ AcesOutputFile::setFrameBuffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AcesOutputFile::writePixels (int numScanLines)
|
AcesOutputFile::writePixels (int numScanLines)
|
||||||
{
|
{
|
||||||
_data->rgbaFile->writePixels (numScanLines);
|
_data->rgbaFile->writePixels (numScanLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
AcesOutputFile::currentScanLine () const
|
AcesOutputFile::currentScanLine () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->currentScanLine();
|
return _data->rgbaFile->currentScanLine();
|
||||||
@ -267,49 +268,49 @@ AcesOutputFile::header () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Imath::Box2i &
|
const IMATH_NAMESPACE::Box2i &
|
||||||
AcesOutputFile::displayWindow () const
|
AcesOutputFile::displayWindow () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->displayWindow();
|
return _data->rgbaFile->displayWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Imath::Box2i &
|
const IMATH_NAMESPACE::Box2i &
|
||||||
AcesOutputFile::dataWindow () const
|
AcesOutputFile::dataWindow () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->dataWindow();
|
return _data->rgbaFile->dataWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
AcesOutputFile::pixelAspectRatio () const
|
AcesOutputFile::pixelAspectRatio () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->pixelAspectRatio();
|
return _data->rgbaFile->pixelAspectRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Imath::V2f
|
const IMATH_NAMESPACE::V2f
|
||||||
AcesOutputFile::screenWindowCenter () const
|
AcesOutputFile::screenWindowCenter () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->screenWindowCenter();
|
return _data->rgbaFile->screenWindowCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
AcesOutputFile::screenWindowWidth () const
|
AcesOutputFile::screenWindowWidth () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->screenWindowWidth();
|
return _data->rgbaFile->screenWindowWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LineOrder
|
LineOrder
|
||||||
AcesOutputFile::lineOrder () const
|
AcesOutputFile::lineOrder () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->lineOrder();
|
return _data->rgbaFile->lineOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Compression
|
Compression
|
||||||
AcesOutputFile::compression () const
|
AcesOutputFile::compression () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->compression();
|
return _data->rgbaFile->compression();
|
||||||
@ -323,7 +324,7 @@ AcesOutputFile::channels () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AcesOutputFile::updatePreviewImage (const PreviewRgba pixels[])
|
AcesOutputFile::updatePreviewImage (const PreviewRgba pixels[])
|
||||||
{
|
{
|
||||||
_data->rgbaFile->updatePreviewImage (pixels);
|
_data->rgbaFile->updatePreviewImage (pixels);
|
||||||
@ -379,28 +380,28 @@ AcesInputFile::Data::initColorConversion ()
|
|||||||
Chromaticities fileChr;
|
Chromaticities fileChr;
|
||||||
|
|
||||||
if (hasChromaticities (header))
|
if (hasChromaticities (header))
|
||||||
fileChr = chromaticities (header);
|
fileChr = chromaticities (header);
|
||||||
|
|
||||||
V2f fileNeutral = fileChr.white;
|
V2f fileNeutral = fileChr.white;
|
||||||
|
|
||||||
if (hasAdoptedNeutral (header))
|
if (hasAdoptedNeutral (header))
|
||||||
fileNeutral = adoptedNeutral (header);
|
fileNeutral = adoptedNeutral (header);
|
||||||
|
|
||||||
const Chromaticities acesChr = acesChromaticities();
|
const Chromaticities acesChr = acesChromaticities();
|
||||||
|
|
||||||
V2f acesNeutral = acesChr.white;
|
V2f acesNeutral = acesChr.white;
|
||||||
|
|
||||||
if (fileChr.red == acesChr.red &&
|
if (fileChr.red == acesChr.red &&
|
||||||
fileChr.green == acesChr.green &&
|
fileChr.green == acesChr.green &&
|
||||||
fileChr.blue == acesChr.blue &&
|
fileChr.blue == acesChr.blue &&
|
||||||
fileChr.white == acesChr.white &&
|
fileChr.white == acesChr.white &&
|
||||||
fileNeutral == acesNeutral)
|
fileNeutral == acesNeutral)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// The file already contains ACES data,
|
// The file already contains ACES data,
|
||||||
// color conversion is not necessary.
|
// color conversion is not necessary.
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mustConvertColor = true;
|
mustConvertColor = true;
|
||||||
@ -419,16 +420,16 @@ AcesInputFile::Data::initColorConversion ()
|
|||||||
//
|
//
|
||||||
|
|
||||||
static const M44f bradfordCPM
|
static const M44f bradfordCPM
|
||||||
(0.895100, -0.750200, 0.038900, 0.000000,
|
(0.895100, -0.750200, 0.038900, 0.000000,
|
||||||
0.266400, 1.713500, -0.068500, 0.000000,
|
0.266400, 1.713500, -0.068500, 0.000000,
|
||||||
-0.161400, 0.036700, 1.029600, 0.000000,
|
-0.161400, 0.036700, 1.029600, 0.000000,
|
||||||
0.000000, 0.000000, 0.000000, 1.000000);
|
0.000000, 0.000000, 0.000000, 1.000000);
|
||||||
|
|
||||||
const static M44f inverseBradfordCPM
|
const static M44f inverseBradfordCPM
|
||||||
(0.986993, 0.432305, -0.008529, 0.000000,
|
(0.986993, 0.432305, -0.008529, 0.000000,
|
||||||
-0.147054, 0.518360, 0.040043, 0.000000,
|
-0.147054, 0.518360, 0.040043, 0.000000,
|
||||||
0.159963, 0.049291, 0.968487, 0.000000,
|
0.159963, 0.049291, 0.968487, 0.000000,
|
||||||
0.000000, 0.000000, 0.000000, 1.000000);
|
0.000000, 0.000000, 0.000000, 1.000000);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert the white points of the two RGB spaces to XYZ
|
// Convert the white points of the two RGB spaces to XYZ
|
||||||
@ -447,16 +448,16 @@ AcesInputFile::Data::initColorConversion ()
|
|||||||
//
|
//
|
||||||
|
|
||||||
V3f ratio ((acesNeutralXYZ * bradfordCPM) /
|
V3f ratio ((acesNeutralXYZ * bradfordCPM) /
|
||||||
(fileNeutralXYZ * bradfordCPM));
|
(fileNeutralXYZ * bradfordCPM));
|
||||||
|
|
||||||
M44f ratioMat (ratio[0], 0, 0, 0,
|
M44f ratioMat (ratio[0], 0, 0, 0,
|
||||||
0, ratio[1], 0, 0,
|
0, ratio[1], 0, 0,
|
||||||
0, 0, ratio[2], 0,
|
0, 0, ratio[2], 0,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
|
||||||
M44f bradfordTrans = bradfordCPM *
|
M44f bradfordTrans = bradfordCPM *
|
||||||
ratioMat *
|
ratioMat *
|
||||||
inverseBradfordCPM;
|
inverseBradfordCPM;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build a combined file-RGB-to-ACES-RGB conversion matrix
|
// Build a combined file-RGB-to-ACES-RGB conversion matrix
|
||||||
@ -488,7 +489,7 @@ AcesInputFile::~AcesInputFile ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AcesInputFile::setFrameBuffer (Rgba *base, size_t xStride, size_t yStride)
|
AcesInputFile::setFrameBuffer (Rgba *base, size_t xStride, size_t yStride)
|
||||||
{
|
{
|
||||||
_data->rgbaFile->setFrameBuffer (base, xStride, yStride);
|
_data->rgbaFile->setFrameBuffer (base, xStride, yStride);
|
||||||
@ -498,7 +499,7 @@ AcesInputFile::setFrameBuffer (Rgba *base, size_t xStride, size_t yStride)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AcesInputFile::readPixels (int scanLine1, int scanLine2)
|
AcesInputFile::readPixels (int scanLine1, int scanLine2)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@ -514,32 +515,32 @@ AcesInputFile::readPixels (int scanLine1, int scanLine2)
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (!_data->mustConvertColor)
|
if (!_data->mustConvertColor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int minY = min (scanLine1, scanLine2);
|
int minY = min (scanLine1, scanLine2);
|
||||||
int maxY = max (scanLine1, scanLine2);
|
int maxY = max (scanLine1, scanLine2);
|
||||||
|
|
||||||
for (int y = minY; y <= maxY; ++y)
|
for (int y = minY; y <= maxY; ++y)
|
||||||
{
|
{
|
||||||
Rgba *base = _data->fbBase +
|
Rgba *base = _data->fbBase +
|
||||||
_data->fbXStride * _data->minX +
|
_data->fbXStride * _data->minX +
|
||||||
_data->fbYStride * y;
|
_data->fbYStride * y;
|
||||||
|
|
||||||
for (int x = _data->minX; x <= _data->maxX; ++x)
|
for (int x = _data->minX; x <= _data->maxX; ++x)
|
||||||
{
|
{
|
||||||
V3f aces = V3f (base->r, base->g, base->b) * _data->fileToAces;
|
V3f aces = V3f (base->r, base->g, base->b) * _data->fileToAces;
|
||||||
|
|
||||||
base->r = aces[0];
|
base->r = aces[0];
|
||||||
base->g = aces[1];
|
base->g = aces[1];
|
||||||
base->b = aces[2];
|
base->b = aces[2];
|
||||||
|
|
||||||
base += _data->fbXStride;
|
base += _data->fbXStride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AcesInputFile::readPixels (int scanLine)
|
AcesInputFile::readPixels (int scanLine)
|
||||||
{
|
{
|
||||||
readPixels (scanLine, scanLine);
|
readPixels (scanLine, scanLine);
|
||||||
@ -553,14 +554,14 @@ AcesInputFile::header () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Imath::Box2i &
|
const IMATH_NAMESPACE::Box2i &
|
||||||
AcesInputFile::displayWindow () const
|
AcesInputFile::displayWindow () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->displayWindow();
|
return _data->rgbaFile->displayWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Imath::Box2i &
|
const IMATH_NAMESPACE::Box2i &
|
||||||
AcesInputFile::dataWindow () const
|
AcesInputFile::dataWindow () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->dataWindow();
|
return _data->rgbaFile->dataWindow();
|
||||||
@ -574,7 +575,7 @@ AcesInputFile::pixelAspectRatio () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Imath::V2f
|
const IMATH_NAMESPACE::V2f
|
||||||
AcesInputFile::screenWindowCenter () const
|
AcesInputFile::screenWindowCenter () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->screenWindowCenter();
|
return _data->rgbaFile->screenWindowCenter();
|
||||||
@ -609,7 +610,7 @@ AcesInputFile::channels () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
AcesInputFile::fileName () const
|
AcesInputFile::fileName () const
|
||||||
{
|
{
|
||||||
return _data->rgbaFile->fileName();
|
return _data->rgbaFile->fileName();
|
||||||
@ -629,4 +630,4 @@ AcesInputFile::version () const
|
|||||||
return _data->rgbaFile->version();
|
return _data->rgbaFile->version();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
150
3rdparty/openexr/IlmImf/ImfAcesFile.h
vendored
150
3rdparty/openexr/IlmImf/ImfAcesFile.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -41,33 +41,33 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ACES image file I/O.
|
// ACES image file I/O.
|
||||||
//
|
//
|
||||||
// This header file declares two classes that directly support
|
// This header file declares two classes that directly support
|
||||||
// image file input and output according to the Academy Image
|
// image file input and output according to the Academy Image
|
||||||
// Interchange Framework.
|
// Interchange Framework.
|
||||||
//
|
//
|
||||||
// The Academy Image Interchange file format is a subset of OpenEXR:
|
// The Academy Image Interchange file format is a subset of OpenEXR:
|
||||||
//
|
//
|
||||||
// - Images are stored as scanlines. Tiles are not allowed.
|
// - Images are stored as scanlines. Tiles are not allowed.
|
||||||
//
|
//
|
||||||
// - Images contain three color channels, either
|
// - Images contain three color channels, either
|
||||||
// R, G, B (red, green, blue) or
|
// R, G, B (red, green, blue) or
|
||||||
// Y, RY, BY (luminance, sub-sampled chroma)
|
// Y, RY, BY (luminance, sub-sampled chroma)
|
||||||
//
|
//
|
||||||
// - Images may optionally contain an alpha channel.
|
// - Images may optionally contain an alpha channel.
|
||||||
//
|
//
|
||||||
// - Only three compression types are allowed:
|
// - Only three compression types are allowed:
|
||||||
// - NO_COMPRESSION (file is not compressed)
|
// - NO_COMPRESSION (file is not compressed)
|
||||||
// - PIZ_COMPRESSION (lossless)
|
// - PIZ_COMPRESSION (lossless)
|
||||||
// - B44A_COMPRESSION (lossy)
|
// - B44A_COMPRESSION (lossy)
|
||||||
//
|
//
|
||||||
// - The "chromaticities" header attribute must specify
|
// - The "chromaticities" header attribute must specify
|
||||||
// the ACES RGB primaries and white point.
|
// the ACES RGB primaries and white point.
|
||||||
//
|
//
|
||||||
// class AcesOutputFile writes an OpenEXR file, enforcing the
|
// class AcesOutputFile writes an OpenEXR file, enforcing the
|
||||||
// restrictions listed above. Pixel data supplied by application
|
// restrictions listed above. Pixel data supplied by application
|
||||||
// software must already be in the ACES RGB space.
|
// software must already be in the ACES RGB space.
|
||||||
//
|
//
|
||||||
// class AcesInputFile reads an OpenEXR file. Pixel data delivered
|
// class AcesInputFile reads an OpenEXR file. Pixel data delivered
|
||||||
// to application software is guaranteed to be in the ACES RGB space.
|
// to application software is guaranteed to be in the ACES RGB space.
|
||||||
// If the RGB space of the file is not the same as the ACES space,
|
// If the RGB space of the file is not the same as the ACES space,
|
||||||
@ -77,21 +77,20 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfHeader.h>
|
#include "ImfHeader.h"
|
||||||
#include <ImfRgba.h>
|
#include "ImfRgba.h"
|
||||||
#include "ImathVec.h"
|
#include "ImathVec.h"
|
||||||
#include "ImathBox.h"
|
#include "ImathBox.h"
|
||||||
#include <ImfThreading.h>
|
#include "ImfThreading.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
class RgbaOutputFile;
|
|
||||||
class RgbaInputFile;
|
|
||||||
struct PreviewRgba;
|
|
||||||
struct Chromaticities;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ACES red, green, blue and white-point chromaticities.
|
// ACES red, green, blue and white-point chromaticities.
|
||||||
//
|
//
|
||||||
@ -111,9 +110,10 @@ class AcesOutputFile
|
|||||||
// Constructor -- header is constructed by the caller
|
// Constructor -- header is constructed by the caller
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
AcesOutputFile (const std::string &name,
|
AcesOutputFile (const std::string &name,
|
||||||
const Header &header,
|
const Header &header,
|
||||||
RgbaChannels rgbaChannels = WRITE_RGBA,
|
RgbaChannels rgbaChannels = WRITE_RGBA,
|
||||||
int numThreads = globalThreadCount());
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
@ -123,9 +123,10 @@ class AcesOutputFile
|
|||||||
// automatically close the file.
|
// automatically close the file.
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
AcesOutputFile (OStream &os,
|
IMF_EXPORT
|
||||||
const Header &header,
|
AcesOutputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
||||||
RgbaChannels rgbaChannels = WRITE_RGBA,
|
const Header &header,
|
||||||
|
RgbaChannels rgbaChannels = WRITE_RGBA,
|
||||||
int numThreads = globalThreadCount());
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
@ -134,15 +135,16 @@ class AcesOutputFile
|
|||||||
// call arguments (empty dataWindow means "same as displayWindow")
|
// call arguments (empty dataWindow means "same as displayWindow")
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
AcesOutputFile (const std::string &name,
|
AcesOutputFile (const std::string &name,
|
||||||
const Imath::Box2i &displayWindow,
|
const IMATH_NAMESPACE::Box2i &displayWindow,
|
||||||
const Imath::Box2i &dataWindow = Imath::Box2i(),
|
const IMATH_NAMESPACE::Box2i &dataWindow = IMATH_NAMESPACE::Box2i(),
|
||||||
RgbaChannels rgbaChannels = WRITE_RGBA,
|
RgbaChannels rgbaChannels = WRITE_RGBA,
|
||||||
float pixelAspectRatio = 1,
|
float pixelAspectRatio = 1,
|
||||||
const Imath::V2f screenWindowCenter = Imath::V2f (0, 0),
|
const IMATH_NAMESPACE::V2f screenWindowCenter = IMATH_NAMESPACE::V2f (0, 0),
|
||||||
float screenWindowWidth = 1,
|
float screenWindowWidth = 1,
|
||||||
LineOrder lineOrder = INCREASING_Y,
|
LineOrder lineOrder = INCREASING_Y,
|
||||||
Compression compression = PIZ_COMPRESSION,
|
Compression compression = PIZ_COMPRESSION,
|
||||||
int numThreads = globalThreadCount());
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
@ -152,15 +154,16 @@ class AcesOutputFile
|
|||||||
// Box2i (V2i (0, 0), V2i (width - 1, height -1))
|
// Box2i (V2i (0, 0), V2i (width - 1, height -1))
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
AcesOutputFile (const std::string &name,
|
AcesOutputFile (const std::string &name,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
RgbaChannels rgbaChannels = WRITE_RGBA,
|
RgbaChannels rgbaChannels = WRITE_RGBA,
|
||||||
float pixelAspectRatio = 1,
|
float pixelAspectRatio = 1,
|
||||||
const Imath::V2f screenWindowCenter = Imath::V2f (0, 0),
|
const IMATH_NAMESPACE::V2f screenWindowCenter = IMATH_NAMESPACE::V2f (0, 0),
|
||||||
float screenWindowWidth = 1,
|
float screenWindowWidth = 1,
|
||||||
LineOrder lineOrder = INCREASING_Y,
|
LineOrder lineOrder = INCREASING_Y,
|
||||||
Compression compression = PIZ_COMPRESSION,
|
Compression compression = PIZ_COMPRESSION,
|
||||||
int numThreads = globalThreadCount());
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
@ -168,6 +171,7 @@ class AcesOutputFile
|
|||||||
// Destructor
|
// Destructor
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual ~AcesOutputFile ();
|
virtual ~AcesOutputFile ();
|
||||||
|
|
||||||
|
|
||||||
@ -179,9 +183,10 @@ class AcesOutputFile
|
|||||||
//
|
//
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void setFrameBuffer (const Rgba *base,
|
void setFrameBuffer (const Rgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
size_t yStride);
|
size_t yStride);
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -197,14 +202,23 @@ class AcesOutputFile
|
|||||||
// Access to the file header
|
// Access to the file header
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const Header & header () const;
|
const Header & header () const;
|
||||||
const Imath::Box2i & displayWindow () const;
|
IMF_EXPORT
|
||||||
const Imath::Box2i & dataWindow () const;
|
const IMATH_NAMESPACE::Box2i & displayWindow () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
const IMATH_NAMESPACE::Box2i & dataWindow () const;
|
||||||
|
IMF_EXPORT
|
||||||
float pixelAspectRatio () const;
|
float pixelAspectRatio () const;
|
||||||
const Imath::V2f screenWindowCenter () const;
|
IMF_EXPORT
|
||||||
|
const IMATH_NAMESPACE::V2f screenWindowCenter () const;
|
||||||
|
IMF_EXPORT
|
||||||
float screenWindowWidth () const;
|
float screenWindowWidth () const;
|
||||||
|
IMF_EXPORT
|
||||||
LineOrder lineOrder () const;
|
LineOrder lineOrder () const;
|
||||||
|
IMF_EXPORT
|
||||||
Compression compression () const;
|
Compression compression () const;
|
||||||
|
IMF_EXPORT
|
||||||
RgbaChannels channels () const;
|
RgbaChannels channels () const;
|
||||||
|
|
||||||
|
|
||||||
@ -212,6 +226,7 @@ class AcesOutputFile
|
|||||||
// Update the preview image (see Imf::OutputFile::updatePreviewImage())
|
// Update the preview image (see Imf::OutputFile::updatePreviewImage())
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void updatePreviewImage (const PreviewRgba[]);
|
void updatePreviewImage (const PreviewRgba[]);
|
||||||
|
|
||||||
|
|
||||||
@ -239,8 +254,9 @@ class AcesInputFile
|
|||||||
// destructor will automatically close the file.
|
// destructor will automatically close the file.
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
AcesInputFile (const std::string &name,
|
AcesInputFile (const std::string &name,
|
||||||
int numThreads = globalThreadCount());
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
@ -250,14 +266,16 @@ class AcesInputFile
|
|||||||
// close the file.
|
// close the file.
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
AcesInputFile (IStream &is,
|
IMF_EXPORT
|
||||||
int numThreads = globalThreadCount());
|
AcesInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
|
||||||
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
// Destructor
|
// Destructor
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual ~AcesInputFile ();
|
virtual ~AcesInputFile ();
|
||||||
|
|
||||||
|
|
||||||
@ -269,9 +287,10 @@ class AcesInputFile
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void setFrameBuffer (Rgba *base,
|
void setFrameBuffer (Rgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
size_t yStride);
|
size_t yStride);
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
@ -279,7 +298,9 @@ class AcesInputFile
|
|||||||
// Pixels returned will contain ACES RGB data.
|
// Pixels returned will contain ACES RGB data.
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void readPixels (int scanLine1, int scanLine2);
|
void readPixels (int scanLine1, int scanLine2);
|
||||||
|
IMF_EXPORT
|
||||||
void readPixels (int scanLine);
|
void readPixels (int scanLine);
|
||||||
|
|
||||||
|
|
||||||
@ -287,16 +308,27 @@ class AcesInputFile
|
|||||||
// Access to the file header
|
// Access to the file header
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const Header & header () const;
|
const Header & header () const;
|
||||||
const Imath::Box2i & displayWindow () const;
|
IMF_EXPORT
|
||||||
const Imath::Box2i & dataWindow () const;
|
const IMATH_NAMESPACE::Box2i & displayWindow () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
const IMATH_NAMESPACE::Box2i & dataWindow () const;
|
||||||
|
IMF_EXPORT
|
||||||
float pixelAspectRatio () const;
|
float pixelAspectRatio () const;
|
||||||
const Imath::V2f screenWindowCenter () const;
|
IMF_EXPORT
|
||||||
|
const IMATH_NAMESPACE::V2f screenWindowCenter () const;
|
||||||
|
IMF_EXPORT
|
||||||
float screenWindowWidth () const;
|
float screenWindowWidth () const;
|
||||||
|
IMF_EXPORT
|
||||||
LineOrder lineOrder () const;
|
LineOrder lineOrder () const;
|
||||||
|
IMF_EXPORT
|
||||||
Compression compression () const;
|
Compression compression () const;
|
||||||
|
IMF_EXPORT
|
||||||
RgbaChannels channels () const;
|
RgbaChannels channels () const;
|
||||||
|
IMF_EXPORT
|
||||||
const char * fileName () const;
|
const char * fileName () const;
|
||||||
|
IMF_EXPORT
|
||||||
bool isComplete () const;
|
bool isComplete () const;
|
||||||
|
|
||||||
|
|
||||||
@ -304,6 +336,7 @@ class AcesInputFile
|
|||||||
// Access to the file format version
|
// Access to the file format version
|
||||||
//----------------------------------
|
//----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int version () const;
|
int version () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -317,6 +350,9 @@ class AcesInputFile
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
54
3rdparty/openexr/IlmImf/ImfArray.h
vendored
54
3rdparty/openexr/IlmImf/ImfArray.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -37,6 +37,8 @@
|
|||||||
#ifndef INCLUDED_IMF_ARRAY_H
|
#ifndef INCLUDED_IMF_ARRAY_H
|
||||||
#define INCLUDED_IMF_ARRAY_H
|
#define INCLUDED_IMF_ARRAY_H
|
||||||
|
|
||||||
|
#include "ImfForward.h"
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// class Array
|
// class Array
|
||||||
@ -53,24 +55,23 @@
|
|||||||
// C () {std::cout << "C::C (" << this << ")\n";};
|
// C () {std::cout << "C::C (" << this << ")\n";};
|
||||||
// virtual ~C () {std::cout << "C::~C (" << this << ")\n";};
|
// virtual ~C () {std::cout << "C::~C (" << this << ")\n";};
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// int
|
// int
|
||||||
// main ()
|
// main ()
|
||||||
// {
|
// {
|
||||||
// Array <C> a(3);
|
// Array <C> a(3);
|
||||||
//
|
//
|
||||||
// C &b = a[1];
|
// C &b = a[1];
|
||||||
// const C &c = a[1];
|
// const C &c = a[1];
|
||||||
// C *d = a + 2;
|
// C *d = a + 2;
|
||||||
// const C *e = a;
|
// const C *e = a;
|
||||||
//
|
//
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class Array
|
class Array
|
||||||
@ -81,8 +82,8 @@ class Array
|
|||||||
// Constructors and destructors
|
// Constructors and destructors
|
||||||
//-----------------------------
|
//-----------------------------
|
||||||
|
|
||||||
Array () {_data = 0;}
|
Array () {_data = 0; _size = 0;}
|
||||||
Array (long size) {_data = new T[size];}
|
Array (long size) {_data = new T[size]; _size = size;}
|
||||||
~Array () {delete [] _data;}
|
~Array () {delete [] _data;}
|
||||||
|
|
||||||
|
|
||||||
@ -110,11 +111,19 @@ class Array
|
|||||||
void resizeEraseUnsafe (long size);
|
void resizeEraseUnsafe (long size);
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------
|
||||||
|
// Return the size of this array.
|
||||||
|
//-------------------------------
|
||||||
|
|
||||||
|
long size() const {return _size;}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Array (const Array &); // Copying and assignment
|
Array (const Array &); // Copying and assignment
|
||||||
Array & operator = (const Array &); // are not implemented
|
Array & operator = (const Array &); // are not implemented
|
||||||
|
|
||||||
|
long _size;
|
||||||
T * _data;
|
T * _data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -157,11 +166,20 @@ class Array2D
|
|||||||
void resizeEraseUnsafe (long sizeX, long sizeY);
|
void resizeEraseUnsafe (long sizeX, long sizeY);
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------
|
||||||
|
// Return the size of this array.
|
||||||
|
//-------------------------------
|
||||||
|
|
||||||
|
long height() const {return _sizeX;}
|
||||||
|
long width() const {return _sizeY;}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Array2D (const Array2D &); // Copying and assignment
|
Array2D (const Array2D &); // Copying and assignment
|
||||||
Array2D & operator = (const Array2D &); // are not implemented
|
Array2D & operator = (const Array2D &); // are not implemented
|
||||||
|
|
||||||
|
long _sizeX;
|
||||||
long _sizeY;
|
long _sizeY;
|
||||||
T * _data;
|
T * _data;
|
||||||
};
|
};
|
||||||
@ -177,6 +195,7 @@ Array<T>::resizeErase (long size)
|
|||||||
{
|
{
|
||||||
T *tmp = new T[size];
|
T *tmp = new T[size];
|
||||||
delete [] _data;
|
delete [] _data;
|
||||||
|
_size = size;
|
||||||
_data = tmp;
|
_data = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,14 +206,16 @@ Array<T>::resizeEraseUnsafe (long size)
|
|||||||
{
|
{
|
||||||
delete [] _data;
|
delete [] _data;
|
||||||
_data = 0;
|
_data = 0;
|
||||||
|
_size = 0;
|
||||||
_data = new T[size];
|
_data = new T[size];
|
||||||
|
_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline
|
inline
|
||||||
Array2D<T>::Array2D ():
|
Array2D<T>::Array2D ():
|
||||||
_sizeY (0), _data (0)
|
_sizeX(0), _sizeY (0), _data (0)
|
||||||
{
|
{
|
||||||
// emtpy
|
// emtpy
|
||||||
}
|
}
|
||||||
@ -203,7 +224,7 @@ Array2D<T>::Array2D ():
|
|||||||
template <class T>
|
template <class T>
|
||||||
inline
|
inline
|
||||||
Array2D<T>::Array2D (long sizeX, long sizeY):
|
Array2D<T>::Array2D (long sizeX, long sizeY):
|
||||||
_sizeY (sizeY), _data (new T[sizeX * sizeY])
|
_sizeX (sizeX), _sizeY (sizeY), _data (new T[sizeX * sizeY])
|
||||||
{
|
{
|
||||||
// emtpy
|
// emtpy
|
||||||
}
|
}
|
||||||
@ -218,7 +239,7 @@ Array2D<T>::~Array2D ()
|
|||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T *
|
inline T *
|
||||||
Array2D<T>::operator [] (long x)
|
Array2D<T>::operator [] (long x)
|
||||||
{
|
{
|
||||||
return _data + x * _sizeY;
|
return _data + x * _sizeY;
|
||||||
@ -239,6 +260,7 @@ Array2D<T>::resizeErase (long sizeX, long sizeY)
|
|||||||
{
|
{
|
||||||
T *tmp = new T[sizeX * sizeY];
|
T *tmp = new T[sizeX * sizeY];
|
||||||
delete [] _data;
|
delete [] _data;
|
||||||
|
_sizeX = sizeX;
|
||||||
_sizeY = sizeY;
|
_sizeY = sizeY;
|
||||||
_data = tmp;
|
_data = tmp;
|
||||||
}
|
}
|
||||||
@ -250,12 +272,14 @@ Array2D<T>::resizeEraseUnsafe (long sizeX, long sizeY)
|
|||||||
{
|
{
|
||||||
delete [] _data;
|
delete [] _data;
|
||||||
_data = 0;
|
_data = 0;
|
||||||
|
_sizeX = 0;
|
||||||
_sizeY = 0;
|
_sizeY = 0;
|
||||||
_data = new T[sizeX * sizeY];
|
_data = new T[sizeX * sizeY];
|
||||||
|
_sizeX = sizeX;
|
||||||
_sizeY = sizeY;
|
_sizeY = sizeY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
44
3rdparty/openexr/IlmImf/ImfAttribute.cpp
vendored
44
3rdparty/openexr/IlmImf/ImfAttribute.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -46,11 +46,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
using IlmThread::Mutex;
|
|
||||||
using IlmThread::Lock;
|
using ILMTHREAD_NAMESPACE::Mutex;
|
||||||
|
using ILMTHREAD_NAMESPACE::Lock;
|
||||||
|
|
||||||
|
|
||||||
Attribute::Attribute () {}
|
Attribute::Attribute () {}
|
||||||
@ -66,7 +68,7 @@ struct NameCompare: std::binary_function <const char *, const char *, bool>
|
|||||||
bool
|
bool
|
||||||
operator () (const char *x, const char *y) const
|
operator () (const char *x, const char *y) const
|
||||||
{
|
{
|
||||||
return strcmp (x, y) < 0;
|
return strcmp (x, y) < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,22 +88,28 @@ class LockedTypeMap: public TypeMap
|
|||||||
LockedTypeMap &
|
LockedTypeMap &
|
||||||
typeMap ()
|
typeMap ()
|
||||||
{
|
{
|
||||||
|
// c++11 requires thread-safe static variable initialization
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
static LockedTypeMap tMap;
|
||||||
|
return tMap;
|
||||||
|
#else
|
||||||
static Mutex criticalSection;
|
static Mutex criticalSection;
|
||||||
Lock lock (criticalSection);
|
Lock lock (criticalSection);
|
||||||
|
|
||||||
static LockedTypeMap* typeMap = 0;
|
static LockedTypeMap* typeMap = 0;
|
||||||
|
|
||||||
if (typeMap == 0)
|
if (typeMap == 0)
|
||||||
typeMap = new LockedTypeMap ();
|
typeMap = new LockedTypeMap ();
|
||||||
|
|
||||||
return *typeMap;
|
return *typeMap;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Attribute::knownType (const char typeName[])
|
Attribute::knownType (const char typeName[])
|
||||||
{
|
{
|
||||||
LockedTypeMap& tMap = typeMap();
|
LockedTypeMap& tMap = typeMap();
|
||||||
@ -111,17 +119,17 @@ Attribute::knownType (const char typeName[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Attribute::registerAttributeType (const char typeName[],
|
Attribute::registerAttributeType (const char typeName[],
|
||||||
Attribute *(*newAttribute)())
|
Attribute *(*newAttribute)())
|
||||||
{
|
{
|
||||||
LockedTypeMap& tMap = typeMap();
|
LockedTypeMap& tMap = typeMap();
|
||||||
Lock lock (tMap.mutex);
|
Lock lock (tMap.mutex);
|
||||||
|
|
||||||
if (tMap.find (typeName) != tMap.end())
|
if (tMap.find (typeName) != tMap.end())
|
||||||
THROW (Iex::ArgExc, "Cannot register image file attribute "
|
THROW (IEX_NAMESPACE::ArgExc, "Cannot register image file attribute "
|
||||||
"type \"" << typeName << "\". "
|
"type \"" << typeName << "\". "
|
||||||
"The type has already been registered.");
|
"The type has already been registered.");
|
||||||
|
|
||||||
tMap.insert (TypeMap::value_type (typeName, newAttribute));
|
tMap.insert (TypeMap::value_type (typeName, newAttribute));
|
||||||
}
|
}
|
||||||
@ -146,11 +154,11 @@ Attribute::newAttribute (const char typeName[])
|
|||||||
TypeMap::const_iterator i = tMap.find (typeName);
|
TypeMap::const_iterator i = tMap.find (typeName);
|
||||||
|
|
||||||
if (i == tMap.end())
|
if (i == tMap.end())
|
||||||
THROW (Iex::ArgExc, "Cannot create image file attribute of "
|
THROW (IEX_NAMESPACE::ArgExc, "Cannot create image file attribute of "
|
||||||
"unknown type \"" << typeName << "\".");
|
"unknown type \"" << typeName << "\".");
|
||||||
|
|
||||||
return (i->second)();
|
return (i->second)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
108
3rdparty/openexr/IlmImf/ImfAttribute.h
vendored
108
3rdparty/openexr/IlmImf/ImfAttribute.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -44,11 +44,13 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "IexBaseExc.h"
|
#include "IexBaseExc.h"
|
||||||
#include <ImfIO.h>
|
#include "ImfIO.h"
|
||||||
#include <ImfXdr.h>
|
#include "ImfXdr.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
|
|
||||||
class Attribute
|
class Attribute
|
||||||
@ -59,7 +61,9 @@ class Attribute
|
|||||||
// Constructor and destructor
|
// Constructor and destructor
|
||||||
//---------------------------
|
//---------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Attribute ();
|
Attribute ();
|
||||||
|
IMF_EXPORT
|
||||||
virtual ~Attribute ();
|
virtual ~Attribute ();
|
||||||
|
|
||||||
|
|
||||||
@ -81,12 +85,12 @@ class Attribute
|
|||||||
// Type-specific attribute I/O and copying
|
// Type-specific attribute I/O and copying
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
||||||
virtual void writeValueTo (OStream &os,
|
virtual void writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
||||||
int version) const = 0;
|
int version) const = 0;
|
||||||
|
|
||||||
virtual void readValueFrom (IStream &is,
|
virtual void readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
|
||||||
int size,
|
int size,
|
||||||
int version) = 0;
|
int version) = 0;
|
||||||
|
|
||||||
virtual void copyValueFrom (const Attribute &other) = 0;
|
virtual void copyValueFrom (const Attribute &other) = 0;
|
||||||
|
|
||||||
@ -95,6 +99,7 @@ class Attribute
|
|||||||
// Attribute factory
|
// Attribute factory
|
||||||
//------------------
|
//------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
static Attribute * newAttribute (const char typeName[]);
|
static Attribute * newAttribute (const char typeName[]);
|
||||||
|
|
||||||
|
|
||||||
@ -102,6 +107,7 @@ class Attribute
|
|||||||
// Test if a given attribute type has already been registered
|
// Test if a given attribute type has already been registered
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
static bool knownType (const char typeName[]);
|
static bool knownType (const char typeName[]);
|
||||||
|
|
||||||
|
|
||||||
@ -112,8 +118,9 @@ class Attribute
|
|||||||
// knows how to make objects of this type.
|
// knows how to make objects of this type.
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
static void registerAttributeType (const char typeName[],
|
static void registerAttributeType (const char typeName[],
|
||||||
Attribute *(*newAttribute)());
|
Attribute *(*newAttribute)());
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// Un-register an attribute type so that newAttribute()
|
// Un-register an attribute type so that newAttribute()
|
||||||
@ -121,6 +128,7 @@ class Attribute
|
|||||||
// debugging only).
|
// debugging only).
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
static void unRegisterAttributeType (const char typeName[]);
|
static void unRegisterAttributeType (const char typeName[]);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,7 +136,7 @@ class Attribute
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Class template for attributes of a specific type
|
// Class template for attributes of a specific type
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class TypedAttribute: public Attribute
|
class TypedAttribute: public Attribute
|
||||||
{
|
{
|
||||||
@ -157,7 +165,7 @@ class TypedAttribute: public Attribute
|
|||||||
//--------------------------------
|
//--------------------------------
|
||||||
|
|
||||||
virtual const char * typeName () const;
|
virtual const char * typeName () const;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// Static version of typeName()
|
// Static version of typeName()
|
||||||
@ -165,7 +173,7 @@ class TypedAttribute: public Attribute
|
|||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
static const char * staticTypeName ();
|
static const char * staticTypeName ();
|
||||||
|
|
||||||
|
|
||||||
//---------------------
|
//---------------------
|
||||||
// Make a new attribute
|
// Make a new attribute
|
||||||
@ -186,12 +194,12 @@ class TypedAttribute: public Attribute
|
|||||||
// Depending on type T, these functions may have to be specialized.
|
// Depending on type T, these functions may have to be specialized.
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
virtual void writeValueTo (OStream &os,
|
virtual void writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
||||||
int version) const;
|
int version) const;
|
||||||
|
|
||||||
virtual void readValueFrom (IStream &is,
|
virtual void readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
|
||||||
int size,
|
int size,
|
||||||
int version);
|
int version);
|
||||||
|
|
||||||
virtual void copyValueFrom (const Attribute &other);
|
virtual void copyValueFrom (const Attribute &other);
|
||||||
|
|
||||||
@ -233,11 +241,9 @@ class TypedAttribute: public Attribute
|
|||||||
T _value;
|
T _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// Implementation of TypedAttribute<T>
|
// Implementation of TypedAttribute<T>
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
TypedAttribute<T>::TypedAttribute ():
|
TypedAttribute<T>::TypedAttribute ():
|
||||||
Attribute (),
|
Attribute (),
|
||||||
@ -248,7 +254,7 @@ TypedAttribute<T>::TypedAttribute ():
|
|||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
TypedAttribute<T>::TypedAttribute (const T &value):
|
TypedAttribute<T>::TypedAttribute (const T & value):
|
||||||
Attribute (),
|
Attribute (),
|
||||||
_value (value)
|
_value (value)
|
||||||
{
|
{
|
||||||
@ -289,7 +295,7 @@ TypedAttribute<T>::value () const
|
|||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
const char *
|
const char *
|
||||||
TypedAttribute<T>::typeName () const
|
TypedAttribute<T>::typeName () const
|
||||||
{
|
{
|
||||||
return staticTypeName();
|
return staticTypeName();
|
||||||
@ -315,23 +321,26 @@ TypedAttribute<T>::copy () const
|
|||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
TypedAttribute<T>::writeValueTo (OStream &os, int) const
|
TypedAttribute<T>::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
||||||
|
int version) const
|
||||||
{
|
{
|
||||||
Xdr::write <StreamIO> (os, _value);
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::write <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (os, _value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
TypedAttribute<T>::readValueFrom (IStream &is, int, int)
|
TypedAttribute<T>::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,
|
||||||
|
int size,
|
||||||
|
int version)
|
||||||
{
|
{
|
||||||
Xdr::read <StreamIO> (is, _value);
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (is, _value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
TypedAttribute<T>::copyValueFrom (const Attribute &other)
|
TypedAttribute<T>::copyValueFrom (const Attribute &other)
|
||||||
{
|
{
|
||||||
_value = cast(other)._value;
|
_value = cast(other)._value;
|
||||||
@ -343,10 +352,10 @@ TypedAttribute<T> *
|
|||||||
TypedAttribute<T>::cast (Attribute *attribute)
|
TypedAttribute<T>::cast (Attribute *attribute)
|
||||||
{
|
{
|
||||||
TypedAttribute<T> *t =
|
TypedAttribute<T> *t =
|
||||||
dynamic_cast <TypedAttribute<T> *> (attribute);
|
dynamic_cast <TypedAttribute<T> *> (attribute);
|
||||||
|
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
throw Iex::TypeExc ("Unexpected attribute type.");
|
throw IEX_NAMESPACE::TypeExc ("Unexpected attribute type.");
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -357,10 +366,10 @@ const TypedAttribute<T> *
|
|||||||
TypedAttribute<T>::cast (const Attribute *attribute)
|
TypedAttribute<T>::cast (const Attribute *attribute)
|
||||||
{
|
{
|
||||||
const TypedAttribute<T> *t =
|
const TypedAttribute<T> *t =
|
||||||
dynamic_cast <const TypedAttribute<T> *> (attribute);
|
dynamic_cast <const TypedAttribute<T> *> (attribute);
|
||||||
|
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
throw Iex::TypeExc ("Unexpected attribute type.");
|
throw IEX_NAMESPACE::TypeExc ("Unexpected attribute type.");
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -398,30 +407,7 @@ TypedAttribute<T>::unRegisterAttributeType ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
#if defined(OPENEXR_DLL) && defined(_MSC_VER)
|
|
||||||
// Tell MS VC++ to disable "non dll-interface class used as base
|
|
||||||
// for dll-interface class" and "no suitable definition provided
|
|
||||||
// for explicit template"
|
|
||||||
#pragma warning (disable : 4275 4661)
|
|
||||||
|
|
||||||
#if defined (ILMIMF_EXPORTS)
|
|
||||||
#define IMF_EXPIMP_TEMPLATE
|
|
||||||
#else
|
|
||||||
#define IMF_EXPIMP_TEMPLATE extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IMF_EXPIMP_TEMPLATE template class Imf::TypedAttribute<float>;
|
|
||||||
IMF_EXPIMP_TEMPLATE template class Imf::TypedAttribute<double>;
|
|
||||||
|
|
||||||
#pragma warning(default : 4251)
|
|
||||||
#undef EXTERN_TEMPLATE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
38
3rdparty/openexr/IlmImf/ImfAutoArray.h
vendored
38
3rdparty/openexr/IlmImf/ImfAutoArray.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -44,13 +44,10 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "OpenEXRConfig.h"
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
#if !defined (HAVE_LARGE_STACK)
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
#if !defined (HAVE_LARGE_STACK)
|
#if !defined (HAVE_LARGE_STACK)
|
||||||
@ -61,15 +58,15 @@ namespace Imf {
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AutoArray (): _data (new T [size]) { memset(_data, 0, size*sizeof(T)); }
|
AutoArray (): _data (new T [size]) { memset(_data, 0, size*sizeof(T)); }
|
||||||
~AutoArray () {delete [] _data;}
|
~AutoArray () {delete [] _data;}
|
||||||
|
|
||||||
operator T * () {return _data;}
|
|
||||||
operator const T * () const {return _data;}
|
|
||||||
|
|
||||||
|
operator T * () {return _data;}
|
||||||
|
operator const T * () const {return _data;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
T *_data;
|
T *_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -81,17 +78,18 @@ namespace Imf {
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
operator T * () {return _data;}
|
operator T * () {return _data;}
|
||||||
operator const T * () const {return _data;}
|
operator const T * () const {return _data;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
T _data[size];
|
T _data[size];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
799
3rdparty/openexr/IlmImf/ImfB44Compressor.cpp
vendored
799
3rdparty/openexr/IlmImf/ImfB44Compressor.cpp
vendored
File diff suppressed because it is too large
Load Diff
75
3rdparty/openexr/IlmImf/ImfB44Compressor.h
vendored
75
3rdparty/openexr/IlmImf/ImfB44Compressor.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -42,60 +42,69 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfCompressor.h>
|
#include "ImfCompressor.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
class ChannelList;
|
|
||||||
|
|
||||||
|
|
||||||
class B44Compressor: public Compressor
|
class B44Compressor: public Compressor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
B44Compressor (const Header &hdr,
|
B44Compressor (const Header &hdr,
|
||||||
size_t maxScanLineSize,
|
size_t maxScanLineSize,
|
||||||
size_t numScanLines,
|
size_t numScanLines,
|
||||||
bool optFlatFields);
|
bool optFlatFields);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual ~B44Compressor ();
|
virtual ~B44Compressor ();
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int numScanLines () const;
|
virtual int numScanLines () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual Format format () const;
|
virtual Format format () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int compress (const char *inPtr,
|
virtual int compress (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
int minY,
|
int minY,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int compressTile (const char *inPtr,
|
virtual int compressTile (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Imath::Box2i range,
|
IMATH_NAMESPACE::Box2i range,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int uncompress (const char *inPtr,
|
virtual int uncompress (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
int minY,
|
int minY,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int uncompressTile (const char *inPtr,
|
virtual int uncompressTile (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Imath::Box2i range,
|
IMATH_NAMESPACE::Box2i range,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct ChannelData;
|
struct ChannelData;
|
||||||
|
|
||||||
int compress (const char *inPtr,
|
int compress (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Imath::Box2i range,
|
IMATH_NAMESPACE::Box2i range,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
int uncompress (const char *inPtr,
|
int uncompress (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Imath::Box2i range,
|
IMATH_NAMESPACE::Box2i range,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
int _maxScanLineSize;
|
int _maxScanLineSize;
|
||||||
bool _optFlatFields;
|
bool _optFlatFields;
|
||||||
@ -112,6 +121,6 @@ class B44Compressor: public Compressor
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
21
3rdparty/openexr/IlmImf/ImfBoxAttribute.cpp
vendored
21
3rdparty/openexr/IlmImf/ImfBoxAttribute.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -44,8 +44,9 @@
|
|||||||
#include <ImfBoxAttribute.h>
|
#include <ImfBoxAttribute.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
const char *
|
const char *
|
||||||
@ -57,7 +58,7 @@ Box2iAttribute::staticTypeName ()
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
Box2iAttribute::writeValueTo (OStream &os, int) const
|
Box2iAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
{
|
{
|
||||||
Xdr::write <StreamIO> (os, _value.min.x);
|
Xdr::write <StreamIO> (os, _value.min.x);
|
||||||
Xdr::write <StreamIO> (os, _value.min.y);
|
Xdr::write <StreamIO> (os, _value.min.y);
|
||||||
@ -68,7 +69,7 @@ Box2iAttribute::writeValueTo (OStream &os, int) const
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
Box2iAttribute::readValueFrom (IStream &is, int, int)
|
Box2iAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
{
|
{
|
||||||
Xdr::read <StreamIO> (is, _value.min.x);
|
Xdr::read <StreamIO> (is, _value.min.x);
|
||||||
Xdr::read <StreamIO> (is, _value.min.y);
|
Xdr::read <StreamIO> (is, _value.min.y);
|
||||||
@ -87,7 +88,7 @@ Box2fAttribute::staticTypeName ()
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
Box2fAttribute::writeValueTo (OStream &os, int) const
|
Box2fAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
{
|
{
|
||||||
Xdr::write <StreamIO> (os, _value.min.x);
|
Xdr::write <StreamIO> (os, _value.min.x);
|
||||||
Xdr::write <StreamIO> (os, _value.min.y);
|
Xdr::write <StreamIO> (os, _value.min.y);
|
||||||
@ -98,7 +99,7 @@ Box2fAttribute::writeValueTo (OStream &os, int) const
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
Box2fAttribute::readValueFrom (IStream &is, int, int)
|
Box2fAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
{
|
{
|
||||||
Xdr::read <StreamIO> (is, _value.min.x);
|
Xdr::read <StreamIO> (is, _value.min.x);
|
||||||
Xdr::read <StreamIO> (is, _value.min.y);
|
Xdr::read <StreamIO> (is, _value.min.y);
|
||||||
@ -107,4 +108,4 @@ Box2fAttribute::readValueFrom (IStream &is, int, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
58
3rdparty/openexr/IlmImf/ImfBoxAttribute.h
vendored
58
3rdparty/openexr/IlmImf/ImfBoxAttribute.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -44,30 +44,44 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfForward.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfAttribute.h"
|
||||||
#include "ImathBox.h"
|
#include "ImathBox.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
typedef TypedAttribute<IMATH_NAMESPACE::Box2i> Box2iAttribute;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
const char *Box2iAttribute::staticTypeName ();
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void Box2iAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &,
|
||||||
|
int) const;
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void Box2iAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
|
||||||
|
int, int);
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<Imath::Box2i> Box2iAttribute;
|
typedef TypedAttribute<IMATH_NAMESPACE::Box2f> Box2fAttribute;
|
||||||
template <> const char *Box2iAttribute::staticTypeName ();
|
template <>
|
||||||
template <> void Box2iAttribute::writeValueTo (OStream &, int) const;
|
IMF_EXPORT
|
||||||
template <> void Box2iAttribute::readValueFrom (IStream &, int, int);
|
const char *Box2fAttribute::staticTypeName ();
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void Box2fAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &,
|
||||||
|
int) const;
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void Box2fAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
|
||||||
|
int, int);
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<Imath::Box2f> Box2fAttribute;
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
template <> const char *Box2fAttribute::staticTypeName ();
|
|
||||||
template <> void Box2fAttribute::writeValueTo (OStream &, int) const;
|
|
||||||
template <> void Box2fAttribute::readValueFrom (IStream &, int, int);
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfBoxAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
928
3rdparty/openexr/IlmImf/ImfCRgbaFile.cpp
vendored
928
3rdparty/openexr/IlmImf/ImfCRgbaFile.cpp
vendored
File diff suppressed because it is too large
Load Diff
296
3rdparty/openexr/IlmImf/ImfCRgbaFile.h
vendored
296
3rdparty/openexr/IlmImf/ImfCRgbaFile.h
vendored
@ -16,7 +16,7 @@ in the documentation and/or other materials provided with the
|
|||||||
distribution.
|
distribution.
|
||||||
* Neither the name of Industrial Light & Magic nor the names of
|
* Neither the name of Industrial Light & Magic nor the names of
|
||||||
its contributors may be used to endorse or promote products derived
|
its contributors may be used to endorse or promote products derived
|
||||||
from this software without specific prior written permission.
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
@ -35,6 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef INCLUDED_IMF_C_RGBA_FILE_H
|
#ifndef INCLUDED_IMF_C_RGBA_FILE_H
|
||||||
#define INCLUDED_IMF_C_RGBA_FILE_H
|
#define INCLUDED_IMF_C_RGBA_FILE_H
|
||||||
|
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -48,18 +49,22 @@ extern "C" {
|
|||||||
|
|
||||||
typedef unsigned short ImfHalf;
|
typedef unsigned short ImfHalf;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfFloatToHalf (float f,
|
void ImfFloatToHalf (float f,
|
||||||
ImfHalf *h);
|
ImfHalf *h);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfFloatToHalfArray (int n,
|
void ImfFloatToHalfArray (int n,
|
||||||
const float f[/*n*/],
|
const float f[/*n*/],
|
||||||
ImfHalf h[/*n*/]);
|
ImfHalf h[/*n*/]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
float ImfHalfToFloat (ImfHalf h);
|
float ImfHalfToFloat (ImfHalf h);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHalfToFloatArray (int n,
|
void ImfHalfToFloatArray (int n,
|
||||||
const ImfHalf h[/*n*/],
|
const ImfHalf h[/*n*/],
|
||||||
float f[/*n*/]);
|
float f[/*n*/]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** RGBA pixel; memory layout must be the same as struct Imf::Rgba.
|
** RGBA pixel; memory layout must be the same as struct Imf::Rgba.
|
||||||
@ -93,7 +98,7 @@ typedef struct ImfRgba ImfRgba;
|
|||||||
|
|
||||||
#define IMF_INCREASING_Y 0
|
#define IMF_INCREASING_Y 0
|
||||||
#define IMF_DECREASING_Y 1
|
#define IMF_DECREASING_Y 1
|
||||||
#define IMF_RAMDOM_Y 2
|
#define IMF_RANDOM_Y 2
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -151,153 +156,194 @@ typedef struct ImfRgba ImfRgba;
|
|||||||
struct ImfHeader;
|
struct ImfHeader;
|
||||||
typedef struct ImfHeader ImfHeader;
|
typedef struct ImfHeader ImfHeader;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfHeader * ImfNewHeader (void);
|
ImfHeader * ImfNewHeader (void);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfDeleteHeader (ImfHeader *hdr);
|
void ImfDeleteHeader (ImfHeader *hdr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfHeader * ImfCopyHeader (const ImfHeader *hdr);
|
ImfHeader * ImfCopyHeader (const ImfHeader *hdr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetDisplayWindow (ImfHeader *hdr,
|
void ImfHeaderSetDisplayWindow (ImfHeader *hdr,
|
||||||
int xMin, int yMin,
|
int xMin, int yMin,
|
||||||
int xMax, int yMax);
|
int xMax, int yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderDisplayWindow (const ImfHeader *hdr,
|
void ImfHeaderDisplayWindow (const ImfHeader *hdr,
|
||||||
int *xMin, int *yMin,
|
int *xMin, int *yMin,
|
||||||
int *xMax, int *yMax);
|
int *xMax, int *yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetDataWindow (ImfHeader *hdr,
|
void ImfHeaderSetDataWindow (ImfHeader *hdr,
|
||||||
int xMin, int yMin,
|
int xMin, int yMin,
|
||||||
int xMax, int yMax);
|
int xMax, int yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderDataWindow (const ImfHeader *hdr,
|
void ImfHeaderDataWindow (const ImfHeader *hdr,
|
||||||
int *xMin, int *yMin,
|
int *xMin, int *yMin,
|
||||||
int *xMax, int *yMax);
|
int *xMax, int *yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetPixelAspectRatio (ImfHeader *hdr,
|
void ImfHeaderSetPixelAspectRatio (ImfHeader *hdr,
|
||||||
float pixelAspectRatio);
|
float pixelAspectRatio);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
float ImfHeaderPixelAspectRatio (const ImfHeader *hdr);
|
float ImfHeaderPixelAspectRatio (const ImfHeader *hdr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetScreenWindowCenter (ImfHeader *hdr,
|
void ImfHeaderSetScreenWindowCenter (ImfHeader *hdr,
|
||||||
float x, float y);
|
float x, float y);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderScreenWindowCenter (const ImfHeader *hdr,
|
void ImfHeaderScreenWindowCenter (const ImfHeader *hdr,
|
||||||
float *x, float *y);
|
float *x, float *y);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetScreenWindowWidth (ImfHeader *hdr,
|
void ImfHeaderSetScreenWindowWidth (ImfHeader *hdr,
|
||||||
float width);
|
float width);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
float ImfHeaderScreenWindowWidth (const ImfHeader *hdr);
|
float ImfHeaderScreenWindowWidth (const ImfHeader *hdr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetLineOrder (ImfHeader *hdr,
|
void ImfHeaderSetLineOrder (ImfHeader *hdr,
|
||||||
int lineOrder);
|
int lineOrder);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderLineOrder (const ImfHeader *hdr);
|
int ImfHeaderLineOrder (const ImfHeader *hdr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfHeaderSetCompression (ImfHeader *hdr,
|
void ImfHeaderSetCompression (ImfHeader *hdr,
|
||||||
int compression);
|
int compression);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderCompression (const ImfHeader *hdr);
|
int ImfHeaderCompression (const ImfHeader *hdr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetIntAttribute (ImfHeader *hdr,
|
int ImfHeaderSetIntAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int value);
|
int value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderIntAttribute (const ImfHeader *hdr,
|
int ImfHeaderIntAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int *value);
|
int *value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetFloatAttribute (ImfHeader *hdr,
|
int ImfHeaderSetFloatAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float value);
|
float value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetDoubleAttribute (ImfHeader *hdr,
|
int ImfHeaderSetDoubleAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
double value);
|
double value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderFloatAttribute (const ImfHeader *hdr,
|
int ImfHeaderFloatAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float *value);
|
float *value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderDoubleAttribute (const ImfHeader *hdr,
|
int ImfHeaderDoubleAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
double *value);
|
double *value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetStringAttribute (ImfHeader *hdr,
|
int ImfHeaderSetStringAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
const char value[]);
|
const char value[]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderStringAttribute (const ImfHeader *hdr,
|
int ImfHeaderStringAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
const char **value);
|
const char **value);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetBox2iAttribute (ImfHeader *hdr,
|
int ImfHeaderSetBox2iAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int xMin, int yMin,
|
int xMin, int yMin,
|
||||||
int xMax, int yMax);
|
int xMax, int yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderBox2iAttribute (const ImfHeader *hdr,
|
int ImfHeaderBox2iAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int *xMin, int *yMin,
|
int *xMin, int *yMin,
|
||||||
int *xMax, int *yMax);
|
int *xMax, int *yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetBox2fAttribute (ImfHeader *hdr,
|
int ImfHeaderSetBox2fAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float xMin, float yMin,
|
float xMin, float yMin,
|
||||||
float xMax, float yMax);
|
float xMax, float yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderBox2fAttribute (const ImfHeader *hdr,
|
int ImfHeaderBox2fAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float *xMin, float *yMin,
|
float *xMin, float *yMin,
|
||||||
float *xMax, float *yMax);
|
float *xMax, float *yMax);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetV2iAttribute (ImfHeader *hdr,
|
int ImfHeaderSetV2iAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int x, int y);
|
int x, int y);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderV2iAttribute (const ImfHeader *hdr,
|
int ImfHeaderV2iAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int *x, int *y);
|
int *x, int *y);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetV2fAttribute (ImfHeader *hdr,
|
int ImfHeaderSetV2fAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float x, float y);
|
float x, float y);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderV2fAttribute (const ImfHeader *hdr,
|
int ImfHeaderV2fAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float *x, float *y);
|
float *x, float *y);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetV3iAttribute (ImfHeader *hdr,
|
int ImfHeaderSetV3iAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int x, int y, int z);
|
int x, int y, int z);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderV3iAttribute (const ImfHeader *hdr,
|
int ImfHeaderV3iAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
int *x, int *y, int *z);
|
int *x, int *y, int *z);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetV3fAttribute (ImfHeader *hdr,
|
int ImfHeaderSetV3fAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float x, float y, float z);
|
float x, float y, float z);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderV3fAttribute (const ImfHeader *hdr,
|
int ImfHeaderV3fAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float *x, float *y, float *z);
|
float *x, float *y, float *z);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetM33fAttribute (ImfHeader *hdr,
|
int ImfHeaderSetM33fAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
const float m[3][3]);
|
const float m[3][3]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderM33fAttribute (const ImfHeader *hdr,
|
int ImfHeaderM33fAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float m[3][3]);
|
float m[3][3]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderSetM44fAttribute (ImfHeader *hdr,
|
int ImfHeaderSetM44fAttribute (ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
const float m[4][4]);
|
const float m[4][4]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfHeaderM44fAttribute (const ImfHeader *hdr,
|
int ImfHeaderM44fAttribute (const ImfHeader *hdr,
|
||||||
const char name[],
|
const char name[],
|
||||||
float m[4][4]);
|
float m[4][4]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** RGBA output file
|
** RGBA output file
|
||||||
@ -306,24 +352,31 @@ int ImfHeaderM44fAttribute (const ImfHeader *hdr,
|
|||||||
struct ImfOutputFile;
|
struct ImfOutputFile;
|
||||||
typedef struct ImfOutputFile ImfOutputFile;
|
typedef struct ImfOutputFile ImfOutputFile;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfOutputFile * ImfOpenOutputFile (const char name[],
|
ImfOutputFile * ImfOpenOutputFile (const char name[],
|
||||||
const ImfHeader *hdr,
|
const ImfHeader *hdr,
|
||||||
int channels);
|
int channels);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfCloseOutputFile (ImfOutputFile *out);
|
int ImfCloseOutputFile (ImfOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfOutputSetFrameBuffer (ImfOutputFile *out,
|
int ImfOutputSetFrameBuffer (ImfOutputFile *out,
|
||||||
const ImfRgba *base,
|
const ImfRgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
size_t yStride);
|
size_t yStride);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfOutputWritePixels (ImfOutputFile *out,
|
int ImfOutputWritePixels (ImfOutputFile *out,
|
||||||
int numScanLines);
|
int numScanLines);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfOutputCurrentScanLine (const ImfOutputFile *out);
|
int ImfOutputCurrentScanLine (const ImfOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const ImfHeader * ImfOutputHeader (const ImfOutputFile *out);
|
const ImfHeader * ImfOutputHeader (const ImfOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfOutputChannels (const ImfOutputFile *out);
|
int ImfOutputChannels (const ImfOutputFile *out);
|
||||||
|
|
||||||
|
|
||||||
@ -334,39 +387,51 @@ int ImfOutputChannels (const ImfOutputFile *out);
|
|||||||
struct ImfTiledOutputFile;
|
struct ImfTiledOutputFile;
|
||||||
typedef struct ImfTiledOutputFile ImfTiledOutputFile;
|
typedef struct ImfTiledOutputFile ImfTiledOutputFile;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfTiledOutputFile * ImfOpenTiledOutputFile (const char name[],
|
ImfTiledOutputFile * ImfOpenTiledOutputFile (const char name[],
|
||||||
const ImfHeader *hdr,
|
const ImfHeader *hdr,
|
||||||
int channels,
|
int channels,
|
||||||
int xSize, int ySize,
|
int xSize, int ySize,
|
||||||
int mode, int rmode);
|
int mode, int rmode);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfCloseTiledOutputFile (ImfTiledOutputFile *out);
|
int ImfCloseTiledOutputFile (ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputSetFrameBuffer (ImfTiledOutputFile *out,
|
int ImfTiledOutputSetFrameBuffer (ImfTiledOutputFile *out,
|
||||||
const ImfRgba *base,
|
const ImfRgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
size_t yStride);
|
size_t yStride);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputWriteTile (ImfTiledOutputFile *out,
|
int ImfTiledOutputWriteTile (ImfTiledOutputFile *out,
|
||||||
int dx, int dy,
|
int dx, int dy,
|
||||||
int lx, int ly);
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputWriteTiles (ImfTiledOutputFile *out,
|
int ImfTiledOutputWriteTiles (ImfTiledOutputFile *out,
|
||||||
int dxMin, int dxMax,
|
int dxMin, int dxMax,
|
||||||
int dyMin, int dyMax,
|
int dyMin, int dyMax,
|
||||||
int lx, int ly);
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const ImfHeader * ImfTiledOutputHeader (const ImfTiledOutputFile *out);
|
const ImfHeader * ImfTiledOutputHeader (const ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputChannels (const ImfTiledOutputFile *out);
|
int ImfTiledOutputChannels (const ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputTileXSize (const ImfTiledOutputFile *out);
|
int ImfTiledOutputTileXSize (const ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputTileYSize (const ImfTiledOutputFile *out);
|
int ImfTiledOutputTileYSize (const ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputLevelMode (const ImfTiledOutputFile *out);
|
int ImfTiledOutputLevelMode (const ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledOutputLevelRoundingMode
|
int ImfTiledOutputLevelRoundingMode
|
||||||
(const ImfTiledOutputFile *out);
|
(const ImfTiledOutputFile *out);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -378,21 +443,27 @@ typedef struct ImfInputFile ImfInputFile;
|
|||||||
|
|
||||||
ImfInputFile * ImfOpenInputFile (const char name[]);
|
ImfInputFile * ImfOpenInputFile (const char name[]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfCloseInputFile (ImfInputFile *in);
|
int ImfCloseInputFile (ImfInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfInputSetFrameBuffer (ImfInputFile *in,
|
int ImfInputSetFrameBuffer (ImfInputFile *in,
|
||||||
ImfRgba *base,
|
ImfRgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
size_t yStride);
|
size_t yStride);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfInputReadPixels (ImfInputFile *in,
|
int ImfInputReadPixels (ImfInputFile *in,
|
||||||
int scanLine1,
|
int scanLine1,
|
||||||
int scanLine2);
|
int scanLine2);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const ImfHeader * ImfInputHeader (const ImfInputFile *in);
|
const ImfHeader * ImfInputHeader (const ImfInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfInputChannels (const ImfInputFile *in);
|
int ImfInputChannels (const ImfInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const char * ImfInputFileName (const ImfInputFile *in);
|
const char * ImfInputFileName (const ImfInputFile *in);
|
||||||
|
|
||||||
|
|
||||||
@ -403,38 +474,50 @@ const char * ImfInputFileName (const ImfInputFile *in);
|
|||||||
struct ImfTiledInputFile;
|
struct ImfTiledInputFile;
|
||||||
typedef struct ImfTiledInputFile ImfTiledInputFile;
|
typedef struct ImfTiledInputFile ImfTiledInputFile;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfTiledInputFile * ImfOpenTiledInputFile (const char name[]);
|
ImfTiledInputFile * ImfOpenTiledInputFile (const char name[]);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfCloseTiledInputFile (ImfTiledInputFile *in);
|
int ImfCloseTiledInputFile (ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputSetFrameBuffer (ImfTiledInputFile *in,
|
int ImfTiledInputSetFrameBuffer (ImfTiledInputFile *in,
|
||||||
ImfRgba *base,
|
ImfRgba *base,
|
||||||
size_t xStride,
|
size_t xStride,
|
||||||
size_t yStride);
|
size_t yStride);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputReadTile (ImfTiledInputFile *in,
|
int ImfTiledInputReadTile (ImfTiledInputFile *in,
|
||||||
int dx, int dy,
|
int dx, int dy,
|
||||||
int lx, int ly);
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputReadTiles (ImfTiledInputFile *in,
|
int ImfTiledInputReadTiles (ImfTiledInputFile *in,
|
||||||
int dxMin, int dxMax,
|
int dxMin, int dxMax,
|
||||||
int dyMin, int dyMax,
|
int dyMin, int dyMax,
|
||||||
int lx, int ly);
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const ImfHeader * ImfTiledInputHeader (const ImfTiledInputFile *in);
|
const ImfHeader * ImfTiledInputHeader (const ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputChannels (const ImfTiledInputFile *in);
|
int ImfTiledInputChannels (const ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const char * ImfTiledInputFileName (const ImfTiledInputFile *in);
|
const char * ImfTiledInputFileName (const ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputTileXSize (const ImfTiledInputFile *in);
|
int ImfTiledInputTileXSize (const ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputTileYSize (const ImfTiledInputFile *in);
|
int ImfTiledInputTileYSize (const ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputLevelMode (const ImfTiledInputFile *in);
|
int ImfTiledInputLevelMode (const ImfTiledInputFile *in);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
int ImfTiledInputLevelRoundingMode
|
int ImfTiledInputLevelRoundingMode
|
||||||
(const ImfTiledInputFile *in);
|
(const ImfTiledInputFile *in);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Lookup tables
|
** Lookup tables
|
||||||
@ -443,20 +526,25 @@ int ImfTiledInputLevelRoundingMode
|
|||||||
struct ImfLut;
|
struct ImfLut;
|
||||||
typedef struct ImfLut ImfLut;
|
typedef struct ImfLut ImfLut;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfLut * ImfNewRound12logLut (int channels);
|
ImfLut * ImfNewRound12logLut (int channels);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ImfLut * ImfNewRoundNBitLut (unsigned int n, int channels);
|
ImfLut * ImfNewRoundNBitLut (unsigned int n, int channels);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfDeleteLut (ImfLut *lut);
|
void ImfDeleteLut (ImfLut *lut);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void ImfApplyLut (ImfLut *lut,
|
void ImfApplyLut (ImfLut *lut,
|
||||||
ImfRgba *data,
|
ImfRgba *data,
|
||||||
int nData,
|
int nData,
|
||||||
int stride);
|
int stride);
|
||||||
/*
|
/*
|
||||||
** Most recent error message
|
** Most recent error message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const char * ImfErrorMessage (void);
|
const char * ImfErrorMessage (void);
|
||||||
|
|
||||||
|
|
||||||
|
101
3rdparty/openexr/IlmImf/ImfChannelList.cpp
vendored
101
3rdparty/openexr/IlmImf/ImfChannelList.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -47,8 +47,9 @@
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::set;
|
using std::set;
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
Channel::Channel (PixelType t, int xs, int ys, bool pl):
|
Channel::Channel (PixelType t, int xs, int ys, bool pl):
|
||||||
@ -61,27 +62,27 @@ Channel::Channel (PixelType t, int xs, int ys, bool pl):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Channel::operator == (const Channel &other) const
|
Channel::operator == (const Channel &other) const
|
||||||
{
|
{
|
||||||
return type == other.type &&
|
return type == other.type &&
|
||||||
xSampling == other.xSampling &&
|
xSampling == other.xSampling &&
|
||||||
ySampling == other.ySampling &&
|
ySampling == other.ySampling &&
|
||||||
pLinear == other.pLinear;
|
pLinear == other.pLinear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::insert (const char name[], const Channel &channel)
|
ChannelList::insert (const char name[], const Channel &channel)
|
||||||
{
|
{
|
||||||
if (name[0] == 0)
|
if (name[0] == 0)
|
||||||
THROW (Iex::ArgExc, "Image channel name cannot be an empty string.");
|
THROW (IEX_NAMESPACE::ArgExc, "Image channel name cannot be an empty string.");
|
||||||
|
|
||||||
_map[name] = channel;
|
_map[name] = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::insert (const string &name, const Channel &channel)
|
ChannelList::insert (const string &name, const Channel &channel)
|
||||||
{
|
{
|
||||||
insert (name.c_str(), channel);
|
insert (name.c_str(), channel);
|
||||||
@ -94,7 +95,7 @@ ChannelList::operator [] (const char name[])
|
|||||||
ChannelMap::iterator i = _map.find (name);
|
ChannelMap::iterator i = _map.find (name);
|
||||||
|
|
||||||
if (i == _map.end())
|
if (i == _map.end())
|
||||||
THROW (Iex::ArgExc, "Cannot find image channel \"" << name << "\".");
|
THROW (IEX_NAMESPACE::ArgExc, "Cannot find image channel \"" << name << "\".");
|
||||||
|
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
@ -106,7 +107,7 @@ ChannelList::operator [] (const char name[]) const
|
|||||||
ChannelMap::const_iterator i = _map.find (name);
|
ChannelMap::const_iterator i = _map.find (name);
|
||||||
|
|
||||||
if (i == _map.end())
|
if (i == _map.end())
|
||||||
THROW (Iex::ArgExc, "Cannot find image channel \"" << name << "\".");
|
THROW (IEX_NAMESPACE::ArgExc, "Cannot find image channel \"" << name << "\".");
|
||||||
|
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
@ -156,14 +157,14 @@ ChannelList::findChannel (const string &name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChannelList::Iterator
|
ChannelList::Iterator
|
||||||
ChannelList::begin ()
|
ChannelList::begin ()
|
||||||
{
|
{
|
||||||
return _map.begin();
|
return _map.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChannelList::ConstIterator
|
ChannelList::ConstIterator
|
||||||
ChannelList::begin () const
|
ChannelList::begin () const
|
||||||
{
|
{
|
||||||
return _map.begin();
|
return _map.begin();
|
||||||
@ -177,7 +178,7 @@ ChannelList::end ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ChannelList::ConstIterator
|
ChannelList::ConstIterator
|
||||||
ChannelList::end () const
|
ChannelList::end () const
|
||||||
{
|
{
|
||||||
return _map.end();
|
return _map.end();
|
||||||
@ -219,22 +220,22 @@ ChannelList::layers (set <string> &layerNames) const
|
|||||||
|
|
||||||
for (ConstIterator i = begin(); i != end(); ++i)
|
for (ConstIterator i = begin(); i != end(); ++i)
|
||||||
{
|
{
|
||||||
string layerName = i.name();
|
string layerName = i.name();
|
||||||
size_t pos = layerName.rfind ('.');
|
size_t pos = layerName.rfind ('.');
|
||||||
|
|
||||||
if (pos != string::npos && pos != 0 && pos + 1 < layerName.size())
|
if (pos != string::npos && pos != 0 && pos + 1 < layerName.size())
|
||||||
{
|
{
|
||||||
layerName.erase (pos);
|
layerName.erase (pos);
|
||||||
layerNames.insert (layerName);
|
layerNames.insert (layerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::channelsInLayer (const string &layerName,
|
ChannelList::channelsInLayer (const string &layerName,
|
||||||
Iterator &first,
|
Iterator &first,
|
||||||
Iterator &last)
|
Iterator &last)
|
||||||
{
|
{
|
||||||
channelsWithPrefix (layerName + '.', first, last);
|
channelsWithPrefix (layerName + '.', first, last);
|
||||||
}
|
}
|
||||||
@ -242,49 +243,49 @@ ChannelList::channelsInLayer (const string &layerName,
|
|||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::channelsInLayer (const string &layerName,
|
ChannelList::channelsInLayer (const string &layerName,
|
||||||
ConstIterator &first,
|
ConstIterator &first,
|
||||||
ConstIterator &last) const
|
ConstIterator &last) const
|
||||||
{
|
{
|
||||||
channelsWithPrefix (layerName + '.', first, last);
|
channelsWithPrefix (layerName + '.', first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::channelsWithPrefix (const char prefix[],
|
ChannelList::channelsWithPrefix (const char prefix[],
|
||||||
Iterator &first,
|
Iterator &first,
|
||||||
Iterator &last)
|
Iterator &last)
|
||||||
{
|
{
|
||||||
first = last = _map.lower_bound (prefix);
|
first = last = _map.lower_bound (prefix);
|
||||||
int n = strlen (prefix);
|
size_t n = int(strlen (prefix));
|
||||||
|
|
||||||
while (last != Iterator (_map.end()) &&
|
while (last != Iterator (_map.end()) &&
|
||||||
strncmp (last.name(), prefix, n) <= 0)
|
strncmp (last.name(), prefix, n) <= 0)
|
||||||
{
|
{
|
||||||
++last;
|
++last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::channelsWithPrefix (const char prefix[],
|
ChannelList::channelsWithPrefix (const char prefix[],
|
||||||
ConstIterator &first,
|
ConstIterator &first,
|
||||||
ConstIterator &last) const
|
ConstIterator &last) const
|
||||||
{
|
{
|
||||||
first = last = _map.lower_bound (prefix);
|
first = last = _map.lower_bound (prefix);
|
||||||
int n = strlen (prefix);
|
size_t n = strlen (prefix);
|
||||||
|
|
||||||
while (last != ConstIterator (_map.end()) &&
|
while (last != ConstIterator (_map.end()) &&
|
||||||
strncmp (last.name(), prefix, n) <= 0)
|
strncmp (last.name(), prefix, n) <= 0)
|
||||||
{
|
{
|
||||||
++last;
|
++last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::channelsWithPrefix (const string &prefix,
|
ChannelList::channelsWithPrefix (const string &prefix,
|
||||||
Iterator &first,
|
Iterator &first,
|
||||||
Iterator &last)
|
Iterator &last)
|
||||||
{
|
{
|
||||||
return channelsWithPrefix (prefix.c_str(), first, last);
|
return channelsWithPrefix (prefix.c_str(), first, last);
|
||||||
}
|
}
|
||||||
@ -292,14 +293,14 @@ ChannelList::channelsWithPrefix (const string &prefix,
|
|||||||
|
|
||||||
void
|
void
|
||||||
ChannelList::channelsWithPrefix (const string &prefix,
|
ChannelList::channelsWithPrefix (const string &prefix,
|
||||||
ConstIterator &first,
|
ConstIterator &first,
|
||||||
ConstIterator &last) const
|
ConstIterator &last) const
|
||||||
{
|
{
|
||||||
return channelsWithPrefix (prefix.c_str(), first, last);
|
return channelsWithPrefix (prefix.c_str(), first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ChannelList::operator == (const ChannelList &other) const
|
ChannelList::operator == (const ChannelList &other) const
|
||||||
{
|
{
|
||||||
ConstIterator i = begin();
|
ConstIterator i = begin();
|
||||||
@ -307,15 +308,15 @@ ChannelList::operator == (const ChannelList &other) const
|
|||||||
|
|
||||||
while (i != end() && j != other.end())
|
while (i != end() && j != other.end())
|
||||||
{
|
{
|
||||||
if (!(i.channel() == j.channel()))
|
if (!(i.channel() == j.channel()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i == end() && j == other.end();
|
return i == end() && j == other.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
120
3rdparty/openexr/IlmImf/ImfChannelList.h
vendored
120
3rdparty/openexr/IlmImf/ImfChannelList.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -44,14 +44,17 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfName.h>
|
#include "ImfName.h"
|
||||||
#include <ImfPixelType.h>
|
#include "ImfPixelType.h"
|
||||||
|
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
|
|
||||||
struct Channel
|
struct Channel
|
||||||
@ -65,7 +68,7 @@ struct Channel
|
|||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
// Subsampling: pixel (x, y) is present in the
|
// Subsampling: pixel (x, y) is present in the
|
||||||
// channel only if
|
// channel only if
|
||||||
//
|
//
|
||||||
// x % xSampling == 0 && y % ySampling == 0
|
// x % xSampling == 0 && y % ySampling == 0
|
||||||
//
|
//
|
||||||
@ -96,17 +99,19 @@ struct Channel
|
|||||||
//------------
|
//------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Channel (PixelType type = HALF,
|
Channel (PixelType type = HALF,
|
||||||
int xSampling = 1,
|
int xSampling = 1,
|
||||||
int ySampling = 1,
|
int ySampling = 1,
|
||||||
bool pLinear = false);
|
bool pLinear = false);
|
||||||
|
|
||||||
|
|
||||||
//------------
|
//------------
|
||||||
// Operator ==
|
// Operator ==
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
bool operator == (const Channel &other) const;
|
bool operator == (const Channel &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -119,17 +124,19 @@ class ChannelList
|
|||||||
// Add a channel
|
// Add a channel
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void insert (const char name[],
|
void insert (const char name[],
|
||||||
const Channel &channel);
|
const Channel &channel);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void insert (const std::string &name,
|
void insert (const std::string &name,
|
||||||
const Channel &channel);
|
const Channel &channel);
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Access to existing channels:
|
// Access to existing channels:
|
||||||
//
|
//
|
||||||
// [n] Returns a reference to the channel with name n.
|
// [n] Returns a reference to the channel with name n.
|
||||||
// If no channel with name n exists, an Iex::ArgExc
|
// If no channel with name n exists, an IEX_NAMESPACE::ArgExc
|
||||||
// is thrown.
|
// is thrown.
|
||||||
//
|
//
|
||||||
// findChannel(n) Returns a pointer to the channel with name n,
|
// findChannel(n) Returns a pointer to the channel with name n,
|
||||||
@ -137,16 +144,24 @@ class ChannelList
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Channel & operator [] (const char name[]);
|
Channel & operator [] (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
const Channel & operator [] (const char name[]) const;
|
const Channel & operator [] (const char name[]) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Channel & operator [] (const std::string &name);
|
Channel & operator [] (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
const Channel & operator [] (const std::string &name) const;
|
const Channel & operator [] (const std::string &name) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Channel * findChannel (const char name[]);
|
Channel * findChannel (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
const Channel * findChannel (const char name[]) const;
|
const Channel * findChannel (const char name[]) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Channel * findChannel (const std::string &name);
|
Channel * findChannel (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
const Channel * findChannel (const std::string &name) const;
|
const Channel * findChannel (const std::string &name) const;
|
||||||
|
|
||||||
|
|
||||||
@ -159,19 +174,27 @@ class ChannelList
|
|||||||
class Iterator;
|
class Iterator;
|
||||||
class ConstIterator;
|
class ConstIterator;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator begin ();
|
Iterator begin ();
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator begin () const;
|
ConstIterator begin () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator end ();
|
Iterator end ();
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator end () const;
|
ConstIterator end () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator find (const char name[]);
|
Iterator find (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator find (const char name[]) const;
|
ConstIterator find (const char name[]) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator find (const std::string &name);
|
Iterator find (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator find (const std::string &name) const;
|
ConstIterator find (const std::string &name) const;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
// Support for image layers:
|
// Support for image layers:
|
||||||
//
|
//
|
||||||
@ -186,7 +209,7 @@ class ChannelList
|
|||||||
// several different virtual light sources. The channels in
|
// several different virtual light sources. The channels in
|
||||||
// this image might be called "light1.R", "light1.G", "light1.B",
|
// this image might be called "light1.R", "light1.G", "light1.B",
|
||||||
// "light2.R", "light2.G", "light2.B", etc.
|
// "light2.R", "light2.G", "light2.B", etc.
|
||||||
//
|
//
|
||||||
// Note that this naming convention allows layers to be nested;
|
// Note that this naming convention allows layers to be nested;
|
||||||
// for example, "light1.specular.R" identifies the "R" channel
|
// for example, "light1.specular.R" identifies the "R" channel
|
||||||
// in the "specular" sub-layer of layer "light1".
|
// in the "specular" sub-layer of layer "light1".
|
||||||
@ -212,15 +235,18 @@ class ChannelList
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void layers (std::set <std::string> &layerNames) const;
|
void layers (std::set <std::string> &layerNames) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void channelsInLayer (const std::string &layerName,
|
void channelsInLayer (const std::string &layerName,
|
||||||
Iterator &first,
|
Iterator &first,
|
||||||
Iterator &last);
|
Iterator &last);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void channelsInLayer (const std::string &layerName,
|
void channelsInLayer (const std::string &layerName,
|
||||||
ConstIterator &first,
|
ConstIterator &first,
|
||||||
ConstIterator &last) const;
|
ConstIterator &last) const;
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -235,26 +261,31 @@ class ChannelList
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void channelsWithPrefix (const char prefix[],
|
void channelsWithPrefix (const char prefix[],
|
||||||
Iterator &first,
|
Iterator &first,
|
||||||
Iterator &last);
|
Iterator &last);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void channelsWithPrefix (const char prefix[],
|
void channelsWithPrefix (const char prefix[],
|
||||||
ConstIterator &first,
|
ConstIterator &first,
|
||||||
ConstIterator &last) const;
|
ConstIterator &last) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void channelsWithPrefix (const std::string &prefix,
|
void channelsWithPrefix (const std::string &prefix,
|
||||||
Iterator &first,
|
Iterator &first,
|
||||||
Iterator &last);
|
Iterator &last);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
void channelsWithPrefix (const std::string &prefix,
|
void channelsWithPrefix (const std::string &prefix,
|
||||||
ConstIterator &first,
|
ConstIterator &first,
|
||||||
ConstIterator &last) const;
|
ConstIterator &last) const;
|
||||||
|
|
||||||
//------------
|
//------------
|
||||||
// Operator ==
|
// Operator ==
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
bool operator == (const ChannelList &other) const;
|
bool operator == (const ChannelList &other) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -271,13 +302,19 @@ class ChannelList::Iterator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator ();
|
Iterator ();
|
||||||
|
IMF_EXPORT
|
||||||
Iterator (const ChannelList::ChannelMap::iterator &i);
|
Iterator (const ChannelList::ChannelMap::iterator &i);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator & operator ++ ();
|
Iterator & operator ++ ();
|
||||||
|
IMF_EXPORT
|
||||||
Iterator operator ++ (int);
|
Iterator operator ++ (int);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const char * name () const;
|
const char * name () const;
|
||||||
|
IMF_EXPORT
|
||||||
Channel & channel () const;
|
Channel & channel () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -292,14 +329,21 @@ class ChannelList::ConstIterator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator ();
|
ConstIterator ();
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator (const ChannelList::ChannelMap::const_iterator &i);
|
ConstIterator (const ChannelList::ChannelMap::const_iterator &i);
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator (const ChannelList::Iterator &other);
|
ConstIterator (const ChannelList::Iterator &other);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator & operator ++ ();
|
ConstIterator & operator ++ ();
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator operator ++ (int);
|
ConstIterator operator ++ (int);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
const char * name () const;
|
const char * name () const;
|
||||||
|
IMF_EXPORT
|
||||||
const Channel & channel () const;
|
const Channel & channel () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -330,7 +374,7 @@ ChannelList::Iterator::Iterator (const ChannelList::ChannelMap::iterator &i):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline ChannelList::Iterator &
|
inline ChannelList::Iterator &
|
||||||
ChannelList::Iterator::operator ++ ()
|
ChannelList::Iterator::operator ++ ()
|
||||||
{
|
{
|
||||||
++_i;
|
++_i;
|
||||||
@ -338,7 +382,7 @@ ChannelList::Iterator::operator ++ ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline ChannelList::Iterator
|
inline ChannelList::Iterator
|
||||||
ChannelList::Iterator::operator ++ (int)
|
ChannelList::Iterator::operator ++ (int)
|
||||||
{
|
{
|
||||||
Iterator tmp = *this;
|
Iterator tmp = *this;
|
||||||
@ -354,7 +398,7 @@ ChannelList::Iterator::name () const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Channel &
|
inline Channel &
|
||||||
ChannelList::Iterator::channel () const
|
ChannelList::Iterator::channel () const
|
||||||
{
|
{
|
||||||
return _i->second;
|
return _i->second;
|
||||||
@ -390,7 +434,7 @@ ChannelList::ConstIterator::operator ++ ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline ChannelList::ConstIterator
|
inline ChannelList::ConstIterator
|
||||||
ChannelList::ConstIterator::operator ++ (int)
|
ChannelList::ConstIterator::operator ++ (int)
|
||||||
{
|
{
|
||||||
ConstIterator tmp = *this;
|
ConstIterator tmp = *this;
|
||||||
@ -405,7 +449,7 @@ ChannelList::ConstIterator::name () const
|
|||||||
return *_i->first;
|
return *_i->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Channel &
|
inline const Channel &
|
||||||
ChannelList::ConstIterator::channel () const
|
ChannelList::ConstIterator::channel () const
|
||||||
{
|
{
|
||||||
return _i->second;
|
return _i->second;
|
||||||
@ -414,7 +458,7 @@ ChannelList::ConstIterator::channel () const
|
|||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator == (const ChannelList::ConstIterator &x,
|
operator == (const ChannelList::ConstIterator &x,
|
||||||
const ChannelList::ConstIterator &y)
|
const ChannelList::ConstIterator &y)
|
||||||
{
|
{
|
||||||
return x._i == y._i;
|
return x._i == y._i;
|
||||||
}
|
}
|
||||||
@ -422,12 +466,12 @@ operator == (const ChannelList::ConstIterator &x,
|
|||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator != (const ChannelList::ConstIterator &x,
|
operator != (const ChannelList::ConstIterator &x,
|
||||||
const ChannelList::ConstIterator &y)
|
const ChannelList::ConstIterator &y)
|
||||||
{
|
{
|
||||||
return !(x == y);
|
return !(x == y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
101
3rdparty/openexr/IlmImf/ImfChannelListAttribute.cpp
vendored
101
3rdparty/openexr/IlmImf/ImfChannelListAttribute.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -42,26 +42,26 @@
|
|||||||
|
|
||||||
#include <ImfChannelListAttribute.h>
|
#include <ImfChannelListAttribute.h>
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
void checkIsNullTerminated (const char (&str)[N], const char *what)
|
void checkIsNullTerminated (const char (&str)[N], const char *what)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
if (str[i] == '\0')
|
if (str[i] == '\0')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << "Invalid " << what << ": it is more than " << (N - 1)
|
s << "Invalid " << what << ": it is more than " << (N - 1)
|
||||||
<< " characters long.";
|
<< " characters long.";
|
||||||
throw Iex::InputExc(s);
|
throw IEX_NAMESPACE::InputExc(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
const char *
|
const char *
|
||||||
ChannelListAttribute::staticTypeName ()
|
ChannelListAttribute::staticTypeName ()
|
||||||
@ -69,30 +69,31 @@ ChannelListAttribute::staticTypeName ()
|
|||||||
return "chlist";
|
return "chlist";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
ChannelListAttribute::writeValueTo (OStream &os, int) const
|
ChannelListAttribute::writeValueTo (OStream &os, int version) const
|
||||||
{
|
{
|
||||||
for (ChannelList::ConstIterator i = _value.begin();
|
for (ChannelList::ConstIterator i = _value.begin();
|
||||||
i != _value.end();
|
i != _value.end();
|
||||||
++i)
|
++i)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Write name
|
// Write name
|
||||||
//
|
//
|
||||||
|
|
||||||
Xdr::write <StreamIO> (os, i.name());
|
Xdr::write <StreamIO> (os, i.name());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Write Channel struct
|
// Write Channel struct
|
||||||
//
|
//
|
||||||
|
|
||||||
Xdr::write <StreamIO> (os, int (i.channel().type));
|
Xdr::write <StreamIO> (os, int (i.channel().type));
|
||||||
Xdr::write <StreamIO> (os, i.channel().pLinear);
|
Xdr::write <StreamIO> (os, i.channel().pLinear);
|
||||||
Xdr::pad <StreamIO> (os, 3);
|
Xdr::pad <StreamIO> (os, 3);
|
||||||
Xdr::write <StreamIO> (os, i.channel().xSampling);
|
Xdr::write <StreamIO> (os, i.channel().xSampling);
|
||||||
Xdr::write <StreamIO> (os, i.channel().ySampling);
|
Xdr::write <StreamIO> (os, i.channel().ySampling);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -105,41 +106,45 @@ ChannelListAttribute::writeValueTo (OStream &os, int) const
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
ChannelListAttribute::readValueFrom (IStream &is, int, int)
|
ChannelListAttribute::readValueFrom (IStream &is,
|
||||||
|
int size,
|
||||||
|
int version)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Read name; zero length name means end of channel list
|
// Read name; zero length name means end of channel list
|
||||||
//
|
//
|
||||||
|
|
||||||
char name[Name::SIZE];
|
char name[Name::SIZE];
|
||||||
Xdr::read <StreamIO> (is, Name::MAX_LENGTH, name);
|
Xdr::read <StreamIO> (is,Name::MAX_LENGTH,name);
|
||||||
|
|
||||||
if (name[0] == 0)
|
if (name[0] == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
checkIsNullTerminated (name, "channel name");
|
checkIsNullTerminated (name, "channel name");
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read Channel struct
|
// Read Channel struct
|
||||||
//
|
//
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
bool pLinear;
|
bool pLinear;
|
||||||
int xSampling;
|
int xSampling;
|
||||||
int ySampling;
|
int ySampling;
|
||||||
|
|
||||||
Xdr::read <StreamIO> (is, type);
|
Xdr::read <StreamIO> (is, type);
|
||||||
Xdr::read <StreamIO> (is, pLinear);
|
Xdr::read <StreamIO> (is, pLinear);
|
||||||
Xdr::skip <StreamIO> (is, 3);
|
Xdr::skip <StreamIO> (is, 3);
|
||||||
Xdr::read <StreamIO> (is, xSampling);
|
Xdr::read <StreamIO> (is, xSampling);
|
||||||
Xdr::read <StreamIO> (is, ySampling);
|
Xdr::read <StreamIO> (is, ySampling);
|
||||||
|
|
||||||
_value.insert
|
_value.insert (name, Channel (PixelType (type),
|
||||||
(name, Channel (PixelType (type), xSampling, ySampling, pLinear));
|
xSampling,
|
||||||
|
ySampling,
|
||||||
|
pLinear));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,25 +43,32 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfAttribute.h"
|
||||||
#include <ImfChannelList.h>
|
#include "ImfChannelList.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
typedef TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::ChannelList> ChannelListAttribute;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
const char *ChannelListAttribute::staticTypeName ();
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void ChannelListAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &,
|
||||||
|
int) const;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void ChannelListAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
|
||||||
|
int, int);
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<ChannelList> ChannelListAttribute;
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
template <> const char *ChannelListAttribute::staticTypeName ();
|
|
||||||
template <> void ChannelListAttribute::writeValueTo (OStream &, int) const;
|
|
||||||
template <> void ChannelListAttribute::readValueFrom (IStream &, int, int);
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfChannelListAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
30
3rdparty/openexr/IlmImf/ImfCheckedArithmetic.h
vendored
30
3rdparty/openexr/IlmImf/ImfCheckedArithmetic.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2009, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2009, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,15 +43,16 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <IexMathExc.h>
|
#include "IexMathExc.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
template <bool b> struct StaticAssertionFailed;
|
template <bool b> struct StaticAssertionFailed;
|
||||||
template <> struct StaticAssertionFailed <true> {};
|
template <> struct StaticAssertionFailed <true> {};
|
||||||
|
|
||||||
#define IMF_STATIC_ASSERT(x) \
|
#define IMF_STATIC_ASSERT(x) \
|
||||||
do {StaticAssertionFailed <x> staticAssertionFailed;} while (false)
|
do {StaticAssertionFailed <x> staticAssertionFailed; ((void) staticAssertionFailed);} while (false)
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -66,7 +67,7 @@ uiMult (T a, T b)
|
|||||||
std::numeric_limits<T>::is_integer);
|
std::numeric_limits<T>::is_integer);
|
||||||
|
|
||||||
if (a > 0 && b > std::numeric_limits<T>::max() / a)
|
if (a > 0 && b > std::numeric_limits<T>::max() / a)
|
||||||
throw Iex::OverflowExc ("Integer multiplication overflow.");
|
throw IEX_NAMESPACE::OverflowExc ("Integer multiplication overflow.");
|
||||||
|
|
||||||
return a * b;
|
return a * b;
|
||||||
}
|
}
|
||||||
@ -84,7 +85,7 @@ uiDiv (T a, T b)
|
|||||||
std::numeric_limits<T>::is_integer);
|
std::numeric_limits<T>::is_integer);
|
||||||
|
|
||||||
if (b == 0)
|
if (b == 0)
|
||||||
throw Iex::DivzeroExc ("Integer division by zero.");
|
throw IEX_NAMESPACE::DivzeroExc ("Integer division by zero.");
|
||||||
|
|
||||||
return a / b;
|
return a / b;
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ uiAdd (T a, T b)
|
|||||||
std::numeric_limits<T>::is_integer);
|
std::numeric_limits<T>::is_integer);
|
||||||
|
|
||||||
if (a > std::numeric_limits<T>::max() - b)
|
if (a > std::numeric_limits<T>::max() - b)
|
||||||
throw Iex::OverflowExc ("Integer addition overflow.");
|
throw IEX_NAMESPACE::OverflowExc ("Integer addition overflow.");
|
||||||
|
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
@ -120,7 +121,7 @@ uiSub (T a, T b)
|
|||||||
std::numeric_limits<T>::is_integer);
|
std::numeric_limits<T>::is_integer);
|
||||||
|
|
||||||
if (a < b)
|
if (a < b)
|
||||||
throw Iex::UnderflowExc ("Integer subtraction underflow.");
|
throw IEX_NAMESPACE::UnderflowExc ("Integer subtraction underflow.");
|
||||||
|
|
||||||
return a - b;
|
return a - b;
|
||||||
}
|
}
|
||||||
@ -138,7 +139,7 @@ checkArraySize (T n, size_t s)
|
|||||||
//
|
//
|
||||||
// size_t (n) * s
|
// size_t (n) * s
|
||||||
//
|
//
|
||||||
// would overflow, then throw an Iex::OverflowExc exception.
|
// would overflow, then throw an IEX_NAMESPACE::OverflowExc exception.
|
||||||
// Otherwise return
|
// Otherwise return
|
||||||
//
|
//
|
||||||
// size_t (n).
|
// size_t (n).
|
||||||
@ -150,12 +151,13 @@ checkArraySize (T n, size_t s)
|
|||||||
IMF_STATIC_ASSERT (sizeof (T) <= sizeof (size_t));
|
IMF_STATIC_ASSERT (sizeof (T) <= sizeof (size_t));
|
||||||
|
|
||||||
if (size_t (n) > std::numeric_limits<size_t>::max() / s)
|
if (size_t (n) > std::numeric_limits<size_t>::max() / s)
|
||||||
throw Iex::OverflowExc ("Integer multiplication overflow.");
|
throw IEX_NAMESPACE::OverflowExc ("Integer multiplication overflow.");
|
||||||
|
|
||||||
return size_t (n);
|
return size_t (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
74
3rdparty/openexr/IlmImf/ImfChromaticities.cpp
vendored
74
3rdparty/openexr/IlmImf/ImfChromaticities.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -41,14 +41,16 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfChromaticities.h>
|
#include <ImfChromaticities.h>
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
Chromaticities::Chromaticities (const Imath::V2f &red,
|
Chromaticities::Chromaticities (const IMATH_NAMESPACE::V2f &red,
|
||||||
const Imath::V2f &green,
|
const IMATH_NAMESPACE::V2f &green,
|
||||||
const Imath::V2f &blue,
|
const IMATH_NAMESPACE::V2f &blue,
|
||||||
const Imath::V2f &white)
|
const IMATH_NAMESPACE::V2f &white)
|
||||||
:
|
:
|
||||||
red (red),
|
red (red),
|
||||||
green (green),
|
green (green),
|
||||||
@ -58,14 +60,28 @@ Chromaticities::Chromaticities (const Imath::V2f &red,
|
|||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Chromaticities::operator == (const Chromaticities & c) const
|
||||||
|
{
|
||||||
|
return red == c.red && green == c.green && blue == c.blue;
|
||||||
|
}
|
||||||
|
|
||||||
Imath::M44f
|
|
||||||
|
bool
|
||||||
|
Chromaticities::operator != (const Chromaticities & c) const
|
||||||
|
{
|
||||||
|
return red != c.red || green != c.green || blue != c.blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::M44f
|
||||||
RGBtoXYZ (const Chromaticities chroma, float Y)
|
RGBtoXYZ (const Chromaticities chroma, float Y)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// For an explanation of how the color conversion matrix is derived,
|
// For an explanation of how the color conversion matrix is derived,
|
||||||
// see Roy Hall, "Illumination and Color in Computer Generated Imagery",
|
// see Roy Hall, "Illumination and Color in Computer Generated Imagery",
|
||||||
// Springer-Verlag, 1989, chapter 3, "Perceptual Response"; and
|
// Springer-Verlag, 1989, chapter 3, "Perceptual Response"; and
|
||||||
// Charles A. Poynton, "A Technical Introduction to Digital Video",
|
// Charles A. Poynton, "A Technical Introduction to Digital Video",
|
||||||
// John Wiley & Sons, 1996, chapter 7, "Color science for video".
|
// John Wiley & Sons, 1996, chapter 7, "Color science for video".
|
||||||
//
|
//
|
||||||
@ -82,32 +98,32 @@ RGBtoXYZ (const Chromaticities chroma, float Y)
|
|||||||
//
|
//
|
||||||
|
|
||||||
float d = chroma.red.x * (chroma.blue.y - chroma.green.y) +
|
float d = chroma.red.x * (chroma.blue.y - chroma.green.y) +
|
||||||
chroma.blue.x * (chroma.green.y - chroma.red.y) +
|
chroma.blue.x * (chroma.green.y - chroma.red.y) +
|
||||||
chroma.green.x * (chroma.red.y - chroma.blue.y);
|
chroma.green.x * (chroma.red.y - chroma.blue.y);
|
||||||
|
|
||||||
float Sr = (X * (chroma.blue.y - chroma.green.y) -
|
float Sr = (X * (chroma.blue.y - chroma.green.y) -
|
||||||
chroma.green.x * (Y * (chroma.blue.y - 1) +
|
chroma.green.x * (Y * (chroma.blue.y - 1) +
|
||||||
chroma.blue.y * (X + Z)) +
|
chroma.blue.y * (X + Z)) +
|
||||||
chroma.blue.x * (Y * (chroma.green.y - 1) +
|
chroma.blue.x * (Y * (chroma.green.y - 1) +
|
||||||
chroma.green.y * (X + Z))) / d;
|
chroma.green.y * (X + Z))) / d;
|
||||||
|
|
||||||
float Sg = (X * (chroma.red.y - chroma.blue.y) +
|
float Sg = (X * (chroma.red.y - chroma.blue.y) +
|
||||||
chroma.red.x * (Y * (chroma.blue.y - 1) +
|
chroma.red.x * (Y * (chroma.blue.y - 1) +
|
||||||
chroma.blue.y * (X + Z)) -
|
chroma.blue.y * (X + Z)) -
|
||||||
chroma.blue.x * (Y * (chroma.red.y - 1) +
|
chroma.blue.x * (Y * (chroma.red.y - 1) +
|
||||||
chroma.red.y * (X + Z))) / d;
|
chroma.red.y * (X + Z))) / d;
|
||||||
|
|
||||||
float Sb = (X * (chroma.green.y - chroma.red.y) -
|
float Sb = (X * (chroma.green.y - chroma.red.y) -
|
||||||
chroma.red.x * (Y * (chroma.green.y - 1) +
|
chroma.red.x * (Y * (chroma.green.y - 1) +
|
||||||
chroma.green.y * (X + Z)) +
|
chroma.green.y * (X + Z)) +
|
||||||
chroma.green.x * (Y * (chroma.red.y - 1) +
|
chroma.green.x * (Y * (chroma.red.y - 1) +
|
||||||
chroma.red.y * (X + Z))) / d;
|
chroma.red.y * (X + Z))) / d;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assemble the matrix
|
// Assemble the matrix
|
||||||
//
|
//
|
||||||
|
|
||||||
Imath::M44f M;
|
IMATH_NAMESPACE::M44f M;
|
||||||
|
|
||||||
M[0][0] = Sr * chroma.red.x;
|
M[0][0] = Sr * chroma.red.x;
|
||||||
M[0][1] = Sr * chroma.red.y;
|
M[0][1] = Sr * chroma.red.y;
|
||||||
@ -125,11 +141,11 @@ RGBtoXYZ (const Chromaticities chroma, float Y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Imath::M44f
|
IMATH_NAMESPACE::M44f
|
||||||
XYZtoRGB (const Chromaticities chroma, float Y)
|
XYZtoRGB (const Chromaticities chroma, float Y)
|
||||||
{
|
{
|
||||||
return RGBtoXYZ (chroma, Y).inverse();
|
return RGBtoXYZ (chroma, Y).inverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
70
3rdparty/openexr/IlmImf/ImfChromaticities.h
vendored
70
3rdparty/openexr/IlmImf/ImfChromaticities.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -45,10 +45,13 @@
|
|||||||
|
|
||||||
#include "ImathVec.h"
|
#include "ImathVec.h"
|
||||||
#include "ImathMatrix.h"
|
#include "ImathMatrix.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
namespace Imf {
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
struct Chromaticities
|
struct Chromaticities
|
||||||
{
|
{
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
@ -56,20 +59,31 @@ struct Chromaticities
|
|||||||
// (1,0,0), (0,1,0), (0,0,1) and (1,1,1).
|
// (1,0,0), (0,1,0), (0,0,1) and (1,1,1).
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
|
||||||
Imath::V2f red;
|
IMATH_NAMESPACE::V2f red;
|
||||||
Imath::V2f green;
|
IMATH_NAMESPACE::V2f green;
|
||||||
Imath::V2f blue;
|
IMATH_NAMESPACE::V2f blue;
|
||||||
Imath::V2f white;
|
IMATH_NAMESPACE::V2f white;
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
// Default constructor produces chromaticities
|
// Default constructor produces chromaticities
|
||||||
// according to Rec. ITU-R BT.709-3
|
// according to Rec. ITU-R BT.709-3
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
Chromaticities (const Imath::V2f &red = Imath::V2f (0.6400f, 0.3300f),
|
IMF_EXPORT
|
||||||
const Imath::V2f &green = Imath::V2f (0.3000f, 0.6000f),
|
Chromaticities (const IMATH_NAMESPACE::V2f &red = IMATH_NAMESPACE::V2f (0.6400f, 0.3300f),
|
||||||
const Imath::V2f &blue = Imath::V2f (0.1500f, 0.0600f),
|
const IMATH_NAMESPACE::V2f &green = IMATH_NAMESPACE::V2f (0.3000f, 0.6000f),
|
||||||
const Imath::V2f &white = Imath::V2f (0.3127f, 0.3290f));
|
const IMATH_NAMESPACE::V2f &blue = IMATH_NAMESPACE::V2f (0.1500f, 0.0600f),
|
||||||
|
const IMATH_NAMESPACE::V2f &white = IMATH_NAMESPACE::V2f (0.3127f, 0.3290f));
|
||||||
|
|
||||||
|
|
||||||
|
//---------
|
||||||
|
// Equality
|
||||||
|
//---------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
bool operator == (const Chromaticities &v) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
bool operator != (const Chromaticities &v) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -82,39 +96,39 @@ struct Chromaticities
|
|||||||
// triple (1,1,1), or "white", RGBtoXYZ(c,Y) computes a matrix, M, so
|
// triple (1,1,1), or "white", RGBtoXYZ(c,Y) computes a matrix, M, so
|
||||||
// that multiplying an RGB value, v, with M produces an equivalent
|
// that multiplying an RGB value, v, with M produces an equivalent
|
||||||
// XYZ value, w. (w == v * M)
|
// XYZ value, w. (w == v * M)
|
||||||
//
|
//
|
||||||
// If we define that
|
// If we define that
|
||||||
//
|
//
|
||||||
// (Xr, Yr, Zr) == (1, 0, 0) * M
|
// (Xr, Yr, Zr) == (1, 0, 0) * M
|
||||||
// (Xg, Yg, Zg) == (0, 1, 0) * M
|
// (Xg, Yg, Zg) == (0, 1, 0) * M
|
||||||
// (Xb, Yb, Zb) == (0, 0, 1) * M
|
// (Xb, Yb, Zb) == (0, 0, 1) * M
|
||||||
// (Xw, Yw, Zw) == (1, 1, 1) * M,
|
// (Xw, Yw, Zw) == (1, 1, 1) * M,
|
||||||
//
|
//
|
||||||
// then the following statements are true:
|
// then the following statements are true:
|
||||||
//
|
//
|
||||||
// Xr / (Xr + Yr + Zr) == c.red.x
|
// Xr / (Xr + Yr + Zr) == c.red.x
|
||||||
// Yr / (Xr + Yr + Zr) == c.red.y
|
// Yr / (Xr + Yr + Zr) == c.red.y
|
||||||
//
|
//
|
||||||
// Xg / (Xg + Yg + Zg) == c.red.x
|
// Xg / (Xg + Yg + Zg) == c.red.x
|
||||||
// Yg / (Xg + Yg + Zg) == c.red.y
|
// Yg / (Xg + Yg + Zg) == c.red.y
|
||||||
//
|
//
|
||||||
// Xb / (Xb + Yb + Zb) == c.red.x
|
// Xb / (Xb + Yb + Zb) == c.red.x
|
||||||
// Yb / (Xb + Yb + Zb) == c.red.y
|
// Yb / (Xb + Yb + Zb) == c.red.y
|
||||||
//
|
//
|
||||||
// Xw / (Xw + Yw + Zw) == c.red.x
|
// Xw / (Xw + Yw + Zw) == c.red.x
|
||||||
// Yw / (Xw + Yw + Zw) == c.red.y
|
// Yw / (Xw + Yw + Zw) == c.red.y
|
||||||
//
|
//
|
||||||
// Yw == Y.
|
// Yw == Y.
|
||||||
//
|
//
|
||||||
// XYZ to RGB:
|
// XYZ to RGB:
|
||||||
//
|
//
|
||||||
// YYZtoRGB(c,Y) returns RGBtoXYZ(c,Y).inverse().
|
// YYZtoRGB(c,Y) returns RGBtoXYZ(c,Y).inverse().
|
||||||
//
|
//
|
||||||
|
|
||||||
Imath::M44f RGBtoXYZ (const Chromaticities chroma, float Y);
|
IMF_EXPORT IMATH_NAMESPACE::M44f RGBtoXYZ (const Chromaticities chroma, float Y);
|
||||||
Imath::M44f XYZtoRGB (const Chromaticities chroma, float Y);
|
IMF_EXPORT IMATH_NAMESPACE::M44f XYZtoRGB (const Chromaticities chroma, float Y);
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -42,8 +42,9 @@
|
|||||||
#include <ImfChromaticitiesAttribute.h>
|
#include <ImfChromaticitiesAttribute.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
const char *
|
const char *
|
||||||
@ -55,7 +56,7 @@ ChromaticitiesAttribute::staticTypeName ()
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
ChromaticitiesAttribute::writeValueTo (OStream &os, int) const
|
ChromaticitiesAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
{
|
{
|
||||||
Xdr::write <StreamIO> (os, _value.red.x);
|
Xdr::write <StreamIO> (os, _value.red.x);
|
||||||
Xdr::write <StreamIO> (os, _value.red.y);
|
Xdr::write <StreamIO> (os, _value.red.y);
|
||||||
@ -70,7 +71,7 @@ ChromaticitiesAttribute::writeValueTo (OStream &os, int) const
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
ChromaticitiesAttribute::readValueFrom (IStream &is, int, int)
|
ChromaticitiesAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
{
|
{
|
||||||
Xdr::read <StreamIO> (is, _value.red.x);
|
Xdr::read <StreamIO> (is, _value.red.x);
|
||||||
Xdr::read <StreamIO> (is, _value.red.y);
|
Xdr::read <StreamIO> (is, _value.red.y);
|
||||||
@ -83,4 +84,4 @@ ChromaticitiesAttribute::readValueFrom (IStream &is, int, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,30 +43,31 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfAttribute.h"
|
||||||
#include <ImfChromaticities.h>
|
#include "ImfChromaticities.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
typedef TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::Chromaticities> ChromaticitiesAttribute;
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<Chromaticities> ChromaticitiesAttribute;
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
const char *ChromaticitiesAttribute::staticTypeName ();
|
const char *ChromaticitiesAttribute::staticTypeName ();
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void ChromaticitiesAttribute::writeValueTo (OStream &, int) const;
|
IMF_EXPORT
|
||||||
|
void ChromaticitiesAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &,
|
||||||
|
int) const;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void ChromaticitiesAttribute::readValueFrom (IStream &, int, int);
|
IMF_EXPORT
|
||||||
|
void ChromaticitiesAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
|
||||||
|
int,
|
||||||
|
int);
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfChromaticitiesAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
591
3rdparty/openexr/IlmImf/ImfCompositeDeepScanLine.cpp
vendored
Normal file
591
3rdparty/openexr/IlmImf/ImfCompositeDeepScanLine.cpp
vendored
Normal file
@ -0,0 +1,591 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Weta Digital Ltd
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Weta Digital nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#include "ImfCompositeDeepScanLine.h"
|
||||||
|
#include "ImfDeepScanLineInputPart.h"
|
||||||
|
#include "ImfDeepScanLineInputFile.h"
|
||||||
|
#include "ImfChannelList.h"
|
||||||
|
#include "ImfFrameBuffer.h"
|
||||||
|
#include "ImfDeepFrameBuffer.h"
|
||||||
|
#include "ImfDeepCompositing.h"
|
||||||
|
#include "ImfPixelType.h"
|
||||||
|
#include "IlmThreadPool.h"
|
||||||
|
|
||||||
|
#include <Iex.h>
|
||||||
|
#include <vector>
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
using std::string;
|
||||||
|
using IMATH_NAMESPACE::Box2i;
|
||||||
|
using ILMTHREAD_NAMESPACE::Task;
|
||||||
|
using ILMTHREAD_NAMESPACE::TaskGroup;
|
||||||
|
using ILMTHREAD_NAMESPACE::ThreadPool;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct CompositeDeepScanLine::Data{
|
||||||
|
public :
|
||||||
|
vector<DeepScanLineInputFile *> _file; // array of files
|
||||||
|
vector<DeepScanLineInputPart *> _part; // array of parts
|
||||||
|
FrameBuffer _outputFrameBuffer; // output frame buffer provided
|
||||||
|
bool _zback; // true if we are using zback (otherwise channel 1 = channel 0)
|
||||||
|
vector< vector<float> > _channeldata; // pixel values, read from the input, one array per channel
|
||||||
|
vector< int > _sampleCounts; // total per-pixel sample counts,
|
||||||
|
Box2i _dataWindow; // data window of combined inputs
|
||||||
|
DeepCompositing * _comp; // user-provided compositor
|
||||||
|
vector<string> _channels; // names of channels that will be composited
|
||||||
|
vector<int> _bufferMap; // entry _outputFrameBuffer[n].name() == _channels[ _bufferMap[n] ].name()
|
||||||
|
|
||||||
|
void check_valid(const Header & header); // check newly added part/file is OK; on first good call, set _zback/_dataWindow
|
||||||
|
|
||||||
|
//
|
||||||
|
// set up the given deep frame buffer to contain the required channels
|
||||||
|
// resize counts and pointers to the width of _dataWindow
|
||||||
|
// zero-out all counts, since the datawindow may be smaller than/not include this part
|
||||||
|
//
|
||||||
|
|
||||||
|
void handleDeepFrameBuffer (DeepFrameBuffer & buf,
|
||||||
|
vector<unsigned int> & counts, //per-pixel counts
|
||||||
|
vector< vector<float *> > & pointers, //per-channel-per-pixel pointers to data
|
||||||
|
const Header & header,
|
||||||
|
int start,
|
||||||
|
int end);
|
||||||
|
|
||||||
|
Data();
|
||||||
|
};
|
||||||
|
|
||||||
|
CompositeDeepScanLine::Data::Data() : _zback(false) , _comp(NULL) {}
|
||||||
|
|
||||||
|
CompositeDeepScanLine::CompositeDeepScanLine() : _Data(new Data) {}
|
||||||
|
|
||||||
|
CompositeDeepScanLine::~CompositeDeepScanLine()
|
||||||
|
{
|
||||||
|
delete _Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::addSource(DeepScanLineInputPart* part)
|
||||||
|
{
|
||||||
|
_Data->check_valid(part->header());
|
||||||
|
_Data->_part.push_back(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::addSource(DeepScanLineInputFile* file)
|
||||||
|
{
|
||||||
|
_Data->check_valid(file->header());
|
||||||
|
_Data->_file.push_back(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
CompositeDeepScanLine::sources() const
|
||||||
|
{
|
||||||
|
return int(_Data->_part.size())+int(_Data->_file.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::Data::check_valid(const Header & header)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool has_z=false;
|
||||||
|
bool has_alpha=false;
|
||||||
|
// check good channel names
|
||||||
|
for( ChannelList::ConstIterator i=header.channels().begin();i!=header.channels().end();++i)
|
||||||
|
{
|
||||||
|
std::string n(i.name());
|
||||||
|
if(n=="ZBack")
|
||||||
|
{
|
||||||
|
_zback=true;
|
||||||
|
}
|
||||||
|
else if(n=="Z")
|
||||||
|
{
|
||||||
|
has_z=true;
|
||||||
|
}
|
||||||
|
else if(n=="A")
|
||||||
|
{
|
||||||
|
has_alpha=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!has_z)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::ArgExc("Deep data provided to CompositeDeepScanLine is missing a Z channel");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!has_alpha)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::ArgExc("Deep data provided to CompositeDeepScanLine is missing an alpha channel");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(_part.size()==0 && _file.size()==0)
|
||||||
|
{
|
||||||
|
// first in - update and return
|
||||||
|
|
||||||
|
_dataWindow = header.dataWindow();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Header * const match_header = _part.size()>0 ? &_part[0]->header() : &_file[0]->header();
|
||||||
|
|
||||||
|
// check the sizes match
|
||||||
|
if(match_header->displayWindow() != header.displayWindow())
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::ArgExc("Deep data provided to CompositeDeepScanLine has a different displayWindow to previously provided data");
|
||||||
|
}
|
||||||
|
|
||||||
|
_dataWindow.extendBy(header.dataWindow());
|
||||||
|
|
||||||
|
}
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::Data::handleDeepFrameBuffer (DeepFrameBuffer& buf,
|
||||||
|
std::vector< unsigned int > & counts,
|
||||||
|
vector< std::vector< float* > > & pointers,
|
||||||
|
const Header& header,
|
||||||
|
int start,
|
||||||
|
int end)
|
||||||
|
{
|
||||||
|
int width=_dataWindow.size().x+1;
|
||||||
|
size_t pixelcount = width * (end-start+1);
|
||||||
|
pointers.resize(_channels.size());
|
||||||
|
counts.resize(pixelcount);
|
||||||
|
buf.insertSampleCountSlice (Slice (OPENEXR_IMF_INTERNAL_NAMESPACE::UINT,
|
||||||
|
(char *) (&counts[0]-_dataWindow.min.x-start*width),
|
||||||
|
sizeof(unsigned int),
|
||||||
|
sizeof(unsigned int)*width));
|
||||||
|
|
||||||
|
pointers[0].resize(pixelcount);
|
||||||
|
buf.insert ("Z", DeepSlice (OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT,
|
||||||
|
(char *)(&pointers[0][0]-_dataWindow.min.x-start*width),
|
||||||
|
sizeof(float *),
|
||||||
|
sizeof(float *)*width,
|
||||||
|
sizeof(float) ));
|
||||||
|
|
||||||
|
if(_zback)
|
||||||
|
{
|
||||||
|
pointers[1].resize(pixelcount);
|
||||||
|
buf.insert ("ZBack", DeepSlice (OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT,
|
||||||
|
(char *)(&pointers[1][0]-_dataWindow.min.x-start*width),
|
||||||
|
sizeof(float *),
|
||||||
|
sizeof(float *)*width,
|
||||||
|
sizeof(float) ));
|
||||||
|
}
|
||||||
|
|
||||||
|
pointers[2].resize(pixelcount);
|
||||||
|
buf.insert ("A", DeepSlice (OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT,
|
||||||
|
(char *)(&pointers[2][0]-_dataWindow.min.x-start*width),
|
||||||
|
sizeof(float *),
|
||||||
|
sizeof(float *)*width,
|
||||||
|
sizeof(float) ));
|
||||||
|
|
||||||
|
|
||||||
|
size_t i =0;
|
||||||
|
for(FrameBuffer::ConstIterator qt = _outputFrameBuffer.begin();
|
||||||
|
qt != _outputFrameBuffer.end();
|
||||||
|
qt++)
|
||||||
|
{
|
||||||
|
int channel_in_source = _bufferMap[i];
|
||||||
|
if(channel_in_source>2)
|
||||||
|
{
|
||||||
|
// not dealt with yet (0,1,2 previously inserted)
|
||||||
|
pointers[channel_in_source].resize(pixelcount);
|
||||||
|
buf.insert (qt.name(),
|
||||||
|
DeepSlice (OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT,
|
||||||
|
(char *)(&pointers[channel_in_source][0]-_dataWindow.min.x-start*width),
|
||||||
|
sizeof(float *),
|
||||||
|
sizeof(float *)*width,
|
||||||
|
sizeof(float) ));
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::setCompositing(DeepCompositing* c)
|
||||||
|
{
|
||||||
|
_Data->_comp=c;
|
||||||
|
}
|
||||||
|
|
||||||
|
const IMATH_NAMESPACE::Box2i& CompositeDeepScanLine::dataWindow() const
|
||||||
|
{
|
||||||
|
return _Data->_dataWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::setFrameBuffer(const FrameBuffer& fr)
|
||||||
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// count channels; build map between channels in frame buffer
|
||||||
|
// and channels in internal buffers
|
||||||
|
//
|
||||||
|
|
||||||
|
_Data->_channels.resize(3);
|
||||||
|
_Data->_channels[0]="Z";
|
||||||
|
_Data->_channels[1]=_Data->_zback ? "ZBack" : "Z";
|
||||||
|
_Data->_channels[2]="A";
|
||||||
|
_Data->_bufferMap.resize(0);
|
||||||
|
|
||||||
|
for(FrameBuffer::ConstIterator q=fr.begin();q!=fr.end();q++)
|
||||||
|
{
|
||||||
|
string name(q.name());
|
||||||
|
if(name=="ZBack")
|
||||||
|
{
|
||||||
|
_Data->_bufferMap.push_back(1);
|
||||||
|
}else if(name=="Z")
|
||||||
|
{
|
||||||
|
_Data->_bufferMap.push_back(0);
|
||||||
|
}else if(name=="A")
|
||||||
|
{
|
||||||
|
_Data->_bufferMap.push_back(2);
|
||||||
|
}else{
|
||||||
|
_Data->_bufferMap.push_back(_Data->_channels.size());
|
||||||
|
_Data->_channels.push_back(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_Data->_outputFrameBuffer=fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
class LineCompositeTask : public Task
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
LineCompositeTask ( TaskGroup* group ,
|
||||||
|
CompositeDeepScanLine::Data * data,
|
||||||
|
int y,
|
||||||
|
int start,
|
||||||
|
vector<const char*>* names,
|
||||||
|
vector<vector< vector<float *> > >* pointers,
|
||||||
|
vector<unsigned int>* total_sizes,
|
||||||
|
vector<unsigned int>* num_sources
|
||||||
|
) : Task(group) ,
|
||||||
|
_Data(data),
|
||||||
|
_y(y),
|
||||||
|
_start(start),
|
||||||
|
_names(names),
|
||||||
|
_pointers(pointers),
|
||||||
|
_total_sizes(total_sizes),
|
||||||
|
_num_sources(num_sources)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~LineCompositeTask () {}
|
||||||
|
|
||||||
|
virtual void execute ();
|
||||||
|
CompositeDeepScanLine::Data* _Data;
|
||||||
|
int _y;
|
||||||
|
int _start;
|
||||||
|
vector<const char *>* _names;
|
||||||
|
vector<vector< vector<float *> > >* _pointers;
|
||||||
|
vector<unsigned int>* _total_sizes;
|
||||||
|
vector<unsigned int>* _num_sources;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
composite_line(int y,
|
||||||
|
int start,
|
||||||
|
CompositeDeepScanLine::Data * _Data,
|
||||||
|
vector<const char *> & names,
|
||||||
|
const vector<vector< vector<float *> > > & pointers,
|
||||||
|
const vector<unsigned int> & total_sizes,
|
||||||
|
const vector<unsigned int> & num_sources
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vector<float> output_pixel(names.size()); //the pixel we'll output to
|
||||||
|
vector<const float *> inputs(names.size());
|
||||||
|
DeepCompositing d; // fallback compositing engine
|
||||||
|
DeepCompositing * comp= _Data->_comp ? _Data->_comp : &d;
|
||||||
|
|
||||||
|
int pixel = (y-start)*(_Data->_dataWindow.max.x+1-_Data->_dataWindow.min.x);
|
||||||
|
|
||||||
|
for(int x=_Data->_dataWindow.min.x;x<=_Data->_dataWindow.max.x;x++)
|
||||||
|
{
|
||||||
|
// set inputs[] to point to the first sample of the first part of each channel
|
||||||
|
// if there's a zback, set all channel independently...
|
||||||
|
|
||||||
|
if(_Data->_zback)
|
||||||
|
{
|
||||||
|
|
||||||
|
for(size_t channel=0;channel<names.size();channel++)
|
||||||
|
{
|
||||||
|
inputs[channel]=pointers[0][channel][pixel];
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// otherwise, set 0 and 1 to point to Z
|
||||||
|
|
||||||
|
|
||||||
|
inputs[0]=pointers[0][0][pixel];
|
||||||
|
inputs[1]=pointers[0][0][pixel];
|
||||||
|
for(size_t channel=2;channel<names.size();channel++)
|
||||||
|
{
|
||||||
|
inputs[channel]=pointers[0][channel][pixel];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
comp->composite_pixel(&output_pixel[0],
|
||||||
|
&inputs[0],
|
||||||
|
&names[0],
|
||||||
|
names.size(),
|
||||||
|
total_sizes[pixel],
|
||||||
|
num_sources[pixel]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
size_t channel_number=0;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// write out composited value into internal frame buffer
|
||||||
|
//
|
||||||
|
for(FrameBuffer::Iterator it = _Data->_outputFrameBuffer.begin();it !=_Data->_outputFrameBuffer.end();it++)
|
||||||
|
{
|
||||||
|
|
||||||
|
float value = output_pixel[ _Data->_bufferMap[channel_number] ]; // value to write
|
||||||
|
|
||||||
|
|
||||||
|
// cast to half float if necessary
|
||||||
|
if(it.slice().type==OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT)
|
||||||
|
{
|
||||||
|
* (float *)(it.slice().base + y*it.slice().yStride + x*it.slice().xStride) = value;
|
||||||
|
}
|
||||||
|
else if(it.slice().type==HALF)
|
||||||
|
{
|
||||||
|
* (half *)(it.slice().base + y*it.slice().yStride + x*it.slice().xStride) = half(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
channel_number++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pixel++;
|
||||||
|
|
||||||
|
}// next pixel on row
|
||||||
|
}
|
||||||
|
|
||||||
|
void LineCompositeTask::execute()
|
||||||
|
{
|
||||||
|
composite_line(_y,_start,_Data,*_names,*_pointers,*_total_sizes,*_num_sources);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositeDeepScanLine::readPixels(int start, int end)
|
||||||
|
{
|
||||||
|
size_t parts = _Data->_file.size() + _Data->_part.size(); // total of files+parts
|
||||||
|
|
||||||
|
vector<DeepFrameBuffer> framebuffers(parts);
|
||||||
|
vector< vector<unsigned int> > counts(parts);
|
||||||
|
|
||||||
|
//
|
||||||
|
// for each part, a pointer to an array of channels
|
||||||
|
//
|
||||||
|
vector<vector< vector<float *> > > pointers(parts);
|
||||||
|
vector<const Header *> headers(parts);
|
||||||
|
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for(i=0;i<_Data->_file.size();i++)
|
||||||
|
{
|
||||||
|
headers[i] = &_Data->_file[i]->header();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t j=0;j<_Data->_part.size();j++)
|
||||||
|
{
|
||||||
|
headers[i+j] = &_Data->_part[j]->header();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(size_t i=0;i<parts;i++)
|
||||||
|
{
|
||||||
|
_Data->handleDeepFrameBuffer(framebuffers[i],counts[i],pointers[i],*headers[i],start,end);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// set frame buffers and read scanlines from all parts
|
||||||
|
// TODO what happens if SCANLINE not in data window?
|
||||||
|
//
|
||||||
|
|
||||||
|
{
|
||||||
|
size_t i=0;
|
||||||
|
for(i=0;i<_Data->_file.size();i++)
|
||||||
|
{
|
||||||
|
_Data->_file[i]->setFrameBuffer(framebuffers[i]);
|
||||||
|
_Data->_file[i]->readPixelSampleCounts(start,end);
|
||||||
|
}
|
||||||
|
for(size_t j=0;j<_Data->_part.size();j++)
|
||||||
|
{
|
||||||
|
_Data->_part[j]->setFrameBuffer(framebuffers[i+j]);
|
||||||
|
_Data->_part[j]->readPixelSampleCounts(start,end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// total width
|
||||||
|
//
|
||||||
|
|
||||||
|
size_t total_width = _Data->_dataWindow.size().x+1;
|
||||||
|
size_t total_pixels = total_width*(end-start+1);
|
||||||
|
vector<unsigned int> total_sizes(total_pixels);
|
||||||
|
vector<unsigned int> num_sources(total_pixels); //number of parts with non-zero sample count
|
||||||
|
|
||||||
|
size_t overall_sample_count=0; // sum of all samples in all images between start and end
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// accumulate pixel counts
|
||||||
|
//
|
||||||
|
for(size_t ptr=0;ptr<total_pixels;ptr++)
|
||||||
|
{
|
||||||
|
total_sizes[ptr]=0;
|
||||||
|
num_sources[ptr]=0;
|
||||||
|
for(size_t j=0;j<parts;j++)
|
||||||
|
{
|
||||||
|
total_sizes[ptr]+=counts[j][ptr];
|
||||||
|
if(counts[j][ptr]>0) num_sources[ptr]++;
|
||||||
|
}
|
||||||
|
overall_sample_count+=total_sizes[ptr];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// allocate arrays for pixel data
|
||||||
|
// samples array accessed as in pixels[channel][sample]
|
||||||
|
//
|
||||||
|
|
||||||
|
vector<vector<float> > samples( _Data->_channels.size() );
|
||||||
|
|
||||||
|
for(size_t channel=0;channel<_Data->_channels.size();channel++)
|
||||||
|
{
|
||||||
|
if( channel!=1 || _Data->_zback)
|
||||||
|
{
|
||||||
|
samples[channel].resize(overall_sample_count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t channel=0;channel<samples.size();channel++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if( channel!=1 || _Data->_zback)
|
||||||
|
{
|
||||||
|
|
||||||
|
samples[channel].resize(overall_sample_count);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// allocate pointers for channel data
|
||||||
|
//
|
||||||
|
|
||||||
|
size_t offset=0;
|
||||||
|
|
||||||
|
for(size_t pixel=0;pixel<total_pixels;pixel++)
|
||||||
|
{
|
||||||
|
for(size_t part=0 ; part<parts && offset<overall_sample_count ; part++ )
|
||||||
|
{
|
||||||
|
pointers[part][channel][pixel]=&samples[channel][offset];
|
||||||
|
offset+=counts[part][pixel];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// read data
|
||||||
|
//
|
||||||
|
|
||||||
|
for(size_t i=0;i<_Data->_file.size();i++)
|
||||||
|
{
|
||||||
|
_Data->_file[i]->readPixels(start,end);
|
||||||
|
}
|
||||||
|
for(size_t j=0;j<_Data->_part.size();j++)
|
||||||
|
{
|
||||||
|
_Data->_part[j]->readPixels(start,end);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// composite pixels and write back to framebuffer
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// turn vector of strings into array of char *
|
||||||
|
// and make sure 'ZBack' channel is correct
|
||||||
|
vector<const char *> names(_Data->_channels.size());
|
||||||
|
for(size_t i=0;i<names.size();i++)
|
||||||
|
{
|
||||||
|
names[i]=_Data->_channels[i].c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!_Data->_zback) names[1]=names[0]; // no zback channel, so make it point to z
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TaskGroup g;
|
||||||
|
for(int y=start;y<=end;y++)
|
||||||
|
{
|
||||||
|
ThreadPool::addGlobalTask(new LineCompositeTask(&g,_Data,y,start,&names,&pointers,&total_sizes,&num_sources));
|
||||||
|
}//next row
|
||||||
|
}
|
||||||
|
|
||||||
|
const FrameBuffer&
|
||||||
|
CompositeDeepScanLine::frameBuffer() const
|
||||||
|
{
|
||||||
|
return _Data->_outputFrameBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
152
3rdparty/openexr/IlmImf/ImfCompositeDeepScanLine.h
vendored
Normal file
152
3rdparty/openexr/IlmImf/ImfCompositeDeepScanLine.h
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Weta Digital Ltd
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Weta Digital nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
|
||||||
|
#define INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Class to composite deep samples into a frame buffer
|
||||||
|
// Initialise with a deep input part or deep inputfile
|
||||||
|
// (also supports multiple files and parts, and will
|
||||||
|
// composite them together, as long as their sizes and channelmaps agree)
|
||||||
|
//
|
||||||
|
// Then call setFrameBuffer, and readPixels, exactly as for reading
|
||||||
|
// regular scanline images.
|
||||||
|
//
|
||||||
|
// Restrictions - source file(s) must contain at least Z and alpha channels
|
||||||
|
// - if multiple files/parts are provided, sizes must match
|
||||||
|
// - all requested channels will be composited as premultiplied
|
||||||
|
// - only half and float channels can be requested
|
||||||
|
//
|
||||||
|
// This object should not be considered threadsafe
|
||||||
|
//
|
||||||
|
// The default compositing engine will give spurious results with overlapping
|
||||||
|
// volumetric samples - you may derive from DeepCompositing class, override the
|
||||||
|
// sort_pixel() and composite_pixel() functions, and pass an instance to
|
||||||
|
// setCompositing().
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include <ImathBox.h>
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class CompositeDeepScanLine
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IMF_EXPORT
|
||||||
|
CompositeDeepScanLine();
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~CompositeDeepScanLine();
|
||||||
|
|
||||||
|
/// set the source data as a part
|
||||||
|
///@note all parts must remain valid until after last interaction with DeepComp
|
||||||
|
IMF_EXPORT
|
||||||
|
void addSource(DeepScanLineInputPart * part);
|
||||||
|
|
||||||
|
/// set the source data as a file
|
||||||
|
///@note all file must remain valid until after last interaction with DeepComp
|
||||||
|
IMF_EXPORT
|
||||||
|
void addSource(DeepScanLineInputFile * file);
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// set the frame buffer for output values
|
||||||
|
// the buffers specified must be large enough
|
||||||
|
// to handle the dataWindow()
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer(const FrameBuffer & fr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// retrieve frameBuffer
|
||||||
|
//
|
||||||
|
////////////////////////////////////////
|
||||||
|
IMF_EXPORT
|
||||||
|
const FrameBuffer & frameBuffer() const;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// read scanlines start to end from the source(s)
|
||||||
|
// storing the result in the frame buffer provided
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels(int start,int end);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int sources() const; // return number of sources
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// retrieve the datawindow
|
||||||
|
// If multiple parts are specified, this will
|
||||||
|
// be the union of the dataWindow of all parts
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const IMATH_NAMESPACE::Box2i & dataWindow() const;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// override default sorting/compositing operation
|
||||||
|
// (otherwise an instance of the base class will be used)
|
||||||
|
//
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setCompositing(DeepCompositing *);
|
||||||
|
|
||||||
|
struct Data;
|
||||||
|
private :
|
||||||
|
struct Data *_Data;
|
||||||
|
|
||||||
|
CompositeDeepScanLine(const CompositeDeepScanLine &); // not implemented
|
||||||
|
const CompositeDeepScanLine & operator=(const CompositeDeepScanLine &); // not implemented
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
27
3rdparty/openexr/IlmImf/ImfCompression.h
vendored
27
3rdparty/openexr/IlmImf/ImfCompression.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -42,9 +42,9 @@
|
|||||||
// enum Compression
|
// enum Compression
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
enum Compression
|
enum Compression
|
||||||
{
|
{
|
||||||
@ -61,15 +61,24 @@ enum Compression
|
|||||||
PXR24_COMPRESSION = 5, // lossy 24-bit float compression
|
PXR24_COMPRESSION = 5, // lossy 24-bit float compression
|
||||||
|
|
||||||
B44_COMPRESSION = 6, // lossy 4-by-4 pixel block compression,
|
B44_COMPRESSION = 6, // lossy 4-by-4 pixel block compression,
|
||||||
// fixed compression rate
|
// fixed compression rate
|
||||||
|
|
||||||
B44A_COMPRESSION = 7, // lossy 4-by-4 pixel block compression,
|
B44A_COMPRESSION = 7, // lossy 4-by-4 pixel block compression,
|
||||||
// flat fields are compressed more
|
// flat fields are compressed more
|
||||||
|
|
||||||
|
DWAA_COMPRESSION = 8, // lossy DCT based compression, in blocks
|
||||||
|
// of 32 scanlines. More efficient for partial
|
||||||
|
// buffer access.
|
||||||
|
|
||||||
|
DWAB_COMPRESSION = 9, // lossy DCT based compression, in blocks
|
||||||
|
// of 256 scanlines. More efficient space
|
||||||
|
// wise and faster to decode full frames
|
||||||
|
// than DWAA_COMPRESSION.
|
||||||
|
|
||||||
NUM_COMPRESSION_METHODS // number of different compression methods
|
NUM_COMPRESSION_METHODS // number of different compression methods
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -40,10 +40,12 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfCompressionAttribute.h>
|
#include "ImfCompressionAttribute.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -56,7 +58,7 @@ CompressionAttribute::staticTypeName ()
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
CompressionAttribute::writeValueTo (OStream &os, int) const
|
CompressionAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
{
|
{
|
||||||
unsigned char tmp = _value;
|
unsigned char tmp = _value;
|
||||||
Xdr::write <StreamIO> (os, tmp);
|
Xdr::write <StreamIO> (os, tmp);
|
||||||
@ -65,7 +67,7 @@ CompressionAttribute::writeValueTo (OStream &os, int) const
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
CompressionAttribute::readValueFrom (IStream &is, int, int)
|
CompressionAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
{
|
{
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
Xdr::read <StreamIO> (is, tmp);
|
Xdr::read <StreamIO> (is, tmp);
|
||||||
@ -73,4 +75,4 @@ CompressionAttribute::readValueFrom (IStream &is, int, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,24 +43,22 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfAttribute.h"
|
||||||
#include <ImfCompression.h>
|
#include "ImfCompression.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
typedef TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::Compression> CompressionAttribute;
|
||||||
|
template <> IMF_EXPORT const char *CompressionAttribute::staticTypeName ();
|
||||||
|
template <> IMF_EXPORT void CompressionAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &,
|
||||||
|
int) const;
|
||||||
|
template <> IMF_EXPORT void CompressionAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
|
||||||
|
int,
|
||||||
|
int);
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<Compression> CompressionAttribute;
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
template <> const char *CompressionAttribute::staticTypeName ();
|
|
||||||
template <> void CompressionAttribute::writeValueTo (OStream &, int) const;
|
|
||||||
template <> void CompressionAttribute::readValueFrom (IStream &, int, int);
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfCompressionAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
118
3rdparty/openexr/IlmImf/ImfCompressor.cpp
vendored
118
3rdparty/openexr/IlmImf/ImfCompressor.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -40,17 +40,19 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfCompressor.h>
|
#include "ImfCompressor.h"
|
||||||
#include <ImfRleCompressor.h>
|
#include "ImfRleCompressor.h"
|
||||||
#include <ImfZipCompressor.h>
|
#include "ImfZipCompressor.h"
|
||||||
#include <ImfPizCompressor.h>
|
#include "ImfPizCompressor.h"
|
||||||
#include <ImfPxr24Compressor.h>
|
#include "ImfPxr24Compressor.h"
|
||||||
#include <ImfB44Compressor.h>
|
#include "ImfB44Compressor.h"
|
||||||
#include <ImfCheckedArithmetic.h>
|
#include "ImfDwaCompressor.h"
|
||||||
|
#include "ImfCheckedArithmetic.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
using Imath::Box2i;
|
using IMATH_NAMESPACE::Box2i;
|
||||||
|
|
||||||
|
|
||||||
Compressor::Compressor (const Header &hdr): _header (hdr) {}
|
Compressor::Compressor (const Header &hdr): _header (hdr) {}
|
||||||
@ -68,25 +70,25 @@ Compressor::format () const
|
|||||||
|
|
||||||
int
|
int
|
||||||
Compressor::compressTile (const char *inPtr,
|
Compressor::compressTile (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Box2i range,
|
Box2i range,
|
||||||
const char *&outPtr)
|
const char *&outPtr)
|
||||||
{
|
{
|
||||||
return compress (inPtr, inSize, range.min.y, outPtr);
|
return compress (inPtr, inSize, range.min.y, outPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Compressor::uncompressTile (const char *inPtr,
|
Compressor::uncompressTile (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Box2i range,
|
Box2i range,
|
||||||
const char *&outPtr)
|
const char *&outPtr)
|
||||||
{
|
{
|
||||||
return uncompress (inPtr, inSize, range.min.y, outPtr);
|
return uncompress (inPtr, inSize, range.min.y, outPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isValidCompression (Compression c)
|
isValidCompression (Compression c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
@ -99,15 +101,30 @@ isValidCompression (Compression c)
|
|||||||
case PXR24_COMPRESSION:
|
case PXR24_COMPRESSION:
|
||||||
case B44_COMPRESSION:
|
case B44_COMPRESSION:
|
||||||
case B44A_COMPRESSION:
|
case B44A_COMPRESSION:
|
||||||
|
case DWAA_COMPRESSION:
|
||||||
|
case DWAB_COMPRESSION:
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isValidDeepCompression(Compression c)
|
||||||
|
{
|
||||||
|
switch(c)
|
||||||
|
{
|
||||||
|
case NO_COMPRESSION:
|
||||||
|
case RLE_COMPRESSION:
|
||||||
|
case ZIPS_COMPRESSION:
|
||||||
|
return true;
|
||||||
|
default :
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Compressor *
|
Compressor *
|
||||||
newCompressor (Compression c, size_t maxScanLineSize, const Header &hdr)
|
newCompressor (Compression c, size_t maxScanLineSize, const Header &hdr)
|
||||||
@ -116,77 +133,94 @@ newCompressor (Compression c, size_t maxScanLineSize, const Header &hdr)
|
|||||||
{
|
{
|
||||||
case RLE_COMPRESSION:
|
case RLE_COMPRESSION:
|
||||||
|
|
||||||
return new RleCompressor (hdr, maxScanLineSize);
|
return new RleCompressor (hdr, maxScanLineSize);
|
||||||
|
|
||||||
case ZIPS_COMPRESSION:
|
case ZIPS_COMPRESSION:
|
||||||
|
|
||||||
return new ZipCompressor (hdr, maxScanLineSize, 1);
|
return new ZipCompressor (hdr, maxScanLineSize, 1);
|
||||||
|
|
||||||
case ZIP_COMPRESSION:
|
case ZIP_COMPRESSION:
|
||||||
|
|
||||||
return new ZipCompressor (hdr, maxScanLineSize, 16);
|
return new ZipCompressor (hdr, maxScanLineSize, 16);
|
||||||
|
|
||||||
case PIZ_COMPRESSION:
|
case PIZ_COMPRESSION:
|
||||||
|
|
||||||
return new PizCompressor (hdr, maxScanLineSize, 32);
|
return new PizCompressor (hdr, maxScanLineSize, 32);
|
||||||
|
|
||||||
case PXR24_COMPRESSION:
|
case PXR24_COMPRESSION:
|
||||||
|
|
||||||
return new Pxr24Compressor (hdr, maxScanLineSize, 16);
|
return new Pxr24Compressor (hdr, maxScanLineSize, 16);
|
||||||
|
|
||||||
case B44_COMPRESSION:
|
case B44_COMPRESSION:
|
||||||
|
|
||||||
return new B44Compressor (hdr, maxScanLineSize, 32, false);
|
return new B44Compressor (hdr, maxScanLineSize, 32, false);
|
||||||
|
|
||||||
case B44A_COMPRESSION:
|
case B44A_COMPRESSION:
|
||||||
|
|
||||||
return new B44Compressor (hdr, maxScanLineSize, 32, true);
|
return new B44Compressor (hdr, maxScanLineSize, 32, true);
|
||||||
|
|
||||||
|
case DWAA_COMPRESSION:
|
||||||
|
|
||||||
|
return new DwaCompressor (hdr, maxScanLineSize, 32,
|
||||||
|
DwaCompressor::STATIC_HUFFMAN);
|
||||||
|
|
||||||
|
case DWAB_COMPRESSION:
|
||||||
|
|
||||||
|
return new DwaCompressor (hdr, maxScanLineSize, 256,
|
||||||
|
DwaCompressor::STATIC_HUFFMAN);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Compressor *
|
Compressor *
|
||||||
newTileCompressor (Compression c,
|
newTileCompressor (Compression c,
|
||||||
size_t tileLineSize,
|
size_t tileLineSize,
|
||||||
size_t numTileLines,
|
size_t numTileLines,
|
||||||
const Header &hdr)
|
const Header &hdr)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case RLE_COMPRESSION:
|
case RLE_COMPRESSION:
|
||||||
|
|
||||||
return new RleCompressor (hdr, uiMult (tileLineSize, numTileLines));
|
return new RleCompressor (hdr, uiMult (tileLineSize, numTileLines));
|
||||||
|
|
||||||
case ZIPS_COMPRESSION:
|
case ZIPS_COMPRESSION:
|
||||||
case ZIP_COMPRESSION:
|
case ZIP_COMPRESSION:
|
||||||
|
|
||||||
return new ZipCompressor (hdr, tileLineSize, numTileLines);
|
return new ZipCompressor (hdr, tileLineSize, numTileLines);
|
||||||
|
|
||||||
case PIZ_COMPRESSION:
|
case PIZ_COMPRESSION:
|
||||||
|
|
||||||
return new PizCompressor (hdr, tileLineSize, numTileLines);
|
return new PizCompressor (hdr, tileLineSize, numTileLines);
|
||||||
|
|
||||||
case PXR24_COMPRESSION:
|
case PXR24_COMPRESSION:
|
||||||
|
|
||||||
return new Pxr24Compressor (hdr, tileLineSize, numTileLines);
|
return new Pxr24Compressor (hdr, tileLineSize, numTileLines);
|
||||||
|
|
||||||
case B44_COMPRESSION:
|
case B44_COMPRESSION:
|
||||||
|
|
||||||
return new B44Compressor (hdr, tileLineSize, numTileLines, false);
|
return new B44Compressor (hdr, tileLineSize, numTileLines, false);
|
||||||
|
|
||||||
case B44A_COMPRESSION:
|
case B44A_COMPRESSION:
|
||||||
|
|
||||||
return new B44Compressor (hdr, tileLineSize, numTileLines, true);
|
return new B44Compressor (hdr, tileLineSize, numTileLines, true);
|
||||||
|
|
||||||
|
case DWAA_COMPRESSION:
|
||||||
|
case DWAB_COMPRESSION:
|
||||||
|
|
||||||
|
return new DwaCompressor (hdr, tileLineSize, numTileLines,
|
||||||
|
DwaCompressor::DEFLATE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
|
||||||
|
79
3rdparty/openexr/IlmImf/ImfCompressor.h
vendored
79
3rdparty/openexr/IlmImf/ImfCompressor.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,13 +43,16 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfCompression.h>
|
#include "ImfCompression.h"
|
||||||
#include "ImathBox.h"
|
#include "ImathBox.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
class Header;
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
class Compressor
|
class Compressor
|
||||||
@ -61,6 +64,7 @@ class Compressor
|
|||||||
// that will be compressed or uncompressed
|
// that will be compressed or uncompressed
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Compressor (const Header &hdr);
|
Compressor (const Header &hdr);
|
||||||
|
|
||||||
|
|
||||||
@ -68,6 +72,7 @@ class Compressor
|
|||||||
// Destructor
|
// Destructor
|
||||||
//-----------
|
//-----------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual ~Compressor ();
|
virtual ~Compressor ();
|
||||||
|
|
||||||
|
|
||||||
@ -76,6 +81,7 @@ class Compressor
|
|||||||
// a single call to compress() and uncompress().
|
// a single call to compress() and uncompress().
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int numScanLines () const = 0;
|
virtual int numScanLines () const = 0;
|
||||||
|
|
||||||
|
|
||||||
@ -88,10 +94,11 @@ class Compressor
|
|||||||
|
|
||||||
enum Format
|
enum Format
|
||||||
{
|
{
|
||||||
NATIVE, // the machine's native format
|
NATIVE, // the machine's native format
|
||||||
XDR // Xdr format
|
XDR // Xdr format
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual Format format () const;
|
virtual Format format () const;
|
||||||
|
|
||||||
|
|
||||||
@ -155,15 +162,17 @@ class Compressor
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int compress (const char *inPtr,
|
virtual int compress (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
int minY,
|
int minY,
|
||||||
const char *&outPtr) = 0;
|
const char *&outPtr) = 0;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int compressTile (const char *inPtr,
|
virtual int compressTile (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Imath::Box2i range,
|
IMATH_NAMESPACE::Box2i range,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Uncompress an array of bytes that has been compressed by compress():
|
// Uncompress an array of bytes that has been compressed by compress():
|
||||||
@ -181,15 +190,17 @@ class Compressor
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int uncompress (const char *inPtr,
|
virtual int uncompress (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
int minY,
|
int minY,
|
||||||
const char *&outPtr) = 0;
|
const char *&outPtr) = 0;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
virtual int uncompressTile (const char *inPtr,
|
virtual int uncompressTile (const char *inPtr,
|
||||||
int inSize,
|
int inSize,
|
||||||
Imath::Box2i range,
|
IMATH_NAMESPACE::Box2i range,
|
||||||
const char *&outPtr);
|
const char *&outPtr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -201,7 +212,15 @@ class Compressor
|
|||||||
// Test if c is a valid compression type
|
// Test if c is a valid compression type
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
|
|
||||||
bool isValidCompression (Compression c);
|
IMF_EXPORT
|
||||||
|
bool isValidCompression (Compression c);
|
||||||
|
|
||||||
|
//--------------------------------------
|
||||||
|
// Test if c is valid for deep data
|
||||||
|
//--------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isValidDeepCompression (Compression c);
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
@ -212,16 +231,17 @@ bool isValidCompression (Compression c);
|
|||||||
//
|
//
|
||||||
// header Header of the input or output file whose
|
// header Header of the input or output file whose
|
||||||
// pixels will be compressed or uncompressed.
|
// pixels will be compressed or uncompressed.
|
||||||
//
|
//
|
||||||
// return value A pointer to a new Compressor object (it
|
// return value A pointer to a new Compressor object (it
|
||||||
// is the caller's responsibility to delete
|
// is the caller's responsibility to delete
|
||||||
// the object), or 0 (if c is NO_COMPRESSION).
|
// the object), or 0 (if c is NO_COMPRESSION).
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Compressor * newCompressor (Compression c,
|
Compressor * newCompressor (Compression c,
|
||||||
size_t maxScanLineSize,
|
size_t maxScanLineSize,
|
||||||
const Header &hdr);
|
const Header &hdr);
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
@ -241,12 +261,13 @@ Compressor * newCompressor (Compression c,
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Compressor * newTileCompressor (Compression c,
|
Compressor * newTileCompressor (Compression c,
|
||||||
size_t tileLineSize,
|
size_t tileLineSize,
|
||||||
size_t numTileLines,
|
size_t numTileLines,
|
||||||
const Header &hdr);
|
const Header &hdr);
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
42
3rdparty/openexr/IlmImf/ImfConvert.cpp
vendored
42
3rdparty/openexr/IlmImf/ImfConvert.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -40,10 +40,14 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfConvert.h>
|
#include "ImfConvert.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
namespace Imf {
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
@ -88,10 +92,10 @@ unsigned int
|
|||||||
halfToUint (half h)
|
halfToUint (half h)
|
||||||
{
|
{
|
||||||
if (h.isNegative() || h.isNan())
|
if (h.isNegative() || h.isNan())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (h.isInfinity())
|
if (h.isInfinity())
|
||||||
return UINT_MAX;
|
return UINT_MAX;
|
||||||
|
|
||||||
return (unsigned int) h;
|
return (unsigned int) h;
|
||||||
}
|
}
|
||||||
@ -101,39 +105,39 @@ unsigned int
|
|||||||
floatToUint (float f)
|
floatToUint (float f)
|
||||||
{
|
{
|
||||||
if (isNegative (f) || isNan (f))
|
if (isNegative (f) || isNan (f))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (isInfinity (f) || f > UINT_MAX)
|
if (isInfinity (f) || f > UINT_MAX)
|
||||||
return UINT_MAX;
|
return UINT_MAX;
|
||||||
|
|
||||||
return (unsigned int) f;
|
return (unsigned int) f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
half
|
half
|
||||||
uintToHalf (unsigned int ui)
|
uintToHalf (unsigned int ui)
|
||||||
{
|
{
|
||||||
if (ui > HALF_MAX)
|
if (ui > HALF_MAX)
|
||||||
return half::posInf();
|
return half::posInf();
|
||||||
|
|
||||||
return half (ui);
|
return half ((float) ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
half
|
half
|
||||||
floatToHalf (float f)
|
floatToHalf (float f)
|
||||||
{
|
{
|
||||||
if (isFinite (f))
|
if (isFinite (f))
|
||||||
{
|
{
|
||||||
if (f > HALF_MAX)
|
if (f > HALF_MAX)
|
||||||
return half::posInf();
|
return half::posInf();
|
||||||
|
|
||||||
if (f < -HALF_MAX)
|
if (f < -HALF_MAX)
|
||||||
return half::negInf();
|
return half::negInf();
|
||||||
}
|
}
|
||||||
|
|
||||||
return half (f);
|
return half (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
23
3rdparty/openexr/IlmImf/ImfConvert.h
vendored
23
3rdparty/openexr/IlmImf/ImfConvert.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -47,9 +47,11 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "half.h"
|
#include "half.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// Conversion from half or float to unsigned int:
|
// Conversion from half or float to unsigned int:
|
||||||
@ -70,8 +72,8 @@ namespace Imf {
|
|||||||
//
|
//
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
unsigned int halfToUint (half h);
|
IMF_EXPORT unsigned int halfToUint (half h);
|
||||||
unsigned int floatToUint (float f);
|
IMF_EXPORT unsigned int floatToUint (float f);
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
@ -95,10 +97,11 @@ unsigned int floatToUint (float f);
|
|||||||
//
|
//
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
half uintToHalf (unsigned int ui);
|
IMF_EXPORT half uintToHalf (unsigned int ui);
|
||||||
half floatToHalf (float f);
|
IMF_EXPORT half floatToHalf (float f);
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
110
3rdparty/openexr/IlmImf/ImfDeepCompositing.cpp
vendored
Normal file
110
3rdparty/openexr/IlmImf/ImfDeepCompositing.cpp
vendored
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Weta Digital Ltd
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Weta Digital nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfDeepCompositing.h"
|
||||||
|
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using std::sort;
|
||||||
|
using std::vector;
|
||||||
|
DeepCompositing::DeepCompositing()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
DeepCompositing::~DeepCompositing()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepCompositing::composite_pixel (float outputs[],
|
||||||
|
const float* inputs[],
|
||||||
|
const char*channel_names[],
|
||||||
|
int num_channels,
|
||||||
|
int num_samples,
|
||||||
|
int sources)
|
||||||
|
{
|
||||||
|
for(int i=0;i<num_channels;i++) outputs[i]=0.0;
|
||||||
|
// no samples? do nothing
|
||||||
|
if(num_samples==0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<int> sort_order;
|
||||||
|
if(sources>1)
|
||||||
|
{
|
||||||
|
sort_order.resize(num_samples);
|
||||||
|
for(int i=0;i<num_samples;i++) sort_order[i]=i;
|
||||||
|
sort(&sort_order[0],inputs,channel_names,num_channels,num_samples,sources);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(int i=0;i<num_samples;i++)
|
||||||
|
{
|
||||||
|
int s=(sources>1) ? sort_order[i] : i;
|
||||||
|
float alpha=outputs[2];
|
||||||
|
if(alpha>=1.0) return;
|
||||||
|
|
||||||
|
for(int c=0;c<num_channels;c++)
|
||||||
|
{
|
||||||
|
outputs[c]+=(1.0-alpha)*inputs[c][s];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct sort_helper
|
||||||
|
{
|
||||||
|
const float ** inputs;
|
||||||
|
bool operator() (int a,int b)
|
||||||
|
{
|
||||||
|
if(inputs[0][a] < inputs[0][b]) return true;
|
||||||
|
if(inputs[0][a] > inputs[0][b]) return false;
|
||||||
|
if(inputs[1][a] < inputs[1][b]) return true;
|
||||||
|
if(inputs[1][a] > inputs[1][b]) return false;
|
||||||
|
return a<b;
|
||||||
|
}
|
||||||
|
sort_helper(const float ** i) : inputs(i) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepCompositing::sort(int order[], const float* inputs[], const char* channel_names[], int num_channels, int num_samples, int sources)
|
||||||
|
{
|
||||||
|
std::sort(order+0,order+num_samples,sort_helper(inputs));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
136
3rdparty/openexr/IlmImf/ImfDeepCompositing.h
vendored
Normal file
136
3rdparty/openexr/IlmImf/ImfDeepCompositing.h
vendored
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Weta Digital Ltd
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Weta Digital nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEPCOMPOSITING_H
|
||||||
|
#define INCLUDED_IMF_DEEPCOMPOSITING_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Class to sort and composite deep samples into a frame buffer
|
||||||
|
// You may derive from this class to change the way that CompositeDeepScanLine
|
||||||
|
// and CompositeDeepTile combine samples together - pass an instance of your derived
|
||||||
|
// class to the compositing engine
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class DeepCompositing
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepCompositing();
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~DeepCompositing();
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
///
|
||||||
|
/// composite together the given channels
|
||||||
|
///
|
||||||
|
/// @param outputs - return array of pixel values -
|
||||||
|
/// @param inputs - arrays of input sample
|
||||||
|
/// @param channel_names - array of channel names for corresponding channels
|
||||||
|
/// @param num_channels - number of active channels (3 or greater)
|
||||||
|
/// @param num_samples - number of values in all input arrays
|
||||||
|
/// @param sources - number of different sources
|
||||||
|
///
|
||||||
|
/// each array input has num_channels entries: outputs[n] should be the composited
|
||||||
|
/// values in array inputs[n], whose name will be given by channel_names[n]
|
||||||
|
///
|
||||||
|
/// The channel ordering shall be as follows:
|
||||||
|
/// Position Channel
|
||||||
|
/// 0 Z
|
||||||
|
/// 1 ZBack (if no ZBack, then inputs[1]==inputs[0] and channel_names[1]==channel_names[0])
|
||||||
|
/// 2 A (alpha channel)
|
||||||
|
/// 3-n other channels - only channels in the frame buffer will appear here
|
||||||
|
///
|
||||||
|
/// since a Z and Alpha channel is required, and channel[1] is ZBack or another copy of Z
|
||||||
|
/// there will always be 3 or more channels.
|
||||||
|
///
|
||||||
|
/// The default implementation calls sort() if and only if more than one source is active,
|
||||||
|
/// composites all samples together using the Over operator from front to back,
|
||||||
|
/// stopping as soon as a sample with alpha=1 is found
|
||||||
|
/// It also blanks all outputs if num_samples==0
|
||||||
|
///
|
||||||
|
/// note - multiple threads may call composite_pixel simultaneously for different pixels
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual void composite_pixel(float outputs[],
|
||||||
|
const float * inputs[],
|
||||||
|
const char * channel_names[],
|
||||||
|
int num_channels,
|
||||||
|
int num_samples,
|
||||||
|
int sources
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
///
|
||||||
|
/// find the depth order for samples with given channel values
|
||||||
|
/// does not sort the values in-place. Instead it populates
|
||||||
|
/// array 'order' with the desired sorting order
|
||||||
|
///
|
||||||
|
/// the default operation sorts samples from front to back according to their Z channel
|
||||||
|
///
|
||||||
|
/// @param order - required output order. order[n] shall be the nth closest sample
|
||||||
|
/// @param inputs - arrays of input samples, one array per channel_name
|
||||||
|
/// @param channel_names - array of channel names for corresponding channels
|
||||||
|
/// @param num_channels - number of channels (3 or greater)
|
||||||
|
/// @param num_samples - number of samples in each array
|
||||||
|
/// @param sources - number of different sources the data arises from
|
||||||
|
///
|
||||||
|
/// the channel layout is identical to composite_pixel()
|
||||||
|
///
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual void sort(int order[],
|
||||||
|
const float * inputs[],
|
||||||
|
const char * channel_names[],
|
||||||
|
int num_channels,
|
||||||
|
int num_samples,
|
||||||
|
int sources);
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
230
3rdparty/openexr/IlmImf/ImfDeepFrameBuffer.cpp
vendored
Normal file
230
3rdparty/openexr/IlmImf/ImfDeepFrameBuffer.cpp
vendored
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfDeepFrameBuffer.h"
|
||||||
|
#include "Iex.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
DeepSlice::DeepSlice (PixelType t,
|
||||||
|
char *b,
|
||||||
|
size_t xst,
|
||||||
|
size_t yst,
|
||||||
|
size_t spst,
|
||||||
|
int xsm,
|
||||||
|
int ysm,
|
||||||
|
double fv,
|
||||||
|
bool xtc,
|
||||||
|
bool ytc)
|
||||||
|
:
|
||||||
|
Slice (t, b, xst, yst, xsm, ysm, fv, xtc, ytc),
|
||||||
|
sampleStride (spst)
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepFrameBuffer::insert (const char name[], const DeepSlice &slice)
|
||||||
|
{
|
||||||
|
if (name[0] == 0)
|
||||||
|
{
|
||||||
|
THROW (IEX_NAMESPACE::ArgExc,
|
||||||
|
"Frame buffer slice name cannot be an empty string.");
|
||||||
|
}
|
||||||
|
|
||||||
|
_map[name] = slice;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepFrameBuffer::insert (const string &name, const DeepSlice &slice)
|
||||||
|
{
|
||||||
|
insert (name.c_str(), slice);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepSlice &
|
||||||
|
DeepFrameBuffer::operator [] (const char name[])
|
||||||
|
{
|
||||||
|
SliceMap::iterator i = _map.find (name);
|
||||||
|
|
||||||
|
if (i == _map.end())
|
||||||
|
{
|
||||||
|
THROW (IEX_NAMESPACE::ArgExc,
|
||||||
|
"Cannot find frame buffer slice \"" << name << "\".");
|
||||||
|
}
|
||||||
|
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepSlice &
|
||||||
|
DeepFrameBuffer::operator [] (const char name[]) const
|
||||||
|
{
|
||||||
|
SliceMap::const_iterator i = _map.find (name);
|
||||||
|
|
||||||
|
if (i == _map.end())
|
||||||
|
{
|
||||||
|
THROW (IEX_NAMESPACE::ArgExc,
|
||||||
|
"Cannot find frame buffer slice \"" << name << "\".");
|
||||||
|
}
|
||||||
|
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepSlice &
|
||||||
|
DeepFrameBuffer::operator [] (const string &name)
|
||||||
|
{
|
||||||
|
return this->operator[] (name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepSlice &
|
||||||
|
DeepFrameBuffer::operator [] (const string &name) const
|
||||||
|
{
|
||||||
|
return this->operator[] (name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepSlice *
|
||||||
|
DeepFrameBuffer::findSlice (const char name[])
|
||||||
|
{
|
||||||
|
SliceMap::iterator i = _map.find (name);
|
||||||
|
return (i == _map.end())? 0: &i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepSlice *
|
||||||
|
DeepFrameBuffer::findSlice (const char name[]) const
|
||||||
|
{
|
||||||
|
SliceMap::const_iterator i = _map.find (name);
|
||||||
|
return (i == _map.end())? 0: &i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepSlice *
|
||||||
|
DeepFrameBuffer::findSlice (const string &name)
|
||||||
|
{
|
||||||
|
return findSlice (name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepSlice *
|
||||||
|
DeepFrameBuffer::findSlice (const string &name) const
|
||||||
|
{
|
||||||
|
return findSlice (name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::Iterator
|
||||||
|
DeepFrameBuffer::begin ()
|
||||||
|
{
|
||||||
|
return _map.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::ConstIterator
|
||||||
|
DeepFrameBuffer::begin () const
|
||||||
|
{
|
||||||
|
return _map.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::Iterator
|
||||||
|
DeepFrameBuffer::end ()
|
||||||
|
{
|
||||||
|
return _map.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::ConstIterator
|
||||||
|
DeepFrameBuffer::end () const
|
||||||
|
{
|
||||||
|
return _map.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::Iterator
|
||||||
|
DeepFrameBuffer::find (const char name[])
|
||||||
|
{
|
||||||
|
return _map.find (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::ConstIterator
|
||||||
|
DeepFrameBuffer::find (const char name[]) const
|
||||||
|
{
|
||||||
|
return _map.find (name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::Iterator
|
||||||
|
DeepFrameBuffer::find (const string &name)
|
||||||
|
{
|
||||||
|
return find (name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeepFrameBuffer::ConstIterator
|
||||||
|
DeepFrameBuffer::find (const string &name) const
|
||||||
|
{
|
||||||
|
return find (name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepFrameBuffer::insertSampleCountSlice(const Slice & slice)
|
||||||
|
{
|
||||||
|
if (slice.type != UINT)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::ArgExc("The type of sample count slice should be UINT.");
|
||||||
|
}
|
||||||
|
|
||||||
|
_sampleCounts = slice;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Slice &
|
||||||
|
DeepFrameBuffer::getSampleCountSlice() const
|
||||||
|
{
|
||||||
|
return _sampleCounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
373
3rdparty/openexr/IlmImf/ImfDeepFrameBuffer.h
vendored
Normal file
373
3rdparty/openexr/IlmImf/ImfDeepFrameBuffer.h
vendored
Normal file
@ -0,0 +1,373 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef IMFDEEPFRAMEBUFFER_H_
|
||||||
|
#define IMFDEEPFRAMEBUFFER_H_
|
||||||
|
|
||||||
|
#include "ImfFrameBuffer.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
// Description of a single deep slice of the frame buffer:
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
struct DeepSlice : public Slice
|
||||||
|
{
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
// The stride for each sample in this slice.
|
||||||
|
//
|
||||||
|
// Memory layout: The address of sample i in pixel (x, y) is
|
||||||
|
//
|
||||||
|
// base + (xp / xSampling) * xStride + (yp / ySampling) * yStride
|
||||||
|
// + i * sampleStride
|
||||||
|
//
|
||||||
|
// where xp and yp are computed as follows:
|
||||||
|
//
|
||||||
|
// * If we are reading or writing a scanline-based file:
|
||||||
|
//
|
||||||
|
// xp = x
|
||||||
|
// yp = y
|
||||||
|
//
|
||||||
|
// * If we are reading a tile whose upper left coorner is at (xt, yt):
|
||||||
|
//
|
||||||
|
// if xTileCoords is true then xp = x - xt, else xp = x
|
||||||
|
// if yTileCoords is true then yp = y - yt, else yp = y
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
int sampleStride;
|
||||||
|
|
||||||
|
//------------
|
||||||
|
// Constructor
|
||||||
|
//------------
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepSlice (PixelType type = HALF,
|
||||||
|
char * base = 0,
|
||||||
|
size_t xStride = 0,
|
||||||
|
size_t yStride = 0,
|
||||||
|
size_t sampleStride = 0,
|
||||||
|
int xSampling = 1,
|
||||||
|
int ySampling = 1,
|
||||||
|
double fillValue = 0.0,
|
||||||
|
bool xTileCoords = false,
|
||||||
|
bool yTileCoords = false);
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------
|
||||||
|
// DeepFrameBuffer.
|
||||||
|
//-----------------
|
||||||
|
|
||||||
|
class DeepFrameBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
//------------
|
||||||
|
// Add a slice
|
||||||
|
//------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void insert (const char name[],
|
||||||
|
const DeepSlice &slice);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void insert (const std::string &name,
|
||||||
|
const DeepSlice &slice);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
// Access to existing slices:
|
||||||
|
//
|
||||||
|
// [n] Returns a reference to the slice with name n.
|
||||||
|
// If no slice with name n exists, an IEX_NAMESPACE::ArgExc
|
||||||
|
// is thrown.
|
||||||
|
//
|
||||||
|
// findSlice(n) Returns a pointer to the slice with name n,
|
||||||
|
// or 0 if no slice with name n exists.
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepSlice & operator [] (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepSlice & operator [] (const char name[]) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepSlice & operator [] (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepSlice & operator [] (const std::string &name) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepSlice * findSlice (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepSlice * findSlice (const char name[]) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepSlice * findSlice (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepSlice * findSlice (const std::string &name) const;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------
|
||||||
|
// Iterator-style access to existing slices
|
||||||
|
//-----------------------------------------
|
||||||
|
|
||||||
|
typedef std::map <Name, DeepSlice> SliceMap;
|
||||||
|
|
||||||
|
class Iterator;
|
||||||
|
class ConstIterator;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator begin ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator begin () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator end ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator end () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator find (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator find (const char name[]) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator find (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator find (const std::string &name) const;
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
// Public function for accessing a sample count slice.
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void insertSampleCountSlice(const Slice & slice);
|
||||||
|
IMF_EXPORT
|
||||||
|
const Slice & getSampleCountSlice() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
SliceMap _map;
|
||||||
|
Slice _sampleCounts;
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------
|
||||||
|
// Iterators
|
||||||
|
//----------
|
||||||
|
|
||||||
|
class DeepFrameBuffer::Iterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator ();
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator (const DeepFrameBuffer::SliceMap::iterator &i);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator & operator ++ ();
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator operator ++ (int);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * name () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepSlice & slice () const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class DeepFrameBuffer::ConstIterator;
|
||||||
|
|
||||||
|
DeepFrameBuffer::SliceMap::iterator _i;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DeepFrameBuffer::ConstIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator (const DeepFrameBuffer::SliceMap::const_iterator &i);
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator (const DeepFrameBuffer::Iterator &other);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator & operator ++ ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator operator ++ (int);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * name () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepSlice & slice () const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend bool operator == (const ConstIterator &, const ConstIterator &);
|
||||||
|
friend bool operator != (const ConstIterator &, const ConstIterator &);
|
||||||
|
|
||||||
|
DeepFrameBuffer::SliceMap::const_iterator _i;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------
|
||||||
|
// Inline Functions
|
||||||
|
//-----------------
|
||||||
|
|
||||||
|
inline
|
||||||
|
DeepFrameBuffer::Iterator::Iterator (): _i()
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
DeepFrameBuffer::Iterator::Iterator (const DeepFrameBuffer::SliceMap::iterator &i):
|
||||||
|
_i (i)
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline DeepFrameBuffer::Iterator &
|
||||||
|
DeepFrameBuffer::Iterator::operator ++ ()
|
||||||
|
{
|
||||||
|
++_i;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline DeepFrameBuffer::Iterator
|
||||||
|
DeepFrameBuffer::Iterator::operator ++ (int)
|
||||||
|
{
|
||||||
|
Iterator tmp = *this;
|
||||||
|
++_i;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const char *
|
||||||
|
DeepFrameBuffer::Iterator::name () const
|
||||||
|
{
|
||||||
|
return *_i->first;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline DeepSlice &
|
||||||
|
DeepFrameBuffer::Iterator::slice () const
|
||||||
|
{
|
||||||
|
return _i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
DeepFrameBuffer::ConstIterator::ConstIterator (): _i()
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
DeepFrameBuffer::ConstIterator::ConstIterator
|
||||||
|
(const DeepFrameBuffer::SliceMap::const_iterator &i): _i (i)
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
DeepFrameBuffer::ConstIterator::ConstIterator (const DeepFrameBuffer::Iterator &other):
|
||||||
|
_i (other._i)
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
inline DeepFrameBuffer::ConstIterator &
|
||||||
|
DeepFrameBuffer::ConstIterator::operator ++ ()
|
||||||
|
{
|
||||||
|
++_i;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline DeepFrameBuffer::ConstIterator
|
||||||
|
DeepFrameBuffer::ConstIterator::operator ++ (int)
|
||||||
|
{
|
||||||
|
ConstIterator tmp = *this;
|
||||||
|
++_i;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const char *
|
||||||
|
DeepFrameBuffer::ConstIterator::name () const
|
||||||
|
{
|
||||||
|
return *_i->first;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const DeepSlice &
|
||||||
|
DeepFrameBuffer::ConstIterator::slice () const
|
||||||
|
{
|
||||||
|
return _i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
operator == (const DeepFrameBuffer::ConstIterator &x,
|
||||||
|
const DeepFrameBuffer::ConstIterator &y)
|
||||||
|
{
|
||||||
|
return x._i == y._i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
operator != (const DeepFrameBuffer::ConstIterator &x,
|
||||||
|
const DeepFrameBuffer::ConstIterator &y)
|
||||||
|
{
|
||||||
|
return !(x == y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* IMFDEEPFRAMEBUFFER_H_ */
|
96
3rdparty/openexr/IlmImf/ImfDeepImageState.h
vendored
Normal file
96
3rdparty/openexr/IlmImf/ImfDeepImageState.h
vendored
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2013, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEPIMAGESTATE_H
|
||||||
|
#define INCLUDED_IMF_DEEPIMAGESTATE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// enum DeepImageState -- describes how orderly the pixel data
|
||||||
|
// in a deep image are
|
||||||
|
//
|
||||||
|
// The samples in a deep image pixel may be sorted according to
|
||||||
|
// depth, and the sample depths or depth ranges may or may not
|
||||||
|
// overlap each other. A pixel is
|
||||||
|
//
|
||||||
|
// - SORTED if for every i and j with i < j
|
||||||
|
//
|
||||||
|
// (Z[i] < Z[j]) || (Z[i] == Z[j] && ZBack[i] < ZBack[j]),
|
||||||
|
//
|
||||||
|
// - NON_OVERLAPPING if for every i and j with i != j
|
||||||
|
//
|
||||||
|
// (Z[i] < Z[j] && ZBack[i] <= Z[j]) ||
|
||||||
|
// (Z[j] < Z[i] && ZBack[j] <= Z[i]) ||
|
||||||
|
// (Z[i] == Z[j] && ZBack[i] <= Z[i] & ZBack[j] > Z[j]) ||
|
||||||
|
// (Z[i] == Z[j] && ZBack[j] <= Z[j] & ZBack[i] > Z[i]),
|
||||||
|
//
|
||||||
|
// - TIDY if it is SORTED and NON_OVERLAPPING,
|
||||||
|
//
|
||||||
|
// - MESSY if it is neither SORTED nor NON_OVERLAPPING.
|
||||||
|
//
|
||||||
|
// A deep image is
|
||||||
|
//
|
||||||
|
// - MESSY if at least one of its pixels is MESSY,
|
||||||
|
// - SORTED if all of its pixels are SORTED,
|
||||||
|
// - NON_OVERLAPPING if all of its pixels are NON_OVERLAPPING,
|
||||||
|
// - TIDY if all of its pixels are TIDY.
|
||||||
|
//
|
||||||
|
// Note: the rather complicated definition of NON_OVERLAPPING prohibits
|
||||||
|
// overlapping volume samples, coincident point samples and point samples
|
||||||
|
// in the middle of a volume sample, but it does allow point samples at
|
||||||
|
// the front or back of a volume sample.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
enum DeepImageState
|
||||||
|
{
|
||||||
|
DIS_MESSY = 0,
|
||||||
|
DIS_SORTED = 1,
|
||||||
|
DIS_NON_OVERLAPPING = 2,
|
||||||
|
DIS_TIDY = 3,
|
||||||
|
|
||||||
|
DIS_NUMSTATES // Number of different image states
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
78
3rdparty/openexr/IlmImf/ImfDeepImageStateAttribute.cpp
vendored
Normal file
78
3rdparty/openexr/IlmImf/ImfDeepImageStateAttribute.cpp
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2013, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DeepImageStateAttribute
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <ImfDeepImageStateAttribute.h>
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
const char *
|
||||||
|
DeepImageStateAttribute::staticTypeName ()
|
||||||
|
{
|
||||||
|
return "deepImageState";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void
|
||||||
|
DeepImageStateAttribute::writeValueTo
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
|
{
|
||||||
|
unsigned char tmp = _value;
|
||||||
|
Xdr::write <StreamIO> (os, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void
|
||||||
|
DeepImageStateAttribute::readValueFrom
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
|
{
|
||||||
|
unsigned char tmp;
|
||||||
|
Xdr::read <StreamIO> (is, tmp);
|
||||||
|
_value = DeepImageState (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
68
3rdparty/openexr/IlmImf/ImfDeepImageStateAttribute.h
vendored
Normal file
68
3rdparty/openexr/IlmImf/ImfDeepImageStateAttribute.h
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2013, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEPIMAGESTATE_ATTRIBUTE_H
|
||||||
|
#define INCLUDED_IMF_DEEPIMAGESTATE_ATTRIBUTE_H
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DeepImageStateAttribute
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfAttribute.h"
|
||||||
|
#include "ImfDeepImageState.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
typedef TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::DeepImageState>
|
||||||
|
DeepImageStateAttribute;
|
||||||
|
|
||||||
|
template <> IMF_EXPORT const char *DeepImageStateAttribute::staticTypeName ();
|
||||||
|
|
||||||
|
template <> IMF_EXPORT
|
||||||
|
void DeepImageStateAttribute::writeValueTo
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &, int) const;
|
||||||
|
|
||||||
|
template <> IMF_EXPORT
|
||||||
|
void DeepImageStateAttribute::readValueFrom
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &, int, int);
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
2025
3rdparty/openexr/IlmImf/ImfDeepScanLineInputFile.cpp
vendored
Normal file
2025
3rdparty/openexr/IlmImf/ImfDeepScanLineInputFile.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
294
3rdparty/openexr/IlmImf/ImfDeepScanLineInputFile.h
vendored
Normal file
294
3rdparty/openexr/IlmImf/ImfDeepScanLineInputFile.h
vendored
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEP_SCAN_LINE_INPUT_FILE_H
|
||||||
|
#define INCLUDED_IMF_DEEP_SCAN_LINE_INPUT_FILE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DeepScanLineInputFile
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfThreading.h"
|
||||||
|
#include "ImfGenericInputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfDeepScanLineOutputFile.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
class DeepScanLineInputFile : public GenericInputFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//------------
|
||||||
|
// Constructor
|
||||||
|
//------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepScanLineInputFile (const char fileName[],
|
||||||
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepScanLineInputFile (const Header &header, OPENEXR_IMF_INTERNAL_NAMESPACE::IStream *is,
|
||||||
|
int version, /*version field from file*/
|
||||||
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------
|
||||||
|
// Destructor -- deallocates internal data
|
||||||
|
// structures, but does not close the file.
|
||||||
|
//-----------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~DeepScanLineInputFile ();
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------
|
||||||
|
// Access to the file format version
|
||||||
|
//----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int version () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the InputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the destination for the pixel
|
||||||
|
// data read from the file. The current frame buffer must be
|
||||||
|
// set at least once before readPixels() is called.
|
||||||
|
// The current frame buffer can be changed after each call
|
||||||
|
// to readPixels().
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Check if the file is complete:
|
||||||
|
//
|
||||||
|
// isComplete() returns true if all pixels in the data window are
|
||||||
|
// present in the input file, or false if any pixels are missing.
|
||||||
|
// (Another program may still be busy writing the file, or file
|
||||||
|
// writing may have been aborted prematurely.)
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isComplete () const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Read pixel data:
|
||||||
|
//
|
||||||
|
// readPixels(s1,s2) reads all scan lines with y coordinates
|
||||||
|
// in the interval [min (s1, s2), max (s1, s2)] from the file,
|
||||||
|
// and stores them in the current frame buffer.
|
||||||
|
//
|
||||||
|
// Both s1 and s2 must be within the interval
|
||||||
|
// [header().dataWindow().min.y, header.dataWindow().max.y]
|
||||||
|
//
|
||||||
|
// The scan lines can be read from the file in random order, and
|
||||||
|
// individual scan lines may be skipped or read multiple times.
|
||||||
|
// For maximum efficiency, the scan lines should be read in the
|
||||||
|
// order in which they were written to the file.
|
||||||
|
//
|
||||||
|
// readPixels(s) calls readPixels(s,s).
|
||||||
|
//
|
||||||
|
// If threading is enabled, readPixels (s1, s2) tries to perform
|
||||||
|
// decopmression of multiple scanlines in parallel.
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels (int scanLine1, int scanLine2);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels (int scanLine);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Extract pixel data from pre-read block
|
||||||
|
//
|
||||||
|
// readPixels(rawPixelData,frameBuffer,s1,s2) reads all scan lines with y coordinates
|
||||||
|
// in the interval [min (s1, s2), max (s1, s2)] from the data provided and
|
||||||
|
// stores them in the provided frameBuffer.
|
||||||
|
// the data can be obtained from a call to rawPixelData()
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Both s1 and s2 must be within the data specified
|
||||||
|
//
|
||||||
|
// you must provide a frameBuffer with a samplecountslice, which must have been read
|
||||||
|
// and the data valid - readPixels uses your sample count buffer to compute
|
||||||
|
// offsets to the data it needs
|
||||||
|
//
|
||||||
|
// This call does not block, and is thread safe for clients with an existing
|
||||||
|
// threading model. The InputFile's frameBuffer is not used in this call.
|
||||||
|
//
|
||||||
|
// This call is only provided for clients which have an existing threading model in place
|
||||||
|
// and unpredictable access patterns to the data.
|
||||||
|
// The fastest way to read an entire image is to enable threading,use setFrameBuffer then
|
||||||
|
// readPixels(header().dataWindow().min.y, header.dataWindow().max.y)
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels (const char * rawPixelData,
|
||||||
|
const DeepFrameBuffer & frameBuffer,
|
||||||
|
int scanLine1,
|
||||||
|
int scanLine2) const;
|
||||||
|
|
||||||
|
//----------------------------------------------
|
||||||
|
// Read a block of raw pixel data from the file,
|
||||||
|
// without uncompressing it (this function is
|
||||||
|
// used to implement OutputFile::copyPixels()).
|
||||||
|
// note: returns the entire payload of the relevant chunk of data, not including part number
|
||||||
|
// including compressed and uncompressed sizes
|
||||||
|
// on entry, if pixelDataSize is insufficiently large, no bytes are read (pixelData can safely be NULL)
|
||||||
|
// on exit, pixelDataSize is the number of bytes required to read the chunk
|
||||||
|
//
|
||||||
|
//----------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void rawPixelData (int firstScanLine,
|
||||||
|
char * pixelData,
|
||||||
|
Int64 &pixelDataSize);
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// firstScanLineInChunk() returns the row number of the first row that's stored in the
|
||||||
|
// same chunk as scanline y. Depending on the compression mode, this may not be the same as y
|
||||||
|
//
|
||||||
|
// lastScanLineInChunk() returns the row number of the last row that's stored in the same
|
||||||
|
// chunk as scanline y. Depending on the compression mode, this may not be the same as y.
|
||||||
|
// The last chunk in the file may be smaller than all the others
|
||||||
|
//
|
||||||
|
//------------------------------------------------
|
||||||
|
IMF_EXPORT
|
||||||
|
int firstScanLineInChunk(int y) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int lastScanLineInChunk (int y) const;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Read pixel sample counts into a slice in the frame buffer.
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(s1, s2) reads all the counts of
|
||||||
|
// pixel samples with y coordinates in the interval
|
||||||
|
// [min (s1, s2), max (s1, s2)] from the file, and stores
|
||||||
|
// them in the slice naming "sample count".
|
||||||
|
//
|
||||||
|
// Both s1 and s2 must be within the interval
|
||||||
|
// [header().dataWindow().min.y, header.dataWindow().max.y]
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (int scanline1,
|
||||||
|
int scanline2);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (int scanline);
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------
|
||||||
|
// Read pixel sample counts into the provided frameBuffer
|
||||||
|
// using a block read of data read by rawPixelData
|
||||||
|
// for multi-scanline compression schemes, you must decode the entire block
|
||||||
|
// so scanline1=firstScanLineInChunk(y) and scanline2=lastScanLineInChunk(y)
|
||||||
|
//
|
||||||
|
// This call does not block, and is thread safe for clients with an existing
|
||||||
|
// threading model. The InputFile's frameBuffer is not used in this call.
|
||||||
|
//
|
||||||
|
// The fastest way to read an entire image is to enable threading in OpenEXR, use setFrameBuffer then
|
||||||
|
// readPixelSampleCounts(header().dataWindow().min.y, header.dataWindow().max.y)
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (const char * rawdata ,
|
||||||
|
const DeepFrameBuffer & frameBuffer,
|
||||||
|
int scanLine1 ,
|
||||||
|
int scanLine2) const;
|
||||||
|
|
||||||
|
struct Data;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Data * _data;
|
||||||
|
|
||||||
|
DeepScanLineInputFile (InputPartData* part);
|
||||||
|
|
||||||
|
void initialize(const Header& header);
|
||||||
|
void compatibilityInitialize(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream & is);
|
||||||
|
void multiPartInitialize(InputPartData* part);
|
||||||
|
|
||||||
|
friend class InputFile;
|
||||||
|
friend class MultiPartInputFile;
|
||||||
|
friend void DeepScanLineOutputFile::copyPixels(DeepScanLineInputFile &);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
149
3rdparty/openexr/IlmImf/ImfDeepScanLineInputPart.cpp
vendored
Normal file
149
3rdparty/openexr/IlmImf/ImfDeepScanLineInputPart.cpp
vendored
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#include "ImfDeepScanLineInputPart.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
DeepScanLineInputPart::DeepScanLineInputPart(MultiPartInputFile& multiPartFile, int partNumber)
|
||||||
|
{
|
||||||
|
file = multiPartFile.getInputPart<DeepScanLineInputFile>(partNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
DeepScanLineInputPart::fileName () const
|
||||||
|
{
|
||||||
|
return file->fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Header &
|
||||||
|
DeepScanLineInputPart::header () const
|
||||||
|
{
|
||||||
|
return file->header();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepScanLineInputPart::version () const
|
||||||
|
{
|
||||||
|
return file->version();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::setFrameBuffer (const DeepFrameBuffer &frameBuffer)
|
||||||
|
{
|
||||||
|
file->setFrameBuffer(frameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepFrameBuffer &
|
||||||
|
DeepScanLineInputPart::frameBuffer () const
|
||||||
|
{
|
||||||
|
return file->frameBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DeepScanLineInputPart::isComplete () const
|
||||||
|
{
|
||||||
|
return file->isComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::readPixels (int scanLine1, int scanLine2)
|
||||||
|
{
|
||||||
|
file->readPixels(scanLine1, scanLine2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::readPixels (int scanLine)
|
||||||
|
{
|
||||||
|
file->readPixels(scanLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::rawPixelData (int firstScanLine,
|
||||||
|
char *pixelData,
|
||||||
|
Int64 &pixelDataSize)
|
||||||
|
{
|
||||||
|
file->rawPixelData(firstScanLine, pixelData, pixelDataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::readPixelSampleCounts(int scanline1,
|
||||||
|
int scanline2)
|
||||||
|
{
|
||||||
|
file->readPixelSampleCounts(scanline1, scanline2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::readPixelSampleCounts(int scanline)
|
||||||
|
{
|
||||||
|
file->readPixelSampleCounts(scanline);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepScanLineInputPart::firstScanLineInChunk(int y) const
|
||||||
|
{
|
||||||
|
return file->firstScanLineInChunk(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepScanLineInputPart::lastScanLineInChunk(int y) const
|
||||||
|
{
|
||||||
|
return file->lastScanLineInChunk(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::readPixels(const char* rawPixelData, const DeepFrameBuffer& frameBuffer, int scanLine1, int scanLine2) const
|
||||||
|
{
|
||||||
|
return file->readPixels(rawPixelData,frameBuffer,scanLine1,scanLine2);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
DeepScanLineInputPart::readPixelSampleCounts(const char* rawdata, const DeepFrameBuffer& frameBuffer, int scanLine1, int scanLine2) const
|
||||||
|
{
|
||||||
|
return file->readPixelSampleCounts(rawdata,frameBuffer,scanLine1,scanLine2);
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
197
3rdparty/openexr/IlmImf/ImfDeepScanLineInputPart.h
vendored
Normal file
197
3rdparty/openexr/IlmImf/ImfDeepScanLineInputPart.h
vendored
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IMFDEEPSCANLINEINPUTPART_H_
|
||||||
|
#define IMFDEEPSCANLINEINPUTPART_H_
|
||||||
|
|
||||||
|
#include "ImfMultiPartInputFile.h"
|
||||||
|
#include "ImfDeepScanLineInputFile.h"
|
||||||
|
#include "ImfDeepScanLineOutputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class DeepScanLineInputPart
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepScanLineInputPart(MultiPartInputFile& file, int partNumber);
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------
|
||||||
|
// Access to the file format version
|
||||||
|
//----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int version () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the InputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the destination for the pixel
|
||||||
|
// data read from the file. The current frame buffer must be
|
||||||
|
// set at least once before readPixels() is called.
|
||||||
|
// The current frame buffer can be changed after each call
|
||||||
|
// to readPixels().
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Check if the file is complete:
|
||||||
|
//
|
||||||
|
// isComplete() returns true if all pixels in the data window are
|
||||||
|
// present in the input file, or false if any pixels are missing.
|
||||||
|
// (Another program may still be busy writing the file, or file
|
||||||
|
// writing may have been aborted prematurely.)
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isComplete () const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Read pixel data:
|
||||||
|
//
|
||||||
|
// readPixels(s1,s2) reads all scan lines with y coordinates
|
||||||
|
// in the interval [min (s1, s2), max (s1, s2)] from the file,
|
||||||
|
// and stores them in the current frame buffer.
|
||||||
|
//
|
||||||
|
// Both s1 and s2 must be within the interval
|
||||||
|
// [header().dataWindow().min.y, header.dataWindow().max.y]
|
||||||
|
//
|
||||||
|
// The scan lines can be read from the file in random order, and
|
||||||
|
// individual scan lines may be skipped or read multiple times.
|
||||||
|
// For maximum efficiency, the scan lines should be read in the
|
||||||
|
// order in which they were written to the file.
|
||||||
|
//
|
||||||
|
// readPixels(s) calls readPixels(s,s).
|
||||||
|
//
|
||||||
|
// If threading is enabled, readPixels (s1, s2) tries to perform
|
||||||
|
// decopmression of multiple scanlines in parallel.
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels (int scanLine1, int scanLine2);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels (int scanLine);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixels (const char * rawPixelData,const DeepFrameBuffer & frameBuffer,
|
||||||
|
int scanLine1,int scanLine2) const;
|
||||||
|
|
||||||
|
//----------------------------------------------
|
||||||
|
// Read a block of raw pixel data from the file,
|
||||||
|
// without uncompressing it (this function is
|
||||||
|
// used to implement OutputFile::copyPixels()).
|
||||||
|
//----------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void rawPixelData (int firstScanLine,
|
||||||
|
char * pixelData,
|
||||||
|
Int64 &pixelDataSize);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Read pixel sample counts into a slice in the frame buffer.
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(s1, s2) reads all the counts of
|
||||||
|
// pixel samples with y coordinates in the interval
|
||||||
|
// [min (s1, s2), max (s1, s2)] from the file, and stores
|
||||||
|
// them in the slice naming "sample count".
|
||||||
|
//
|
||||||
|
// Both s1 and s2 must be within the interval
|
||||||
|
// [header().dataWindow().min.y, header.dataWindow().max.y]
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(s) calls readPixelSampleCounts(s,s).
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts(int scanline1,
|
||||||
|
int scanline2);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts(int scanline);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts( const char * rawdata , const DeepFrameBuffer & frameBuffer,
|
||||||
|
int scanLine1 , int scanLine2) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int firstScanLineInChunk(int y) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int lastScanLineInChunk (int y) const;
|
||||||
|
private:
|
||||||
|
DeepScanLineInputFile *file;
|
||||||
|
|
||||||
|
// needed for copyPixels
|
||||||
|
friend void DeepScanLineOutputFile::copyPixels(DeepScanLineInputPart &);
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* IMFDEEPSCANLINEINPUTPART_H_ */
|
1554
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputFile.cpp
vendored
Normal file
1554
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputFile.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
256
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputFile.h
vendored
Normal file
256
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputFile.h
vendored
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEP_SCAN_LINE_OUTPUT_FILE_H
|
||||||
|
#define INCLUDED_IMF_DEEP_SCAN_LINE_OUTPUT_FILE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DeepScanLineOutputFile
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfHeader.h"
|
||||||
|
#include "ImfFrameBuffer.h"
|
||||||
|
#include "ImfThreading.h"
|
||||||
|
#include "ImfGenericOutputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
struct PreviewRgba;
|
||||||
|
|
||||||
|
class DeepScanLineOutputFile : public GenericOutputFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Constructor -- opens the file and writes the file header.
|
||||||
|
// The file header is also copied into the DeepScanLineOutputFile
|
||||||
|
// object, and can later be accessed via the header() method.
|
||||||
|
// Destroying this DeepScanLineOutputFile object automatically closes
|
||||||
|
// the file.
|
||||||
|
//
|
||||||
|
// numThreads determines the number of threads that will be
|
||||||
|
// used to write the file (see ImfThreading.h).
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepScanLineOutputFile (const char fileName[], const Header &header,
|
||||||
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Constructor -- attaches the new DeepScanLineOutputFile object
|
||||||
|
// to a file that has already been opened, and writes the file header.
|
||||||
|
// The file header is also copied into the DeepScanLineOutputFile
|
||||||
|
// object, and can later be accessed via the header() method.
|
||||||
|
// Destroying this DeepScanLineOutputFile object does not automatically
|
||||||
|
// close the file.
|
||||||
|
//
|
||||||
|
// numThreads determines the number of threads that will be
|
||||||
|
// used to write the file (see ImfThreading.h).
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepScanLineOutputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, const Header &header,
|
||||||
|
int numThreads = globalThreadCount());
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// Destructor
|
||||||
|
//
|
||||||
|
// Destroying the DeepScanLineOutputFile object
|
||||||
|
// before writing all scan lines within the data
|
||||||
|
// window results in an incomplete file.
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~DeepScanLineOutputFile ();
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the OutputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the source of the pixel
|
||||||
|
// data written to the file. The current frame buffer
|
||||||
|
// must be set at least once before writePixels() is
|
||||||
|
// called. The current frame buffer can be changed
|
||||||
|
// after each call to writePixels.
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Write pixel data:
|
||||||
|
//
|
||||||
|
// writePixels(n) retrieves the next n scan lines worth of data from
|
||||||
|
// the current frame buffer, starting with the scan line indicated by
|
||||||
|
// currentScanLine(), and stores the data in the output file, and
|
||||||
|
// progressing in the direction indicated by header.lineOrder().
|
||||||
|
//
|
||||||
|
// To produce a complete and correct file, exactly m scan lines must
|
||||||
|
// be written, where m is equal to
|
||||||
|
// header().dataWindow().max.y - header().dataWindow().min.y + 1.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writePixels (int numScanLines = 1);
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Access to the current scan line:
|
||||||
|
//
|
||||||
|
// currentScanLine() returns the y coordinate of the first scan line
|
||||||
|
// that will be read from the current frame buffer during the next
|
||||||
|
// call to writePixels().
|
||||||
|
//
|
||||||
|
// If header.lineOrder() == INCREASING_Y:
|
||||||
|
//
|
||||||
|
// The current scan line before the first call to writePixels()
|
||||||
|
// is header().dataWindow().min.y. After writing each scan line,
|
||||||
|
// the current scan line is incremented by 1.
|
||||||
|
//
|
||||||
|
// If header.lineOrder() == DECREASING_Y:
|
||||||
|
//
|
||||||
|
// The current scan line before the first call to writePixels()
|
||||||
|
// is header().dataWindow().max.y. After writing each scan line,
|
||||||
|
// the current scan line is decremented by 1.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int currentScanLine () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Shortcut to copy all pixels from an InputFile into this file,
|
||||||
|
// without uncompressing and then recompressing the pixel data.
|
||||||
|
// This file's header must be compatible with the InputFile's
|
||||||
|
// header: The two header's "dataWindow", "compression",
|
||||||
|
// "lineOrder" and "channels" attributes must be the same.
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepScanLineInputFile &in);
|
||||||
|
|
||||||
|
// --------------------------------------------------------------
|
||||||
|
// Shortcut to copy pixels from a given part of a multipart file
|
||||||
|
// --------------------------------------------------------------
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepScanLineInputPart &in);
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Updating the preview image:
|
||||||
|
//
|
||||||
|
// updatePreviewImage() supplies a new set of pixels for the
|
||||||
|
// preview image attribute in the file's header. If the header
|
||||||
|
// does not contain a preview image, updatePreviewImage() throws
|
||||||
|
// an IEX_NAMESPACE::LogicExc.
|
||||||
|
//
|
||||||
|
// Note: updatePreviewImage() is necessary because images are
|
||||||
|
// often stored in a file incrementally, a few scan lines at a
|
||||||
|
// time, while the image is being generated. Since the preview
|
||||||
|
// image is an attribute in the file's header, it gets stored in
|
||||||
|
// the file as soon as the file is opened, but we may not know
|
||||||
|
// what the preview image should look like until we have written
|
||||||
|
// the last scan line of the main image.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void updatePreviewImage (const PreviewRgba newPixels[]);
|
||||||
|
|
||||||
|
|
||||||
|
struct Data;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Constructor -- attaches the OutputStreamMutex to the
|
||||||
|
// given one from MultiPartOutputFile. Set the previewPosition
|
||||||
|
// and lineOffsetsPosition which have been acquired from
|
||||||
|
// the constructor of MultiPartOutputFile as well.
|
||||||
|
//------------------------------------------------------------
|
||||||
|
DeepScanLineOutputFile (const OutputPartData* part);
|
||||||
|
|
||||||
|
DeepScanLineOutputFile (const DeepScanLineOutputFile &); // not implemented
|
||||||
|
DeepScanLineOutputFile & operator = (const DeepScanLineOutputFile &); // not implemented
|
||||||
|
|
||||||
|
void initialize (const Header &header);
|
||||||
|
void initializeLineBuffer();
|
||||||
|
|
||||||
|
Data * _data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
friend class MultiPartOutputFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
107
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputPart.cpp
vendored
Normal file
107
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputPart.cpp
vendored
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfDeepScanLineOutputPart.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
DeepScanLineOutputPart::DeepScanLineOutputPart(MultiPartOutputFile& multiPartFile, int partNumber)
|
||||||
|
{
|
||||||
|
file = multiPartFile.getOutputPart<DeepScanLineOutputFile>(partNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
DeepScanLineOutputPart::fileName () const
|
||||||
|
{
|
||||||
|
return file->fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Header &
|
||||||
|
DeepScanLineOutputPart::header () const
|
||||||
|
{
|
||||||
|
return file->header();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineOutputPart::setFrameBuffer (const DeepFrameBuffer &frameBuffer)
|
||||||
|
{
|
||||||
|
file->setFrameBuffer(frameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepFrameBuffer &
|
||||||
|
DeepScanLineOutputPart::frameBuffer () const
|
||||||
|
{
|
||||||
|
return file->frameBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineOutputPart::writePixels (int numScanLines)
|
||||||
|
{
|
||||||
|
file->writePixels(numScanLines);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepScanLineOutputPart::currentScanLine () const
|
||||||
|
{
|
||||||
|
return file->currentScanLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineOutputPart::copyPixels (DeepScanLineInputFile &in)
|
||||||
|
{
|
||||||
|
file->copyPixels(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineOutputPart::copyPixels (DeepScanLineInputPart &in)
|
||||||
|
{
|
||||||
|
file->copyPixels(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepScanLineOutputPart::updatePreviewImage (const PreviewRgba newPixels[])
|
||||||
|
{
|
||||||
|
file->updatePreviewImage(newPixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
|
178
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputPart.h
vendored
Normal file
178
3rdparty/openexr/IlmImf/ImfDeepScanLineOutputPart.h
vendored
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef IMFDEEPSCANLINEOUTPUTPART_H_
|
||||||
|
#define IMFDEEPSCANLINEOUTPUTPART_H_
|
||||||
|
|
||||||
|
#include "ImfDeepScanLineOutputFile.h"
|
||||||
|
#include "ImfMultiPartOutputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class DeepScanLineOutputPart
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepScanLineOutputPart(MultiPartOutputFile& multiPartFile, int partNumber);
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the OutputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the source of the pixel
|
||||||
|
// data written to the file. The current frame buffer
|
||||||
|
// must be set at least once before writePixels() is
|
||||||
|
// called. The current frame buffer can be changed
|
||||||
|
// after each call to writePixels.
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Write pixel data:
|
||||||
|
//
|
||||||
|
// writePixels(n) retrieves the next n scan lines worth of data from
|
||||||
|
// the current frame buffer, starting with the scan line indicated by
|
||||||
|
// currentScanLine(), and stores the data in the output file, and
|
||||||
|
// progressing in the direction indicated by header.lineOrder().
|
||||||
|
//
|
||||||
|
// To produce a complete and correct file, exactly m scan lines must
|
||||||
|
// be written, where m is equal to
|
||||||
|
// header().dataWindow().max.y - header().dataWindow().min.y + 1.
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writePixels (int numScanLines = 1);
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Access to the current scan line:
|
||||||
|
//
|
||||||
|
// currentScanLine() returns the y coordinate of the first scan line
|
||||||
|
// that will be read from the current frame buffer during the next
|
||||||
|
// call to writePixels().
|
||||||
|
//
|
||||||
|
// If header.lineOrder() == INCREASING_Y:
|
||||||
|
//
|
||||||
|
// The current scan line before the first call to writePixels()
|
||||||
|
// is header().dataWindow().min.y. After writing each scan line,
|
||||||
|
// the current scan line is incremented by 1.
|
||||||
|
//
|
||||||
|
// If header.lineOrder() == DECREASING_Y:
|
||||||
|
//
|
||||||
|
// The current scan line before the first call to writePixels()
|
||||||
|
// is header().dataWindow().max.y. After writing each scan line,
|
||||||
|
// the current scan line is decremented by 1.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int currentScanLine () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Shortcut to copy all pixels from an InputFile into this file,
|
||||||
|
// without uncompressing and then recompressing the pixel data.
|
||||||
|
// This file's header must be compatible with the InputFile's
|
||||||
|
// header: The two header's "dataWindow", "compression",
|
||||||
|
// "lineOrder" and "channels" attributes must be the same.
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepScanLineInputFile &in);
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepScanLineInputPart &in);
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Updating the preview image:
|
||||||
|
//
|
||||||
|
// updatePreviewImage() supplies a new set of pixels for the
|
||||||
|
// preview image attribute in the file's header. If the header
|
||||||
|
// does not contain a preview image, updatePreviewImage() throws
|
||||||
|
// an IEX_NAMESPACE::LogicExc.
|
||||||
|
//
|
||||||
|
// Note: updatePreviewImage() is necessary because images are
|
||||||
|
// often stored in a file incrementally, a few scan lines at a
|
||||||
|
// time, while the image is being generated. Since the preview
|
||||||
|
// image is an attribute in the file's header, it gets stored in
|
||||||
|
// the file as soon as the file is opened, but we may not know
|
||||||
|
// what the preview image should look like until we have written
|
||||||
|
// the last scan line of the main image.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void updatePreviewImage (const PreviewRgba newPixels[]);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DeepScanLineOutputFile* file;
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* IMFDEEPSCANLINEOUTPUTPART_H_ */
|
1979
3rdparty/openexr/IlmImf/ImfDeepTiledInputFile.cpp
vendored
Normal file
1979
3rdparty/openexr/IlmImf/ImfDeepTiledInputFile.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
472
3rdparty/openexr/IlmImf/ImfDeepTiledInputFile.h
vendored
Normal file
472
3rdparty/openexr/IlmImf/ImfDeepTiledInputFile.h
vendored
Normal file
@ -0,0 +1,472 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEP_TILED_INPUT_FILE_H
|
||||||
|
#define INCLUDED_IMF_DEEP_TILED_INPUT_FILE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DeepTiledInputFile
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfHeader.h"
|
||||||
|
#include "ImfFrameBuffer.h"
|
||||||
|
#include "ImathBox.h"
|
||||||
|
#include "ImfTileDescription.h"
|
||||||
|
#include "ImfThreading.h"
|
||||||
|
#include "ImfGenericInputFile.h"
|
||||||
|
#include "ImfDeepFrameBuffer.h"
|
||||||
|
#include "ImfDeepTiledOutputFile.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class DeepTiledInputFile : public GenericInputFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// A constructor that opens the file with the specified name, and
|
||||||
|
// reads the file header. The constructor throws an IEX_NAMESPACE::ArgExc
|
||||||
|
// exception if the file is not tiled.
|
||||||
|
// The numThreads parameter specifies how many worker threads this
|
||||||
|
// file will try to keep busy when decompressing individual tiles.
|
||||||
|
// Destroying TiledInputFile objects constructed with this constructor
|
||||||
|
// automatically closes the corresponding files.
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepTiledInputFile (const char fileName[],
|
||||||
|
int numThreads = globalThreadCount ());
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------
|
||||||
|
// A constructor that attaches the new TiledInputFile object
|
||||||
|
// to a file that has already been opened.
|
||||||
|
// Destroying TiledInputFile objects constructed with this
|
||||||
|
// constructor does not automatically close the corresponding
|
||||||
|
// files.
|
||||||
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepTiledInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThreads = globalThreadCount ());
|
||||||
|
|
||||||
|
|
||||||
|
//-----------
|
||||||
|
// Destructor
|
||||||
|
//-----------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~DeepTiledInputFile ();
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------
|
||||||
|
// Access to the file format version
|
||||||
|
//----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int version () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the TiledInputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the destination for the pixel
|
||||||
|
// data read from the file. The current frame buffer must be
|
||||||
|
// set at least once before readTile() is called.
|
||||||
|
// The current frame buffer can be changed after each call
|
||||||
|
// to readTile().
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Check if the file is complete:
|
||||||
|
//
|
||||||
|
// isComplete() returns true if all pixels in the data window
|
||||||
|
// (in all levels) are present in the input file, or false if
|
||||||
|
// any pixels are missing. (Another program may still be busy
|
||||||
|
// writing the file, or file writing may have been aborted
|
||||||
|
// prematurely.)
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isComplete () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// Utility functions:
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Multiresolution mode and tile size:
|
||||||
|
// The following functions return the xSize, ySize and mode
|
||||||
|
// fields of the file header's TileDescriptionAttribute.
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileXSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileYSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelMode levelMode () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelRoundingMode levelRoundingMode () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Number of levels:
|
||||||
|
//
|
||||||
|
// numXLevels() returns the file's number of levels in x direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL:
|
||||||
|
// return value is: 1
|
||||||
|
//
|
||||||
|
// if levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (max (w, h)) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (w) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// where
|
||||||
|
// w is the width of the image's data window, max.x - min.x + 1,
|
||||||
|
// y is the height of the image's data window, max.y - min.y + 1,
|
||||||
|
// and rfunc(x) is either floor(x), or ceil(x), depending on
|
||||||
|
// whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP.
|
||||||
|
//
|
||||||
|
// numYLevels() returns the file's number of levels in y direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (h) / log (2)) + 1
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numLevels() is a convenience function for use with
|
||||||
|
// MIPMAP_LEVELS files.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// an IEX_NAMESPACE::LogicExc exception is thrown
|
||||||
|
//
|
||||||
|
// isValidLevel(lx, ly) returns true if the file contains
|
||||||
|
// a level with level number (lx, ly), false if not.
|
||||||
|
//
|
||||||
|
// totalTiles() returns the total number of tiles in the image
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isValidLevel (int lx, int ly) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
size_t totalTiles() const;
|
||||||
|
|
||||||
|
//----------------------------------------------------------
|
||||||
|
// Dimensions of a level:
|
||||||
|
//
|
||||||
|
// levelWidth(lx) returns the width of a level with level
|
||||||
|
// number (lx, *), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (w / pow (2, lx)))
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// levelHeight(ly) returns the height of a level with level
|
||||||
|
// number (*, ly), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (h / pow (2, ly)))
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelWidth (int lx) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelHeight (int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Number of tiles:
|
||||||
|
//
|
||||||
|
// numXTiles(lx) returns the number of tiles in x direction
|
||||||
|
// that cover a level with level number (lx, *), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelWidth(lx) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numYTiles(ly) returns the number of tiles in y direction
|
||||||
|
// that cover a level with level number (*, ly), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelHeight(ly) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXTiles (int lx = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYTiles (int ly = 0) const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Level pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(lx, ly) returns a 2-dimensional region of
|
||||||
|
// valid pixel coordinates for a level with level number (lx, ly)
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x, dataWindow.min.y)
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + levelWidth(lx) - 1,
|
||||||
|
// dataWindow.min.y + levelHeight(ly) - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(level) is a convenience function used
|
||||||
|
// for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForLevel(level, level).
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int l = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Tile pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional
|
||||||
|
// region of valid pixel coordinates for a tile with tile coordinates
|
||||||
|
// (dx,dy) and level number (lx, ly).
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x + dx * tileXSize(),
|
||||||
|
// dataWindow.min.y + dy * tileYSize())
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + (dx + 1) * tileXSize() - 1,
|
||||||
|
// dataWindow.min.y + (dy + 1) * tileYSize() - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, level) is a convenience function
|
||||||
|
// used for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy, int l = 0) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Read pixel data:
|
||||||
|
//
|
||||||
|
// readTile(dx, dy, lx, ly) reads the tile with tile
|
||||||
|
// coordinates (dx, dy), and level number (lx, ly),
|
||||||
|
// and stores it in the current frame buffer.
|
||||||
|
//
|
||||||
|
// dx must lie in the interval [0, numXTiles(lx)-1]
|
||||||
|
// dy must lie in the interval [0, numYTiles(ly)-1]
|
||||||
|
//
|
||||||
|
// lx must lie in the interval [0, numXLevels()-1]
|
||||||
|
// ly must lie in the inverval [0, numYLevels()-1]
|
||||||
|
//
|
||||||
|
// readTile(dx, dy, level) is a convenience function used
|
||||||
|
// for ONE_LEVEL and MIPMAP_LEVELS files. It calls
|
||||||
|
// readTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
// The two readTiles(dx1, dx2, dy1, dy2, ...) functions allow
|
||||||
|
// reading multiple tiles at once. If multi-threading is used
|
||||||
|
// the multiple tiles are read concurrently.
|
||||||
|
//
|
||||||
|
// Pixels that are outside the pixel coordinate range for the
|
||||||
|
// tile's level, are never accessed by readTile().
|
||||||
|
//
|
||||||
|
// Attempting to access a tile that is not present in the file
|
||||||
|
// throws an InputExc exception.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTile (int dx, int dy, int l = 0);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTile (int dx, int dy, int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int l = 0);
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// Read a tile of raw pixel data from the file,
|
||||||
|
// without uncompressing it (this function is
|
||||||
|
// used to implement TiledOutputFile::copyPixels()).
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void rawTileData (int &dx, int &dy,
|
||||||
|
int &lx, int &ly,
|
||||||
|
char *pixelData,
|
||||||
|
Int64 &dataSize) const;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Read pixel sample counts into a slice in the frame buffer.
|
||||||
|
//
|
||||||
|
// readPixelSampleCount(dx, dy, lx, ly) reads the sample counts
|
||||||
|
// for tile (dx, dy) in level (lx, ly).
|
||||||
|
//
|
||||||
|
// readPixelSampleCount(dx, dy, l) calls
|
||||||
|
// readPixelSampleCount(dx, dy, lx = l, ly = l)
|
||||||
|
//
|
||||||
|
// dx must lie in the interval [0, numXTiles(lx)-1]
|
||||||
|
// dy must lie in the interval [0, numYTiles(ly)-1]
|
||||||
|
//
|
||||||
|
// lx must lie in the interval [0, numXLevels()-1]
|
||||||
|
// ly must lie in the inverval [0, numYLevels()-1]
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(dx1, dx2, dy1, dy2, lx, ly) reads all
|
||||||
|
// the sample counts for tiles within range
|
||||||
|
// [(min(dx1, dx2), min(dy1, dy2))...(max(dx1, dx2), max(dy1, dy2)],
|
||||||
|
// and on level (lx, ly)
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(dx1, dx2, dy1, dy2, l) calls
|
||||||
|
// readPixelSampleCounts(dx1, dx2, dy1, dy2, lx = l, ly = l).
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCount (int dx, int dy, int l = 0);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCount (int dx, int dy, int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (int dx1, int dx2,
|
||||||
|
int dy1, int dy2,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (int dx1, int dx2,
|
||||||
|
int dy1, int dy2,
|
||||||
|
int l = 0);
|
||||||
|
|
||||||
|
struct Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class InputFile;
|
||||||
|
friend class MultiPartInputFile;
|
||||||
|
|
||||||
|
DeepTiledInputFile (InputPartData* part);
|
||||||
|
|
||||||
|
DeepTiledInputFile (const DeepTiledInputFile &); // not implemented
|
||||||
|
DeepTiledInputFile & operator = (const DeepTiledInputFile &); // not implemented
|
||||||
|
|
||||||
|
DeepTiledInputFile (const Header &header, OPENEXR_IMF_INTERNAL_NAMESPACE::IStream *is, int version,
|
||||||
|
int numThreads);
|
||||||
|
|
||||||
|
void initialize ();
|
||||||
|
void multiPartInitialize(InputPartData* part);
|
||||||
|
void compatibilityInitialize(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is);
|
||||||
|
|
||||||
|
bool isValidTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
size_t bytesPerLineForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
void getTileOrder(int dx[],int dy[],int lx[],int ly[]) const;
|
||||||
|
|
||||||
|
|
||||||
|
Data * _data;
|
||||||
|
|
||||||
|
|
||||||
|
// needed for copyPixels
|
||||||
|
friend void DeepTiledOutputFile::copyPixels(DeepTiledInputFile &);
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
273
3rdparty/openexr/IlmImf/ImfDeepTiledInputPart.cpp
vendored
Normal file
273
3rdparty/openexr/IlmImf/ImfDeepTiledInputPart.cpp
vendored
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#include "ImfDeepTiledInputPart.h"
|
||||||
|
#include "ImfMultiPartInputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
DeepTiledInputPart::DeepTiledInputPart(MultiPartInputFile& multiPartFile, int partNumber)
|
||||||
|
{
|
||||||
|
file = multiPartFile.getInputPart<DeepTiledInputFile>(partNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
DeepTiledInputPart::fileName () const
|
||||||
|
{
|
||||||
|
return file->fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Header &
|
||||||
|
DeepTiledInputPart::header () const
|
||||||
|
{
|
||||||
|
return file->header();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::version () const
|
||||||
|
{
|
||||||
|
return file->version();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::setFrameBuffer (const DeepFrameBuffer &frameBuffer)
|
||||||
|
{
|
||||||
|
file->setFrameBuffer(frameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepFrameBuffer &
|
||||||
|
DeepTiledInputPart::frameBuffer () const
|
||||||
|
{
|
||||||
|
return file->frameBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DeepTiledInputPart::isComplete () const
|
||||||
|
{
|
||||||
|
return file->isComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
DeepTiledInputPart::tileXSize () const
|
||||||
|
{
|
||||||
|
return file->tileXSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
DeepTiledInputPart::tileYSize () const
|
||||||
|
{
|
||||||
|
return file->tileYSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LevelMode
|
||||||
|
DeepTiledInputPart::levelMode () const
|
||||||
|
{
|
||||||
|
return file->levelMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LevelRoundingMode
|
||||||
|
DeepTiledInputPart::levelRoundingMode () const
|
||||||
|
{
|
||||||
|
return file->levelRoundingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::numLevels () const
|
||||||
|
{
|
||||||
|
return file->numLevels();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::numXLevels () const
|
||||||
|
{
|
||||||
|
return file->numXLevels();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::numYLevels () const
|
||||||
|
{
|
||||||
|
return file->numYLevels();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DeepTiledInputPart::isValidLevel (int lx, int ly) const
|
||||||
|
{
|
||||||
|
return file->isValidLevel(lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::levelWidth (int lx) const
|
||||||
|
{
|
||||||
|
return file->levelWidth(lx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::levelHeight (int ly) const
|
||||||
|
{
|
||||||
|
return file->levelHeight(ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::numXTiles (int lx) const
|
||||||
|
{
|
||||||
|
return file->numXTiles(lx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledInputPart::numYTiles (int ly) const
|
||||||
|
{
|
||||||
|
return file->numYTiles(ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledInputPart::dataWindowForLevel (int l) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForLevel(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledInputPart::dataWindowForLevel (int lx, int ly) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForLevel(lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledInputPart::dataWindowForTile (int dx, int dy, int l) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForTile(dx, dy, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledInputPart::dataWindowForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForTile(dx, dy, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readTile (int dx, int dy, int l)
|
||||||
|
{
|
||||||
|
file->readTile(dx, dy, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readTile (int dx, int dy, int lx, int ly)
|
||||||
|
{
|
||||||
|
file->readTile(dx, dy, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int lx, int ly)
|
||||||
|
{
|
||||||
|
file->readTiles(dx1, dx2, dy1, dy2, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int l)
|
||||||
|
{
|
||||||
|
file->readTiles(dx1, dx2, dy1, dy2, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::rawTileData (int &dx, int &dy,
|
||||||
|
int &lx, int &ly,
|
||||||
|
char * pixelData,
|
||||||
|
Int64 & dataSize) const
|
||||||
|
{
|
||||||
|
file->rawTileData(dx, dy, lx, ly, pixelData, dataSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readPixelSampleCount (int dx, int dy, int l)
|
||||||
|
{
|
||||||
|
file->readPixelSampleCount(dx, dy, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readPixelSampleCount (int dx, int dy, int lx, int ly)
|
||||||
|
{
|
||||||
|
file->readPixelSampleCount(dx, dy, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readPixelSampleCounts (int dx1, int dx2,
|
||||||
|
int dy1, int dy2,
|
||||||
|
int lx, int ly)
|
||||||
|
{
|
||||||
|
file->readPixelSampleCounts(dx1, dx2, dy1, dy2, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledInputPart::readPixelSampleCounts (int dx1, int dx2,
|
||||||
|
int dy1, int dy2,
|
||||||
|
int l)
|
||||||
|
{
|
||||||
|
file->readPixelSampleCounts(dx1, dx2, dy1, dy2, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
394
3rdparty/openexr/IlmImf/ImfDeepTiledInputPart.h
vendored
Normal file
394
3rdparty/openexr/IlmImf/ImfDeepTiledInputPart.h
vendored
Normal file
@ -0,0 +1,394 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IMFDEEPTILEDINPUTPART_H_
|
||||||
|
#define IMFDEEPTILEDINPUTPART_H_
|
||||||
|
|
||||||
|
#include "ImfDeepTiledInputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class DeepTiledInputPart
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepTiledInputPart(MultiPartInputFile& multiPartFile, int partNumber);
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------
|
||||||
|
// Access to the file format version
|
||||||
|
//----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int version () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the TiledInputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the destination for the pixel
|
||||||
|
// data read from the file. The current frame buffer must be
|
||||||
|
// set at least once before readTile() is called.
|
||||||
|
// The current frame buffer can be changed after each call
|
||||||
|
// to readTile().
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Check if the file is complete:
|
||||||
|
//
|
||||||
|
// isComplete() returns true if all pixels in the data window
|
||||||
|
// (in all levels) are present in the input file, or false if
|
||||||
|
// any pixels are missing. (Another program may still be busy
|
||||||
|
// writing the file, or file writing may have been aborted
|
||||||
|
// prematurely.)
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isComplete () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// Utility functions:
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Multiresolution mode and tile size:
|
||||||
|
// The following functions return the xSize, ySize and mode
|
||||||
|
// fields of the file header's TileDescriptionAttribute.
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileXSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileYSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelMode levelMode () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelRoundingMode levelRoundingMode () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Number of levels:
|
||||||
|
//
|
||||||
|
// numXLevels() returns the file's number of levels in x direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL:
|
||||||
|
// return value is: 1
|
||||||
|
//
|
||||||
|
// if levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (max (w, h)) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (w) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// where
|
||||||
|
// w is the width of the image's data window, max.x - min.x + 1,
|
||||||
|
// y is the height of the image's data window, max.y - min.y + 1,
|
||||||
|
// and rfunc(x) is either floor(x), or ceil(x), depending on
|
||||||
|
// whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP.
|
||||||
|
//
|
||||||
|
// numYLevels() returns the file's number of levels in y direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (h) / log (2)) + 1
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numLevels() is a convenience function for use with
|
||||||
|
// MIPMAP_LEVELS files.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// an IEX_NAMESPACE::LogicExc exception is thrown
|
||||||
|
//
|
||||||
|
// isValidLevel(lx, ly) returns true if the file contains
|
||||||
|
// a level with level number (lx, ly), false if not.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isValidLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------
|
||||||
|
// Dimensions of a level:
|
||||||
|
//
|
||||||
|
// levelWidth(lx) returns the width of a level with level
|
||||||
|
// number (lx, *), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (w / pow (2, lx)))
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// levelHeight(ly) returns the height of a level with level
|
||||||
|
// number (*, ly), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (h / pow (2, ly)))
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelWidth (int lx) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelHeight (int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Number of tiles:
|
||||||
|
//
|
||||||
|
// numXTiles(lx) returns the number of tiles in x direction
|
||||||
|
// that cover a level with level number (lx, *), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelWidth(lx) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numYTiles(ly) returns the number of tiles in y direction
|
||||||
|
// that cover a level with level number (*, ly), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelHeight(ly) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXTiles (int lx = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYTiles (int ly = 0) const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Level pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(lx, ly) returns a 2-dimensional region of
|
||||||
|
// valid pixel coordinates for a level with level number (lx, ly)
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x, dataWindow.min.y)
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + levelWidth(lx) - 1,
|
||||||
|
// dataWindow.min.y + levelHeight(ly) - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(level) is a convenience function used
|
||||||
|
// for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForLevel(level, level).
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int l = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Tile pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional
|
||||||
|
// region of valid pixel coordinates for a tile with tile coordinates
|
||||||
|
// (dx,dy) and level number (lx, ly).
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x + dx * tileXSize(),
|
||||||
|
// dataWindow.min.y + dy * tileYSize())
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + (dx + 1) * tileXSize() - 1,
|
||||||
|
// dataWindow.min.y + (dy + 1) * tileYSize() - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, level) is a convenience function
|
||||||
|
// used for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy, int l = 0) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
//------------------------------------------------------------
|
||||||
|
// Read pixel data:
|
||||||
|
//
|
||||||
|
// readTile(dx, dy, lx, ly) reads the tile with tile
|
||||||
|
// coordinates (dx, dy), and level number (lx, ly),
|
||||||
|
// and stores it in the current frame buffer.
|
||||||
|
//
|
||||||
|
// dx must lie in the interval [0, numXTiles(lx)-1]
|
||||||
|
// dy must lie in the interval [0, numYTiles(ly)-1]
|
||||||
|
//
|
||||||
|
// lx must lie in the interval [0, numXLevels()-1]
|
||||||
|
// ly must lie in the inverval [0, numYLevels()-1]
|
||||||
|
//
|
||||||
|
// readTile(dx, dy, level) is a convenience function used
|
||||||
|
// for ONE_LEVEL and MIPMAP_LEVELS files. It calls
|
||||||
|
// readTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
// The two readTiles(dx1, dx2, dy1, dy2, ...) functions allow
|
||||||
|
// reading multiple tiles at once. If multi-threading is used
|
||||||
|
// the multiple tiles are read concurrently.
|
||||||
|
//
|
||||||
|
// Pixels that are outside the pixel coordinate range for the
|
||||||
|
// tile's level, are never accessed by readTile().
|
||||||
|
//
|
||||||
|
// Attempting to access a tile that is not present in the file
|
||||||
|
// throws an InputExc exception.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTile (int dx, int dy, int l = 0);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTile (int dx, int dy, int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int l = 0);
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// Read a tile of raw pixel data from the file,
|
||||||
|
// without uncompressing it (this function is
|
||||||
|
// used to implement TiledOutputFile::copyPixels()).
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void rawTileData (int &dx, int &dy,
|
||||||
|
int &lx, int &ly,
|
||||||
|
char *data,
|
||||||
|
Int64 &dataSize
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Read pixel sample counts into a slice in the frame buffer.
|
||||||
|
//
|
||||||
|
// readPixelSampleCount(dx, dy, lx, ly) reads the sample counts
|
||||||
|
// for tile (dx, dy) in level (lx, ly).
|
||||||
|
//
|
||||||
|
// readPixelSampleCount(dx, dy, l) calls
|
||||||
|
// readPixelSampleCount(dx, dy, lx = l, ly = l)
|
||||||
|
//
|
||||||
|
// dx must lie in the interval [0, numXTiles(lx)-1]
|
||||||
|
// dy must lie in the interval [0, numYTiles(ly)-1]
|
||||||
|
//
|
||||||
|
// lx must lie in the interval [0, numXLevels()-1]
|
||||||
|
// ly must lie in the inverval [0, numYLevels()-1]
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(dx1, dx2, dy1, dy2, lx, ly) reads all
|
||||||
|
// the sample counts for tiles within range
|
||||||
|
// [(min(dx1, dx2), min(dy1, dy2))...(max(dx1, dx2), max(dy1, dy2)],
|
||||||
|
// and on level (lx, ly)
|
||||||
|
//
|
||||||
|
// readPixelSampleCounts(dx1, dx2, dy1, dy2, l) calls
|
||||||
|
// readPixelSampleCounts(dx1, dx2, dy1, dy2, lx = l, ly = l).
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCount (int dx, int dy, int l = 0);
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCount (int dx, int dy, int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (int dx1, int dx2,
|
||||||
|
int dy1, int dy2,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void readPixelSampleCounts (int dx1, int dx2,
|
||||||
|
int dy1, int dy2,
|
||||||
|
int l = 0);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DeepTiledInputFile* file;
|
||||||
|
|
||||||
|
friend void DeepTiledOutputFile::copyPixels(DeepTiledInputPart &);
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* IMFDEEPTILEDINPUTPART_H_ */
|
2055
3rdparty/openexr/IlmImf/ImfDeepTiledOutputFile.cpp
vendored
Normal file
2055
3rdparty/openexr/IlmImf/ImfDeepTiledOutputFile.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
506
3rdparty/openexr/IlmImf/ImfDeepTiledOutputFile.h
vendored
Normal file
506
3rdparty/openexr/IlmImf/ImfDeepTiledOutputFile.h
vendored
Normal file
@ -0,0 +1,506 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DEEP_TILED_OUTPUT_FILE_H
|
||||||
|
#define INCLUDED_IMF_DEEP_TILED_OUTPUT_FILE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DeepTiledOutputFile
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfHeader.h"
|
||||||
|
#include "ImfFrameBuffer.h"
|
||||||
|
#include "ImathBox.h"
|
||||||
|
#include "ImfThreading.h"
|
||||||
|
#include "ImfGenericOutputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
class DeepTiledOutputFile : public GenericOutputFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// A constructor that opens the file with the specified name, and
|
||||||
|
// writes the file header. The file header is also copied into the
|
||||||
|
// TiledOutputFile object, and can later be accessed via the header()
|
||||||
|
// method.
|
||||||
|
//
|
||||||
|
// Destroying TiledOutputFile constructed with this constructor
|
||||||
|
// automatically closes the corresponding files.
|
||||||
|
//
|
||||||
|
// The header must contain a TileDescriptionAttribute called "tiles".
|
||||||
|
//
|
||||||
|
// The x and y subsampling factors for all image channels must be 1;
|
||||||
|
// subsampling is not supported.
|
||||||
|
//
|
||||||
|
// Tiles can be written to the file in arbitrary order. The line
|
||||||
|
// order attribute can be used to cause the tiles to be sorted in
|
||||||
|
// the file. When the file is read later, reading the tiles in the
|
||||||
|
// same order as they are in the file tends to be significantly
|
||||||
|
// faster than reading the tiles in random order (see writeTile,
|
||||||
|
// below).
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepTiledOutputFile (const char fileName[],
|
||||||
|
const Header &header,
|
||||||
|
int numThreads = globalThreadCount ());
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
// A constructor that attaches the new TiledOutputFile object to
|
||||||
|
// a file that has already been opened. Destroying TiledOutputFile
|
||||||
|
// objects constructed with this constructor does not automatically
|
||||||
|
// close the corresponding files.
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepTiledOutputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os,
|
||||||
|
const Header &header,
|
||||||
|
int numThreads = globalThreadCount ());
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// Destructor
|
||||||
|
//
|
||||||
|
// Destroying a TiledOutputFile object before all tiles
|
||||||
|
// have been written results in an incomplete file.
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~DeepTiledOutputFile ();
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the TiledOutputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the source of the pixel
|
||||||
|
// data written to the file. The current frame buffer
|
||||||
|
// must be set at least once before writeTile() is
|
||||||
|
// called. The current frame buffer can be changed
|
||||||
|
// after each call to writeTile().
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------
|
||||||
|
// Utility functions:
|
||||||
|
//-------------------
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Multiresolution mode and tile size:
|
||||||
|
// The following functions return the xSize, ySize and mode
|
||||||
|
// fields of the file header's TileDescriptionAttribute.
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileXSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileYSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelMode levelMode () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelRoundingMode levelRoundingMode () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Number of levels:
|
||||||
|
//
|
||||||
|
// numXLevels() returns the file's number of levels in x direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL:
|
||||||
|
// return value is: 1
|
||||||
|
//
|
||||||
|
// if levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (max (w, h)) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (w) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// where
|
||||||
|
// w is the width of the image's data window, max.x - min.x + 1,
|
||||||
|
// y is the height of the image's data window, max.y - min.y + 1,
|
||||||
|
// and rfunc(x) is either floor(x), or ceil(x), depending on
|
||||||
|
// whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP.
|
||||||
|
//
|
||||||
|
// numYLevels() returns the file's number of levels in y direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (h) / log (2)) + 1
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numLevels() is a convenience function for use with MIPMAP_LEVELS
|
||||||
|
// files.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// an IEX_NAMESPACE::LogicExc exception is thrown
|
||||||
|
//
|
||||||
|
// isValidLevel(lx, ly) returns true if the file contains
|
||||||
|
// a level with level number (lx, ly), false if not.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isValidLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Dimensions of a level:
|
||||||
|
//
|
||||||
|
// levelWidth(lx) returns the width of a level with level
|
||||||
|
// number (lx, *), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (w / pow (2, lx)))
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// levelHeight(ly) returns the height of a level with level
|
||||||
|
// number (*, ly), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (h / pow (2, ly)))
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelWidth (int lx) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelHeight (int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------
|
||||||
|
// Number of tiles:
|
||||||
|
//
|
||||||
|
// numXTiles(lx) returns the number of tiles in x direction
|
||||||
|
// that cover a level with level number (lx, *), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelWidth(lx) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numYTiles(ly) returns the number of tiles in y direction
|
||||||
|
// that cover a level with level number (*, ly), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelHeight(ly) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXTiles (int lx = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYTiles (int ly = 0) const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Level pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(lx, ly) returns a 2-dimensional
|
||||||
|
// region of valid pixel coordinates for a level with
|
||||||
|
// level number (lx, ly)
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x, dataWindow.min.y)
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + levelWidth(lx) - 1,
|
||||||
|
// dataWindow.min.y + levelHeight(ly) - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(level) is a convenience function used
|
||||||
|
// for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForLevel(level, level).
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int l = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Tile pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional
|
||||||
|
// region of valid pixel coordinates for a tile with tile coordinates
|
||||||
|
// (dx,dy) and level number (lx, ly).
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x + dx * tileXSize(),
|
||||||
|
// dataWindow.min.y + dy * tileYSize())
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + (dx + 1) * tileXSize() - 1,
|
||||||
|
// dataWindow.min.y + (dy + 1) * tileYSize() - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, level) is a convenience function
|
||||||
|
// used for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
||||||
|
int l = 0) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Write pixel data:
|
||||||
|
//
|
||||||
|
// writeTile(dx, dy, lx, ly) writes the tile with tile
|
||||||
|
// coordinates (dx, dy), and level number (lx, ly) to
|
||||||
|
// the file.
|
||||||
|
//
|
||||||
|
// dx must lie in the interval [0, numXTiles(lx) - 1]
|
||||||
|
// dy must lie in the interval [0, numYTiles(ly) - 1]
|
||||||
|
//
|
||||||
|
// lx must lie in the interval [0, numXLevels() - 1]
|
||||||
|
// ly must lie in the inverval [0, numYLevels() - 1]
|
||||||
|
//
|
||||||
|
// writeTile(dx, dy, level) is a convenience function
|
||||||
|
// used for ONE_LEVEL and MIPMAP_LEVEL files. It calls
|
||||||
|
// writeTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
// The two writeTiles(dx1, dx2, dy1, dy2, ...) functions allow
|
||||||
|
// writing multiple tiles at once. If multi-threading is used
|
||||||
|
// multiple tiles are written concurrently. The tile coordinates,
|
||||||
|
// dx1, dx2 and dy1, dy2, specify inclusive ranges of tile
|
||||||
|
// coordinates. It is valid for dx1 < dx2 or dy1 < dy2; the
|
||||||
|
// tiles are always written in the order specified by the line
|
||||||
|
// order attribute. Hence, it is not possible to specify an
|
||||||
|
// "invalid" or empty tile range.
|
||||||
|
//
|
||||||
|
// Pixels that are outside the pixel coordinate range for the tile's
|
||||||
|
// level, are never accessed by writeTile().
|
||||||
|
//
|
||||||
|
// Each tile in the file must be written exactly once.
|
||||||
|
//
|
||||||
|
// The file's line order attribute determines the order of the tiles
|
||||||
|
// in the file:
|
||||||
|
//
|
||||||
|
// INCREASING_Y In the file, the tiles for each level are stored
|
||||||
|
// in a contiguous block. The levels are ordered
|
||||||
|
// like this:
|
||||||
|
//
|
||||||
|
// (0, 0) (1, 0) ... (nx-1, 0)
|
||||||
|
// (0, 1) (1, 1) ... (nx-1, 1)
|
||||||
|
// ...
|
||||||
|
// (0,ny-1) (1,ny-1) ... (nx-1,ny-1)
|
||||||
|
//
|
||||||
|
// where nx = numXLevels(), and ny = numYLevels().
|
||||||
|
// In an individual level, (lx, ly), the tiles
|
||||||
|
// are stored in the following order:
|
||||||
|
//
|
||||||
|
// (0, 0) (1, 0) ... (tx-1, 0)
|
||||||
|
// (0, 1) (1, 1) ... (tx-1, 1)
|
||||||
|
// ...
|
||||||
|
// (0,ty-1) (1,ty-1) ... (tx-1,ty-1)
|
||||||
|
//
|
||||||
|
// where tx = numXTiles(lx),
|
||||||
|
// and ty = numYTiles(ly).
|
||||||
|
//
|
||||||
|
// DECREASING_Y As for INCREASING_Y, the tiles for each level
|
||||||
|
// are stored in a contiguous block. The levels
|
||||||
|
// are ordered the same way as for INCREASING_Y,
|
||||||
|
// but within an individual level, the tiles
|
||||||
|
// are stored in this order:
|
||||||
|
//
|
||||||
|
// (0,ty-1) (1,ty-1) ... (tx-1,ty-1)
|
||||||
|
// ...
|
||||||
|
// (0, 1) (1, 1) ... (tx-1, 1)
|
||||||
|
// (0, 0) (1, 0) ... (tx-1, 0)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// RANDOM_Y The order of the calls to writeTile() determines
|
||||||
|
// the order of the tiles in the file.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTile (int dx, int dy, int l = 0);
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTile (int dx, int dy, int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int l = 0);
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Shortcut to copy all pixels from a TiledInputFile into this file,
|
||||||
|
// without uncompressing and then recompressing the pixel data.
|
||||||
|
// This file's header must be compatible with the TiledInputFile's
|
||||||
|
// header: The two header's "dataWindow", "compression",
|
||||||
|
// "lineOrder", "channels", and "tiles" attributes must be the same.
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepTiledInputFile &in);
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepTiledInputPart &in);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Updating the preview image:
|
||||||
|
//
|
||||||
|
// updatePreviewImage() supplies a new set of pixels for the
|
||||||
|
// preview image attribute in the file's header. If the header
|
||||||
|
// does not contain a preview image, updatePreviewImage() throws
|
||||||
|
// an IEX_NAMESPACE::LogicExc.
|
||||||
|
//
|
||||||
|
// Note: updatePreviewImage() is necessary because images are
|
||||||
|
// often stored in a file incrementally, a few tiles at a time,
|
||||||
|
// while the image is being generated. Since the preview image
|
||||||
|
// is an attribute in the file's header, it gets stored in the
|
||||||
|
// file as soon as the file is opened, but we may not know what
|
||||||
|
// the preview image should look like until we have written the
|
||||||
|
// last tile of the main image.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void updatePreviewImage (const PreviewRgba newPixels[]);
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------
|
||||||
|
// Break a tile -- for testing and debugging only:
|
||||||
|
//
|
||||||
|
// breakTile(dx,dy,lx,ly,p,n,c) introduces an error into the
|
||||||
|
// output file by writing n copies of character c, starting
|
||||||
|
// p bytes from the beginning of the tile with tile coordinates
|
||||||
|
// (dx, dy) and level number (lx, ly).
|
||||||
|
//
|
||||||
|
// Warning: Calling this function usually results in a broken
|
||||||
|
// image file. The file or parts of it may not be readable,
|
||||||
|
// or the file may contain bad data.
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void breakTile (int dx, int dy,
|
||||||
|
int lx, int ly,
|
||||||
|
int offset,
|
||||||
|
int length,
|
||||||
|
char c);
|
||||||
|
struct Data;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
// A constructor attaches the OutputStreamMutex to the
|
||||||
|
// given one from MultiPartOutputFile. Set the previewPosition
|
||||||
|
// and lineOffsetsPosition which have been acquired from
|
||||||
|
// the constructor of MultiPartOutputFile as well.
|
||||||
|
// ----------------------------------------------------------------
|
||||||
|
DeepTiledOutputFile (const OutputPartData* part);
|
||||||
|
|
||||||
|
DeepTiledOutputFile (const DeepTiledOutputFile &); // not implemented
|
||||||
|
DeepTiledOutputFile & operator = (const DeepTiledOutputFile &); // not implemented
|
||||||
|
|
||||||
|
void initialize (const Header &header);
|
||||||
|
|
||||||
|
bool isValidTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
size_t bytesPerLineForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
Data * _data;
|
||||||
|
|
||||||
|
|
||||||
|
friend class MultiPartOutputFile;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
250
3rdparty/openexr/IlmImf/ImfDeepTiledOutputPart.cpp
vendored
Normal file
250
3rdparty/openexr/IlmImf/ImfDeepTiledOutputPart.cpp
vendored
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfDeepTiledOutputPart.h"
|
||||||
|
#include "ImfMultiPartOutputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
DeepTiledOutputPart::DeepTiledOutputPart(MultiPartOutputFile& multiPartFile, int partNumber)
|
||||||
|
{
|
||||||
|
file = multiPartFile.getOutputPart<DeepTiledOutputFile>(partNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
DeepTiledOutputPart::fileName () const
|
||||||
|
{
|
||||||
|
return file->fileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Header &
|
||||||
|
DeepTiledOutputPart::header () const
|
||||||
|
{
|
||||||
|
return file->header();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::setFrameBuffer (const DeepFrameBuffer &frameBuffer)
|
||||||
|
{
|
||||||
|
file->setFrameBuffer(frameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DeepFrameBuffer &
|
||||||
|
DeepTiledOutputPart::frameBuffer () const
|
||||||
|
{
|
||||||
|
return file->frameBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
DeepTiledOutputPart::tileXSize () const
|
||||||
|
{
|
||||||
|
return file->tileXSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
DeepTiledOutputPart::tileYSize () const
|
||||||
|
{
|
||||||
|
return file->tileYSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LevelMode
|
||||||
|
DeepTiledOutputPart::levelMode () const
|
||||||
|
{
|
||||||
|
return file->levelMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LevelRoundingMode
|
||||||
|
DeepTiledOutputPart::levelRoundingMode () const
|
||||||
|
{
|
||||||
|
return file->levelRoundingMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::numLevels () const
|
||||||
|
{
|
||||||
|
return file->numLevels();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::numXLevels () const
|
||||||
|
{
|
||||||
|
return file->numXLevels();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::numYLevels () const
|
||||||
|
{
|
||||||
|
return file->numYLevels();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
DeepTiledOutputPart::isValidLevel (int lx, int ly) const
|
||||||
|
{
|
||||||
|
return file->isValidLevel(lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::levelWidth (int lx) const
|
||||||
|
{
|
||||||
|
return file->levelWidth(lx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::levelHeight (int ly) const
|
||||||
|
{
|
||||||
|
return file->levelHeight(ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::numXTiles (int lx) const
|
||||||
|
{
|
||||||
|
return file->numXTiles(lx);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
DeepTiledOutputPart::numYTiles (int ly) const
|
||||||
|
{
|
||||||
|
return file->numYTiles(ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledOutputPart::dataWindowForLevel (int l) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForLevel(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledOutputPart::dataWindowForLevel (int lx, int ly) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForLevel(lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledOutputPart::dataWindowForTile (int dx, int dy,
|
||||||
|
int l) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForTile(dx, dy, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMATH_NAMESPACE::Box2i
|
||||||
|
DeepTiledOutputPart::dataWindowForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const
|
||||||
|
{
|
||||||
|
return file->dataWindowForTile(dx, dy, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::writeTile (int dx, int dy, int l)
|
||||||
|
{
|
||||||
|
file->writeTile(dx, dy, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::writeTile (int dx, int dy, int lx, int ly)
|
||||||
|
{
|
||||||
|
file->writeTile(dx, dy, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::writeTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int lx, int ly)
|
||||||
|
{
|
||||||
|
file->writeTiles(dx1, dx2, dy1, dy2, lx, ly);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::writeTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int l)
|
||||||
|
{
|
||||||
|
file->writeTiles(dx1, dx2, dy1, dy2, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::copyPixels (DeepTiledInputFile &in)
|
||||||
|
{
|
||||||
|
file->copyPixels(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::copyPixels (DeepTiledInputPart &in)
|
||||||
|
{
|
||||||
|
file->copyPixels(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::updatePreviewImage (const PreviewRgba newPixels[])
|
||||||
|
{
|
||||||
|
file->updatePreviewImage(newPixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DeepTiledOutputPart::breakTile (int dx, int dy,
|
||||||
|
int lx, int ly,
|
||||||
|
int offset,
|
||||||
|
int length,
|
||||||
|
char c)
|
||||||
|
{
|
||||||
|
file->breakTile(dx, dy, lx, ly, offset, length, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
423
3rdparty/openexr/IlmImf/ImfDeepTiledOutputPart.h
vendored
Normal file
423
3rdparty/openexr/IlmImf/ImfDeepTiledOutputPart.h
vendored
Normal file
@ -0,0 +1,423 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef IMFDEEPTILEDOUTPUTPART_H_
|
||||||
|
#define IMFDEEPTILEDOUTPUTPART_H_
|
||||||
|
|
||||||
|
#include "ImfForward.h"
|
||||||
|
#include "ImfDeepTiledInputFile.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
class DeepTiledOutputPart
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DeepTiledOutputPart(MultiPartOutputFile& multiPartFile, int partNumber);
|
||||||
|
|
||||||
|
//------------------------
|
||||||
|
// Access to the file name
|
||||||
|
//------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const char * fileName () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------
|
||||||
|
// Access to the file header
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const Header & header () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// Set the current frame buffer -- copies the FrameBuffer
|
||||||
|
// object into the TiledOutputFile object.
|
||||||
|
//
|
||||||
|
// The current frame buffer is the source of the pixel
|
||||||
|
// data written to the file. The current frame buffer
|
||||||
|
// must be set at least once before writeTile() is
|
||||||
|
// called. The current frame buffer can be changed
|
||||||
|
// after each call to writeTile().
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void setFrameBuffer (const DeepFrameBuffer &frameBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------
|
||||||
|
// Access to the current frame buffer
|
||||||
|
//-----------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
const DeepFrameBuffer & frameBuffer () const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------
|
||||||
|
// Utility functions:
|
||||||
|
//-------------------
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Multiresolution mode and tile size:
|
||||||
|
// The following functions return the xSize, ySize and mode
|
||||||
|
// fields of the file header's TileDescriptionAttribute.
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileXSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
unsigned int tileYSize () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelMode levelMode () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
LevelRoundingMode levelRoundingMode () const;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Number of levels:
|
||||||
|
//
|
||||||
|
// numXLevels() returns the file's number of levels in x direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL:
|
||||||
|
// return value is: 1
|
||||||
|
//
|
||||||
|
// if levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (max (w, h)) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (w) / log (2)) + 1
|
||||||
|
//
|
||||||
|
// where
|
||||||
|
// w is the width of the image's data window, max.x - min.x + 1,
|
||||||
|
// y is the height of the image's data window, max.y - min.y + 1,
|
||||||
|
// and rfunc(x) is either floor(x), or ceil(x), depending on
|
||||||
|
// whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP.
|
||||||
|
//
|
||||||
|
// numYLevels() returns the file's number of levels in y direction.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// return value is: rfunc (log (h) / log (2)) + 1
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numLevels() is a convenience function for use with MIPMAP_LEVELS
|
||||||
|
// files.
|
||||||
|
//
|
||||||
|
// if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS:
|
||||||
|
// return value is the same as for numXLevels()
|
||||||
|
//
|
||||||
|
// if levelMode() == RIPMAP_LEVELS:
|
||||||
|
// an IEX_NAMESPACE::LogicExc exception is thrown
|
||||||
|
//
|
||||||
|
// isValidLevel(lx, ly) returns true if the file contains
|
||||||
|
// a level with level number (lx, ly), false if not.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYLevels () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
bool isValidLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Dimensions of a level:
|
||||||
|
//
|
||||||
|
// levelWidth(lx) returns the width of a level with level
|
||||||
|
// number (lx, *), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (w / pow (2, lx)))
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// levelHeight(ly) returns the height of a level with level
|
||||||
|
// number (*, ly), where * is any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// max (1, rfunc (h / pow (2, ly)))
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelWidth (int lx) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int levelHeight (int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------
|
||||||
|
// Number of tiles:
|
||||||
|
//
|
||||||
|
// numXTiles(lx) returns the number of tiles in x direction
|
||||||
|
// that cover a level with level number (lx, *), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelWidth(lx) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// numYTiles(ly) returns the number of tiles in y direction
|
||||||
|
// that cover a level with level number (*, ly), where * is
|
||||||
|
// any number.
|
||||||
|
//
|
||||||
|
// return value is:
|
||||||
|
// (levelHeight(ly) + tileXSize() - 1) / tileXSize()
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
int numXTiles (int lx = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
int numYTiles (int ly = 0) const;
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
// Level pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(lx, ly) returns a 2-dimensional
|
||||||
|
// region of valid pixel coordinates for a level with
|
||||||
|
// level number (lx, ly)
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x, dataWindow.min.y)
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + levelWidth(lx) - 1,
|
||||||
|
// dataWindow.min.y + levelHeight(ly) - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForLevel(level) is a convenience function used
|
||||||
|
// for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForLevel(level, level).
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int l = 0) const;
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForLevel (int lx, int ly) const;
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Tile pixel ranges:
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional
|
||||||
|
// region of valid pixel coordinates for a tile with tile coordinates
|
||||||
|
// (dx,dy) and level number (lx, ly).
|
||||||
|
//
|
||||||
|
// return value is a Box2i with min value:
|
||||||
|
// (dataWindow.min.x + dx * tileXSize(),
|
||||||
|
// dataWindow.min.y + dy * tileYSize())
|
||||||
|
//
|
||||||
|
// and max value:
|
||||||
|
// (dataWindow.min.x + (dx + 1) * tileXSize() - 1,
|
||||||
|
// dataWindow.min.y + (dy + 1) * tileYSize() - 1)
|
||||||
|
//
|
||||||
|
// dataWindowForTile(dx, dy, level) is a convenience function
|
||||||
|
// used for ONE_LEVEL and MIPMAP_LEVELS files. It returns
|
||||||
|
// dataWindowForTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
||||||
|
int l = 0) const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::Box2i dataWindowForTile (int dx, int dy,
|
||||||
|
int lx, int ly) const;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Write pixel data:
|
||||||
|
//
|
||||||
|
// writeTile(dx, dy, lx, ly) writes the tile with tile
|
||||||
|
// coordinates (dx, dy), and level number (lx, ly) to
|
||||||
|
// the file.
|
||||||
|
//
|
||||||
|
// dx must lie in the interval [0, numXTiles(lx) - 1]
|
||||||
|
// dy must lie in the interval [0, numYTiles(ly) - 1]
|
||||||
|
//
|
||||||
|
// lx must lie in the interval [0, numXLevels() - 1]
|
||||||
|
// ly must lie in the inverval [0, numYLevels() - 1]
|
||||||
|
//
|
||||||
|
// writeTile(dx, dy, level) is a convenience function
|
||||||
|
// used for ONE_LEVEL and MIPMAP_LEVEL files. It calls
|
||||||
|
// writeTile(dx, dy, level, level).
|
||||||
|
//
|
||||||
|
// The two writeTiles(dx1, dx2, dy1, dy2, ...) functions allow
|
||||||
|
// writing multiple tiles at once. If multi-threading is used
|
||||||
|
// multiple tiles are written concurrently. The tile coordinates,
|
||||||
|
// dx1, dx2 and dy1, dy2, specify inclusive ranges of tile
|
||||||
|
// coordinates. It is valid for dx1 < dx2 or dy1 < dy2; the
|
||||||
|
// tiles are always written in the order specified by the line
|
||||||
|
// order attribute. Hence, it is not possible to specify an
|
||||||
|
// "invalid" or empty tile range.
|
||||||
|
//
|
||||||
|
// Pixels that are outside the pixel coordinate range for the tile's
|
||||||
|
// level, are never accessed by writeTile().
|
||||||
|
//
|
||||||
|
// Each tile in the file must be written exactly once.
|
||||||
|
//
|
||||||
|
// The file's line order attribute determines the order of the tiles
|
||||||
|
// in the file:
|
||||||
|
//
|
||||||
|
// INCREASING_Y In the file, the tiles for each level are stored
|
||||||
|
// in a contiguous block. The levels are ordered
|
||||||
|
// like this:
|
||||||
|
//
|
||||||
|
// (0, 0) (1, 0) ... (nx-1, 0)
|
||||||
|
// (0, 1) (1, 1) ... (nx-1, 1)
|
||||||
|
// ...
|
||||||
|
// (0,ny-1) (1,ny-1) ... (nx-1,ny-1)
|
||||||
|
//
|
||||||
|
// where nx = numXLevels(), and ny = numYLevels().
|
||||||
|
// In an individual level, (lx, ly), the tiles
|
||||||
|
// are stored in the following order:
|
||||||
|
//
|
||||||
|
// (0, 0) (1, 0) ... (tx-1, 0)
|
||||||
|
// (0, 1) (1, 1) ... (tx-1, 1)
|
||||||
|
// ...
|
||||||
|
// (0,ty-1) (1,ty-1) ... (tx-1,ty-1)
|
||||||
|
//
|
||||||
|
// where tx = numXTiles(lx),
|
||||||
|
// and ty = numYTiles(ly).
|
||||||
|
//
|
||||||
|
// DECREASING_Y As for INCREASING_Y, the tiles for each level
|
||||||
|
// are stored in a contiguous block. The levels
|
||||||
|
// are ordered the same way as for INCREASING_Y,
|
||||||
|
// but within an individual level, the tiles
|
||||||
|
// are stored in this order:
|
||||||
|
//
|
||||||
|
// (0,ty-1) (1,ty-1) ... (tx-1,ty-1)
|
||||||
|
// ...
|
||||||
|
// (0, 1) (1, 1) ... (tx-1, 1)
|
||||||
|
// (0, 0) (1, 0) ... (tx-1, 0)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// RANDOM_Y The order of the calls to writeTile() determines
|
||||||
|
// the order of the tiles in the file.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTile (int dx, int dy, int l = 0);
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTile (int dx, int dy, int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void writeTiles (int dx1, int dx2, int dy1, int dy2,
|
||||||
|
int l = 0);
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Shortcut to copy all pixels from a TiledInputFile into this file,
|
||||||
|
// without uncompressing and then recompressing the pixel data.
|
||||||
|
// This file's header must be compatible with the TiledInputFile's
|
||||||
|
// header: The two header's "dataWindow", "compression",
|
||||||
|
// "lineOrder", "channels", and "tiles" attributes must be the same.
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepTiledInputFile &in);
|
||||||
|
IMF_EXPORT
|
||||||
|
void copyPixels (DeepTiledInputPart &in);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// Updating the preview image:
|
||||||
|
//
|
||||||
|
// updatePreviewImage() supplies a new set of pixels for the
|
||||||
|
// preview image attribute in the file's header. If the header
|
||||||
|
// does not contain a preview image, updatePreviewImage() throws
|
||||||
|
// an IEX_NAMESPACE::LogicExc.
|
||||||
|
//
|
||||||
|
// Note: updatePreviewImage() is necessary because images are
|
||||||
|
// often stored in a file incrementally, a few tiles at a time,
|
||||||
|
// while the image is being generated. Since the preview image
|
||||||
|
// is an attribute in the file's header, it gets stored in the
|
||||||
|
// file as soon as the file is opened, but we may not know what
|
||||||
|
// the preview image should look like until we have written the
|
||||||
|
// last tile of the main image.
|
||||||
|
//
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void updatePreviewImage (const PreviewRgba newPixels[]);
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------
|
||||||
|
// Break a tile -- for testing and debugging only:
|
||||||
|
//
|
||||||
|
// breakTile(dx,dy,lx,ly,p,n,c) introduces an error into the
|
||||||
|
// output file by writing n copies of character c, starting
|
||||||
|
// p bytes from the beginning of the tile with tile coordinates
|
||||||
|
// (dx, dy) and level number (lx, ly).
|
||||||
|
//
|
||||||
|
// Warning: Calling this function usually results in a broken
|
||||||
|
// image file. The file or parts of it may not be readable,
|
||||||
|
// or the file may contain bad data.
|
||||||
|
//
|
||||||
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void breakTile (int dx, int dy,
|
||||||
|
int lx, int ly,
|
||||||
|
int offset,
|
||||||
|
int length,
|
||||||
|
char c);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DeepTiledOutputFile* file;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif /* IMFDEEPTILEDOUTPUTPART_H_ */
|
12
3rdparty/openexr/IlmImf/ImfDoubleAttribute.cpp
vendored
12
3rdparty/openexr/IlmImf/ImfDoubleAttribute.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,7 +43,7 @@
|
|||||||
#include <ImfDoubleAttribute.h>
|
#include <ImfDoubleAttribute.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -54,4 +54,4 @@ DoubleAttribute::staticTypeName ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
22
3rdparty/openexr/IlmImf/ImfDoubleAttribute.h
vendored
22
3rdparty/openexr/IlmImf/ImfDoubleAttribute.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,21 +43,17 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfAttribute.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<double> DoubleAttribute;
|
typedef TypedAttribute<double> DoubleAttribute;
|
||||||
template <> const char *DoubleAttribute::staticTypeName ();
|
template <> IMF_EXPORT const char *DoubleAttribute::staticTypeName ();
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfDoubleAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
3439
3rdparty/openexr/IlmImf/ImfDwaCompressor.cpp
vendored
Normal file
3439
3rdparty/openexr/IlmImf/ImfDwaCompressor.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
219
3rdparty/openexr/IlmImf/ImfDwaCompressor.h
vendored
Normal file
219
3rdparty/openexr/IlmImf/ImfDwaCompressor.h
vendored
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2009-2014 DreamWorks Animation LLC.
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of DreamWorks Animation nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_DWA_COMRESSOR_H
|
||||||
|
#define INCLUDED_IMF_DWA_COMRESSOR_H
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class DwaCompressor -- Store lossy RGB data by quantizing DCT components.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <half.h>
|
||||||
|
|
||||||
|
#include "ImfInt64.h"
|
||||||
|
#include "ImfZip.h"
|
||||||
|
#include "ImfChannelList.h"
|
||||||
|
#include "ImfCompressor.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class DwaCompressor: public Compressor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum AcCompression
|
||||||
|
{
|
||||||
|
STATIC_HUFFMAN,
|
||||||
|
DEFLATE,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
DwaCompressor (const Header &hdr,
|
||||||
|
int maxScanLineSize,
|
||||||
|
int numScanLines, // ideally is a multiple of 8
|
||||||
|
AcCompression acCompression);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~DwaCompressor ();
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual int numScanLines () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual OPENEXR_IMF_NAMESPACE::Compressor::Format format () const;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual int compress (const char *inPtr,
|
||||||
|
int inSize,
|
||||||
|
int minY,
|
||||||
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual int compressTile (const char *inPtr,
|
||||||
|
int inSize,
|
||||||
|
IMATH_NAMESPACE::Box2i range,
|
||||||
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual int uncompress (const char *inPtr,
|
||||||
|
int inSize,
|
||||||
|
int minY,
|
||||||
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual int uncompressTile (const char *inPtr,
|
||||||
|
int inSize,
|
||||||
|
IMATH_NAMESPACE::Box2i range,
|
||||||
|
const char *&outPtr);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
static void initializeFuncs ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
struct ChannelData;
|
||||||
|
struct CscChannelSet;
|
||||||
|
struct Classifier;
|
||||||
|
|
||||||
|
class LossyDctDecoderBase;
|
||||||
|
class LossyDctDecoder;
|
||||||
|
class LossyDctDecoderCsc;
|
||||||
|
|
||||||
|
class LossyDctEncoderBase;
|
||||||
|
class LossyDctEncoder;
|
||||||
|
class LossyDctEncoderCsc;
|
||||||
|
|
||||||
|
enum CompressorScheme
|
||||||
|
{
|
||||||
|
UNKNOWN = 0,
|
||||||
|
LOSSY_DCT,
|
||||||
|
RLE,
|
||||||
|
|
||||||
|
NUM_COMPRESSOR_SCHEMES
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Per-chunk compressed data sizes, one value per chunk
|
||||||
|
//
|
||||||
|
|
||||||
|
enum DataSizesSingle
|
||||||
|
{
|
||||||
|
VERSION = 0, // Version number:
|
||||||
|
// 0: classic
|
||||||
|
// 1: adds "end of block" to the AC RLE
|
||||||
|
|
||||||
|
UNKNOWN_UNCOMPRESSED_SIZE, // Size of leftover data, uncompressed.
|
||||||
|
UNKNOWN_COMPRESSED_SIZE, // Size of leftover data, zlib compressed.
|
||||||
|
|
||||||
|
AC_COMPRESSED_SIZE, // AC RLE + Huffman size
|
||||||
|
DC_COMPRESSED_SIZE, // DC + Deflate size
|
||||||
|
RLE_COMPRESSED_SIZE, // RLE + Deflate data size
|
||||||
|
RLE_UNCOMPRESSED_SIZE, // RLE'd data size
|
||||||
|
RLE_RAW_SIZE, // Un-RLE'd data size
|
||||||
|
|
||||||
|
AC_UNCOMPRESSED_COUNT, // AC RLE number of elements
|
||||||
|
DC_UNCOMPRESSED_COUNT, // DC number of elements
|
||||||
|
|
||||||
|
AC_COMPRESSION, // AC compression strategy
|
||||||
|
NUM_SIZES_SINGLE
|
||||||
|
};
|
||||||
|
|
||||||
|
AcCompression _acCompression;
|
||||||
|
|
||||||
|
int _maxScanLineSize;
|
||||||
|
int _numScanLines;
|
||||||
|
int _min[2], _max[2];
|
||||||
|
|
||||||
|
ChannelList _channels;
|
||||||
|
std::vector<ChannelData> _channelData;
|
||||||
|
std::vector<CscChannelSet> _cscSets;
|
||||||
|
std::vector<Classifier> _channelRules;
|
||||||
|
|
||||||
|
char *_packedAcBuffer;
|
||||||
|
size_t _packedAcBufferSize;
|
||||||
|
char *_packedDcBuffer;
|
||||||
|
size_t _packedDcBufferSize;
|
||||||
|
char *_rleBuffer;
|
||||||
|
size_t _rleBufferSize;
|
||||||
|
char *_outBuffer;
|
||||||
|
size_t _outBufferSize;
|
||||||
|
char *_planarUncBuffer[NUM_COMPRESSOR_SCHEMES];
|
||||||
|
size_t _planarUncBufferSize[NUM_COMPRESSOR_SCHEMES];
|
||||||
|
|
||||||
|
Zip *_zip;
|
||||||
|
float _dwaCompressionLevel;
|
||||||
|
|
||||||
|
int compress (const char *inPtr,
|
||||||
|
int inSize,
|
||||||
|
IMATH_NAMESPACE::Box2i range,
|
||||||
|
const char *&outPtr);
|
||||||
|
|
||||||
|
int uncompress (const char *inPtr,
|
||||||
|
int inSize,
|
||||||
|
IMATH_NAMESPACE::Box2i range,
|
||||||
|
const char *&outPtr);
|
||||||
|
|
||||||
|
void initializeBuffers (size_t&);
|
||||||
|
void initializeDefaultChannelRules ();
|
||||||
|
void initializeLegacyChannelRules ();
|
||||||
|
|
||||||
|
void relevantChannelRules( std::vector<Classifier> &) const;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Populate our cached version of the channel data with
|
||||||
|
// data from the real channel list. We want to
|
||||||
|
// copy over attributes, determine compression schemes
|
||||||
|
// releveant for the channel type, and find sets of
|
||||||
|
// channels to be compressed from Y'CbCr data instead
|
||||||
|
// of R'G'B'.
|
||||||
|
//
|
||||||
|
|
||||||
|
void classifyChannels (ChannelList channels,
|
||||||
|
std::vector<ChannelData> &chanData,
|
||||||
|
std::vector<CscChannelSet> &cscData);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compute various buffer pointers for each channel
|
||||||
|
//
|
||||||
|
|
||||||
|
void setupChannelData (int minX, int minY, int maxX, int maxY);
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
2172
3rdparty/openexr/IlmImf/ImfDwaCompressorSimd.h
vendored
Normal file
2172
3rdparty/openexr/IlmImf/ImfDwaCompressorSimd.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
209
3rdparty/openexr/IlmImf/ImfEnvmap.cpp
vendored
209
3rdparty/openexr/IlmImf/ImfEnvmap.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -39,25 +39,30 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfEnvmap.h>
|
#include "ImfEnvmap.h"
|
||||||
#include "ImathFun.h"
|
#include "ImathFun.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Imath;
|
using namespace IMATH_NAMESPACE;
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
|
||||||
namespace LatLongMap {
|
namespace LatLongMap {
|
||||||
|
|
||||||
V2f
|
V2f
|
||||||
latLong (const V3f &dir)
|
latLong (const V3f &dir)
|
||||||
{
|
{
|
||||||
float r = sqrt (dir.z * dir.z + dir.x * dir.x);
|
float r = sqrt (dir.z * dir.z + dir.x * dir.x);
|
||||||
|
|
||||||
float latitude = (r < abs (dir.y))?
|
float latitude = (r < abs (dir.y))?
|
||||||
acos (r / dir.length()) * sign (dir.y):
|
acos (r / dir.length()) * sign (dir.y):
|
||||||
asin (dir.y / dir.length());
|
asin (dir.y / dir.length());
|
||||||
|
|
||||||
float longitude = (dir.z == 0 && dir.x == 0)? 0: atan2 (dir.x, dir.z);
|
float longitude = (dir.z == 0 && dir.x == 0)? 0: atan2 (dir.x, dir.z);
|
||||||
|
|
||||||
@ -72,24 +77,24 @@ latLong (const Box2i &dataWindow, const V2f &pixelPosition)
|
|||||||
|
|
||||||
if (dataWindow.max.y > dataWindow.min.y)
|
if (dataWindow.max.y > dataWindow.min.y)
|
||||||
{
|
{
|
||||||
latitude = -M_PI *
|
latitude = -1 * float(M_PI) *
|
||||||
((pixelPosition.y - dataWindow.min.y) /
|
((pixelPosition.y - dataWindow.min.y) /
|
||||||
(dataWindow.max.y - dataWindow.min.y) - 0.5f);
|
(dataWindow.max.y - dataWindow.min.y) - 0.5f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
latitude = 0;
|
latitude = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataWindow.max.x > dataWindow.min.x)
|
if (dataWindow.max.x > dataWindow.min.x)
|
||||||
{
|
{
|
||||||
longitude = -2 * M_PI *
|
longitude = -2 * float(M_PI) *
|
||||||
((pixelPosition.x - dataWindow.min.x) /
|
((pixelPosition.x - dataWindow.min.x) /
|
||||||
(dataWindow.max.x - dataWindow.min.x) - 0.5f);
|
(dataWindow.max.x - dataWindow.min.x) - 0.5f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
longitude = 0;
|
longitude = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return V2f (latitude, longitude);
|
return V2f (latitude, longitude);
|
||||||
@ -99,11 +104,11 @@ latLong (const Box2i &dataWindow, const V2f &pixelPosition)
|
|||||||
V2f
|
V2f
|
||||||
pixelPosition (const Box2i &dataWindow, const V2f &latLong)
|
pixelPosition (const Box2i &dataWindow, const V2f &latLong)
|
||||||
{
|
{
|
||||||
float x = latLong.y / (-2 * M_PI) + 0.5f;
|
float x = latLong.y / (-2 * float(M_PI)) + 0.5f;
|
||||||
float y = latLong.x / -M_PI + 0.5f;
|
float y = latLong.x / (-1 * float(M_PI)) + 0.5f;
|
||||||
|
|
||||||
return V2f (x * (dataWindow.max.x - dataWindow.min.x) + dataWindow.min.x,
|
return V2f (x * (dataWindow.max.x - dataWindow.min.x) + dataWindow.min.x,
|
||||||
y * (dataWindow.max.y - dataWindow.min.y) + dataWindow.min.y);
|
y * (dataWindow.max.y - dataWindow.min.y) + dataWindow.min.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,8 +125,8 @@ direction (const Box2i &dataWindow, const V2f &pixelPosition)
|
|||||||
V2f ll = latLong (dataWindow, pixelPosition);
|
V2f ll = latLong (dataWindow, pixelPosition);
|
||||||
|
|
||||||
return V3f (sin (ll.y) * cos (ll.x),
|
return V3f (sin (ll.y) * cos (ll.x),
|
||||||
sin (ll.x),
|
sin (ll.x),
|
||||||
cos (ll.y) * cos (ll.x));
|
cos (ll.y) * cos (ll.x));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace LatLongMap
|
} // namespace LatLongMap
|
||||||
@ -133,7 +138,7 @@ int
|
|||||||
sizeOfFace (const Box2i &dataWindow)
|
sizeOfFace (const Box2i &dataWindow)
|
||||||
{
|
{
|
||||||
return min ((dataWindow.max.x - dataWindow.min.x + 1),
|
return min ((dataWindow.max.x - dataWindow.min.x + 1),
|
||||||
(dataWindow.max.y - dataWindow.min.y + 1) / 6);
|
(dataWindow.max.y - dataWindow.min.y + 1) / 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,39 +168,39 @@ pixelPosition (CubeMapFace face, const Box2i &dataWindow, V2f positionInFace)
|
|||||||
{
|
{
|
||||||
case CUBEFACE_POS_X:
|
case CUBEFACE_POS_X:
|
||||||
|
|
||||||
pos.x = dwf.min.x + positionInFace.y;
|
pos.x = dwf.min.x + positionInFace.y;
|
||||||
pos.y = dwf.max.y - positionInFace.x;
|
pos.y = dwf.max.y - positionInFace.x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_NEG_X:
|
case CUBEFACE_NEG_X:
|
||||||
|
|
||||||
pos.x = dwf.max.x - positionInFace.y;
|
pos.x = dwf.max.x - positionInFace.y;
|
||||||
pos.y = dwf.max.y - positionInFace.x;
|
pos.y = dwf.max.y - positionInFace.x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_POS_Y:
|
case CUBEFACE_POS_Y:
|
||||||
|
|
||||||
pos.x = dwf.min.x + positionInFace.x;
|
pos.x = dwf.min.x + positionInFace.x;
|
||||||
pos.y = dwf.max.y - positionInFace.y;
|
pos.y = dwf.max.y - positionInFace.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_NEG_Y:
|
case CUBEFACE_NEG_Y:
|
||||||
|
|
||||||
pos.x = dwf.min.x + positionInFace.x;
|
pos.x = dwf.min.x + positionInFace.x;
|
||||||
pos.y = dwf.min.y + positionInFace.y;
|
pos.y = dwf.min.y + positionInFace.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_POS_Z:
|
case CUBEFACE_POS_Z:
|
||||||
|
|
||||||
pos.x = dwf.max.x - positionInFace.x;
|
pos.x = dwf.max.x - positionInFace.x;
|
||||||
pos.y = dwf.max.y - positionInFace.y;
|
pos.y = dwf.max.y - positionInFace.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_NEG_Z:
|
case CUBEFACE_NEG_Z:
|
||||||
|
|
||||||
pos.x = dwf.min.x + positionInFace.x;
|
pos.x = dwf.min.x + positionInFace.x;
|
||||||
pos.y = dwf.max.y - positionInFace.y;
|
pos.y = dwf.max.y - positionInFace.y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
@ -204,9 +209,9 @@ pixelPosition (CubeMapFace face, const Box2i &dataWindow, V2f positionInFace)
|
|||||||
|
|
||||||
void
|
void
|
||||||
faceAndPixelPosition (const V3f &direction,
|
faceAndPixelPosition (const V3f &direction,
|
||||||
const Box2i &dataWindow,
|
const Box2i &dataWindow,
|
||||||
CubeMapFace &face,
|
CubeMapFace &face,
|
||||||
V2f &pif)
|
V2f &pif)
|
||||||
{
|
{
|
||||||
int sof = sizeOfFace (dataWindow);
|
int sof = sizeOfFace (dataWindow);
|
||||||
float absx = abs (direction.x);
|
float absx = abs (direction.x);
|
||||||
@ -215,44 +220,44 @@ faceAndPixelPosition (const V3f &direction,
|
|||||||
|
|
||||||
if (absx >= absy && absx >= absz)
|
if (absx >= absy && absx >= absz)
|
||||||
{
|
{
|
||||||
if (absx == 0)
|
if (absx == 0)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Special case - direction is (0, 0, 0)
|
// Special case - direction is (0, 0, 0)
|
||||||
//
|
//
|
||||||
|
|
||||||
face = CUBEFACE_POS_X;
|
face = CUBEFACE_POS_X;
|
||||||
pif = V2f (0, 0);
|
pif = V2f (0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pif.x = (direction.y / absx + 1) / 2 * (sof - 1);
|
pif.x = (direction.y / absx + 1) / 2 * (sof - 1);
|
||||||
pif.y = (direction.z / absx + 1) / 2 * (sof - 1);
|
pif.y = (direction.z / absx + 1) / 2 * (sof - 1);
|
||||||
|
|
||||||
if (direction.x > 0)
|
if (direction.x > 0)
|
||||||
face = CUBEFACE_POS_X;
|
face = CUBEFACE_POS_X;
|
||||||
else
|
else
|
||||||
face = CUBEFACE_NEG_X;
|
face = CUBEFACE_NEG_X;
|
||||||
}
|
}
|
||||||
else if (absy >= absz)
|
else if (absy >= absz)
|
||||||
{
|
{
|
||||||
pif.x = (direction.x / absy + 1) / 2 * (sof - 1);
|
pif.x = (direction.x / absy + 1) / 2 * (sof - 1);
|
||||||
pif.y = (direction.z / absy + 1) / 2 * (sof - 1);
|
pif.y = (direction.z / absy + 1) / 2 * (sof - 1);
|
||||||
|
|
||||||
if (direction.y > 0)
|
if (direction.y > 0)
|
||||||
face = CUBEFACE_POS_Y;
|
face = CUBEFACE_POS_Y;
|
||||||
else
|
else
|
||||||
face = CUBEFACE_NEG_Y;
|
face = CUBEFACE_NEG_Y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pif.x = (direction.x / absz + 1) / 2 * (sof - 1);
|
pif.x = (direction.x / absz + 1) / 2 * (sof - 1);
|
||||||
pif.y = (direction.y / absz + 1) / 2 * (sof - 1);
|
pif.y = (direction.y / absz + 1) / 2 * (sof - 1);
|
||||||
|
|
||||||
if (direction.z > 0)
|
if (direction.z > 0)
|
||||||
face = CUBEFACE_POS_Z;
|
face = CUBEFACE_POS_Z;
|
||||||
else
|
else
|
||||||
face = CUBEFACE_NEG_Z;
|
face = CUBEFACE_NEG_Z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,15 +268,15 @@ direction (CubeMapFace face, const Box2i &dataWindow, const V2f &positionInFace)
|
|||||||
int sof = sizeOfFace (dataWindow);
|
int sof = sizeOfFace (dataWindow);
|
||||||
|
|
||||||
V2f pos;
|
V2f pos;
|
||||||
|
|
||||||
if (sof > 1)
|
if (sof > 1)
|
||||||
{
|
{
|
||||||
pos = V2f (positionInFace.x / (sof - 1) * 2 - 1,
|
pos = V2f (positionInFace.x / (sof - 1) * 2 - 1,
|
||||||
positionInFace.y / (sof - 1) * 2 - 1);
|
positionInFace.y / (sof - 1) * 2 - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pos = V2f (0, 0);
|
pos = V2f (0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
V3f dir (1, 0, 0);
|
V3f dir (1, 0, 0);
|
||||||
@ -280,49 +285,51 @@ direction (CubeMapFace face, const Box2i &dataWindow, const V2f &positionInFace)
|
|||||||
{
|
{
|
||||||
case CUBEFACE_POS_X:
|
case CUBEFACE_POS_X:
|
||||||
|
|
||||||
dir.x = 1;
|
dir.x = 1;
|
||||||
dir.y = pos.x;
|
dir.y = pos.x;
|
||||||
dir.z = pos.y;
|
dir.z = pos.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_NEG_X:
|
case CUBEFACE_NEG_X:
|
||||||
|
|
||||||
dir.x = -1;
|
dir.x = -1;
|
||||||
dir.y = pos.x;
|
dir.y = pos.x;
|
||||||
dir.z = pos.y;
|
dir.z = pos.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_POS_Y:
|
case CUBEFACE_POS_Y:
|
||||||
|
|
||||||
dir.x = pos.x;
|
dir.x = pos.x;
|
||||||
dir.y = 1;
|
dir.y = 1;
|
||||||
dir.z = pos.y;
|
dir.z = pos.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_NEG_Y:
|
case CUBEFACE_NEG_Y:
|
||||||
|
|
||||||
dir.x = pos.x;
|
dir.x = pos.x;
|
||||||
dir.y = -1;
|
dir.y = -1;
|
||||||
dir.z = pos.y;
|
dir.z = pos.y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_POS_Z:
|
case CUBEFACE_POS_Z:
|
||||||
|
|
||||||
dir.x = pos.x;
|
dir.x = pos.x;
|
||||||
dir.y = pos.y;
|
dir.y = pos.y;
|
||||||
dir.z = 1;
|
dir.z = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUBEFACE_NEG_Z:
|
case CUBEFACE_NEG_Z:
|
||||||
|
|
||||||
dir.x = pos.x;
|
dir.x = pos.x;
|
||||||
dir.y = pos.y;
|
dir.y = pos.y;
|
||||||
dir.z = -1;
|
dir.z = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CubeMap
|
} // namespace CubeMap
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
78
3rdparty/openexr/IlmImf/ImfEnvmap.h
vendored
78
3rdparty/openexr/IlmImf/ImfEnvmap.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -73,8 +73,11 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "ImathBox.h"
|
#include "ImathBox.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
namespace Imf {
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
// Supported environment map types
|
// Supported environment map types
|
||||||
@ -116,7 +119,8 @@ namespace LatLongMap
|
|||||||
// and longitude.
|
// and longitude.
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
Imath::V2f latLong (const Imath::V3f &direction);
|
IMF_EXPORT
|
||||||
|
IMATH_NAMESPACE::V2f latLong (const IMATH_NAMESPACE::V3f &direction);
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
@ -125,8 +129,9 @@ namespace LatLongMap
|
|||||||
// and longitude.
|
// and longitude.
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
Imath::V2f latLong (const Imath::Box2i &dataWindow,
|
IMF_EXPORT
|
||||||
const Imath::V2f &pixelPosition);
|
IMATH_NAMESPACE::V2f latLong (const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
|
const IMATH_NAMESPACE::V2f &pixelPosition);
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
@ -134,8 +139,9 @@ namespace LatLongMap
|
|||||||
// longitude and latitude, into a corresponding pixel position.
|
// longitude and latitude, into a corresponding pixel position.
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
Imath::V2f pixelPosition (const Imath::Box2i &dataWindow,
|
IMF_EXPORT
|
||||||
const Imath::V2f &latLong);
|
IMATH_NAMESPACE::V2f pixelPosition (const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
|
const IMATH_NAMESPACE::V2f &latLong);
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -144,8 +150,9 @@ namespace LatLongMap
|
|||||||
// to pixelPosition(dw,latLong(dw,dir)).
|
// to pixelPosition(dw,latLong(dw,dir)).
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
Imath::V2f pixelPosition (const Imath::Box2i &dataWindow,
|
IMF_EXPORT
|
||||||
const Imath::V3f &direction);
|
IMATH_NAMESPACE::V2f pixelPosition (const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
|
const IMATH_NAMESPACE::V3f &direction);
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
@ -153,8 +160,9 @@ namespace LatLongMap
|
|||||||
// map into a corresponding 3D direction.
|
// map into a corresponding 3D direction.
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
Imath::V3f direction (const Imath::Box2i &dataWindow,
|
IMF_EXPORT
|
||||||
const Imath::V2f &pixelPosition);
|
IMATH_NAMESPACE::V3f direction (const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
|
const IMATH_NAMESPACE::V2f &pixelPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,10 +185,10 @@ namespace LatLongMap
|
|||||||
// | | / /
|
// | | / /
|
||||||
// | |/ /
|
// | |/ /
|
||||||
// 4-----------5 Z
|
// 4-----------5 Z
|
||||||
//
|
//
|
||||||
// dataWindow.min
|
// dataWindow.min
|
||||||
// /
|
// /
|
||||||
// /
|
// /
|
||||||
// +-----------+
|
// +-----------+
|
||||||
// |3 Y 7|
|
// |3 Y 7|
|
||||||
// | | |
|
// | | |
|
||||||
@ -237,7 +245,7 @@ namespace LatLongMap
|
|||||||
// The size of the data window should be N by 6*N pixels
|
// The size of the data window should be N by 6*N pixels
|
||||||
// (width by height), where N can be any integer greater
|
// (width by height), where N can be any integer greater
|
||||||
// than 0.
|
// than 0.
|
||||||
//
|
//
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
@ -260,7 +268,8 @@ namespace CubeMap
|
|||||||
// Width and height of a cube's face, in pixels
|
// Width and height of a cube's face, in pixels
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
|
|
||||||
int sizeOfFace (const Imath::Box2i &dataWindow);
|
IMF_EXPORT
|
||||||
|
int sizeOfFace (const IMATH_NAMESPACE::Box2i &dataWindow);
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
@ -268,8 +277,9 @@ namespace CubeMap
|
|||||||
// that is covered by the specified face.
|
// that is covered by the specified face.
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
Imath::Box2i dataWindowForFace (CubeMapFace face,
|
IMF_EXPORT
|
||||||
const Imath::Box2i &dataWindow);
|
IMATH_NAMESPACE::Box2i dataWindowForFace (CubeMapFace face,
|
||||||
|
const IMATH_NAMESPACE::Box2i &dataWindow);
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
@ -279,9 +289,10 @@ namespace CubeMap
|
|||||||
// in the environment map.
|
// in the environment map.
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
Imath::V2f pixelPosition (CubeMapFace face,
|
IMF_EXPORT
|
||||||
const Imath::Box2i &dataWindow,
|
IMATH_NAMESPACE::V2f pixelPosition (CubeMapFace face,
|
||||||
Imath::V2f positionInFace);
|
const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
|
IMATH_NAMESPACE::V2f positionInFace);
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
@ -300,23 +311,26 @@ namespace CubeMap
|
|||||||
//
|
//
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
void faceAndPixelPosition (const Imath::V3f &direction,
|
IMF_EXPORT
|
||||||
const Imath::Box2i &dataWindow,
|
void faceAndPixelPosition (const IMATH_NAMESPACE::V3f &direction,
|
||||||
CubeMapFace &face,
|
const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
Imath::V2f &positionInFace);
|
CubeMapFace &face,
|
||||||
|
IMATH_NAMESPACE::V2f &positionInFace);
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// Given a cube face and a pixel position within that face,
|
// Given a cube face and a pixel position within that face,
|
||||||
// compute the corresponding 3D direction.
|
// compute the corresponding 3D direction.
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
Imath::V3f direction (CubeMapFace face,
|
IMF_EXPORT
|
||||||
const Imath::Box2i &dataWindow,
|
IMATH_NAMESPACE::V3f direction (CubeMapFace face,
|
||||||
const Imath::V2f &positionInFace);
|
const IMATH_NAMESPACE::Box2i &dataWindow,
|
||||||
|
const IMATH_NAMESPACE::V2f &positionInFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
17
3rdparty/openexr/IlmImf/ImfEnvmapAttribute.cpp
vendored
17
3rdparty/openexr/IlmImf/ImfEnvmapAttribute.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -42,8 +42,9 @@
|
|||||||
#include <ImfEnvmapAttribute.h>
|
#include <ImfEnvmapAttribute.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
const char *
|
const char *
|
||||||
@ -55,7 +56,7 @@ EnvmapAttribute::staticTypeName ()
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
EnvmapAttribute::writeValueTo (OStream &os, int) const
|
EnvmapAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
{
|
{
|
||||||
unsigned char tmp = _value;
|
unsigned char tmp = _value;
|
||||||
Xdr::write <StreamIO> (os, tmp);
|
Xdr::write <StreamIO> (os, tmp);
|
||||||
@ -64,7 +65,7 @@ EnvmapAttribute::writeValueTo (OStream &os, int) const
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
EnvmapAttribute::readValueFrom (IStream &is, int, int)
|
EnvmapAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
{
|
{
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
Xdr::read <StreamIO> (is, tmp);
|
Xdr::read <StreamIO> (is, tmp);
|
||||||
@ -72,4 +73,4 @@ EnvmapAttribute::readValueFrom (IStream &is, int, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
41
3rdparty/openexr/IlmImf/ImfEnvmapAttribute.h
vendored
41
3rdparty/openexr/IlmImf/ImfEnvmapAttribute.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -42,24 +42,27 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfAttribute.h"
|
||||||
#include <ImfEnvmap.h>
|
#include "ImfEnvmap.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
typedef TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::Envmap> EnvmapAttribute;
|
||||||
|
|
||||||
|
template <> IMF_EXPORT const char *EnvmapAttribute::staticTypeName ();
|
||||||
|
|
||||||
|
template <> IMF_EXPORT
|
||||||
|
void EnvmapAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &,
|
||||||
|
int) const;
|
||||||
|
|
||||||
|
template <> IMF_EXPORT
|
||||||
|
void EnvmapAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
|
||||||
|
int,
|
||||||
|
int);
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<Envmap> EnvmapAttribute;
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
template <> const char *EnvmapAttribute::staticTypeName ();
|
|
||||||
template <> void EnvmapAttribute::writeValueTo (OStream &, int) const;
|
|
||||||
template <> void EnvmapAttribute::readValueFrom (IStream &, int, int);
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfEnvmapAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
46
3rdparty/openexr/IlmImf/ImfExport.h
vendored
Normal file
46
3rdparty/openexr/IlmImf/ImfExport.h
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#if defined(OPENEXR_DLL)
|
||||||
|
#if defined(ILMIMF_EXPORTS)
|
||||||
|
#define IMF_EXPORT __declspec(dllexport)
|
||||||
|
#define IMF_EXPORT_CONST extern __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define IMF_EXPORT __declspec(dllimport)
|
||||||
|
#define IMF_EXPORT_CONST extern __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define IMF_EXPORT
|
||||||
|
#define IMF_EXPORT_CONST extern const
|
||||||
|
#endif
|
768
3rdparty/openexr/IlmImf/ImfFastHuf.cpp
vendored
Normal file
768
3rdparty/openexr/IlmImf/ImfFastHuf.cpp
vendored
Normal file
@ -0,0 +1,768 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2009-2014 DreamWorks Animation LLC.
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of DreamWorks Animation nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfFastHuf.h"
|
||||||
|
#include <Iex.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
//
|
||||||
|
// Adapted from hufUnpackEncTable -
|
||||||
|
// We don't need to reconstruct the code book, just the encoded
|
||||||
|
// lengths for each symbol. From the lengths, we can build the
|
||||||
|
// base + offset tables. This should be a bit more efficient
|
||||||
|
// for sparse code books.
|
||||||
|
//
|
||||||
|
// table - ptr to the start of the code length data. Will be
|
||||||
|
// updated as we decode data
|
||||||
|
//
|
||||||
|
// numBytes - size of the encoded table (I think)?
|
||||||
|
//
|
||||||
|
// minSymbol - smallest symbol in the code book
|
||||||
|
//
|
||||||
|
// maxSymbol - largest symbol in the code book.
|
||||||
|
//
|
||||||
|
// rleSymbol - the symbol to trigger RLE in the encoded bitstream
|
||||||
|
//
|
||||||
|
|
||||||
|
FastHufDecoder::FastHufDecoder
|
||||||
|
(const char *&table,
|
||||||
|
int numBytes,
|
||||||
|
int minSymbol,
|
||||||
|
int maxSymbol,
|
||||||
|
int rleSymbol)
|
||||||
|
:
|
||||||
|
_rleSymbol (rleSymbol),
|
||||||
|
_numSymbols (0),
|
||||||
|
_minCodeLength (255),
|
||||||
|
_maxCodeLength (0),
|
||||||
|
_idToSymbol (0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// List of symbols that we find with non-zero code lengths
|
||||||
|
// (listed in the order we find them). Store these in the
|
||||||
|
// same format as the code book stores codes + lengths -
|
||||||
|
// low 6 bits are the length, everything above that is
|
||||||
|
// the symbol.
|
||||||
|
//
|
||||||
|
|
||||||
|
std::vector<Int64> symbols;
|
||||||
|
|
||||||
|
//
|
||||||
|
// The 'base' table is the minimum code at each code length. base[i]
|
||||||
|
// is the smallest code (numerically) of length i.
|
||||||
|
//
|
||||||
|
|
||||||
|
Int64 base[MAX_CODE_LEN + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// The 'offset' table is the position (in sorted order) of the first id
|
||||||
|
// of a given code lenght. Array is indexed by code length, like base.
|
||||||
|
//
|
||||||
|
|
||||||
|
Int64 offset[MAX_CODE_LEN + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Count of how many codes at each length there are. Array is
|
||||||
|
// indexed by code length, like base and offset.
|
||||||
|
//
|
||||||
|
|
||||||
|
size_t codeCount[MAX_CODE_LEN + 1];
|
||||||
|
|
||||||
|
for (int i = 0; i <= MAX_CODE_LEN; ++i)
|
||||||
|
{
|
||||||
|
codeCount[i] = 0;
|
||||||
|
base[i] = 0xffffffffffffffffULL;
|
||||||
|
offset[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Count the number of codes, the min/max code lengths, the number of
|
||||||
|
// codes with each length, and record symbols with non-zero code
|
||||||
|
// length as we find them.
|
||||||
|
//
|
||||||
|
|
||||||
|
const char *currByte = table;
|
||||||
|
Int64 currBits = 0;
|
||||||
|
int currBitCount = 0;
|
||||||
|
|
||||||
|
const int SHORT_ZEROCODE_RUN = 59;
|
||||||
|
const int LONG_ZEROCODE_RUN = 63;
|
||||||
|
const int SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
|
||||||
|
|
||||||
|
for (Int64 symbol = minSymbol; symbol <= maxSymbol; symbol++)
|
||||||
|
{
|
||||||
|
if (currByte - table > numBytes)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
|
||||||
|
"(Truncated table data).");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Next code length - either:
|
||||||
|
// 0-58 (literal code length)
|
||||||
|
// 59-62 (various lengths runs of 0)
|
||||||
|
// 63 (run of n 0's, with n is the next 8 bits)
|
||||||
|
//
|
||||||
|
|
||||||
|
Int64 codeLen = readBits (6, currBits, currBitCount, currByte);
|
||||||
|
|
||||||
|
if (codeLen == (Int64) LONG_ZEROCODE_RUN)
|
||||||
|
{
|
||||||
|
if (currByte - table > numBytes)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
|
||||||
|
"(Truncated table data).");
|
||||||
|
}
|
||||||
|
|
||||||
|
int runLen = readBits (8, currBits, currBitCount, currByte) +
|
||||||
|
SHORTEST_LONG_RUN;
|
||||||
|
|
||||||
|
if (symbol + runLen > maxSymbol + 1)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
|
||||||
|
"(Run beyond end of table).");
|
||||||
|
}
|
||||||
|
|
||||||
|
symbol += runLen - 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (codeLen >= (Int64) SHORT_ZEROCODE_RUN)
|
||||||
|
{
|
||||||
|
int runLen = codeLen - SHORT_ZEROCODE_RUN + 2;
|
||||||
|
|
||||||
|
if (symbol + runLen > maxSymbol + 1)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
|
||||||
|
"(Run beyond end of table).");
|
||||||
|
}
|
||||||
|
|
||||||
|
symbol += runLen - 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (codeLen != 0)
|
||||||
|
{
|
||||||
|
symbols.push_back ((symbol << 6) | (codeLen & 63));
|
||||||
|
|
||||||
|
if (codeLen < _minCodeLength)
|
||||||
|
_minCodeLength = codeLen;
|
||||||
|
|
||||||
|
if (codeLen > _maxCodeLength)
|
||||||
|
_maxCodeLength = codeLen;
|
||||||
|
|
||||||
|
codeCount[codeLen]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_CODE_LEN; ++i)
|
||||||
|
_numSymbols += codeCount[i];
|
||||||
|
|
||||||
|
table = currByte;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compute base - once we have the code length counts, there
|
||||||
|
// is a closed form solution for this
|
||||||
|
//
|
||||||
|
|
||||||
|
{
|
||||||
|
double* countTmp = new double[_maxCodeLength+1];
|
||||||
|
|
||||||
|
for (int l = _minCodeLength; l <= _maxCodeLength; ++l)
|
||||||
|
{
|
||||||
|
countTmp[l] = (double)codeCount[l] *
|
||||||
|
(double)(2 << (_maxCodeLength-l));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int l = _minCodeLength; l <= _maxCodeLength; ++l)
|
||||||
|
{
|
||||||
|
double tmp = 0;
|
||||||
|
|
||||||
|
for (int k =l + 1; k <= _maxCodeLength; ++k)
|
||||||
|
tmp += countTmp[k];
|
||||||
|
|
||||||
|
tmp /= (double)(2 << (_maxCodeLength - l));
|
||||||
|
|
||||||
|
base[l] = (Int64)ceil (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] countTmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Compute offset - these are the positions of the first
|
||||||
|
// id (not symbol) that has length [i]
|
||||||
|
//
|
||||||
|
|
||||||
|
offset[_maxCodeLength] = 0;
|
||||||
|
|
||||||
|
for (int i= _maxCodeLength - 1; i >= _minCodeLength; i--)
|
||||||
|
offset[i] = offset[i + 1] + codeCount[i + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate and fill the symbol-to-id mapping. Smaller Ids should be
|
||||||
|
// mapped to less-frequent symbols (which have longer codes). Use
|
||||||
|
// the offset table to tell us where the id's for a given code
|
||||||
|
// length start off.
|
||||||
|
//
|
||||||
|
|
||||||
|
_idToSymbol = new int[_numSymbols];
|
||||||
|
|
||||||
|
Int64 mapping[MAX_CODE_LEN + 1];
|
||||||
|
for (int i = 0; i < MAX_CODE_LEN + 1; ++i)
|
||||||
|
mapping[i] = -1;
|
||||||
|
for (int i = _minCodeLength; i <= _maxCodeLength; ++i)
|
||||||
|
mapping[i] = offset[i];
|
||||||
|
|
||||||
|
for (std::vector<Int64>::const_iterator i = symbols.begin();
|
||||||
|
i != symbols.end();
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
int codeLen = *i & 63;
|
||||||
|
int symbol = *i >> 6;
|
||||||
|
|
||||||
|
if (mapping[codeLen] >= _numSymbols)
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
|
||||||
|
"(Invalid symbol in header).");
|
||||||
|
|
||||||
|
_idToSymbol[mapping[codeLen]] = symbol;
|
||||||
|
mapping[codeLen]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTables(base, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FastHufDecoder::~FastHufDecoder()
|
||||||
|
{
|
||||||
|
delete[] _idToSymbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Static check if the decoder is enabled.
|
||||||
|
//
|
||||||
|
// ATM, I only have access to little endian hardware for testing,
|
||||||
|
// so I'm not entirely sure that we are reading fom the bit stream
|
||||||
|
// properly on BE.
|
||||||
|
//
|
||||||
|
// If you happen to have more obscure hardware, check that the
|
||||||
|
// byte swapping in refill() is happening sensable, add an endian
|
||||||
|
// check if needed, and fix the preprocessor magic here.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define READ64(c) \
|
||||||
|
((Int64)(c)[0] << 56) | ((Int64)(c)[1] << 48) | ((Int64)(c)[2] << 40) | \
|
||||||
|
((Int64)(c)[3] << 32) | ((Int64)(c)[4] << 24) | ((Int64)(c)[5] << 16) | \
|
||||||
|
((Int64)(c)[6] << 8) | ((Int64)(c)[7] )
|
||||||
|
|
||||||
|
#ifdef __INTEL_COMPILER // ICC built-in swap for LE hosts
|
||||||
|
#if defined (__i386__) || defined(__x86_64__)
|
||||||
|
#undef READ64
|
||||||
|
#define READ64(c) _bswap64 (*(const Int64*)(c))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
FastHufDecoder::enabled()
|
||||||
|
{
|
||||||
|
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enabled for ICC, GCC:
|
||||||
|
// __i386__ -> x86
|
||||||
|
// __x86_64__ -> 64-bit x86
|
||||||
|
//
|
||||||
|
|
||||||
|
#if defined (__i386__) || defined(__x86_64__)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (_MSC_VER)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enabled for Visual Studio:
|
||||||
|
// _M_IX86 -> x86
|
||||||
|
// _M_X64 -> 64bit x86
|
||||||
|
|
||||||
|
#if defined (_M_IX86) || defined(_M_X64)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
//
|
||||||
|
// Unknown compiler - Be safe and disable.
|
||||||
|
//
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Built the acceleration tables for lookups on the upper bits
|
||||||
|
// as well as the 'LJ' tables.
|
||||||
|
//
|
||||||
|
|
||||||
|
void
|
||||||
|
FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Build the 'left justified' base table, by shifting base left..
|
||||||
|
//
|
||||||
|
|
||||||
|
for (int i = 0; i <= MAX_CODE_LEN; ++i)
|
||||||
|
{
|
||||||
|
if (base[i] != 0xffffffffffffffffULL)
|
||||||
|
{
|
||||||
|
_ljBase[i] = base[i] << (64 - i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Unused code length - insert dummy values
|
||||||
|
//
|
||||||
|
|
||||||
|
_ljBase[i] = 0xffffffffffffffffULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Combine some terms into a big fat constant, which for
|
||||||
|
// lack of a better term we'll call the 'left justified'
|
||||||
|
// offset table (because it serves the same function
|
||||||
|
// as 'offset', when using the left justified base table.
|
||||||
|
//
|
||||||
|
|
||||||
|
for (int i = 0; i <= MAX_CODE_LEN; ++i)
|
||||||
|
_ljOffset[i] = offset[i] - (_ljBase[i] >> (64 - i));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Build the acceleration tables for the lookups of
|
||||||
|
// short codes ( <= TABLE_LOOKUP_BITS long)
|
||||||
|
//
|
||||||
|
|
||||||
|
for (Int64 i = 0; i < 1 << TABLE_LOOKUP_BITS; ++i)
|
||||||
|
{
|
||||||
|
Int64 value = i << (64 - TABLE_LOOKUP_BITS);
|
||||||
|
|
||||||
|
_tableSymbol[i] = 0xffff;
|
||||||
|
_tableCodeLen[i] = 0;
|
||||||
|
|
||||||
|
for (int codeLen = _minCodeLength; codeLen <= _maxCodeLength; ++codeLen)
|
||||||
|
{
|
||||||
|
if (_ljBase[codeLen] <= value)
|
||||||
|
{
|
||||||
|
_tableCodeLen[i] = codeLen;
|
||||||
|
|
||||||
|
Int64 id = _ljOffset[codeLen] + (value >> (64 - codeLen));
|
||||||
|
if (id < _numSymbols)
|
||||||
|
{
|
||||||
|
_tableSymbol[i] = _idToSymbol[id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
|
||||||
|
"(Overrun).");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Store the smallest value in the table that points to real data.
|
||||||
|
// This should be the entry for the largest length that has
|
||||||
|
// valid data (in our case, non-dummy _ljBase)
|
||||||
|
//
|
||||||
|
|
||||||
|
int minIdx = TABLE_LOOKUP_BITS;
|
||||||
|
|
||||||
|
while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffULL)
|
||||||
|
minIdx--;
|
||||||
|
|
||||||
|
if (minIdx < 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Error, no codes with lengths 0-TABLE_LOOKUP_BITS used.
|
||||||
|
// Set the min value such that the table is never tested.
|
||||||
|
//
|
||||||
|
|
||||||
|
_tableMin = 0xffffffffffffffffULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_tableMin = _ljBase[minIdx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// For decoding, we're holding onto 2 Int64's.
|
||||||
|
//
|
||||||
|
// The first (buffer), holds the next bits from the bitstream to be
|
||||||
|
// decoded. For certain paths in the decoder, we only need TABLE_LOOKUP_BITS
|
||||||
|
// valid bits to decode the next symbol. For other paths, we need a full
|
||||||
|
// 64-bits to decode a symbol.
|
||||||
|
//
|
||||||
|
// When we need to refill 'buffer', we could pull bits straight from
|
||||||
|
// the bitstream. But this is very slow and requires lots of book keeping
|
||||||
|
// (what's the next bit in the next byte?). Instead, we keep another Int64
|
||||||
|
// around that we use to refill from. While this doesn't cut down on the
|
||||||
|
// book keeping (still need to know how many valid bits), it does cut
|
||||||
|
// down on some of the bit shifting crazy and byte access.
|
||||||
|
//
|
||||||
|
// The refill Int64 (bufferBack) gets left-shifted after we've pulled
|
||||||
|
// off bits. If we run out of bits in the input bit stream, we just
|
||||||
|
// shift in 0's to bufferBack.
|
||||||
|
//
|
||||||
|
// The refill act takes numBits from the top of bufferBack and sticks
|
||||||
|
// them in the bottom of buffer. If there arn't enough bits in bufferBack,
|
||||||
|
// it gets refilled (to 64-bits) from the input bitstream.
|
||||||
|
//
|
||||||
|
|
||||||
|
inline void
|
||||||
|
FastHufDecoder::refill
|
||||||
|
(Int64 &buffer,
|
||||||
|
int numBits, // number of bits to refill
|
||||||
|
Int64 &bufferBack, // the next 64-bits, to refill from
|
||||||
|
int &bufferBackNumBits, // number of bits left in bufferBack
|
||||||
|
const unsigned char *&currByte, // current byte in the bitstream
|
||||||
|
int &currBitsLeft) // number of bits left in the bitsream
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Refill bits into the bottom of buffer, from the top of bufferBack.
|
||||||
|
// Always top up buffer to be completely full.
|
||||||
|
//
|
||||||
|
|
||||||
|
buffer |= bufferBack >> (64 - numBits);
|
||||||
|
|
||||||
|
if (bufferBackNumBits < numBits)
|
||||||
|
{
|
||||||
|
numBits -= bufferBackNumBits;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Refill all of bufferBack from the bitstream. Either grab
|
||||||
|
// a full 64-bit chunk, or whatever bytes are left. If we
|
||||||
|
// don't have 64-bits left, pad with 0's.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (currBitsLeft >= 64)
|
||||||
|
{
|
||||||
|
bufferBack = READ64 (currByte);
|
||||||
|
bufferBackNumBits = 64;
|
||||||
|
currByte += sizeof (Int64);
|
||||||
|
currBitsLeft -= 8 * sizeof (Int64);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bufferBack = 0;
|
||||||
|
bufferBackNumBits = 64;
|
||||||
|
|
||||||
|
Int64 shift = 56;
|
||||||
|
|
||||||
|
while (currBitsLeft > 0)
|
||||||
|
{
|
||||||
|
bufferBack |= ((Int64)(*currByte)) << shift;
|
||||||
|
|
||||||
|
currByte++;
|
||||||
|
shift -= 8;
|
||||||
|
currBitsLeft -= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// At this point, currBitsLeft might be negative, just because
|
||||||
|
// we're subtracting whole bytes. To keep anyone from freaking
|
||||||
|
// out, zero the counter.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (currBitsLeft < 0)
|
||||||
|
currBitsLeft = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer |= bufferBack >> (64 - numBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferBack = bufferBack << numBits;
|
||||||
|
bufferBackNumBits -= numBits;
|
||||||
|
|
||||||
|
//
|
||||||
|
// We can have cases where the previous shift of bufferBack is << 64 -
|
||||||
|
// in which case no shift occurs. The bit count math still works though,
|
||||||
|
// so if we don't have any bits left, zero out bufferBack.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (bufferBackNumBits == 0)
|
||||||
|
bufferBack = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read the next few bits out of a bitstream. Will be given a backing buffer
|
||||||
|
// (buffer) that may still have data left over from previous reads
|
||||||
|
// (bufferNumBits). Bitstream pointer (currByte) will be advanced when needed.
|
||||||
|
//
|
||||||
|
|
||||||
|
inline Int64
|
||||||
|
FastHufDecoder::readBits
|
||||||
|
(int numBits,
|
||||||
|
Int64 &buffer, // c
|
||||||
|
int &bufferNumBits, // lc
|
||||||
|
const char *&currByte) // in
|
||||||
|
{
|
||||||
|
while (bufferNumBits < numBits)
|
||||||
|
{
|
||||||
|
buffer = (buffer << 8) | *(unsigned char*)(currByte++);
|
||||||
|
bufferNumBits += 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferNumBits -= numBits;
|
||||||
|
return (buffer >> bufferNumBits) & ((1 << numBits) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Decode using a the 'One-Shift' strategy for decoding, with a
|
||||||
|
// small-ish table to accelerate decoding of short codes.
|
||||||
|
//
|
||||||
|
// If possible, try looking up codes into the acceleration table.
|
||||||
|
// This has a few benifits - there's no search involved; We don't
|
||||||
|
// need an additional lookup to map id to symbol; we don't need
|
||||||
|
// a full 64-bits (so less refilling).
|
||||||
|
//
|
||||||
|
|
||||||
|
void
|
||||||
|
FastHufDecoder::decode
|
||||||
|
(const unsigned char *src,
|
||||||
|
int numSrcBits,
|
||||||
|
unsigned short *dst,
|
||||||
|
int numDstElems)
|
||||||
|
{
|
||||||
|
if (numSrcBits < 128)
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Error choosing Huffman decoder implementation "
|
||||||
|
"(insufficient number of bits).");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Current position (byte/bit) in the src data stream
|
||||||
|
// (after the first buffer fill)
|
||||||
|
//
|
||||||
|
|
||||||
|
const unsigned char *currByte = src + 2 * sizeof (Int64);
|
||||||
|
|
||||||
|
numSrcBits -= 8 * 2 * sizeof (Int64);
|
||||||
|
|
||||||
|
//
|
||||||
|
// 64-bit buffer holding the current bits in the stream
|
||||||
|
//
|
||||||
|
|
||||||
|
Int64 buffer = READ64 (src);
|
||||||
|
int bufferNumBits = 64;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 64-bit buffer holding the next bits in the stream
|
||||||
|
//
|
||||||
|
|
||||||
|
Int64 bufferBack = READ64 ((src + sizeof (Int64)));
|
||||||
|
int bufferBackNumBits = 64;
|
||||||
|
|
||||||
|
int dstIdx = 0;
|
||||||
|
|
||||||
|
while (dstIdx < numDstElems)
|
||||||
|
{
|
||||||
|
int codeLen;
|
||||||
|
int symbol;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test if we can be table accelerated. If so, directly
|
||||||
|
// lookup the output symbol. Otherwise, we need to fall
|
||||||
|
// back to searching for the code.
|
||||||
|
//
|
||||||
|
// If we're doing table lookups, we don't really need
|
||||||
|
// a re-filled buffer, so long as we have TABLE_LOOKUP_BITS
|
||||||
|
// left. But for a search, we do need a refilled table.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (_tableMin <= buffer)
|
||||||
|
{
|
||||||
|
int tableIdx = buffer >> (64 - TABLE_LOOKUP_BITS);
|
||||||
|
|
||||||
|
//
|
||||||
|
// For invalid codes, _tableCodeLen[] should return 0. This
|
||||||
|
// will cause the decoder to get stuck in the current spot
|
||||||
|
// until we run out of elements, then barf that the codestream
|
||||||
|
// is bad. So we don't need to stick a condition like
|
||||||
|
// if (codeLen > _maxCodeLength) in this inner.
|
||||||
|
//
|
||||||
|
|
||||||
|
codeLen = _tableCodeLen[tableIdx];
|
||||||
|
symbol = _tableSymbol[tableIdx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bufferNumBits < 64)
|
||||||
|
{
|
||||||
|
refill (buffer,
|
||||||
|
64 - bufferNumBits,
|
||||||
|
bufferBack,
|
||||||
|
bufferBackNumBits,
|
||||||
|
currByte,
|
||||||
|
numSrcBits);
|
||||||
|
|
||||||
|
bufferNumBits = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Brute force search:
|
||||||
|
// Find the smallest length where _ljBase[length] <= buffer
|
||||||
|
//
|
||||||
|
|
||||||
|
codeLen = TABLE_LOOKUP_BITS + 1;
|
||||||
|
|
||||||
|
while (_ljBase[codeLen] > buffer && codeLen <= _maxCodeLength)
|
||||||
|
codeLen++;
|
||||||
|
|
||||||
|
if (codeLen > _maxCodeLength)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
|
||||||
|
"(Decoded an invalid symbol).");
|
||||||
|
}
|
||||||
|
|
||||||
|
Int64 id = _ljOffset[codeLen] + (buffer >> (64 - codeLen));
|
||||||
|
if (id < _numSymbols)
|
||||||
|
{
|
||||||
|
symbol = _idToSymbol[id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
|
||||||
|
"(Decoded an invalid symbol).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Shift over bit stream, and update the bit count in the buffer
|
||||||
|
//
|
||||||
|
|
||||||
|
buffer = buffer << codeLen;
|
||||||
|
bufferNumBits -= codeLen;
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we recieved a RLE symbol (_rleSymbol), then we need
|
||||||
|
// to read ahead 8 bits to know how many times to repeat
|
||||||
|
// the previous symbol. Need to ensure we at least have
|
||||||
|
// 8 bits of data in the buffer
|
||||||
|
//
|
||||||
|
|
||||||
|
if (symbol == _rleSymbol)
|
||||||
|
{
|
||||||
|
if (bufferNumBits < 8)
|
||||||
|
{
|
||||||
|
refill (buffer,
|
||||||
|
64 - bufferNumBits,
|
||||||
|
bufferBack,
|
||||||
|
bufferBackNumBits,
|
||||||
|
currByte,
|
||||||
|
numSrcBits);
|
||||||
|
|
||||||
|
bufferNumBits = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rleCount = buffer >> 56;
|
||||||
|
|
||||||
|
if (dstIdx < 1)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error (RLE code "
|
||||||
|
"with no previous symbol).");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dstIdx + rleCount > numDstElems)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error (Symbol run "
|
||||||
|
"beyond expected output buffer length).");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rleCount <= 0)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc("Huffman decode error"
|
||||||
|
" (Invalid RLE length)");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < rleCount; ++i)
|
||||||
|
dst[dstIdx + i] = dst[dstIdx - 1];
|
||||||
|
|
||||||
|
dstIdx += rleCount;
|
||||||
|
|
||||||
|
buffer = buffer << 8;
|
||||||
|
bufferNumBits -= 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dst[dstIdx] = symbol;
|
||||||
|
dstIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// refill bit stream buffer if we're below the number of
|
||||||
|
// bits needed for a table lookup
|
||||||
|
//
|
||||||
|
|
||||||
|
if (bufferNumBits < TABLE_LOOKUP_BITS)
|
||||||
|
{
|
||||||
|
refill (buffer,
|
||||||
|
64 - bufferNumBits,
|
||||||
|
bufferBack,
|
||||||
|
bufferBackNumBits,
|
||||||
|
currByte,
|
||||||
|
numSrcBits);
|
||||||
|
|
||||||
|
bufferNumBits = 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numSrcBits != 0)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("Huffman decode error (Compressed data remains "
|
||||||
|
"after filling expected output buffer).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
153
3rdparty/openexr/IlmImf/ImfFastHuf.h
vendored
Normal file
153
3rdparty/openexr/IlmImf/ImfFastHuf.h
vendored
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2009-2014 DreamWorks Animation LLC.
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of DreamWorks Animation nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_FAST_HUF_H
|
||||||
|
#define INCLUDED_IMF_FAST_HUF_H
|
||||||
|
|
||||||
|
#include "ImfInt64.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
//
|
||||||
|
// Alternative Canonical Huffman decoder:
|
||||||
|
//
|
||||||
|
// Canonical Huffman decoder based on 'On the Implementation of Minimum
|
||||||
|
// Redundancy Prefix Codes' by Moffat and Turpin - highly recommended
|
||||||
|
// reading as a good description of the problem space, as well as
|
||||||
|
// a fast decoding algorithm.
|
||||||
|
//
|
||||||
|
// The premise is that instead of working directly with the coded
|
||||||
|
// symbols, we create a new ordering based on the frequency of symbols.
|
||||||
|
// Less frequent symbols (and thus longer codes) are ordered earler.
|
||||||
|
// We're calling the values in this ordering 'Ids', as oppsed to
|
||||||
|
// 'Symbols' - which are the short values we eventually want decoded.
|
||||||
|
//
|
||||||
|
// With this new ordering, a few small tables can be derived ('base'
|
||||||
|
// and 'offset') which drive the decoding. To cut down on the
|
||||||
|
// linear scanning of these tables, you can add a small table
|
||||||
|
// to directly look up short codes (as you might in a traditional
|
||||||
|
// lookup-table driven decoder).
|
||||||
|
//
|
||||||
|
// The decoder is meant to be compatible with the encoder (and decoder)
|
||||||
|
// in ImfHuf.cpp, just faster. For ease of implementation, this decoder
|
||||||
|
// should only be used on compressed bitstreams >= 128 bits long.
|
||||||
|
//
|
||||||
|
|
||||||
|
class FastHufDecoder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//
|
||||||
|
// Longest compressed code length that ImfHuf supports (58 bits)
|
||||||
|
//
|
||||||
|
|
||||||
|
static const int MAX_CODE_LEN = 58;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Number of bits in our acceleration table. Should match all
|
||||||
|
// codes up to TABLE_LOOKUP_BITS in length.
|
||||||
|
//
|
||||||
|
|
||||||
|
static const int TABLE_LOOKUP_BITS = 12;
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
FastHufDecoder (const char*& table,
|
||||||
|
int numBytes,
|
||||||
|
int minSymbol,
|
||||||
|
int maxSymbol,
|
||||||
|
int rleSymbol);
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
~FastHufDecoder ();
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
static bool enabled ();
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
|
void decode (const unsigned char *src,
|
||||||
|
int numSrcBits,
|
||||||
|
unsigned short *dst,
|
||||||
|
int numDstElems);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void buildTables (Int64*, Int64*);
|
||||||
|
void refill (Int64&, int, Int64&, int&, const unsigned char *&, int&);
|
||||||
|
Int64 readBits (int, Int64&, int&, const char *&);
|
||||||
|
|
||||||
|
int _rleSymbol; // RLE symbol written by the encoder.
|
||||||
|
// This could be 65536, so beware
|
||||||
|
// when you use shorts to hold things.
|
||||||
|
|
||||||
|
int _numSymbols; // Number of symbols in the codebook.
|
||||||
|
|
||||||
|
unsigned char _minCodeLength; // Minimum code length, in bits.
|
||||||
|
unsigned char _maxCodeLength; // Maximum code length, in bits.
|
||||||
|
|
||||||
|
int *_idToSymbol; // Maps Ids to symbols. Ids are a symbol
|
||||||
|
// ordering sorted first in terms of
|
||||||
|
// code length, and by code within
|
||||||
|
// the same length. Ids run from 0
|
||||||
|
// to mNumSymbols-1.
|
||||||
|
|
||||||
|
Int64 _ljBase[MAX_CODE_LEN + 1]; // the 'left justified base' table.
|
||||||
|
// Takes base[i] (i = code length)
|
||||||
|
// and 'left justifies' it into an Int64
|
||||||
|
|
||||||
|
Int64 _ljOffset[MAX_CODE_LEN +1 ]; // There are some other terms that can
|
||||||
|
// be folded into constants when taking
|
||||||
|
// the 'left justified' decode path. This
|
||||||
|
// holds those constants, indexed by
|
||||||
|
// code length
|
||||||
|
|
||||||
|
//
|
||||||
|
// We can accelerate the 'left justified' processing by running the
|
||||||
|
// top TABLE_LOOKUP_BITS through a LUT, to find the symbol and code
|
||||||
|
// length. These are those acceleration tables.
|
||||||
|
//
|
||||||
|
// Even though our evental 'symbols' are ushort's, the encoder adds
|
||||||
|
// a symbol to indicate RLE. So with a dense code book, we could
|
||||||
|
// have 2^16+1 codes, so both mIdToSymbol and mTableSymbol need
|
||||||
|
// to be bigger than 16 bits.
|
||||||
|
//
|
||||||
|
|
||||||
|
int _tableSymbol[1 << TABLE_LOOKUP_BITS];
|
||||||
|
unsigned char _tableCodeLen[1 << TABLE_LOOKUP_BITS];
|
||||||
|
Int64 _tableMin;
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
12
3rdparty/openexr/IlmImf/ImfFloatAttribute.cpp
vendored
12
3rdparty/openexr/IlmImf/ImfFloatAttribute.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,7 +43,7 @@
|
|||||||
#include <ImfFloatAttribute.h>
|
#include <ImfFloatAttribute.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -54,4 +54,4 @@ FloatAttribute::staticTypeName ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
21
3rdparty/openexr/IlmImf/ImfFloatAttribute.h
vendored
21
3rdparty/openexr/IlmImf/ImfFloatAttribute.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -43,21 +43,16 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfAttribute.h>
|
#include "ImfAttribute.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
typedef TypedAttribute<float> FloatAttribute;
|
typedef TypedAttribute<float> FloatAttribute;
|
||||||
template <> const char *FloatAttribute::staticTypeName ();
|
template <> IMF_EXPORT const char *FloatAttribute::staticTypeName ();
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
// Metrowerks compiler wants the .cpp file inlined, too
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#include <ImfFloatAttribute.cpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2013, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -32,105 +32,53 @@
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// b44ExpLogTable
|
|
||||||
//
|
|
||||||
// A program to generate lookup tables for
|
|
||||||
//
|
|
||||||
// y = exp (x / 8)
|
|
||||||
//
|
|
||||||
// and
|
|
||||||
// x = 8 * log (x);
|
|
||||||
//
|
|
||||||
// where x and y are 16-bit floating-point numbers
|
|
||||||
//
|
|
||||||
// The tables are used by class B44Compressor.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include <half.h>
|
//-----------------------------------------------------------------------------
|
||||||
#include <math.h>
|
//
|
||||||
#include <iostream>
|
// class FloatVectorAttribute
|
||||||
#include <iomanip>
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
using namespace std;
|
#include <ImfFloatVectorAttribute.h>
|
||||||
|
|
||||||
//---------------------------------------------
|
|
||||||
// Main - prints the half-to-float lookup table
|
|
||||||
//---------------------------------------------
|
|
||||||
|
|
||||||
int
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
main ()
|
|
||||||
|
|
||||||
|
using namespace OPENEXR_IMF_INTERNAL_NAMESPACE;
|
||||||
|
|
||||||
|
|
||||||
|
template <>
|
||||||
|
const char *
|
||||||
|
FloatVectorAttribute::staticTypeName ()
|
||||||
{
|
{
|
||||||
#ifndef HAVE_IOS_BASE
|
return "floatvector";
|
||||||
cout.setf (ios::hex, ios::basefield);
|
|
||||||
#else
|
|
||||||
cout.setf (ios_base::hex, ios_base::basefield);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cout << "//\n"
|
|
||||||
"// This is an automatically generated file.\n"
|
|
||||||
"// Do not edit.\n"
|
|
||||||
"//\n\n";
|
|
||||||
|
|
||||||
const int iMax = (1 << 16);
|
|
||||||
|
|
||||||
cout << "const unsigned short expTable[] =\n"
|
|
||||||
"{\n"
|
|
||||||
" ";
|
|
||||||
|
|
||||||
for (int i = 0; i < iMax; i++)
|
|
||||||
{
|
|
||||||
half h;
|
|
||||||
h.setBits (i);
|
|
||||||
|
|
||||||
if (!h.isFinite())
|
|
||||||
h = 0;
|
|
||||||
else if (h >= 8 * log (HALF_MAX))
|
|
||||||
h = HALF_MAX;
|
|
||||||
else
|
|
||||||
h = exp (h / 8);
|
|
||||||
|
|
||||||
cout << "0x" << setfill ('0') << setw (4) << h.bits() << ", ";
|
|
||||||
|
|
||||||
if (i % 8 == 7)
|
|
||||||
{
|
|
||||||
cout << "\n";
|
|
||||||
|
|
||||||
if (i < iMax - 1)
|
|
||||||
cout << " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "};\n\n";
|
|
||||||
|
|
||||||
cout << "const unsigned short logTable[] =\n"
|
|
||||||
"{\n"
|
|
||||||
" ";
|
|
||||||
|
|
||||||
for (int i = 0; i < iMax; i++)
|
|
||||||
{
|
|
||||||
half h;
|
|
||||||
h.setBits (i);
|
|
||||||
|
|
||||||
if (!h.isFinite() || h < 0)
|
|
||||||
h = 0;
|
|
||||||
else
|
|
||||||
h = 8 * log (h);
|
|
||||||
|
|
||||||
cout << "0x" << setfill ('0') << setw (4) << h.bits() << ", ";
|
|
||||||
|
|
||||||
if (i % 8 == 7)
|
|
||||||
{
|
|
||||||
cout << "\n";
|
|
||||||
|
|
||||||
if (i < iMax - 1)
|
|
||||||
cout << " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "};\n";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void
|
||||||
|
FloatVectorAttribute::writeValueTo
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
|
||||||
|
{
|
||||||
|
int n = _value.size();
|
||||||
|
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
Xdr::write <StreamIO> (os, _value[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void
|
||||||
|
FloatVectorAttribute::readValueFrom
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int size, int version)
|
||||||
|
{
|
||||||
|
int n = size / Xdr::size<float>();
|
||||||
|
_value.resize (n);
|
||||||
|
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
Xdr::read <StreamIO> (is, _value[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
76
3rdparty/openexr/IlmImf/ImfFloatVectorAttribute.h
vendored
Normal file
76
3rdparty/openexr/IlmImf/ImfFloatVectorAttribute.h
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2007, Weta Digital Ltd
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Weta Digital nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_FLOATVECTOR_ATTRIBUTE_H
|
||||||
|
#define INCLUDED_IMF_FLOATVECTOR_ATTRIBUTE_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// class FloatVectorAttribute
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "ImfAttribute.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
typedef std::vector<float>
|
||||||
|
FloatVector;
|
||||||
|
|
||||||
|
typedef TypedAttribute<OPENEXR_IMF_INTERNAL_NAMESPACE::FloatVector>
|
||||||
|
FloatVectorAttribute;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
const char *FloatVectorAttribute::staticTypeName ();
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void FloatVectorAttribute::writeValueTo
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &, int) const;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
IMF_EXPORT
|
||||||
|
void FloatVectorAttribute::readValueFrom
|
||||||
|
(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &, int, int);
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
#endif
|
127
3rdparty/openexr/IlmImf/ImfForward.h
vendored
Normal file
127
3rdparty/openexr/IlmImf/ImfForward.h
vendored
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// Portions (c) 2012 Weta Digital Ltd
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDED_IMF_FORWARD_H
|
||||||
|
#define INCLUDED_IMF_FORWARD_H
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Forward declarations for OpenEXR - correctly declares namespace
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
// classes for basic types;
|
||||||
|
template<class T> class Array;
|
||||||
|
template<class T> class Array2D;
|
||||||
|
struct Channel;
|
||||||
|
class ChannelList;
|
||||||
|
struct Chromaticities;
|
||||||
|
|
||||||
|
// attributes used in headers are TypedAttributes
|
||||||
|
class Attribute;
|
||||||
|
|
||||||
|
class Header;
|
||||||
|
|
||||||
|
// file handling classes
|
||||||
|
class OutputFile;
|
||||||
|
class TiledInputFile;
|
||||||
|
class ScanLineInputFile;
|
||||||
|
class InputFile;
|
||||||
|
class TiledOutputFile;
|
||||||
|
class DeepScanLineInputFile;
|
||||||
|
class DeepScanLineOutputFile;
|
||||||
|
class DeepTiledInputFile;
|
||||||
|
class DeepTiledOutputFile;
|
||||||
|
class AcesInputFile;
|
||||||
|
class AcesOutputFile;
|
||||||
|
class TiledInputPart;
|
||||||
|
class TiledInputFile;
|
||||||
|
class TileOffsets;
|
||||||
|
|
||||||
|
// multipart file handling
|
||||||
|
class GenericInputFile;
|
||||||
|
class GenericOutputFile;
|
||||||
|
class MultiPartInputFile;
|
||||||
|
class MultiPartOutputFile;
|
||||||
|
|
||||||
|
class InputPart;
|
||||||
|
class TiledInputPart;
|
||||||
|
class DeepScanLineInputPart;
|
||||||
|
class DeepTiledInputPart;
|
||||||
|
|
||||||
|
class OutputPart;
|
||||||
|
class ScanLineOutputPart;
|
||||||
|
class TiledOutputPart;
|
||||||
|
class DeepScanLineOutputPart;
|
||||||
|
class DeepTiledOutputPart;
|
||||||
|
|
||||||
|
|
||||||
|
// internal use only
|
||||||
|
struct InputPartData;
|
||||||
|
struct OutputStreamMutex;
|
||||||
|
struct OutputPartData;
|
||||||
|
struct InputStreamMutex;
|
||||||
|
|
||||||
|
// frame buffers
|
||||||
|
|
||||||
|
class FrameBuffer;
|
||||||
|
class DeepFrameBuffer;
|
||||||
|
struct DeepSlice;
|
||||||
|
|
||||||
|
// compositing
|
||||||
|
class DeepCompositing;
|
||||||
|
class CompositeDeepScanLine;
|
||||||
|
|
||||||
|
// preview image
|
||||||
|
class PreviewImage;
|
||||||
|
struct PreviewRgba;
|
||||||
|
|
||||||
|
// streams
|
||||||
|
class OStream;
|
||||||
|
class IStream;
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
#endif // include guard
|
42
3rdparty/openexr/IlmImf/ImfFrameBuffer.cpp
vendored
42
3rdparty/openexr/IlmImf/ImfFrameBuffer.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -36,8 +36,8 @@
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// class Slice
|
// class Slice
|
||||||
// class FrameBuffer
|
// class FrameBuffer
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -47,15 +47,17 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace Imf {
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
Slice::Slice (PixelType t,
|
Slice::Slice (PixelType t,
|
||||||
char *b,
|
char *b,
|
||||||
size_t xst,
|
size_t xst,
|
||||||
size_t yst,
|
size_t yst,
|
||||||
int xsm,
|
int xsm,
|
||||||
int ysm,
|
int ysm,
|
||||||
double fv,
|
double fv,
|
||||||
bool xtc,
|
bool xtc,
|
||||||
bool ytc)
|
bool ytc)
|
||||||
:
|
:
|
||||||
@ -78,8 +80,8 @@ FrameBuffer::insert (const char name[], const Slice &slice)
|
|||||||
{
|
{
|
||||||
if (name[0] == 0)
|
if (name[0] == 0)
|
||||||
{
|
{
|
||||||
THROW (Iex::ArgExc,
|
THROW (IEX_NAMESPACE::ArgExc,
|
||||||
"Frame buffer slice name cannot be an empty string.");
|
"Frame buffer slice name cannot be an empty string.");
|
||||||
}
|
}
|
||||||
|
|
||||||
_map[name] = slice;
|
_map[name] = slice;
|
||||||
@ -100,8 +102,8 @@ FrameBuffer::operator [] (const char name[])
|
|||||||
|
|
||||||
if (i == _map.end())
|
if (i == _map.end())
|
||||||
{
|
{
|
||||||
THROW (Iex::ArgExc,
|
THROW (IEX_NAMESPACE::ArgExc,
|
||||||
"Cannot find frame buffer slice \"" << name << "\".");
|
"Cannot find frame buffer slice \"" << name << "\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second;
|
return i->second;
|
||||||
@ -115,8 +117,8 @@ FrameBuffer::operator [] (const char name[]) const
|
|||||||
|
|
||||||
if (i == _map.end())
|
if (i == _map.end())
|
||||||
{
|
{
|
||||||
THROW (Iex::ArgExc,
|
THROW (IEX_NAMESPACE::ArgExc,
|
||||||
"Cannot find frame buffer slice \"" << name << "\".");
|
"Cannot find frame buffer slice \"" << name << "\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second;
|
return i->second;
|
||||||
@ -223,4 +225,4 @@ FrameBuffer::find (const string &name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
169
3rdparty/openexr/IlmImf/ImfFrameBuffer.h
vendored
169
3rdparty/openexr/IlmImf/ImfFrameBuffer.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -39,18 +39,21 @@
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// class Slice
|
// class Slice
|
||||||
// class FrameBuffer
|
// class FrameBuffer
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfName.h>
|
#include "ImfName.h"
|
||||||
#include <ImfPixelType.h>
|
#include "ImfPixelType.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
@ -68,43 +71,43 @@ struct Slice
|
|||||||
// Data type; see ImfPixelType.h
|
// Data type; see ImfPixelType.h
|
||||||
//------------------------------
|
//------------------------------
|
||||||
|
|
||||||
PixelType type;
|
PixelType type;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Memory layout: The address of pixel (x, y) is
|
// Memory layout: The address of pixel (x, y) is
|
||||||
//
|
//
|
||||||
// base + (xp / xSampling) * xStride + (yp / ySampling) * yStride
|
// base + (xp / xSampling) * xStride + (yp / ySampling) * yStride
|
||||||
//
|
//
|
||||||
// where xp and yp are computed as follows:
|
// where xp and yp are computed as follows:
|
||||||
//
|
//
|
||||||
// * If we are reading or writing a scanline-based file:
|
// * If we are reading or writing a scanline-based file:
|
||||||
//
|
//
|
||||||
// xp = x
|
// xp = x
|
||||||
// yp = y
|
// yp = y
|
||||||
//
|
//
|
||||||
// * If we are reading a tile whose upper left coorner is at (xt, yt):
|
// * If we are reading a tile whose upper left coorner is at (xt, yt):
|
||||||
//
|
//
|
||||||
// if xTileCoords is true then xp = x - xt, else xp = x
|
// if xTileCoords is true then xp = x - xt, else xp = x
|
||||||
// if yTileCoords is true then yp = y - yt, else yp = y
|
// if yTileCoords is true then yp = y - yt, else yp = y
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
char * base;
|
char * base;
|
||||||
size_t xStride;
|
size_t xStride;
|
||||||
size_t yStride;
|
size_t yStride;
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
// Subsampling: pixel (x, y) is present in the
|
// Subsampling: pixel (x, y) is present in the
|
||||||
// slice only if
|
// slice only if
|
||||||
//
|
//
|
||||||
// x % xSampling == 0 && y % ySampling == 0
|
// x % xSampling == 0 && y % ySampling == 0
|
||||||
//
|
//
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
int xSampling;
|
int xSampling;
|
||||||
int ySampling;
|
int ySampling;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
@ -112,8 +115,8 @@ struct Slice
|
|||||||
// a channel that corresponds to this slice is read.
|
// a channel that corresponds to this slice is read.
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
double fillValue;
|
double fillValue;
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// For tiled files, the xTileCoords and yTileCoords flags
|
// For tiled files, the xTileCoords and yTileCoords flags
|
||||||
@ -135,13 +138,14 @@ struct Slice
|
|||||||
// Constructor
|
// Constructor
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Slice (PixelType type = HALF,
|
Slice (PixelType type = HALF,
|
||||||
char * base = 0,
|
char * base = 0,
|
||||||
size_t xStride = 0,
|
size_t xStride = 0,
|
||||||
size_t yStride = 0,
|
size_t yStride = 0,
|
||||||
int xSampling = 1,
|
int xSampling = 1,
|
||||||
int ySampling = 1,
|
int ySampling = 1,
|
||||||
double fillValue = 0.0,
|
double fillValue = 0.0,
|
||||||
bool xTileCoords = false,
|
bool xTileCoords = false,
|
||||||
bool yTileCoords = false);
|
bool yTileCoords = false);
|
||||||
};
|
};
|
||||||
@ -155,35 +159,45 @@ class FrameBuffer
|
|||||||
// Add a slice
|
// Add a slice
|
||||||
//------------
|
//------------
|
||||||
|
|
||||||
void insert (const char name[],
|
IMF_EXPORT
|
||||||
const Slice &slice);
|
void insert (const char name[],
|
||||||
|
const Slice &slice);
|
||||||
|
|
||||||
void insert (const std::string &name,
|
IMF_EXPORT
|
||||||
const Slice &slice);
|
void insert (const std::string &name,
|
||||||
|
const Slice &slice);
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// Access to existing slices:
|
// Access to existing slices:
|
||||||
//
|
//
|
||||||
// [n] Returns a reference to the slice with name n.
|
// [n] Returns a reference to the slice with name n.
|
||||||
// If no slice with name n exists, an Iex::ArgExc
|
// If no slice with name n exists, an IEX_NAMESPACE::ArgExc
|
||||||
// is thrown.
|
// is thrown.
|
||||||
//
|
//
|
||||||
// findSlice(n) Returns a pointer to the slice with name n,
|
// findSlice(n) Returns a pointer to the slice with name n,
|
||||||
// or 0 if no slice with name n exists.
|
// or 0 if no slice with name n exists.
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
Slice & operator [] (const char name[]);
|
IMF_EXPORT
|
||||||
const Slice & operator [] (const char name[]) const;
|
Slice & operator [] (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
|
const Slice & operator [] (const char name[]) const;
|
||||||
|
|
||||||
Slice & operator [] (const std::string &name);
|
IMF_EXPORT
|
||||||
const Slice & operator [] (const std::string &name) const;
|
Slice & operator [] (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
|
const Slice & operator [] (const std::string &name) const;
|
||||||
|
|
||||||
Slice * findSlice (const char name[]);
|
IMF_EXPORT
|
||||||
const Slice * findSlice (const char name[]) const;
|
Slice * findSlice (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
|
const Slice * findSlice (const char name[]) const;
|
||||||
|
|
||||||
Slice * findSlice (const std::string &name);
|
IMF_EXPORT
|
||||||
const Slice * findSlice (const std::string &name) const;
|
Slice * findSlice (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
|
const Slice * findSlice (const std::string &name) const;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
@ -195,21 +209,29 @@ class FrameBuffer
|
|||||||
class Iterator;
|
class Iterator;
|
||||||
class ConstIterator;
|
class ConstIterator;
|
||||||
|
|
||||||
Iterator begin ();
|
IMF_EXPORT
|
||||||
ConstIterator begin () const;
|
Iterator begin ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator begin () const;
|
||||||
|
|
||||||
Iterator end ();
|
IMF_EXPORT
|
||||||
ConstIterator end () const;
|
Iterator end ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator end () const;
|
||||||
|
|
||||||
Iterator find (const char name[]);
|
IMF_EXPORT
|
||||||
ConstIterator find (const char name[]) const;
|
Iterator find (const char name[]);
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator find (const char name[]) const;
|
||||||
|
|
||||||
Iterator find (const std::string &name);
|
IMF_EXPORT
|
||||||
ConstIterator find (const std::string &name) const;
|
Iterator find (const std::string &name);
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator find (const std::string &name) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SliceMap _map;
|
SliceMap _map;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -221,14 +243,20 @@ class FrameBuffer::Iterator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
Iterator ();
|
Iterator ();
|
||||||
|
IMF_EXPORT
|
||||||
Iterator (const FrameBuffer::SliceMap::iterator &i);
|
Iterator (const FrameBuffer::SliceMap::iterator &i);
|
||||||
|
|
||||||
Iterator & operator ++ ();
|
IMF_EXPORT
|
||||||
Iterator operator ++ (int);
|
Iterator & operator ++ ();
|
||||||
|
IMF_EXPORT
|
||||||
|
Iterator operator ++ (int);
|
||||||
|
|
||||||
const char * name () const;
|
IMF_EXPORT
|
||||||
Slice & slice () const;
|
const char * name () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
Slice & slice () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -242,15 +270,22 @@ class FrameBuffer::ConstIterator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator ();
|
ConstIterator ();
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator (const FrameBuffer::SliceMap::const_iterator &i);
|
ConstIterator (const FrameBuffer::SliceMap::const_iterator &i);
|
||||||
|
IMF_EXPORT
|
||||||
ConstIterator (const FrameBuffer::Iterator &other);
|
ConstIterator (const FrameBuffer::Iterator &other);
|
||||||
|
|
||||||
ConstIterator & operator ++ ();
|
IMF_EXPORT
|
||||||
ConstIterator operator ++ (int);
|
ConstIterator & operator ++ ();
|
||||||
|
IMF_EXPORT
|
||||||
|
ConstIterator operator ++ (int);
|
||||||
|
|
||||||
const char * name () const;
|
IMF_EXPORT
|
||||||
const Slice & slice () const;
|
const char * name () const;
|
||||||
|
IMF_EXPORT
|
||||||
|
const Slice & slice () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -364,7 +399,7 @@ FrameBuffer::ConstIterator::slice () const
|
|||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator == (const FrameBuffer::ConstIterator &x,
|
operator == (const FrameBuffer::ConstIterator &x,
|
||||||
const FrameBuffer::ConstIterator &y)
|
const FrameBuffer::ConstIterator &y)
|
||||||
{
|
{
|
||||||
return x._i == y._i;
|
return x._i == y._i;
|
||||||
}
|
}
|
||||||
@ -372,12 +407,12 @@ operator == (const FrameBuffer::ConstIterator &x,
|
|||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
operator != (const FrameBuffer::ConstIterator &x,
|
operator != (const FrameBuffer::ConstIterator &x,
|
||||||
const FrameBuffer::ConstIterator &y)
|
const FrameBuffer::ConstIterator &y)
|
||||||
{
|
{
|
||||||
return !(x == y);
|
return !(x == y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
23
3rdparty/openexr/IlmImf/ImfFramesPerSecond.cpp
vendored
23
3rdparty/openexr/IlmImf/ImfFramesPerSecond.cpp
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -41,9 +41,10 @@
|
|||||||
#include <ImfFramesPerSecond.h>
|
#include <ImfFramesPerSecond.h>
|
||||||
#include "ImathFun.h"
|
#include "ImathFun.h"
|
||||||
|
|
||||||
using namespace Imath;
|
using namespace IMATH_NAMESPACE;
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
namespace Imf {
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
Rational
|
Rational
|
||||||
guessExactFps (double fps)
|
guessExactFps (double fps)
|
||||||
@ -58,18 +59,18 @@ guessExactFps (const Rational &fps)
|
|||||||
const double e = 0.002;
|
const double e = 0.002;
|
||||||
|
|
||||||
if (abs (double (fps) - double (fps_23_976())) < e)
|
if (abs (double (fps) - double (fps_23_976())) < e)
|
||||||
return fps_23_976();
|
return fps_23_976();
|
||||||
|
|
||||||
if (abs (double (fps) - double (fps_29_97())) < e)
|
if (abs (double (fps) - double (fps_29_97())) < e)
|
||||||
return fps_29_97();
|
return fps_29_97();
|
||||||
|
|
||||||
if (abs (double (fps) - double (fps_47_952())) < e)
|
if (abs (double (fps) - double (fps_47_952())) < e)
|
||||||
return fps_47_952();
|
return fps_47_952();
|
||||||
|
|
||||||
if (abs (double (fps) - double (fps_59_94())) < e)
|
if (abs (double (fps) - double (fps_59_94())) < e)
|
||||||
return fps_59_94();
|
return fps_59_94();
|
||||||
|
|
||||||
return fps;
|
return fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Imf
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
||||||
|
24
3rdparty/openexr/IlmImf/ImfFramesPerSecond.h
vendored
24
3rdparty/openexr/IlmImf/ImfFramesPerSecond.h
vendored
@ -2,9 +2,9 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
// Copyright (c) 2006, Industrial Light & Magic, a division of Lucas
|
||||||
// Digital Ltd. LLC
|
// Digital Ltd. LLC
|
||||||
//
|
//
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are
|
// modification, are permitted provided that the following conditions are
|
||||||
// met:
|
// met:
|
||||||
@ -16,8 +16,8 @@
|
|||||||
// distribution.
|
// distribution.
|
||||||
// * Neither the name of Industrial Light & Magic nor the names of
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
// its contributors may be used to endorse or promote products derived
|
// its contributors may be used to endorse or promote products derived
|
||||||
// from this software without specific prior written permission.
|
// from this software without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
@ -65,9 +65,13 @@
|
|||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include <ImfRational.h>
|
#include "ImfRational.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
namespace Imf {
|
|
||||||
|
|
||||||
inline Rational fps_23_976 () {return Rational (24000, 1001);}
|
inline Rational fps_23_976 () {return Rational (24000, 1001);}
|
||||||
inline Rational fps_24 () {return Rational (24, 1);}
|
inline Rational fps_24 () {return Rational (24, 1);}
|
||||||
@ -80,9 +84,11 @@ inline Rational fps_50 () {return Rational (50, 1);}
|
|||||||
inline Rational fps_59_94 () {return Rational (60000, 1001);}
|
inline Rational fps_59_94 () {return Rational (60000, 1001);}
|
||||||
inline Rational fps_60 () {return Rational (60, 1);}
|
inline Rational fps_60 () {return Rational (60, 1);}
|
||||||
|
|
||||||
Rational guessExactFps (double fps);
|
IMF_EXPORT Rational guessExactFps (double fps);
|
||||||
Rational guessExactFps (const Rational &fps);
|
IMF_EXPORT Rational guessExactFps (const Rational &fps);
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
} // namespace Imf
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
76
3rdparty/openexr/IlmImf/ImfGenericInputFile.cpp
vendored
Normal file
76
3rdparty/openexr/IlmImf/ImfGenericInputFile.cpp
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfGenericInputFile.h"
|
||||||
|
|
||||||
|
#include <ImfVersion.h>
|
||||||
|
#include <ImfXdr.h>
|
||||||
|
#include <Iex.h>
|
||||||
|
#include <OpenEXRConfig.h>
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
void GenericInputFile::readMagicNumberAndVersionField(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, int& version)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Read the magic number and the file format version number.
|
||||||
|
// Then check if we can read the rest of this file.
|
||||||
|
//
|
||||||
|
|
||||||
|
int magic;
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (is, magic);
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::read <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (is, version);
|
||||||
|
|
||||||
|
if (magic != MAGIC)
|
||||||
|
{
|
||||||
|
throw IEX_NAMESPACE::InputExc ("File is not an image file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getVersion (version) != EXR_VERSION)
|
||||||
|
{
|
||||||
|
THROW (IEX_NAMESPACE::InputExc, "Cannot read "
|
||||||
|
"version " << getVersion (version) << " "
|
||||||
|
"image files. Current file format version "
|
||||||
|
"is " << EXR_VERSION << ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supportsFlags (getFlags (version)))
|
||||||
|
{
|
||||||
|
THROW (IEX_NAMESPACE::InputExc, "The file format version number's flag field "
|
||||||
|
"contains unrecognized flags.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
61
3rdparty/openexr/IlmImf/ImfGenericInputFile.h
vendored
Normal file
61
3rdparty/openexr/IlmImf/ImfGenericInputFile.h
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef IMFGENERICINPUTFILE_H_
|
||||||
|
#define IMFGENERICINPUTFILE_H_
|
||||||
|
|
||||||
|
#include "ImfIO.h"
|
||||||
|
#include "ImfHeader.h"
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
#include "ImfExport.h"
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
|
||||||
|
|
||||||
|
class GenericInputFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IMF_EXPORT
|
||||||
|
virtual ~GenericInputFile() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IMF_EXPORT
|
||||||
|
GenericInputFile() {}
|
||||||
|
IMF_EXPORT
|
||||||
|
void readMagicNumberAndVersionField(OPENEXR_IMF_INTERNAL_NAMESPACE::IStream& is, int& version);
|
||||||
|
};
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* IMFGENERICINPUTFILE_H_ */
|
112
3rdparty/openexr/IlmImf/ImfGenericOutputFile.cpp
vendored
Normal file
112
3rdparty/openexr/IlmImf/ImfGenericOutputFile.cpp
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2011, Industrial Light & Magic, a division of Lucas
|
||||||
|
// Digital Ltd. LLC
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Industrial Light & Magic nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "ImfGenericOutputFile.h"
|
||||||
|
|
||||||
|
#include <ImfBoxAttribute.h>
|
||||||
|
#include <ImfFloatAttribute.h>
|
||||||
|
#include <ImfTimeCodeAttribute.h>
|
||||||
|
#include <ImfChromaticitiesAttribute.h>
|
||||||
|
|
||||||
|
#include <ImfMisc.h>
|
||||||
|
#include <ImfPartType.h>
|
||||||
|
|
||||||
|
#include "ImfNamespace.h"
|
||||||
|
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
GenericOutputFile::writeMagicNumberAndVersionField (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream& os,
|
||||||
|
const Header& header)
|
||||||
|
{
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::write <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (os, MAGIC);
|
||||||
|
|
||||||
|
int version = EXR_VERSION;
|
||||||
|
|
||||||
|
if (header.hasType() && isDeepData(header.type()))
|
||||||
|
{
|
||||||
|
version |= NON_IMAGE_FLAG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// (TODO) we may want to check something else in function signature
|
||||||
|
// instead of hasTileDescription()?
|
||||||
|
if (header.hasTileDescription())
|
||||||
|
version |= TILED_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usesLongNames (header))
|
||||||
|
version |= LONG_NAMES_FLAG;
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::write <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (os, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GenericOutputFile::writeMagicNumberAndVersionField (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream& os,
|
||||||
|
const Header * headers,
|
||||||
|
int parts)
|
||||||
|
{
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::write <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (os, MAGIC);
|
||||||
|
|
||||||
|
int version = EXR_VERSION;
|
||||||
|
|
||||||
|
if (parts == 1)
|
||||||
|
{
|
||||||
|
if (headers[0].type() == TILEDIMAGE)
|
||||||
|
version |= TILED_FLAG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
version |= MULTI_PART_FILE_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < parts; i++)
|
||||||
|
{
|
||||||
|
if (usesLongNames (headers[i]))
|
||||||
|
version |= LONG_NAMES_FLAG;
|
||||||
|
|
||||||
|
if (headers[i].hasType() && isImage(headers[i].type()) == false)
|
||||||
|
version |= NON_IMAGE_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE::Xdr::write <OPENEXR_IMF_INTERNAL_NAMESPACE::StreamIO> (os, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user