Skip to content

Commit

Permalink
commit for CI debugging, will be removed later
Browse files Browse the repository at this point in the history
Signed-off-by: loicvital <[email protected]>
  • Loading branch information
mugulmd committed Nov 5, 2024
1 parent 2a5fc74 commit 8f34a75
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/cmake/build_libuhdr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
4 changes: 4 additions & 0 deletions src/cmake/modules/Findlibuhdr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
8 changes: 7 additions & 1 deletion src/jpeg.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_NAME_IF_EXISTS:libjpeg-turbo::jpeg>
$<TARGET_NAME_IF_EXISTS:JPEG::JPEG>
${LIBUHDR_LIBRARY}
DEFINITIONS ${UHDR_DEFS}
DEFINITIONS "${UHDR_DEFS}"
)
16 changes: 13 additions & 3 deletions src/jpeg.imageio/jpeginput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<unsigned char> 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,
Expand All @@ -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;
}
Expand Down Expand Up @@ -488,6 +497,7 @@ JpgInput::read_uhdr(Filesystem::IOProxy* ioproxy)

return true;
#else
std::cout << "INVESTIGATE: read_uhdr placeholder" << std::endl;
return false;
#endif
}
Expand Down

0 comments on commit 8f34a75

Please sign in to comment.