diff --git a/Android.bp b/Android.bp index ce1f62e01..e2ea47a03 100644 --- a/Android.bp +++ b/Android.bp @@ -1,6 +1,32 @@ +package { + default_applicable_licenses: ["external_libyuv_files_license"], +} + +// Added automatically by a large-scale-change +// +// large-scale-change included anything that looked like it might be a license +// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. +// +// Please consider removing redundant or irrelevant files from 'license_text:'. +// See: http://go/android-license-faq +license { + name: "external_libyuv_files_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-BSD", + ], + license_text: [ + "LICENSE", + "LICENSE_THIRD_PARTY", + "PATENTS", + ], +} + cc_library { name: "libyuv", vendor_available: true, + product_available: true, + host_supported: true, vndk: { enabled: true, }, @@ -61,9 +87,21 @@ cc_library { "-DHAVE_JPEG", ], + arch: { + arm: { + cflags: ["-mfpu=neon"], + }, + }, + shared_libs: ["libjpeg"], export_include_dirs: ["include"], + + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], + min_sdk_version: "29", } // compatibilty static library until all uses of libyuv_static are replaced @@ -72,6 +110,11 @@ cc_library_static { name: "libyuv_static", vendor_available: true, whole_static_libs: ["libyuv"], + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], + min_sdk_version: "29", } cc_test { @@ -108,19 +151,19 @@ cc_test { } cc_test { - name: "i444tonv12_eg", + name: "cpuid", gtest: false, srcs: [ - "util/i444tonv12_eg.cc", + "util/cpuid.c", ], static_libs: ["libyuv"], } cc_test { - name: "cpuid", + name: "i444tonv12_eg", gtest: false, srcs: [ - "util/cpuid.c", + "util/i444tonv12_eg.cc", ], static_libs: ["libyuv"], } @@ -136,6 +179,15 @@ cc_test { static_libs: ["libyuv"], } +cc_test { + name: "yuvconstants", + gtest: false, + srcs: [ + "util/yuvconstants.c", + ], + static_libs: ["libyuv"], +} + cc_test { name: "yuvconvert", gtest: false, @@ -145,12 +197,3 @@ cc_test { static_libs: ["libyuv"], shared_libs: ["libjpeg"], } - -cc_test { - name: "yuvconstants", - gtest: false, - srcs: [ - "util/yuvconstants.c", - ], - static_libs: ["libyuv"], -} diff --git a/source/cpu_id.cc b/source/cpu_id.cc index fe89452b7..588168d65 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -133,7 +133,7 @@ int GetXCR0() { #pragma optimize("g", on) #endif -// based on libvpx arm_cpudetect.c +// Based on libvpx arm_cpudetect.c // For Arm, but public to allow testing on any CPU LIBYUV_API SAFEBUFFERS int ArmCpuCaps(const char* cpuinfo_name) { char cpuinfo_line[512]; diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index 2d333f80f..e52855816 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -229,7 +229,10 @@ TEST_F(LibYUVBaseTest, TestLinuxNeon) { } #if defined(__linux__) && defined(__ARM_NEON__) if (FileExists("/proc/cpuinfo")) { - EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("/proc/cpuinfo")); + if (kCpuHasNEON != ArmCpuCaps("/proc/cpuinfo")) { + // This can happen on ARM emulator but /proc/cpuinfo is from host. + printf("WARNING: Neon build enabled but CPU does not have NEON\n"); + } } else { printf("WARNING: unable to load \"/proc/cpuinfo\"\n"); }