| 1 |
# This file will be copied into //third_party/externals/libjxl via the new_local_repository |
| 2 |
# rule in WORKSPACE.bazel, so all files should be relative to that path. |
| 3 |
|
| 4 |
load("@rules_cc//cc:cc_library.bzl", "cc_library") |
| 5 |
|
| 6 |
# jxl_export.h appears to be a configuration file where clients can override what JXL_EXPORT |
| 7 |
# and JXL_DEPRECATED are. Our GN rules defined these as empty macros. Instead of doing that, |
| 8 |
# we just make a blank file here and define those empty macros in the cc_library rule. |
| 9 |
genrule( |
| 10 |
name = "generate_jxl_export", |
| 11 |
outs = ["lib/include/jxl/jxl_export.h"], |
| 12 |
cmd = "echo '' > $@", |
| 13 |
) |
| 14 |
|
| 15 |
JPEG_XL_SRCS = [ |
| 16 |
"lib/jxl/ac_context.h", |
| 17 |
"lib/jxl/ac_strategy.cc", |
| 18 |
"lib/jxl/ac_strategy.h", |
| 19 |
"lib/jxl/alpha.cc", |
| 20 |
"lib/jxl/alpha.h", |
| 21 |
"lib/jxl/ans_common.cc", |
| 22 |
"lib/jxl/ans_common.h", |
| 23 |
"lib/jxl/ans_params.h", |
| 24 |
"lib/jxl/aux_out.cc", |
| 25 |
"lib/jxl/aux_out.h", |
| 26 |
"lib/jxl/aux_out_fwd.h", |
| 27 |
"lib/jxl/base/arch_macros.h", |
| 28 |
"lib/jxl/base/bits.h", |
| 29 |
"lib/jxl/base/byte_order.h", |
| 30 |
"lib/jxl/base/cache_aligned.cc", |
| 31 |
"lib/jxl/base/cache_aligned.h", |
| 32 |
"lib/jxl/base/compiler_specific.h", |
| 33 |
"lib/jxl/base/data_parallel.cc", |
| 34 |
"lib/jxl/base/data_parallel.h", |
| 35 |
"lib/jxl/base/descriptive_statistics.cc", |
| 36 |
"lib/jxl/base/descriptive_statistics.h", |
| 37 |
"lib/jxl/base/file_io.h", |
| 38 |
"lib/jxl/base/iaca.h", |
| 39 |
"lib/jxl/base/os_macros.h", |
| 40 |
"lib/jxl/base/override.h", |
| 41 |
"lib/jxl/base/padded_bytes.cc", |
| 42 |
"lib/jxl/base/padded_bytes.h", |
| 43 |
"lib/jxl/base/profiler.h", |
| 44 |
"lib/jxl/base/robust_statistics.h", |
| 45 |
"lib/jxl/base/span.h", |
| 46 |
"lib/jxl/base/status.cc", |
| 47 |
"lib/jxl/base/status.h", |
| 48 |
"lib/jxl/base/thread_pool_internal.h", |
| 49 |
"lib/jxl/blending.cc", |
| 50 |
"lib/jxl/blending.h", |
| 51 |
"lib/jxl/chroma_from_luma.cc", |
| 52 |
"lib/jxl/chroma_from_luma.h", |
| 53 |
"lib/jxl/codec_in_out.h", |
| 54 |
"lib/jxl/coeff_order.cc", |
| 55 |
"lib/jxl/coeff_order.h", |
| 56 |
"lib/jxl/coeff_order_fwd.h", |
| 57 |
"lib/jxl/color_encoding_internal.cc", |
| 58 |
"lib/jxl/color_encoding_internal.h", |
| 59 |
"lib/jxl/color_management.cc", |
| 60 |
"lib/jxl/color_management.h", |
| 61 |
"lib/jxl/common.h", |
| 62 |
"lib/jxl/compressed_dc.cc", |
| 63 |
"lib/jxl/compressed_dc.h", |
| 64 |
"lib/jxl/convolve-inl.h", |
| 65 |
"lib/jxl/convolve.cc", |
| 66 |
"lib/jxl/convolve.h", |
| 67 |
"lib/jxl/dct-inl.h", |
| 68 |
"lib/jxl/dct_block-inl.h", |
| 69 |
"lib/jxl/dct_for_test.h", |
| 70 |
"lib/jxl/dct_scales.cc", |
| 71 |
"lib/jxl/dct_scales.h", |
| 72 |
"lib/jxl/dct_util.h", |
| 73 |
"lib/jxl/dec_ans.cc", |
| 74 |
"lib/jxl/dec_ans.h", |
| 75 |
"lib/jxl/dec_bit_reader.h", |
| 76 |
"lib/jxl/dec_cache.cc", |
| 77 |
"lib/jxl/dec_cache.h", |
| 78 |
"lib/jxl/dec_context_map.cc", |
| 79 |
"lib/jxl/dec_context_map.h", |
| 80 |
"lib/jxl/dec_external_image.cc", |
| 81 |
"lib/jxl/dec_external_image.h", |
| 82 |
"lib/jxl/dec_file.h", |
| 83 |
"lib/jxl/dec_frame.cc", |
| 84 |
"lib/jxl/dec_frame.h", |
| 85 |
"lib/jxl/dec_group.cc", |
| 86 |
"lib/jxl/dec_group.h", |
| 87 |
"lib/jxl/dec_group_border.cc", |
| 88 |
"lib/jxl/dec_group_border.h", |
| 89 |
"lib/jxl/dec_huffman.cc", |
| 90 |
"lib/jxl/dec_huffman.h", |
| 91 |
"lib/jxl/dec_modular.cc", |
| 92 |
"lib/jxl/dec_modular.h", |
| 93 |
"lib/jxl/dec_noise.cc", |
| 94 |
"lib/jxl/dec_noise.h", |
| 95 |
"lib/jxl/dec_params.h", |
| 96 |
"lib/jxl/dec_patch_dictionary.cc", |
| 97 |
"lib/jxl/dec_patch_dictionary.h", |
| 98 |
"lib/jxl/dec_reconstruct.cc", |
| 99 |
"lib/jxl/dec_reconstruct.h", |
| 100 |
"lib/jxl/dec_render_pipeline.h", |
| 101 |
"lib/jxl/dec_transforms-inl.h", |
| 102 |
"lib/jxl/dec_transforms_testonly.h", |
| 103 |
"lib/jxl/dec_upsample.cc", |
| 104 |
"lib/jxl/dec_upsample.h", |
| 105 |
"lib/jxl/dec_xyb-inl.h", |
| 106 |
"lib/jxl/dec_xyb.cc", |
| 107 |
"lib/jxl/dec_xyb.h", |
| 108 |
"lib/jxl/decode.cc", |
| 109 |
"lib/jxl/decode_to_jpeg.cc", |
| 110 |
"lib/jxl/decode_to_jpeg.h", |
| 111 |
"lib/jxl/enc_ac_strategy.h", |
| 112 |
"lib/jxl/enc_adaptive_quantization.h", |
| 113 |
"lib/jxl/enc_ans.h", |
| 114 |
"lib/jxl/enc_ans_params.h", |
| 115 |
"lib/jxl/enc_ar_control_field.h", |
| 116 |
"lib/jxl/enc_bit_writer.cc", |
| 117 |
"lib/jxl/enc_bit_writer.h", |
| 118 |
"lib/jxl/enc_butteraugli_comparator.h", |
| 119 |
"lib/jxl/enc_butteraugli_pnorm.h", |
| 120 |
"lib/jxl/enc_cache.h", |
| 121 |
"lib/jxl/enc_chroma_from_luma.h", |
| 122 |
"lib/jxl/enc_cluster.h", |
| 123 |
"lib/jxl/enc_coeff_order.h", |
| 124 |
"lib/jxl/enc_color_management.h", |
| 125 |
"lib/jxl/enc_comparator.h", |
| 126 |
"lib/jxl/enc_context_map.h", |
| 127 |
"lib/jxl/enc_detect_dots.h", |
| 128 |
"lib/jxl/enc_dot_dictionary.h", |
| 129 |
"lib/jxl/enc_entropy_coder.h", |
| 130 |
"lib/jxl/enc_external_image.h", |
| 131 |
"lib/jxl/enc_file.h", |
| 132 |
"lib/jxl/enc_frame.h", |
| 133 |
"lib/jxl/enc_gamma_correct.h", |
| 134 |
"lib/jxl/enc_group.h", |
| 135 |
"lib/jxl/enc_heuristics.h", |
| 136 |
"lib/jxl/enc_huffman.h", |
| 137 |
"lib/jxl/enc_icc_codec.h", |
| 138 |
"lib/jxl/enc_image_bundle.h", |
| 139 |
"lib/jxl/enc_jxl_skcms.h", |
| 140 |
"lib/jxl/enc_modular.h", |
| 141 |
"lib/jxl/enc_noise.h", |
| 142 |
"lib/jxl/enc_params.h", |
| 143 |
"lib/jxl/enc_patch_dictionary.h", |
| 144 |
"lib/jxl/enc_photon_noise.h", |
| 145 |
"lib/jxl/enc_quant_weights.h", |
| 146 |
"lib/jxl/enc_splines.h", |
| 147 |
"lib/jxl/enc_toc.h", |
| 148 |
"lib/jxl/enc_transforms-inl.h", |
| 149 |
"lib/jxl/enc_transforms.h", |
| 150 |
"lib/jxl/enc_xyb.h", |
| 151 |
"lib/jxl/encode_internal.h", |
| 152 |
"lib/jxl/entropy_coder.cc", |
| 153 |
"lib/jxl/entropy_coder.h", |
| 154 |
"lib/jxl/epf.cc", |
| 155 |
"lib/jxl/epf.h", |
| 156 |
"lib/jxl/fake_parallel_runner_testonly.h", |
| 157 |
"lib/jxl/fast_math-inl.h", |
| 158 |
"lib/jxl/field_encodings.h", |
| 159 |
"lib/jxl/fields.cc", |
| 160 |
"lib/jxl/fields.h", |
| 161 |
"lib/jxl/filters.cc", |
| 162 |
"lib/jxl/filters.h", |
| 163 |
"lib/jxl/filters_internal.h", |
| 164 |
"lib/jxl/frame_header.cc", |
| 165 |
"lib/jxl/frame_header.h", |
| 166 |
"lib/jxl/gaborish.h", |
| 167 |
"lib/jxl/gauss_blur.cc", |
| 168 |
"lib/jxl/gauss_blur.h", |
| 169 |
"lib/jxl/headers.cc", |
| 170 |
"lib/jxl/headers.h", |
| 171 |
"lib/jxl/huffman_table.cc", |
| 172 |
"lib/jxl/huffman_table.h", |
| 173 |
"lib/jxl/huffman_tree.h", |
| 174 |
"lib/jxl/icc_codec.cc", |
| 175 |
"lib/jxl/icc_codec.h", |
| 176 |
"lib/jxl/icc_codec_common.cc", |
| 177 |
"lib/jxl/icc_codec_common.h", |
| 178 |
"lib/jxl/image.cc", |
| 179 |
"lib/jxl/image.h", |
| 180 |
"lib/jxl/image_bundle.cc", |
| 181 |
"lib/jxl/image_bundle.h", |
| 182 |
"lib/jxl/image_metadata.cc", |
| 183 |
"lib/jxl/image_metadata.h", |
| 184 |
"lib/jxl/image_ops.h", |
| 185 |
"lib/jxl/image_test_utils.h", |
| 186 |
"lib/jxl/jpeg/dec_jpeg_data.cc", |
| 187 |
"lib/jxl/jpeg/dec_jpeg_data.h", |
| 188 |
"lib/jxl/jpeg/dec_jpeg_data_writer.cc", |
| 189 |
"lib/jxl/jpeg/dec_jpeg_data_writer.h", |
| 190 |
"lib/jxl/jpeg/jpeg_data.cc", |
| 191 |
"lib/jxl/jpeg/jpeg_data.h", |
| 192 |
"lib/jxl/jpeg/dec_jpeg_serialization_state.h", |
| 193 |
"lib/jxl/jpeg/dec_jpeg_output_chunk.h", |
| 194 |
"lib/jxl/jxl_inspection.h", |
| 195 |
"lib/jxl/lehmer_code.h", |
| 196 |
"lib/jxl/linalg.h", |
| 197 |
"lib/jxl/loop_filter.cc", |
| 198 |
"lib/jxl/loop_filter.h", |
| 199 |
"lib/jxl/luminance.cc", |
| 200 |
"lib/jxl/luminance.h", |
| 201 |
"lib/jxl/memory_manager_internal.cc", |
| 202 |
"lib/jxl/memory_manager_internal.h", |
| 203 |
"lib/jxl/modular/encoding/context_predict.h", |
| 204 |
"lib/jxl/modular/encoding/dec_ma.cc", |
| 205 |
"lib/jxl/modular/encoding/dec_ma.h", |
| 206 |
"lib/jxl/modular/encoding/encoding.cc", |
| 207 |
"lib/jxl/modular/encoding/encoding.h", |
| 208 |
"lib/jxl/modular/encoding/ma_common.h", |
| 209 |
"lib/jxl/modular/modular_image.cc", |
| 210 |
"lib/jxl/modular/modular_image.h", |
| 211 |
"lib/jxl/modular/options.h", |
| 212 |
"lib/jxl/modular/transform/palette.h", |
| 213 |
"lib/jxl/modular/transform/rct.h", |
| 214 |
"lib/jxl/modular/transform/squeeze.cc", |
| 215 |
"lib/jxl/modular/transform/squeeze.h", |
| 216 |
"lib/jxl/modular/transform/transform.cc", |
| 217 |
"lib/jxl/modular/transform/transform.h", |
| 218 |
"lib/jxl/noise.h", |
| 219 |
"lib/jxl/noise_distributions.h", |
| 220 |
"lib/jxl/opsin_params.cc", |
| 221 |
"lib/jxl/opsin_params.h", |
| 222 |
"lib/jxl/optimize.h", |
| 223 |
"lib/jxl/passes_state.cc", |
| 224 |
"lib/jxl/passes_state.h", |
| 225 |
"lib/jxl/patch_dictionary_internal.h", |
| 226 |
"lib/jxl/progressive_split.h", |
| 227 |
"lib/jxl/quant_weights.cc", |
| 228 |
"lib/jxl/quant_weights.h", |
| 229 |
"lib/jxl/quantizer-inl.h", |
| 230 |
"lib/jxl/quantizer.cc", |
| 231 |
"lib/jxl/quantizer.h", |
| 232 |
"lib/jxl/rational_polynomial-inl.h", |
| 233 |
"lib/jxl/sanitizers.h", |
| 234 |
"lib/jxl/splines.cc", |
| 235 |
"lib/jxl/splines.h", |
| 236 |
"lib/jxl/test_utils.h", |
| 237 |
"lib/jxl/testdata.h", |
| 238 |
"lib/jxl/toc.cc", |
| 239 |
"lib/jxl/toc.h", |
| 240 |
"lib/jxl/transfer_functions-inl.h", |
| 241 |
"lib/jxl/transpose-inl.h", |
| 242 |
"lib/jxl/xorshift128plus-inl.h", |
| 243 |
] |
| 244 |
|
| 245 |
JPEG_XL_HDRS = [ |
| 246 |
"lib/include/jxl/decode.h", |
| 247 |
"lib/include/jxl/decode_cxx.h", |
| 248 |
"lib/include/jxl/codestream_header.h", |
| 249 |
"lib/include/jxl/color_encoding.h", |
| 250 |
"lib/include/jxl/memory_manager.h", |
| 251 |
"lib/include/jxl/parallel_runner.h", |
| 252 |
"lib/include/jxl/types.h", |
| 253 |
"lib/include/jxl/jxl_export.h", |
| 254 |
] |
| 255 |
|
| 256 |
JPEG_XL_LOCAL_DEFINES = [ |
| 257 |
# Does not really matter. |
| 258 |
"JPEGXL_MAJOR_VERSION=1", |
| 259 |
"JPEGXL_MINOR_VERSION=0", |
| 260 |
"JPEGXL_PATCH_VERSION=0", |
| 261 |
"JPEGXL_ENABLE_SKCMS=1", |
| 262 |
] |
| 263 |
|
| 264 |
JPEG_XL_PUBLIC_DEFINES = [ |
| 265 |
# This impacts some of the header files, so it must be public |
| 266 |
"JPEGXL_ENABLE_TRANSCODE_JPEG=0", |
| 267 |
"JXL_DEPRECATED=", |
| 268 |
"JXL_EXPORT=", |
| 269 |
] |
| 270 |
|
| 271 |
cc_library( |
| 272 |
name = "libjxl", |
| 273 |
srcs = JPEG_XL_SRCS, |
| 274 |
hdrs = JPEG_XL_HDRS, |
| 275 |
copts = [ |
| 276 |
# jxl includes highway with angle brackets, but highway does not have an "includes" |
| 277 |
# attribute. This makes Bazel add the include folders of the dependency using -iquote |
| 278 |
# and thus clang throws an error about that. It is easier to add an extra include |
| 279 |
# path than figuring out if we should upstream the change to libjxl and/or highway. |
| 280 |
"-isystem external/highway", |
| 281 |
"-isystem external/+cpp_modules+highway", |
| 282 |
"-isystem external/skia++cpp_modules+highway", |
| 283 |
"-Wno-unused-function", |
| 284 |
], |
| 285 |
defines = JPEG_XL_PUBLIC_DEFINES, |
| 286 |
includes = ["lib/include"], # We include jxl files from this folder |
| 287 |
local_defines = JPEG_XL_LOCAL_DEFINES, |
| 288 |
visibility = ["//visibility:public"], |
| 289 |
deps = [ |
| 290 |
"@brotli//:brotlidec", |
| 291 |
"@highway//:hwy", |
| 292 |
], |
| 293 |
) |