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