| # This file will be copied into //third_party/externals/libjxl via the new_local_repository |
| # rule in WORKSPACE.bazel, so all files should be relative to that path. |
| |
| # jxl_export.h appears to be a configuration file where clients can override what JXL_EXPORT |
| # and JXL_DEPRECATED are. Our GN rules defined these as empty macros. Instead of doing that, |
| # we just make a blank file here and define those empty macros in the cc_library rule. |
| genrule( |
| name = "generate_jxl_export", |
| outs = ["lib/include/jxl/jxl_export.h"], |
| cmd = "echo '' > $@", |
| ) |
| |
| JPEG_XL_SRCS = [ |
| "lib/jxl/ac_context.h", |
| "lib/jxl/ac_strategy.cc", |
| "lib/jxl/ac_strategy.h", |
| "lib/jxl/alpha.cc", |
| "lib/jxl/alpha.h", |
| "lib/jxl/ans_common.cc", |
| "lib/jxl/ans_common.h", |
| "lib/jxl/ans_params.h", |
| "lib/jxl/aux_out.cc", |
| "lib/jxl/aux_out.h", |
| "lib/jxl/aux_out_fwd.h", |
| "lib/jxl/base/arch_macros.h", |
| "lib/jxl/base/bits.h", |
| "lib/jxl/base/byte_order.h", |
| "lib/jxl/base/cache_aligned.cc", |
| "lib/jxl/base/cache_aligned.h", |
| "lib/jxl/base/compiler_specific.h", |
| "lib/jxl/base/data_parallel.cc", |
| "lib/jxl/base/data_parallel.h", |
| "lib/jxl/base/descriptive_statistics.cc", |
| "lib/jxl/base/descriptive_statistics.h", |
| "lib/jxl/base/file_io.h", |
| "lib/jxl/base/iaca.h", |
| "lib/jxl/base/os_macros.h", |
| "lib/jxl/base/override.h", |
| "lib/jxl/base/padded_bytes.cc", |
| "lib/jxl/base/padded_bytes.h", |
| "lib/jxl/base/profiler.h", |
| "lib/jxl/base/robust_statistics.h", |
| "lib/jxl/base/span.h", |
| "lib/jxl/base/status.cc", |
| "lib/jxl/base/status.h", |
| "lib/jxl/base/thread_pool_internal.h", |
| "lib/jxl/blending.cc", |
| "lib/jxl/blending.h", |
| "lib/jxl/chroma_from_luma.cc", |
| "lib/jxl/chroma_from_luma.h", |
| "lib/jxl/codec_in_out.h", |
| "lib/jxl/coeff_order.cc", |
| "lib/jxl/coeff_order.h", |
| "lib/jxl/coeff_order_fwd.h", |
| "lib/jxl/color_encoding_internal.cc", |
| "lib/jxl/color_encoding_internal.h", |
| "lib/jxl/color_management.cc", |
| "lib/jxl/color_management.h", |
| "lib/jxl/common.h", |
| "lib/jxl/compressed_dc.cc", |
| "lib/jxl/compressed_dc.h", |
| "lib/jxl/convolve-inl.h", |
| "lib/jxl/convolve.cc", |
| "lib/jxl/convolve.h", |
| "lib/jxl/dct-inl.h", |
| "lib/jxl/dct_block-inl.h", |
| "lib/jxl/dct_for_test.h", |
| "lib/jxl/dct_scales.cc", |
| "lib/jxl/dct_scales.h", |
| "lib/jxl/dct_util.h", |
| "lib/jxl/dec_ans.cc", |
| "lib/jxl/dec_ans.h", |
| "lib/jxl/dec_bit_reader.h", |
| "lib/jxl/dec_cache.cc", |
| "lib/jxl/dec_cache.h", |
| "lib/jxl/dec_context_map.cc", |
| "lib/jxl/dec_context_map.h", |
| "lib/jxl/dec_external_image.cc", |
| "lib/jxl/dec_external_image.h", |
| "lib/jxl/dec_file.h", |
| "lib/jxl/dec_frame.cc", |
| "lib/jxl/dec_frame.h", |
| "lib/jxl/dec_group.cc", |
| "lib/jxl/dec_group.h", |
| "lib/jxl/dec_group_border.cc", |
| "lib/jxl/dec_group_border.h", |
| "lib/jxl/dec_huffman.cc", |
| "lib/jxl/dec_huffman.h", |
| "lib/jxl/dec_modular.cc", |
| "lib/jxl/dec_modular.h", |
| "lib/jxl/dec_noise.cc", |
| "lib/jxl/dec_noise.h", |
| "lib/jxl/dec_params.h", |
| "lib/jxl/dec_patch_dictionary.cc", |
| "lib/jxl/dec_patch_dictionary.h", |
| "lib/jxl/dec_reconstruct.cc", |
| "lib/jxl/dec_reconstruct.h", |
| "lib/jxl/dec_render_pipeline.h", |
| "lib/jxl/dec_transforms-inl.h", |
| "lib/jxl/dec_transforms_testonly.h", |
| "lib/jxl/dec_upsample.cc", |
| "lib/jxl/dec_upsample.h", |
| "lib/jxl/dec_xyb-inl.h", |
| "lib/jxl/dec_xyb.cc", |
| "lib/jxl/dec_xyb.h", |
| "lib/jxl/decode.cc", |
| "lib/jxl/decode_to_jpeg.cc", |
| "lib/jxl/decode_to_jpeg.h", |
| "lib/jxl/enc_ac_strategy.h", |
| "lib/jxl/enc_adaptive_quantization.h", |
| "lib/jxl/enc_ans.h", |
| "lib/jxl/enc_ans_params.h", |
| "lib/jxl/enc_ar_control_field.h", |
| "lib/jxl/enc_bit_writer.cc", |
| "lib/jxl/enc_bit_writer.h", |
| "lib/jxl/enc_butteraugli_comparator.h", |
| "lib/jxl/enc_butteraugli_pnorm.h", |
| "lib/jxl/enc_cache.h", |
| "lib/jxl/enc_chroma_from_luma.h", |
| "lib/jxl/enc_cluster.h", |
| "lib/jxl/enc_coeff_order.h", |
| "lib/jxl/enc_color_management.h", |
| "lib/jxl/enc_comparator.h", |
| "lib/jxl/enc_context_map.h", |
| "lib/jxl/enc_detect_dots.h", |
| "lib/jxl/enc_dot_dictionary.h", |
| "lib/jxl/enc_entropy_coder.h", |
| "lib/jxl/enc_external_image.h", |
| "lib/jxl/enc_file.h", |
| "lib/jxl/enc_frame.h", |
| "lib/jxl/enc_gamma_correct.h", |
| "lib/jxl/enc_group.h", |
| "lib/jxl/enc_heuristics.h", |
| "lib/jxl/enc_huffman.h", |
| "lib/jxl/enc_icc_codec.h", |
| "lib/jxl/enc_image_bundle.h", |
| "lib/jxl/enc_jxl_skcms.h", |
| "lib/jxl/enc_modular.h", |
| "lib/jxl/enc_noise.h", |
| "lib/jxl/enc_params.h", |
| "lib/jxl/enc_patch_dictionary.h", |
| "lib/jxl/enc_photon_noise.h", |
| "lib/jxl/enc_quant_weights.h", |
| "lib/jxl/enc_splines.h", |
| "lib/jxl/enc_toc.h", |
| "lib/jxl/enc_transforms-inl.h", |
| "lib/jxl/enc_transforms.h", |
| "lib/jxl/enc_xyb.h", |
| "lib/jxl/encode_internal.h", |
| "lib/jxl/entropy_coder.cc", |
| "lib/jxl/entropy_coder.h", |
| "lib/jxl/epf.cc", |
| "lib/jxl/epf.h", |
| "lib/jxl/fake_parallel_runner_testonly.h", |
| "lib/jxl/fast_math-inl.h", |
| "lib/jxl/field_encodings.h", |
| "lib/jxl/fields.cc", |
| "lib/jxl/fields.h", |
| "lib/jxl/filters.cc", |
| "lib/jxl/filters.h", |
| "lib/jxl/filters_internal.h", |
| "lib/jxl/frame_header.cc", |
| "lib/jxl/frame_header.h", |
| "lib/jxl/gaborish.h", |
| "lib/jxl/gauss_blur.cc", |
| "lib/jxl/gauss_blur.h", |
| "lib/jxl/headers.cc", |
| "lib/jxl/headers.h", |
| "lib/jxl/huffman_table.cc", |
| "lib/jxl/huffman_table.h", |
| "lib/jxl/huffman_tree.h", |
| "lib/jxl/icc_codec.cc", |
| "lib/jxl/icc_codec.h", |
| "lib/jxl/icc_codec_common.cc", |
| "lib/jxl/icc_codec_common.h", |
| "lib/jxl/image.cc", |
| "lib/jxl/image.h", |
| "lib/jxl/image_bundle.cc", |
| "lib/jxl/image_bundle.h", |
| "lib/jxl/image_metadata.cc", |
| "lib/jxl/image_metadata.h", |
| "lib/jxl/image_ops.h", |
| "lib/jxl/image_test_utils.h", |
| "lib/jxl/jpeg/dec_jpeg_data.cc", |
| "lib/jxl/jpeg/dec_jpeg_data.h", |
| "lib/jxl/jpeg/dec_jpeg_data_writer.cc", |
| "lib/jxl/jpeg/dec_jpeg_data_writer.h", |
| "lib/jxl/jpeg/jpeg_data.cc", |
| "lib/jxl/jpeg/jpeg_data.h", |
| "lib/jxl/jpeg/dec_jpeg_serialization_state.h", |
| "lib/jxl/jpeg/dec_jpeg_output_chunk.h", |
| "lib/jxl/jxl_inspection.h", |
| "lib/jxl/lehmer_code.h", |
| "lib/jxl/linalg.h", |
| "lib/jxl/loop_filter.cc", |
| "lib/jxl/loop_filter.h", |
| "lib/jxl/luminance.cc", |
| "lib/jxl/luminance.h", |
| "lib/jxl/memory_manager_internal.cc", |
| "lib/jxl/memory_manager_internal.h", |
| "lib/jxl/modular/encoding/context_predict.h", |
| "lib/jxl/modular/encoding/dec_ma.cc", |
| "lib/jxl/modular/encoding/dec_ma.h", |
| "lib/jxl/modular/encoding/encoding.cc", |
| "lib/jxl/modular/encoding/encoding.h", |
| "lib/jxl/modular/encoding/ma_common.h", |
| "lib/jxl/modular/modular_image.cc", |
| "lib/jxl/modular/modular_image.h", |
| "lib/jxl/modular/options.h", |
| "lib/jxl/modular/transform/palette.h", |
| "lib/jxl/modular/transform/rct.h", |
| "lib/jxl/modular/transform/squeeze.cc", |
| "lib/jxl/modular/transform/squeeze.h", |
| "lib/jxl/modular/transform/transform.cc", |
| "lib/jxl/modular/transform/transform.h", |
| "lib/jxl/noise.h", |
| "lib/jxl/noise_distributions.h", |
| "lib/jxl/opsin_params.cc", |
| "lib/jxl/opsin_params.h", |
| "lib/jxl/optimize.h", |
| "lib/jxl/passes_state.cc", |
| "lib/jxl/passes_state.h", |
| "lib/jxl/patch_dictionary_internal.h", |
| "lib/jxl/progressive_split.h", |
| "lib/jxl/quant_weights.cc", |
| "lib/jxl/quant_weights.h", |
| "lib/jxl/quantizer-inl.h", |
| "lib/jxl/quantizer.cc", |
| "lib/jxl/quantizer.h", |
| "lib/jxl/rational_polynomial-inl.h", |
| "lib/jxl/sanitizers.h", |
| "lib/jxl/splines.cc", |
| "lib/jxl/splines.h", |
| "lib/jxl/test_utils.h", |
| "lib/jxl/testdata.h", |
| "lib/jxl/toc.cc", |
| "lib/jxl/toc.h", |
| "lib/jxl/transfer_functions-inl.h", |
| "lib/jxl/transpose-inl.h", |
| "lib/jxl/xorshift128plus-inl.h", |
| ] |
| |
| JPEG_XL_HDRS = [ |
| "lib/include/jxl/decode.h", |
| "lib/include/jxl/decode_cxx.h", |
| "lib/include/jxl/codestream_header.h", |
| "lib/include/jxl/color_encoding.h", |
| "lib/include/jxl/memory_manager.h", |
| "lib/include/jxl/parallel_runner.h", |
| "lib/include/jxl/types.h", |
| "lib/include/jxl/jxl_export.h", |
| ] |
| |
| JPEG_XL_LOCAL_DEFINES = [ |
| # Does not really matter. |
| "JPEGXL_MAJOR_VERSION=1", |
| "JPEGXL_MINOR_VERSION=0", |
| "JPEGXL_PATCH_VERSION=0", |
| "JPEGXL_ENABLE_SKCMS=1", |
| ] |
| |
| JPEG_XL_PUBLIC_DEFINES = [ |
| # This impacts some of the header files, so it must be public |
| "JPEGXL_ENABLE_TRANSCODE_JPEG=0", |
| "JXL_DEPRECATED=", |
| "JXL_EXPORT=", |
| ] |
| |
| cc_library( |
| name = "libjxl", |
| srcs = JPEG_XL_SRCS, |
| hdrs = JPEG_XL_HDRS, |
| copts = [ |
| # jxl includes highway with angle brackets, but highway does not have an "includes" |
| # attribute. This makes Bazel add the include folders of the dependency using -iquote |
| # and thus clang throws an error about that. It is easier to add an extra include |
| # path than figuring out if we should upstream the change to libjxl and/or highway. |
| "-isystem external/highway", |
| "-Wno-unused-function", |
| ], |
| defines = JPEG_XL_PUBLIC_DEFINES, |
| includes = ["lib/include"], # We include jxl files from this folder |
| local_defines = JPEG_XL_LOCAL_DEFINES, |
| visibility = ["//visibility:public"], |
| deps = [ |
| "@brotli//:brotlidec", |
| "@highway//:hwy", |
| ], |
| ) |