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 bc3d2bc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
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}"
)
9 changes: 8 additions & 1 deletion 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,13 +420,15 @@ 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);

// Check if this is an actual Ultra HDR image.
const bool detect_uhdr = is_uhdr_image(buffer.data(), buffer.size());
std::cout << "INVESTIGATE: detect_uhdr=" << detect_uhdr << std::endl;
if (!detect_uhdr)
return false;

Expand All @@ -446,12 +450,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 +494,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 bc3d2bc

Please sign in to comment.