-
Notifications
You must be signed in to change notification settings - Fork 674
Adding HTJ2K Encoding using the OpenJPH library. #4699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
d6d331e
e45e9e9
a8011bf
ed4b96c
81d32da
61b5459
4a8e567
4e090e6
ce87082
0ed7e3c
eca23b8
7786d2f
92d760a
c41a551
2b1141e
59686c0
d93d170
e6be06e
8dcdcca
0af0325
b4fc92a
aadfaf1
df5b9a9
00f7207
c432632
4fa83c5
814ae5d
3bd6029
4548850
eee3848
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "configurations" : [ | ||
| { | ||
| "id" : "E800C18D-6608-42DB-8622-CF764A0DAE82", | ||
| "name" : "Configuration 1", | ||
| "options" : { | ||
|
|
||
| } | ||
| } | ||
| ], | ||
| "defaultOptions" : { | ||
| "testTimeoutsEnabled" : true | ||
| }, | ||
| "testTargets" : [ | ||
|
|
||
| ], | ||
| "version" : 1 | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| # Copyright Contributors to the OpenImageIO project. | ||
| # SPDX-License-Identifier: BSD-3-Clause and Apache-2.0 | ||
|
richardssam marked this conversation as resolved.
Outdated
|
||
| # https://github.com/AcademySoftwareFoundation/OpenImageIO | ||
|
|
||
| # Module to find OPENJPH. | ||
| # | ||
|
Comment on lines
+5
to
+6
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking: OpenJPH doesn't have an exported cmake config?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think so no. I'll check what they have done with OpenEXR, so we dont have two different approaches. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The more recent 0.21.x version do, and I guess 0.21.2 should be the minimum required due to some other bugfixes as well. See also AcademySoftwareFoundation/openexr#1883
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we never had OpenJPH as a dependency before, there is no need to preserve any back compatibility, so we can set the minimum version to anything we want. If the most recent version makes the build process more foolproof by supplying the exported cmake config files and eliminating the need for a FindOpenJPH module, I think that's a totally valid reason to make it the minimum going forward. An example of a potential counter-argument would be: if OpenJPH is widely used and an older version is probably on most developer's machines already, requiring the very newest is an extra burden for them, so maybe it's worth accommodating older versions. (But I suspect this is not the case with OpenJPH as it would be with something like libtiff or libjpeg... I bet most developers will have to install OpenJPH for the first time only after we add it as a dependency, so it shouldn't matter much if we require them to have a new version.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, I tend to agree; 0.21.x is available OOTB only recently, in the upcoming Fedora 42, Ubuntu 25.04, Debian 13 (trixie), etc.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, so I did clean up the cmake part of findJPH to use pkg-config. |
||
| # This module will first look into the directories defined by the variables: | ||
| # - OPENJPH_ROOT | ||
| # | ||
| # This module defines the following variables: | ||
| # | ||
| # OPENJPH_INCLUDES - where to find ojph_arg.h | ||
| # OPENJPH_LIBRARIES - list of libraries to link against when using OPENJPH. | ||
| # OPENJPH_FOUND - True if OPENJPH was found. | ||
| # OPENJPH_VERSION - Set to the OPENJPH version found | ||
| include (FindPackageHandleStandardArgs) | ||
| include (FindPackageMessage) | ||
| include (SelectLibraryConfigurations) | ||
|
|
||
| macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) | ||
| string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) | ||
| find_path(${tmp_varname} ${includefile} | ||
| PATHS ${${libpath_var}} | ||
| PATH_SUFFIXES openjph | ||
| ) | ||
| if (${tmp_varname}) | ||
| mark_as_advanced (${tmp_varname}) | ||
| endif () | ||
| unset (tmp_varname) | ||
| endmacro () | ||
|
|
||
|
|
||
| macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) | ||
| string (TOUPPER ${prefix}_${libname} tmp_prefix) | ||
| find_library(${tmp_prefix}_LIBRARY_RELEASE | ||
| NAMES ${libname} | ||
| PATHS ${${libpath_var}} | ||
| ) | ||
| find_library(${tmp_prefix}_LIBRARY_DEBUG | ||
| NAMES ${libname}d ${libname}_d ${libname}debug ${libname}_debug | ||
| PATHS ${${libpath_var}} | ||
| ) | ||
| # Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES | ||
| select_library_configurations (${tmp_prefix}) | ||
| list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) | ||
|
|
||
| # Add to the list of variables which should be reset | ||
| list (APPEND ${cachelist_var} | ||
| ${tmp_prefix}_LIBRARY | ||
| ${tmp_prefix}_LIBRARY_RELEASE | ||
| ${tmp_prefix}_LIBRARY_DEBUG) | ||
| mark_as_advanced ( | ||
| ${tmp_prefix}_LIBRARY | ||
| ${tmp_prefix}_LIBRARY_RELEASE | ||
| ${tmp_prefix}_LIBRARY_DEBUG) | ||
| unset (tmp_prefix) | ||
| endmacro () | ||
|
|
||
| # Generic search paths | ||
| set (OPENJPH_include_paths | ||
| /usr/include | ||
| /opt/local/include | ||
| /usr/local/include | ||
| ) | ||
|
|
||
| set (OPENJPH_library_paths | ||
| /usr/lib | ||
| /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} | ||
| /usr/local/lib | ||
| /sw/lib | ||
| /opt/local/lib) | ||
|
|
||
|
|
||
|
|
||
| # Locate the header files | ||
| PREFIX_FIND_INCLUDE_DIR (OPENJPH ojph_arg.h OPENJPH_include_paths) | ||
|
|
||
| # If the headers were found, add its parent to the list of lib directories | ||
| if (OPENJPH_INCLUDE_DIR) | ||
| get_filename_component (tmp_extra_dir "${OPENJPH_INCLUDE_DIR}/../" ABSOLUTE) | ||
| list (APPEND OPENJPH_library_paths ${tmp_extra_dir}) | ||
| unset (tmp_extra_dir) | ||
| endif () | ||
|
|
||
| # Search for opj_config.h -- it is only part of OPENJPH >= 2.0, and will | ||
| # contain symbols OPJ_VERSION_MAJOR and OPJ_VERSION_MINOR. If the file | ||
| # doesn't exist, we're dealing with OPENJPH 1.x. | ||
| # Note that for OPENJPH 2.x, the library is named libopenjp2, not | ||
| # libOPENJPH (which is for 1.x) | ||
| set (OPENJPH_CONFIG_FILE "${OPENJPH_INCLUDE_DIR}/ojph_version.h") | ||
| message("!!!!!!!!!!!!!!!!!!OPENJPH OPENJPH_CONFIG_FILE ${OPENJPH_INCLUDE_DIR} ${OPENJPH_CONFIG_FILE}") | ||
|
|
||
| if (EXISTS "${OPENJPH_CONFIG_FILE}") | ||
| message("!!!!!!--- CONFIGFILE - ${OPENJPH_CONFIG_FILE}") | ||
| file(STRINGS "${OPENJPH_CONFIG_FILE}" TMP REGEX "^#define OPENJPH_VERSION_MAJOR .*$") | ||
| string (REGEX MATCHALL "[0-9]+" OJPH_VERSION_MAJOR ${TMP}) | ||
| file(STRINGS "${OPENJPH_CONFIG_FILE}" TMP REGEX "^#define OPENJPH_VERSION_MINOR .*$") | ||
| string (REGEX MATCHALL "[0-9]+" OJPH_VERSION_MINOR ${TMP}) | ||
| endif () | ||
| set (OPENJPH_VERSION "${OJPH_VERSION_MAJOR}.${OJPH_VERSION_MINOR}") | ||
| message("!!!!!!!!!!!!!!!!!!OPENJPH VERSION ${OPENJPH_VERSION}") | ||
|
|
||
| # Locate the OPENJPH library | ||
| set (OPENJPH_libvars "") | ||
| set (OPENJPH_cachevars "") | ||
|
|
||
| PREFIX_FIND_LIB (OPENJPH openjph | ||
| OPENJPH_library_paths OPENJPH_libvars OPENJPH_cachevars) | ||
|
|
||
|
|
||
| # Use the standard function to handle OPENJPH_FOUND | ||
| FIND_PACKAGE_HANDLE_STANDARD_ARGS (OPENJPH | ||
| VERSION_VAR OPENJPH_VERSION | ||
| REQUIRED_VARS OPENJPH_INCLUDE_DIR ${OPENJPH_libvars}) | ||
|
|
||
| if (OPENJPH_FOUND) | ||
| set (OPENJPH_INCLUDES ${OPENJPH_INCLUDE_DIR}) | ||
| set (OPENJPH_LIBRARIES "") | ||
| foreach (tmplib ${OPENJPH_libvars}) | ||
| list (APPEND OPENJPH_LIBRARIES ${${tmplib}}) | ||
| endforeach () | ||
| if (NOT OPENJPH_FIND_QUIETLY) | ||
| FIND_PACKAGE_MESSAGE (OPENJPH | ||
| "Found OPENJPH: v${OPENJPH_VERSION} ${OPENJPH_LIBRARIES}" | ||
| "[${OPENJPH_INCLUDE_DIR}][${OPENJPH_LIBRARIES}]" | ||
| ) | ||
| endif () | ||
| endif () | ||
|
|
||
| unset (OPENJPH_include_paths) | ||
| unset (OPENJPH_library_paths) | ||
| unset (OPENJPH_libvars) | ||
| unset (OPENJPH_cachevars) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Copyright Contributors to the OpenImageIO project. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # https://github.com/AcademySoftwareFoundation/OpenImageIO | ||
|
|
||
| if (OPENJPH_FOUND) | ||
| add_oiio_plugin (jphoutput.cpp | ||
| INCLUDE_DIRS ${OPENJPH_INCLUDES} | ||
| LINK_LIBRARIES ${OPENJPH_LIBRARIES} | ||
| DEFINITIONS "USE_OPENJPH") | ||
| else() | ||
| message (WARNING "HTJpeg-2000 JPH plugin will not be built") | ||
| endif() |
Uh oh!
There was an error while loading. Please reload this page.