Skip to content

Commit a06d700

Browse files
palemieuxcary-ilm
andauthored
Add HTJ2K Compressor (#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 f7a6cb4 commit a06d700

File tree

59 files changed

+1095
-16
lines changed

Some content is hidden

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

59 files changed

+1095
-16
lines changed

.github/workflows/ci_steps.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ on:
4747
type: string
4848
OPENEXR_FORCE_INTERNAL_DEFLATE:
4949
type: string
50+
OPENEXR_FORCE_INTERNAL_OPENJPH:
51+
type: string
5052
BUILD_TESTING:
5153
type: string
5254
namespace:
@@ -84,6 +86,12 @@ jobs:
8486
run: share/ci/scripts/install_libdeflate.sh master
8587
shell: bash
8688

89+
- name: Install OpenJPH
90+
# Pre-install OpenJPH so the builds validate finding the external installation
91+
if: ${{ inputs.OPENEXR_FORCE_INTERNAL_OPENJPH == 'OFF' }}
92+
run: share/ci/scripts/install_openjph.sh master
93+
shell: bash
94+
8795
- name: Install help2man
8896
# TODO: this could go in the ASWF Linux docker
8997
# container. Also, it doesn't currently work for Windows, so
@@ -113,6 +121,7 @@ jobs:
113121
-DOPENEXR_BUILD_TOOLS=${{ inputs.OPENEXR_BUILD_TOOLS }} \
114122
-DOPENEXR_FORCE_INTERNAL_IMATH=${{ inputs.OPENEXR_FORCE_INTERNAL_IMATH }} \
115123
-DOPENEXR_FORCE_INTERNAL_DEFLATE=${{ inputs.OPENEXR_FORCE_INTERNAL_DEFLATE }} \
124+
-DOPENEXR_FORCE_INTERNAL_OPENJPH=${{ inputs.OPENEXR_FORCE_INTERNAL_OPENJPH }} \
116125
-DBUILD_TESTING=${{ inputs.BUILD_TESTING }} \
117126
-DOPENEXR_RUN_FUZZ_TESTS=OFF \
118127
-DCMAKE_VERBOSE_MAKEFILE=ON"
@@ -170,7 +179,7 @@ jobs:
170179
# When building against external Imath/libdeflate shared objects, the tests need PATH to include the dll's.
171180
if: contains(inputs.os, 'windows')
172181
run: |
173-
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
182+
echo "$PATH;C:/Program Files (x86)/openjph/lib/;C:/Program Files (x86)/openjph/bin;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
174183
shell: bash
175184

176185
- name: Test

.github/workflows/ci_workflow.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
OPENEXR_BUILD_TOOLS: ${{ matrix.OPENEXR_BUILD_TOOLS || 'ON' }}
7878
OPENEXR_FORCE_INTERNAL_IMATH: ${{ matrix.OPENEXR_FORCE_INTERNAL_IMATH || 'OFF' }}
7979
OPENEXR_FORCE_INTERNAL_DEFLATE: ${{ matrix.OPENEXR_FORCE_INTERNAL_DEFLATE || 'OFF' }}
80+
OPENEXR_FORCE_INTERNAL_OPENJPH: ${{ matrix.OPENEXR_FORCE_INTERNAL_OPENJPH || 'OFF' }}
8081
BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }}
8182
namespace: ${{ matrix.namespace }}
8283
validate_install: ${{ matrix.validate_install || 'ON' }}
@@ -107,6 +108,7 @@ jobs:
107108
OPENEXR_BUILD_TOOLS: 'OFF'
108109
OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
109110
OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON'
111+
OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
110112
BUILD_TESTING: 'OFF'
111113

112114
- build: 6
@@ -141,6 +143,7 @@ jobs:
141143
OPENEXR_BUILD_TOOLS: ${{ matrix.OPENEXR_BUILD_TOOLS || 'ON' }}
142144
OPENEXR_FORCE_INTERNAL_IMATH: ${{ matrix.OPENEXR_FORCE_INTERNAL_IMATH || 'OFF' }}
143145
OPENEXR_FORCE_INTERNAL_DEFLATE: ${{ matrix.OPENEXR_FORCE_INTERNAL_DEFLATE || 'OFF' }}
146+
OPENEXR_FORCE_INTERNAL_OPENJPH: ${{ matrix.OPENEXR_FORCE_INTERNAL_OPENJPH || 'OFF' }}
144147
BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }}
145148
validate_install: ${{ matrix.validate_install || 'ON' }}
146149
strategy:
@@ -170,6 +173,7 @@ jobs:
170173
OPENEXR_BUILD_TOOLS: 'OFF'
171174
OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
172175
OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON'
176+
OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
173177
BUILD_TESTING: 'OFF'
174178

175179
- build: 6
@@ -195,6 +199,7 @@ jobs:
195199
OPENEXR_BUILD_TOOLS: ${{ matrix.OPENEXR_BUILD_TOOLS || 'ON' }}
196200
OPENEXR_FORCE_INTERNAL_IMATH: ${{ matrix.OPENEXR_FORCE_INTERNAL_IMATH || 'OFF' }}
197201
OPENEXR_FORCE_INTERNAL_DEFLATE: ${{ matrix.OPENEXR_FORCE_INTERNAL_DEFLATE || 'OFF' }}
202+
OPENEXR_FORCE_INTERNAL_OPENJPH: ${{ matrix.OPENEXR_FORCE_INTERNAL_OPENJPH || 'OFF' }}
198203
BUILD_TESTING: ${{ matrix.BUILD_TESTING || 'ON' }}
199204
validate_install: ${{ matrix.validate_install || 'ON' }}
200205
strategy:
@@ -224,6 +229,7 @@ jobs:
224229
OPENEXR_BUILD_TOOLS: 'OFF'
225230
OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
226231
OPENEXR_FORCE_INTERNAL_DEFLATE: 'ON'
232+
OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
227233
BUILD_TESTING: 'OFF'
228234

229235
- build: 6

.github/workflows/ossfuzz_workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
dry-run: false
4949
language: c++
5050
- name: Upload Crash
51-
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
51+
uses: actions/upload-artifact@v4
5252
if: failure() && steps.build.outcome == 'success'
5353
with:
5454
name: artifacts

.github/workflows/python-wheels-publish-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
CIBW_ENVIRONMENT: OPENEXR_RELEASE_CANDIDATE_TAG="${{ github.ref_name }}"
6565

6666
- name: Upload artifact
67-
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
67+
uses: actions/upload-artifact@v4
6868
with:
6969
name: wheels-${{ matrix.os }}
7070
path: |

.github/workflows/python-wheels-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
CIBW_TEST_SKIP: "*arm64"
5858

5959
- name: Upload artifact
60-
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
60+
uses: actions/upload-artifact@v4
6161
with:
6262
name: wheels-${{ matrix.os }}
6363
path: |

.github/workflows/python-wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ jobs:
7070
OPENEXR_TEST_IMAGE_REPO: "https://raw.githubusercontent.com/AcademySoftwareFoundation/openexr-images/main"
7171

7272
- name: Upload artifact
73-
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
73+
uses: actions/upload-artifact@v4
7474
with:
7575
name: wheels-${{ matrix.os }}
7676
path: |
7777
./wheelhouse/*.whl
78-
./wheelhouse/*.tar.gz
78+
./wheelhouse/*.tar.gz

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
# Upload the results as artifacts (optional)
4545
- name: "Upload artifact"
46-
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
46+
uses: actions/upload-artifact@v4
4747
with:
4848
name: SARIF file
4949
path: results.sarif

BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ cc_library(
189189
"src/lib/OpenEXRCore/internal_dwa_simd.h",
190190
"src/lib/OpenEXRCore/internal_file.h",
191191
"src/lib/OpenEXRCore/internal_float_vector.h",
192+
"src/lib/OpenEXRCore/internal_ht.cpp",
193+
"src/lib/OpenEXRCore/internal_ht_common.h",
194+
"src/lib/OpenEXRCore/internal_ht_common.cpp",
192195
"src/lib/OpenEXRCore/internal_huf.c",
193196
"src/lib/OpenEXRCore/internal_huf.h",
194197
"src/lib/OpenEXRCore/internal_memory.h",
@@ -262,6 +265,7 @@ cc_library(
262265
visibility = ["//visibility:public"],
263266
deps = [
264267
"@imath",
268+
"@openjph",
265269
"@libdeflate//:deflate",
266270
],
267271
)
@@ -308,6 +312,7 @@ cc_library(
308312
"src/lib/OpenEXR/ImfGenericInputFile.cpp",
309313
"src/lib/OpenEXR/ImfGenericOutputFile.cpp",
310314
"src/lib/OpenEXR/ImfHeader.cpp",
315+
"src/lib/OpenEXR/ImfHTCompressor.cpp",
311316
"src/lib/OpenEXR/ImfHuf.cpp",
312317
"src/lib/OpenEXR/ImfIDManifest.cpp",
313318
"src/lib/OpenEXR/ImfIDManifestAttribute.cpp",
@@ -413,6 +418,7 @@ cc_library(
413418
"src/lib/OpenEXR/ImfGenericInputFile.h",
414419
"src/lib/OpenEXR/ImfGenericOutputFile.h",
415420
"src/lib/OpenEXR/ImfHeader.h",
421+
"src/lib/OpenEXR/ImfHTCompressor.h",
416422
"src/lib/OpenEXR/ImfHuf.h",
417423
"src/lib/OpenEXR/ImfIDManifest.h",
418424
"src/lib/OpenEXR/ImfIDManifestAttribute.h",
@@ -504,6 +510,7 @@ cc_library(
504510
":IlmThread",
505511
":OpenEXRCore",
506512
"@imath",
513+
"@openjph"
507514
],
508515
)
509516

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.10")
1314

@@ -30,3 +31,13 @@ archive_override(
3031
strip_prefix = "libdeflate-master",
3132
urls = ["https://github.com/ebiggers/libdeflate/archive/refs/heads/master.zip"],
3233
)
34+
35+
archive_override(
36+
module_name = "openjph",
37+
patches = [
38+
"//bazel:openjph_add_build_file.patch",
39+
"//bazel:openjph_module_dot_bazel.patch",
40+
],
41+
strip_prefix = "OpenJPH-add-export",
42+
urls = ["https://github.com/palemieux/OpenJPH/archive/refs/heads/add-export.zip"],
43+
)

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+
+)

0 commit comments

Comments
 (0)