// Set up common variables for usage across the libjpeg-turbo modules package { default_applicable_licenses: ["external_libjpeg-turbo_license"], } // Added automatically by a large-scale-change that took the approach of // 'apply every license found to every target'. While this makes sure we respect // every license restriction, it may not be entirely correct. // // e.g. GPL in an MIT project might only apply to the contrib/ directory. // // Please consider splitting the single license below into multiple licenses, // taking care not to lose any license_kind information, and overriding the // default license using the 'licenses: [...]' property on targets as needed. // // For unused files, consider creating a 'fileGroup' with "//visibility:private" // to attach the license to, and including a comment whether the files may be // used in the current project. // See: http://go/android-license-faq license { name: "external_libjpeg-turbo_license", visibility: [":__subpackages__"], license_kinds: [ "SPDX-license-identifier-BSD", "SPDX-license-identifier-Beerware", "SPDX-license-identifier-MIT", "SPDX-license-identifier-Zlib", "legacy_notice", "legacy_unencumbered", ], license_text: [ "LICENSE.md", ], } cc_defaults { name: "libjpeg-defaults", cflags: [ "-DWITH_SIMD", "-DNO_GETENV", "-O3", "-fstrict-aliasing", "-Werror", "-Wno-sign-compare", "-Wno-unused-parameter", ], // HUANGLONG begin // jpeg, add hardware decoding whole_static_libs: ["libjpeghal_ex"], // HUANGLONG end srcs: [ "jaricom.c", "jcapimin.c", "jcapistd.c", "jcarith.c", "jccoefct.c", "jccolor.c", "jcdctmgr.c", "jchuff.c", "jcicc.c", "jcinit.c", "jcmainct.c", "jcmarker.c", "jcmaster.c", "jcomapi.c", "jcparam.c", "jcphuff.c", "jcprepct.c", "jcsample.c", "jctrans.c", "jdapimin.c", "jdapistd.c", "jdarith.c", "jdatadst.c", "jdatasrc.c", "jdcoefct.c", "jdcolor.c", "jddctmgr.c", "jdhuff.c", "jdicc.c", "jdinput.c", "jdmainct.c", "jdmarker.c", "jdmaster.c", "jdmerge.c", "jdphuff.c", "jdpostct.c", "jdsample.c", "jdtrans.c", "jerror.c", "jfdctflt.c", "jfdctfst.c", "jfdctint.c", "jidctflt.c", "jidctfst.c", "jidctint.c", "jidctred.c", "jmemmgr.c", "jmemnobs.c", "jpeg_nbits_table.c", "jquant1.c", "jquant2.c", "jutils.c", ], arch: { arm: { // By default, the build system generates ARM target binaries in // thumb mode, where each instruction is 16 bits wide. Defining // this variable as arm forces the build system to generate object // files in 32-bit arm mode. This is the same setting previously // used by libjpeg and it provides a small performance benefit. instruction_set: "arm", // ARM v7 NEON srcs: [ "simd/arm/aarch32/jchuff-neon.c", "simd/arm/aarch32/jsimd.c", "simd/arm/jccolor-neon.c", "simd/arm/jcgray-neon.c", "simd/arm/jcphuff-neon.c", "simd/arm/jcsample-neon.c", "simd/arm/jdcolor-neon.c", "simd/arm/jdmerge-neon.c", "simd/arm/jdsample-neon.c", "simd/arm/jfdctfst-neon.c", "simd/arm/jfdctint-neon.c", "simd/arm/jidctfst-neon.c", "simd/arm/jidctint-neon.c", "simd/arm/jidctred-neon.c", "simd/arm/jquanti-neon.c", ], // HUANGLONG begin // jpeg, add hardware decoding shared_libs: [ "liblog", ], // HUANGLONG end cflags: ["-DNEON_INTRINSICS"], local_include_dirs: ["simd/arm"], }, arm64: { // ARM v8 64-bit NEON srcs: [ "simd/arm/aarch64/jchuff-neon.c", "simd/arm/aarch64/jsimd.c", "simd/arm/jccolor-neon.c", "simd/arm/jcgray-neon.c", "simd/arm/jcphuff-neon.c", "simd/arm/jcsample-neon.c", "simd/arm/jdcolor-neon.c", "simd/arm/jdmerge-neon.c", "simd/arm/jdsample-neon.c", "simd/arm/jfdctfst-neon.c", "simd/arm/jfdctint-neon.c", "simd/arm/jidctfst-neon.c", "simd/arm/jidctint-neon.c", "simd/arm/jidctred-neon.c", "simd/arm/jquanti-neon.c", ], // HUANGLONG begin // jpeg, add hardware decoding shared_libs: [ "liblog", ], // HUANGLONG end cflags: ["-DNEON_INTRINSICS"], local_include_dirs: ["simd/arm"], }, x86: { // x86 MMX and SSE2 srcs: [ "simd/i386/jccolor-avx2.asm", "simd/i386/jccolor-mmx.asm", "simd/i386/jccolor-sse2.asm", "simd/i386/jcgray-avx2.asm", "simd/i386/jcgray-mmx.asm", "simd/i386/jcgray-sse2.asm", "simd/i386/jchuff-sse2.asm", "simd/i386/jcphuff-sse2.asm", "simd/i386/jcsample-avx2.asm", "simd/i386/jcsample-mmx.asm", "simd/i386/jcsample-sse2.asm", "simd/i386/jdcolor-avx2.asm", "simd/i386/jdcolor-mmx.asm", "simd/i386/jdcolor-sse2.asm", "simd/i386/jdmerge-avx2.asm", "simd/i386/jdmerge-mmx.asm", "simd/i386/jdmerge-sse2.asm", "simd/i386/jdsample-avx2.asm", "simd/i386/jdsample-mmx.asm", "simd/i386/jdsample-sse2.asm", "simd/i386/jfdctflt-3dn.asm", "simd/i386/jfdctflt-sse.asm", "simd/i386/jfdctfst-mmx.asm", "simd/i386/jfdctfst-sse2.asm", "simd/i386/jfdctint-avx2.asm", "simd/i386/jfdctint-mmx.asm", "simd/i386/jfdctint-sse2.asm", "simd/i386/jidctflt-3dn.asm", "simd/i386/jidctflt-sse.asm", "simd/i386/jidctflt-sse2.asm", "simd/i386/jidctfst-mmx.asm", "simd/i386/jidctfst-sse2.asm", "simd/i386/jidctint-avx2.asm", "simd/i386/jidctint-mmx.asm", "simd/i386/jidctint-sse2.asm", "simd/i386/jidctred-mmx.asm", "simd/i386/jidctred-sse2.asm", "simd/i386/jquant-3dn.asm", "simd/i386/jquant-mmx.asm", "simd/i386/jquant-sse.asm", "simd/i386/jquantf-sse2.asm", "simd/i386/jquanti-avx2.asm", "simd/i386/jquanti-sse2.asm", "simd/i386/jsimd.c", "simd/i386/jsimdcpu.asm", ], asflags: [ "-DPIC", "-D__x86__", ], local_include_dirs: ["simd/nasm"], }, x86_64: { // x86-64 SSE2 srcs: [ "simd/x86_64/jccolor-avx2.asm", "simd/x86_64/jccolor-sse2.asm", "simd/x86_64/jcgray-avx2.asm", "simd/x86_64/jcgray-sse2.asm", "simd/x86_64/jchuff-sse2.asm", "simd/x86_64/jcphuff-sse2.asm", "simd/x86_64/jcsample-avx2.asm", "simd/x86_64/jcsample-sse2.asm", "simd/x86_64/jdcolor-avx2.asm", "simd/x86_64/jdcolor-sse2.asm", "simd/x86_64/jdmerge-avx2.asm", "simd/x86_64/jdmerge-sse2.asm", "simd/x86_64/jdsample-avx2.asm", "simd/x86_64/jdsample-sse2.asm", "simd/x86_64/jfdctflt-sse.asm", "simd/x86_64/jfdctfst-sse2.asm", "simd/x86_64/jfdctint-avx2.asm", "simd/x86_64/jfdctint-sse2.asm", "simd/x86_64/jidctflt-sse2.asm", "simd/x86_64/jidctfst-sse2.asm", "simd/x86_64/jidctint-avx2.asm", "simd/x86_64/jidctint-sse2.asm", "simd/x86_64/jidctred-sse2.asm", "simd/x86_64/jquantf-sse2.asm", "simd/x86_64/jquanti-avx2.asm", "simd/x86_64/jquanti-sse2.asm", "simd/x86_64/jsimd.c", "simd/x86_64/jsimdcpu.asm", ], asflags: [ "-DPIC", "-D__x86_64__", ], local_include_dirs: ["simd/nasm"], }, }, target: { linux: { asflags: [ "-DELF", ], }, darwin: { asflags: [ "-DMACHO", ], }, windows_x86: { asflags: [ "-DWIN32", ], }, windows_x86_64: { asflags: [ "-DWIN64", ], }, }, } // Build as a shared library. cc_library { name: "libjpeg", host_supported: true, vendor_available: true, product_available: true, vndk: { enabled: true, }, defaults: ["libjpeg-defaults"], export_include_dirs: ["."], target: { windows: { enabled: true, }, }, } // Build static library against the NDK cc_library_static { name: "libjpeg_static_ndk", defaults: ["libjpeg-defaults"], export_include_dirs: ["."], sdk_version: "17", } // Definition for TJBench cc_binary { name: "tjbench", // HUANGLONG begin // jpeg, add hardware decoding shared_libs: [ "liblog", ], // HUANGLONG end whole_static_libs: ["libjpeg"], multilib: { lib32: { stem: "tj32", }, lib64: { stem: "tj64", }, }, compile_multilib: "both", cflags: [ "-DBMP_SUPPORTED", "-DPPM_SUPPORTED", "-Werror", "-Wno-unused-parameter", ], srcs: [ "jdatadst-tj.c", "jdatasrc-tj.c", "rdbmp.c", "rdppm.c", "tjbench.c", "tjutil.c", "transupp.c", "turbojpeg.c", "wrbmp.c", "wrppm.c", ], }