diff --git a/src/cmake/build_libuhdr.cmake b/src/cmake/build_libuhdr.cmake index ec4f6e9fd8..777b50b894 100644 --- a/src/cmake/build_libuhdr.cmake +++ b/src/cmake/build_libuhdr.cmake @@ -22,6 +22,7 @@ build_dependency_with_cmake(libuhdr -D CMAKE_INSTALL_LIBDIR=lib -D CMAKE_POSITION_INDEPENDENT_CODE=ON -D UHDR_BUILD_EXAMPLES=FALSE + -D UHDR_BUILD_DEPS=FALSE -D UHDR_ENABLE_LOGS=TRUE ) diff --git a/src/cmake/modules/Findlibuhdr.cmake b/src/cmake/modules/Findlibuhdr.cmake index ee5538ff95..b1f8c2a7af 100644 --- a/src/cmake/modules/Findlibuhdr.cmake +++ b/src/cmake/modules/Findlibuhdr.cmake @@ -28,3 +28,7 @@ find_package_handle_standard_args (libuhdr REQUIRED_VARS LIBUHDR_INCLUDE_DIR LIBUHDR_LIBRARY ) + +if (libuhdr_FOUND) + message("libuhdr: includedir=${LIBUHDR_INCLUDE_DIR} library=${LIBUHDR_LIBRARY}") +endif() diff --git a/src/jpeg.imageio/CMakeLists.txt b/src/jpeg.imageio/CMakeLists.txt index feb222358a..de3c67d164 100644 --- a/src/jpeg.imageio/CMakeLists.txt +++ b/src/jpeg.imageio/CMakeLists.txt @@ -4,13 +4,19 @@ if (libuhdr_FOUND) set (UHDR_DEFS USE_UHDR) +else () + set (LIBUHDR_INCLUDE_DIR "") + set (LIBUHDR_LIBRARY "") + set (UHDR_DEFS "") endif () +message("UHDR_DEFS: ${UHDR_DEFS}") + add_oiio_plugin (jpeginput.cpp jpegoutput.cpp INCLUDE_DIRS ${LIBUHDR_INCLUDE_DIR} LINK_LIBRARIES $ $ ${LIBUHDR_LIBRARY} - DEFINITIONS ${UHDR_DEFS} + DEFINITIONS "${UHDR_DEFS}" ) diff --git a/src/jpeg.imageio/jpeginput.cpp b/src/jpeg.imageio/jpeginput.cpp index 106222c79e..c3bcd06e57 100644 --- a/src/jpeg.imageio/jpeginput.cpp +++ b/src/jpeg.imageio/jpeginput.cpp @@ -337,6 +337,8 @@ JpgInput::open(const std::string& name, ImageSpec& newspec) if (m_spec.find_attribute("hdrgm:Version")) m_is_uhdr = read_uhdr(m_io); + std::cout << "INVESTIGATE: m_is_uhdr=" << m_is_uhdr << std::endl; + newspec = m_spec; return true; } @@ -418,15 +420,20 @@ bool JpgInput::read_uhdr(Filesystem::IOProxy* ioproxy) { #if defined(USE_UHDR) + std::cout << "INVESTIGATE: read_uhdr main content" << std::endl; // Read entire file content into buffer. const size_t buffer_size = ioproxy->size(); std::vector buffer(buffer_size); ioproxy->pread(buffer.data(), buffer_size, 0); + std::cout << "INVESTIGATE: proxytype=" << ioproxy->proxytype() << std::endl; + std::cout << "INVESTIGATE: proxytype=" << buffer_size << std::endl; + // Check if this is an actual Ultra HDR image. const bool detect_uhdr = is_uhdr_image(buffer.data(), buffer.size()); - if (!detect_uhdr) - return false; + std::cout << "INVESTIGATE: detect_uhdr=" << detect_uhdr << std::endl; + //if (!detect_uhdr) + // return false; // Create Ultra HDR decoder. // Do not forget to release it once we don't need it, @@ -446,12 +453,14 @@ JpgInput::read_uhdr(Filesystem::IOProxy* ioproxy) // Decode Ultra HDR image // and check for decoding errors. uhdr_error_info_t err_info = uhdr_decode(m_uhdr_dec); + std::cout << "INVESTIGATE: error_code=" << err_info.error_code << std::endl; if (err_info.error_code != UHDR_CODEC_OK) { errorfmt("Ultra HDR decoding failed with error code {}", int(err_info.error_code)); if (err_info.has_detail != 0) - errorfmt("Additional error details: {}", err_info.detail); + std::cout << "INVESTIGATE: error details = " << err_info.detail << std::endl; + //errorfmt("Additional error details: {}", err_info.detail); uhdr_release_decoder(m_uhdr_dec); return false; } @@ -488,6 +497,7 @@ JpgInput::read_uhdr(Filesystem::IOProxy* ioproxy) return true; #else + std::cout << "INVESTIGATE: read_uhdr placeholder" << std::endl; return false; #endif }