Skip to content

Commit 8c47b52

Browse files
committed
Merge branch 'main' of github.com:AcademySoftwareFoundation/OpenImageIO into 4632_rust_bindings
2 parents 9c03c11 + b8ffc12 commit 8c47b52

File tree

22 files changed

+1276
-164
lines changed

22 files changed

+1276
-164
lines changed

CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ message(STATUS "Joint namespace PROJ_NAMESPACE_V: ${PROJ_NAMESPACE_V}")
170170
# defined for downstream projects using OIIO.
171171
add_compile_definitions (OIIO_INTERNAL=1)
172172

173+
# If CMake variable OIIO_SITE is set, set compile symbol OIIO_SITE_sitename
174+
if (OIIO_SITE)
175+
add_compile_definitions (OIIO_SITE_${OIIO_SITE})
176+
endif ()
177+
173178
include (GNUInstallDirs)
174179

175180
# Utilities for build instructions of the format-reading plugins
@@ -253,13 +258,6 @@ set (format_plugin_libs "")
253258
set (format_plugin_include_dirs "")
254259
set (format_plugin_definitions "")
255260
file (GLOB all_format_plugin_dirs src/*.imageio)
256-
if ("${OIIO_SITE}" STREQUAL "SPI")
257-
# SPI only -- because of a workaround for a very weird linkage issue
258-
# specific to our system, we need to be sure libtiff is referenced first.
259-
file (GLOB tiff_format_plugin_dir src/tiff.imageio)
260-
list (REMOVE_ITEM all_format_plugin_dirs ${tiff_format_plugin_dir})
261-
list (INSERT all_format_plugin_dirs 0 ${tiff_format_plugin_dir})
262-
endif ()
263261
if (EMBEDPLUGINS AND NOT BUILD_OIIOUTIL_ONLY)
264262
foreach (plugin_dir ${all_format_plugin_dirs})
265263
add_subdirectory (${plugin_dir})

src/doc/imageioapi.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ Efficient unique strings: ``ustring``
9595
9696
.. _sec-span:
9797

98-
Non-owning array views: ``span`` / ``cspan``
99-
============================================
98+
Non-owning contiguous array views: ``span`` / ``cspan``
99+
=======================================================
100100

101101
.. doxygenclass:: OIIO::span
102102
:members:
@@ -111,6 +111,18 @@ Additionally, there is a convenience template:
111111
|
112112
113113

114+
.. _sec-span:
115+
116+
Non-owning image array views: ``image_span``
117+
============================================
118+
119+
.. doxygenclass:: OIIO::image_span
120+
:members:
121+
122+
123+
|
124+
125+
114126

115127
.. _sec-ROI:
116128

src/include/OpenImageIO/fmath.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ scaled_conversion(const S& src, F scale, F min, F max)
757757
template<typename S, typename D>
758758
void convert_type (const S *src, D *dst, size_t n, D _min, D _max)
759759
{
760-
if (std::is_same<S,D>::value) {
760+
if constexpr (std::is_same<S,D>::value) {
761761
// They must be the same type. Just memcpy.
762762
memcpy (dst, src, n*sizeof(D));
763763
return;
@@ -968,6 +968,25 @@ inline void convert_type (const S *src, D *dst, size_t n)
968968

969969

970970

971+
/// Copy (type convert) consecutive values from the cspan `src` holding data
972+
/// of type S into the span `dst` holding the same number of elements of data
973+
/// of type D.
974+
///
975+
/// The conversion is not a simple cast, but correctly remaps the 0.0->1.0
976+
/// range from and to the full positive range of integral types. It's just a
977+
/// straight copy if both types are identical. Optional arguments `min` and
978+
/// `max` can give nonstandard quantizations.
979+
template<typename S, typename D>
980+
void convert_type (cspan<S> src, span<D> dst,
981+
D min = std::numeric_limits<D>::min(),
982+
D max = std::numeric_limits<D>::min())
983+
{
984+
OIIO_DASSERT(src.size() == dst.size());
985+
convert_type(src.data(), dst.data(), std::min(src.size(), dst.size()),
986+
min, max);
987+
}
988+
989+
971990

972991
/// Convert a single value from the type of S to the type of D.
973992
/// The conversion is not a simple cast, but correctly remaps the
@@ -978,7 +997,7 @@ template<typename S, typename D>
978997
inline D
979998
convert_type (const S &src)
980999
{
981-
if (std::is_same<S,D>::value) {
1000+
if constexpr (std::is_same<S,D>::value) {
9821001
// They must be the same type. Just return it.
9831002
return (D)src;
9841003
}

0 commit comments

Comments
 (0)