Skip to content

Commit

Permalink
build: ensure libuhdr build recipe points to correct JPEG package
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 f246e84
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/cmake/build_libuhdr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ set (libuhdr_GIT_TAG "v${libuhdr_BUILD_VERSION}")
set_cache (libuhdr_BUILD_SHARED_LIBS OFF
DOC "Should execute a local libuhdr build, if necessary, build shared libraries" ADVANCED)

# CI debugging
if (TARGET libjpeg-turbo::jpeg)
get_target_property(JPEG_INCLUDE_DIR JPEG::JPEG INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(JPEG_LIBRARY JPEG::JPEG INTERFACE_LINK_LIBRARIES)
endif ()
message("[libuhdr] JPEG_INCLUDE_DIR=${JPEG_INCLUDE_DIR}")
message("[libuhdr] JPEG_LIBRARY=${JPEG_LIBRARY}")

build_dependency_with_cmake(libuhdr
VERSION ${libuhdr_BUILD_VERSION}
GIT_REPOSITORY ${libuhdr_GIT_REPOSITORY}
Expand All @@ -22,7 +30,10 @@ 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
-D JPEG_INCLUDE_DIR=${JPEG_INCLUDE_DIR}
-D JPEG_LIBRARY=${JPEG_LIBRARY}
)

if (WIN32)
Expand Down
8 changes: 4 additions & 4 deletions src/cmake/externalpackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ else ()
endif ()


# Ultra HDR
checked_find_package (libuhdr)


checked_find_package (TIFF REQUIRED
VERSION_MIN 4.0)
alias_library_if_not_exists (TIFF::TIFF TIFF::tiff)
Expand Down Expand Up @@ -226,10 +230,6 @@ checked_find_package (fmt REQUIRED
get_target_property(FMT_INCLUDE_DIR fmt::fmt-header-only INTERFACE_INCLUDE_DIRECTORIES)


# Ultra HDR
checked_find_package (libuhdr)


###########################################################################

list (SORT CFP_ALL_BUILD_DEPS_FOUND COMPARE STRING CASE INSENSITIVE)
Expand Down
6 changes: 5 additions & 1 deletion src/jpeg.imageio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

if (libuhdr_FOUND)
set (UHDR_DEFS USE_UHDR)
else ()
set (LIBUHDR_INCLUDE_DIR "")
set (LIBUHDR_LIBRARY "")
set (UHDR_DEFS "")
endif ()

add_oiio_plugin (jpeginput.cpp jpegoutput.cpp
Expand All @@ -12,5 +16,5 @@ add_oiio_plugin (jpeginput.cpp jpegoutput.cpp
$<TARGET_NAME_IF_EXISTS:libjpeg-turbo::jpeg>
$<TARGET_NAME_IF_EXISTS:JPEG::JPEG>
${LIBUHDR_LIBRARY}
DEFINITIONS ${UHDR_DEFS}
DEFINITIONS "${UHDR_DEFS}"
)
8 changes: 5 additions & 3 deletions src/jpeg.imageio/jpeginput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ JpgInput::read_uhdr(Filesystem::IOProxy* ioproxy)

// 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;
//if (!detect_uhdr)
// return false;

// Create Ultra HDR decoder.
// Do not forget to release it once we don't need it,
Expand All @@ -448,10 +448,12 @@ JpgInput::read_uhdr(Filesystem::IOProxy* ioproxy)
uhdr_error_info_t err_info = uhdr_decode(m_uhdr_dec);

if (err_info.error_code != UHDR_CODEC_OK) {
std::cout << "[libuhdr] error code: " << err_info.error_code << std::endl;
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 << "[libuhdr] error detail: " << err_info.detail << std::endl;
//errorfmt("Additional error details: {}", err_info.detail);
uhdr_release_decoder(m_uhdr_dec);
return false;
}
Expand Down

0 comments on commit f246e84

Please sign in to comment.