Skip to content

Commit b8a58b0

Browse files
palemieuxcary-ilm
andcommitted
Add HTJ2K Compressor (AcademySoftwareFoundation#1883)
* Add HT256 compressor Signed-off-by: Pierre-Anthony Lemieux <[email protected]> * Update src/lib/OpenEXR/ImfCompression.h Co-authored-by: Cary Phillips <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> * Update src/lib/OpenEXR/ImfCompression.cpp Co-authored-by: Cary Phillips <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> * Update website/ReadingAndWritingImageFiles.rst Co-authored-by: Cary Phillips <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> * Add channel map Signed-off-by: Pierre-Anthony Lemieux <[email protected]> --------- Signed-off-by: Pierre-Anthony Lemieux <[email protected]> Signed-off-by: Pierre-Anthony Lemieux <[email protected]> Co-authored-by: Cary Phillips <[email protected]>
1 parent 310e3bd commit b8a58b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1096
-16
lines changed

.github/workflows/ci_steps.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ on:
4949
type: string
5050
OPENEXR_FORCE_INTERNAL_DEFLATE:
5151
type: string
52+
OPENEXR_FORCE_INTERNAL_OPENJPH:
53+
type: string
5254
BUILD_TESTING:
5355
type: string
5456
namespace:
@@ -84,6 +86,9 @@ jobs:
8486
if [ "${{ inputs.OPENEXR_FORCE_INTERNAL_DEFLATE }}" == "OFF" ]; then
8587
PACKAGES="$PACKAGES libdeflate:p"
8688
fi
89+
if [ "${{ inputs.OPENEXR_FORCE_INTERNAL_OPENJPH }}" == "OFF" && "${{ inputs.msystem }}" != "MINGW32" ]; then
90+
PACKAGES="$PACKAGES openjph:p"
91+
fi
8792
echo "PACBOY_PACKAGES=$PACKAGES" >> $GITHUB_ENV
8893
shell: bash
8994

@@ -108,11 +113,17 @@ jobs:
108113
run: share/ci/scripts/install_libdeflate.sh master
109114
shell: bash
110115

111-
- name: Set PATH for Imath/libdeflate DLLs
116+
- name: Install OpenJPH
117+
# Pre-install OpenJPH so the builds validate finding the external installation
118+
if: inputs.OPENEXR_FORCE_INTERNAL_OPENJPH == 'OFF' && inputs.msystem == ''
119+
run: share/ci/scripts/install_openjph.sh 0.21.2
120+
shell: bash
121+
122+
- name: Set PATH for Imath/libdeflate/OpenJPH DLLs
112123
# When building against external Imath/libdeflate shared objects, the tests need PATH to include the dll's.
113124
if: contains(inputs.os, 'windows') && inputs.msystem == ''
114125
run: |
115-
echo "$PATH;C:/Program Files (x86)/Imath/bin;C:/Program Files (x86)/Imath/lib;C:/Program Files (x86)/libdeflate/bin;C:/Program Files (x86)/libdeflate/lib" >> $GITHUB_PATH
126+
echo "$PATH;C:/Program Files (x86)/Imath/bin;C:/Program Files (x86)/Imath/lib;C:/Program Files (x86)/libdeflate/bin;C:/Program Files (x86)/libdeflate/lib;C:/Program Files (x86)/openjph/lib;C:/Program Files (x86)/openjph/bin" >> $GITHUB_PATH
116127
shell: bash
117128

118129
- name: Install help2man
@@ -132,6 +143,7 @@ jobs:
132143
# Construct the cmake command as a variable, so the
133144
# Configure step below can execute it, but also so we can store
134145
# in in the install_manifest as a debugging reference
146+
135147
cmake_args=("-B" "." "-S" "..")
136148
cmake_args+=("-DCMAKE_INSTALL_PREFIX=../_install")
137149
cmake_args+=("-DCMAKE_BUILD_TYPE=${{ inputs.build-type }}")
@@ -144,6 +156,7 @@ jobs:
144156
cmake_args+=("-DOPENEXR_BUILD_TOOLS=${{ inputs.OPENEXR_BUILD_TOOLS }}")
145157
cmake_args+=("-DOPENEXR_FORCE_INTERNAL_IMATH=${{ inputs.OPENEXR_FORCE_INTERNAL_IMATH }}")
146158
cmake_args+=("-DOPENEXR_FORCE_INTERNAL_DEFLATE=${{ inputs.OPENEXR_FORCE_INTERNAL_DEFLATE }}")
159+
cmake_args+=("-DOPENEXR_FORCE_INTERNAL_OPENJPH=${{ inputs.OPENEXR_FORCE_INTERNAL_OPENJPH }}")
147160
cmake_args+=("-DBUILD_TESTING=${{ inputs.BUILD_TESTING }}")
148161
cmake_args+=("-DOPENEXR_RUN_FUZZ_TESTS=OFF")
149162
cmake_args+=("-DCMAKE_VERBOSE_MAKEFILE=ON")
@@ -170,6 +183,7 @@ jobs:
170183
- name: Configure, Build, Test
171184
if: inputs.msystem == ''
172185
run: |
186+
set -x
173187
cmake --version
174188
cmake ${{ env.CMAKE_ARGS }}
175189
cmake --build . --target install --config ${{ inputs.build-type }}
@@ -214,4 +228,3 @@ jobs:
214228
share/ci/scripts/validate_install.py "_build/$INSTALL_MANIFEST" "share/ci/install_manifest/$INSTALL_MANIFEST"
215229
shell: bash
216230

217-

.github/workflows/ci_workflow.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ jobs:
7878
OPENEXR_BUILD_TOOLS: ${{ matrix.OPENEXR_BUILD_TOOLS || 'ON' }}
7979
OPENEXR_FORCE_INTERNAL_IMATH: ${{ matrix.OPENEXR_FORCE_INTERNAL_IMATH || 'OFF' }}
8080
OPENEXR_FORCE_INTERNAL_DEFLATE: ${{ matrix.OPENEXR_FORCE_INTERNAL_DEFLATE || 'OFF' }}
81+
OPENEXR_FORCE_INTERNAL_OPENJPH: ${{ matrix.OPENEXR_FORCE_INTERNAL_OPENJPH || 'OFF' }}
8182
BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }}
8283
namespace: ${{ matrix.namespace }}
8384
validate_install: ${{ matrix.validate_install || 'ON' }}
8485

8586
strategy:
86-
fail-fast: false
8787
matrix:
8888
include:
8989

@@ -110,6 +110,7 @@ jobs:
110110
OPENEXR_BUILD_TOOLS: 'OFF'
111111
OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
112112
OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON'
113+
OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
113114
BUILD_TESTING: 'OFF'
114115

115116
- build: 6
@@ -144,11 +145,11 @@ jobs:
144145
OPENEXR_BUILD_TOOLS: ${{ matrix.OPENEXR_BUILD_TOOLS || 'ON' }}
145146
OPENEXR_FORCE_INTERNAL_IMATH: ${{ matrix.OPENEXR_FORCE_INTERNAL_IMATH || 'OFF' }}
146147
OPENEXR_FORCE_INTERNAL_DEFLATE: ${{ matrix.OPENEXR_FORCE_INTERNAL_DEFLATE || 'OFF' }}
148+
OPENEXR_FORCE_INTERNAL_OPENJPH: ${{ matrix.OPENEXR_FORCE_INTERNAL_OPENJPH || 'OFF' }}
147149
BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }}
148150
validate_install: ${{ matrix.validate_install || 'ON' }}
149151

150152
strategy:
151-
fail-fast: false
152153
matrix:
153154
include:
154155

@@ -175,6 +176,7 @@ jobs:
175176
OPENEXR_BUILD_TOOLS: 'OFF'
176177
OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
177178
OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON'
179+
OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
178180
BUILD_TESTING: 'OFF'
179181

180182
- build: 6
@@ -201,11 +203,11 @@ jobs:
201203
OPENEXR_FORCE_INTERNAL_IMATH: ${{ matrix.OPENEXR_FORCE_INTERNAL_IMATH || 'OFF' }}
202204
OPENEXR_FORCE_INTERNAL_DEFLATE: ${{ matrix.OPENEXR_FORCE_INTERNAL_DEFLATE || 'OFF' }}
203205
msystem: ${{ matrix.msystem }}
206+
OPENEXR_FORCE_INTERNAL_OPENJPH: ${{ matrix.OPENEXR_FORCE_INTERNAL_OPENJPH || 'OFF' }}
204207
BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }}
205208
validate_install: ${{ matrix.validate_install || 'ON' }}
206209

207210
strategy:
208-
fail-fast: false
209211
matrix:
210212
include:
211213
- build: 1
@@ -232,6 +234,7 @@ jobs:
232234
OPENEXR_BUILD_TOOLS: 'OFF'
233235
OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
234236
OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON'
237+
OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
235238
BUILD_TESTING: 'OFF'
236239

237240
- build: 6

.github/workflows/python-wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ jobs:
8989
name: wheels-${{ matrix.os }}-${{ matrix.arch }}
9090
path: |
9191
./wheelhouse/*.whl
92-
./wheelhouse/*.tar.gz
92+
./wheelhouse/*.tar.gz

BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ cc_library(
190190
"src/lib/OpenEXRCore/internal_dwa_simd.h",
191191
"src/lib/OpenEXRCore/internal_file.h",
192192
"src/lib/OpenEXRCore/internal_float_vector.h",
193+
"src/lib/OpenEXRCore/internal_ht.cpp",
194+
"src/lib/OpenEXRCore/internal_ht_common.h",
195+
"src/lib/OpenEXRCore/internal_ht_common.cpp",
193196
"src/lib/OpenEXRCore/internal_huf.c",
194197
"src/lib/OpenEXRCore/internal_huf.h",
195198
"src/lib/OpenEXRCore/internal_memory.h",
@@ -263,6 +266,7 @@ cc_library(
263266
visibility = ["//visibility:public"],
264267
deps = [
265268
"@imath",
269+
"@openjph",
266270
"@libdeflate//:deflate",
267271
],
268272
)
@@ -309,6 +313,7 @@ cc_library(
309313
"src/lib/OpenEXR/ImfGenericInputFile.cpp",
310314
"src/lib/OpenEXR/ImfGenericOutputFile.cpp",
311315
"src/lib/OpenEXR/ImfHeader.cpp",
316+
"src/lib/OpenEXR/ImfHTCompressor.cpp",
312317
"src/lib/OpenEXR/ImfHuf.cpp",
313318
"src/lib/OpenEXR/ImfIDManifest.cpp",
314319
"src/lib/OpenEXR/ImfIDManifestAttribute.cpp",
@@ -414,6 +419,7 @@ cc_library(
414419
"src/lib/OpenEXR/ImfGenericInputFile.h",
415420
"src/lib/OpenEXR/ImfGenericOutputFile.h",
416421
"src/lib/OpenEXR/ImfHeader.h",
422+
"src/lib/OpenEXR/ImfHTCompressor.h",
417423
"src/lib/OpenEXR/ImfHuf.h",
418424
"src/lib/OpenEXR/ImfIDManifest.h",
419425
"src/lib/OpenEXR/ImfIDManifestAttribute.h",
@@ -505,6 +511,7 @@ cc_library(
505511
":IlmThread",
506512
":OpenEXRCore",
507513
"@imath",
514+
"@openjph"
508515
],
509516
)
510517

MODULE.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module(
88

99
bazel_dep(name = "bazel_skylib", version = "1.7.1")
1010
bazel_dep(name = "imath")
11+
bazel_dep(name = "openjph")
1112
bazel_dep(name = "libdeflate")
1213
bazel_dep(name = "platforms", version = "0.0.11")
1314
bazel_dep(name = "rules_cc", version = "0.1.1")
@@ -31,3 +32,13 @@ archive_override(
3132
strip_prefix = "libdeflate-master",
3233
urls = ["https://github.com/ebiggers/libdeflate/archive/refs/heads/master.zip"],
3334
)
35+
36+
archive_override(
37+
module_name = "openjph",
38+
patches = [
39+
"//bazel:openjph_add_build_file.patch",
40+
"//bazel:openjph_module_dot_bazel.patch",
41+
],
42+
strip_prefix = "OpenJPH-add-export",
43+
urls = ["https://github.com/palemieux/OpenJPH/archive/refs/heads/add-export.zip"],
44+
)

bazel/openjph_add_build_file.patch

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
--- /dev/null
2+
+++ BUILD.bazel
3+
@@ -0,0 +1,116 @@
4+
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
5+
+load("@rules_license//rules:license.bzl", "license")
6+
+
7+
+package(
8+
+ default_applicable_licenses = [":license"],
9+
+)
10+
+
11+
+exports_files([
12+
+ "LICENSE",
13+
+])
14+
+
15+
+license(
16+
+ name = "license",
17+
+ license_kinds = ["@rules_license//licenses/spdx:BSD-2-Clause"],
18+
+ license_text = "LICENSE",
19+
+)
20+
+
21+
+cc_binary(
22+
+ name = "ojph_compress",
23+
+ srcs = ["src/apps/ojph_compress/ojph_compress.cpp"],
24+
+ visibility = ["//visibility:public"],
25+
+ deps = [":ojph_expand"],
26+
+)
27+
+
28+
+cc_library(
29+
+ name = "ojph_expand",
30+
+ srcs = [
31+
+ "src/apps/ojph_expand/ojph_expand.cpp",
32+
+ "src/apps/others/ojph_img_io.cpp",
33+
+ ],
34+
+ hdrs = [
35+
+ "src/apps/common/ojph_img_io.h",
36+
+ ],
37+
+ includes = [
38+
+ "src/apps/common",
39+
+ ],
40+
+ visibility = ["//visibility:public"],
41+
+ deps = [":openjph"],
42+
+)
43+
+
44+
+cc_library(
45+
+ name = "openjph",
46+
+ srcs = [
47+
+ "src/core/codestream/ojph_bitbuffer_read.h",
48+
+ "src/core/codestream/ojph_bitbuffer_write.h",
49+
+ "src/core/codestream/ojph_codeblock.cpp",
50+
+ "src/core/codestream/ojph_codeblock.h",
51+
+ "src/core/codestream/ojph_codeblock_fun.cpp",
52+
+ "src/core/codestream/ojph_codeblock_fun.h",
53+
+ "src/core/codestream/ojph_codestream.cpp",
54+
+ "src/core/codestream/ojph_codestream_gen.cpp",
55+
+ "src/core/codestream/ojph_codestream_local.cpp",
56+
+ "src/core/codestream/ojph_codestream_local.h",
57+
+ "src/core/codestream/ojph_params.cpp",
58+
+ "src/core/codestream/ojph_params_local.h",
59+
+ "src/core/codestream/ojph_precinct.cpp",
60+
+ "src/core/codestream/ojph_precinct.h",
61+
+ "src/core/codestream/ojph_resolution.cpp",
62+
+ "src/core/codestream/ojph_resolution.h",
63+
+ "src/core/codestream/ojph_subband.cpp",
64+
+ "src/core/codestream/ojph_subband.h",
65+
+ "src/core/codestream/ojph_tile.cpp",
66+
+ "src/core/codestream/ojph_tile.h",
67+
+ "src/core/codestream/ojph_tile_comp.cpp",
68+
+ "src/core/codestream/ojph_tile_comp.h",
69+
+ "src/core/coding/ojph_block_common.cpp",
70+
+ "src/core/coding/ojph_block_common.h",
71+
+ "src/core/coding/ojph_block_decoder.h",
72+
+ "src/core/coding/ojph_block_decoder32.cpp",
73+
+ "src/core/coding/ojph_block_decoder64.cpp",
74+
+ "src/core/coding/ojph_block_encoder.cpp",
75+
+ "src/core/coding/ojph_block_encoder.h",
76+
+ "src/core/coding/table0.h",
77+
+ "src/core/coding/table1.h",
78+
+ "src/core/common/ojph_arch.h",
79+
+ "src/core/common/ojph_base.h",
80+
+ "src/core/common/ojph_codestream.h",
81+
+ "src/core/common/ojph_defs.h",
82+
+ "src/core/common/ojph_file.h",
83+
+ "src/core/common/ojph_message.h",
84+
+ "src/core/common/ojph_params.h",
85+
+ "src/core/common/ojph_version.h",
86+
+ "src/core/others/ojph_arch.cpp",
87+
+ "src/core/others/ojph_file.cpp",
88+
+ "src/core/others/ojph_mem.cpp",
89+
+ "src/core/others/ojph_message.cpp",
90+
+ "src/core/transform/ojph_colour.cpp",
91+
+ "src/core/transform/ojph_colour.h",
92+
+ "src/core/transform/ojph_colour_local.h",
93+
+ "src/core/transform/ojph_transform.cpp",
94+
+ "src/core/transform/ojph_transform.h",
95+
+ "src/core/transform/ojph_transform_local.h",
96+
+ ],
97+
+ hdrs = [
98+
+ "src/core/common/ojph_arg.h",
99+
+ "src/core/common/ojph_mem.h",
100+
+ ],
101+
+ defines = [
102+
+ "OJPH_DISABLE_SIMD",
103+
+ #"OJPH_DISABLE_SSE2",
104+
+ #"OJPH_DISABLE_SSSE3",
105+
+ #"OJPH_DISABLE_SSE4",
106+
+ #"OJPH_DISABLE_AVX",
107+
+ #"OJPH_DISABLE_AVX2",
108+
+ #"OJPH_DISABLE_AVX512",
109+
+ #"OJPH_DISABLE_NEON",
110+
+ ],
111+
+ includes = [
112+
+ "src/core/codestream",
113+
+ "src/core/coding",
114+
+ "src/core/common",
115+
+ "src/core/others",
116+
+ "src/core/transform",
117+
+ ],
118+
+ visibility = ["//visibility:public"],
119+
+)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- MODULE.bazel
2+
+++ MODULE.bazel
3+
@@ -0,0 +1,8 @@
4+
+module(
5+
+ name = "openjph",
6+
+ version = "0.20.0",
7+
+ compatibility_level = 1,
8+
+)
9+
+
10+
+bazel_dep(name = "rules_cc", version = "0.1.0")
11+
+bazel_dep(name = "rules_license", version = "1.0.0")

cmake/LibraryDefine.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function(OPENEXR_DEFINE_LIBRARY libname)
2424
PRIVATE cxx_std_${OPENEXR_CXX_STANDARD}
2525
INTERFACE cxx_std_17 )
2626

27-
# we are embedding libdeflate
27+
# we are embedding libdeflate
2828
target_include_directories(${objlib} PRIVATE ${EXR_DEFLATE_INCLUDE_DIR})
2929

3030
if(OPENEXR_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS)
@@ -40,7 +40,7 @@ function(OPENEXR_DEFINE_LIBRARY libname)
4040
if(OPENEXR_CURLIB_CURBINDIR)
4141
target_include_directories(${objlib} PRIVATE $<BUILD_INTERFACE:${OPENEXR_CURLIB_CURBINDIR}>)
4242
endif()
43-
target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES})
43+
target_link_libraries(${objlib} PUBLIC ${PROJECT_NAME}::Config ${OPENEXR_CURLIB_DEPENDENCIES} ${CMAKE_DL_LIBS} ${EXR_OPENJPH_LIB})
4444
if(OPENEXR_CURLIB_PRIVATE_DEPS)
4545
target_link_libraries(${objlib} PRIVATE ${OPENEXR_CURLIB_PRIVATE_DEPS})
4646
endif()

0 commit comments

Comments
 (0)