Skip to content

Commit 9b74127

Browse files
committed
Improve Bazel support
Move to new OpenJPH branch
1 parent 5cfbc27 commit 9b74127

File tree

5 files changed

+140
-6
lines changed

5 files changed

+140
-6
lines changed

MODULE.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ archive_override(
3232
urls = ["https://github.com/ebiggers/libdeflate/archive/refs/heads/master.zip"],
3333
)
3434

35-
git_override(
35+
archive_override(
3636
module_name = "openjph",
37+
patches = [
38+
"//bazel:openjph_add_build_file.patch",
39+
"//bazel:openjph_module_dot_bazel.patch",
40+
],
3741
commit = "7a2f6ea63be48729379659933e0db33edcce87a9",
3842
remote = "https://github.com/aous72/OpenJPH.git",
3943
)

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.18.2",
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/OpenEXRSetup.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ message(STATUS "Fetching OpenJPH")
307307
include(FetchContent)
308308
FetchContent_Declare(
309309
openjph
310-
GIT_REPOSITORY https://github.com/palemieux/OpenJPH
311-
GIT_TAG feature/install-fix-openexr
310+
GIT_REPOSITORY https://github.com/aous72/OpenJPH
311+
GIT_TAG supporting_differing_components
312312
)
313313

314314
set(OJPH_BUILD_TESTS OFF CACHE BOOL "" FORCE)

src/lib/OpenEXRCore/internal_ht.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ internal_exr_apply_ht (exr_encode_pipeline_t* encode)
194194
for (ojph::ui32 c = 0; c < encode->channel_count; c++)
195195
{
196196
int file_c = cs_to_file_ch[c].file_index;
197-
nlt.set_type3_transformation (
198-
c, encode->channels[file_c].data_type != EXR_PIXEL_UINT);
199-
197+
if (encode->channels[file_c].data_type != EXR_PIXEL_UINT)
198+
nlt.set_nonlinear_transform (
199+
c, ojph::param_nlt::nonlinearity::OJPH_NLT_BINARY_COMPLEMENT_NLT);
200200
siz.set_component (
201201
c,
202202
ojph::point (

0 commit comments

Comments
 (0)