1- # Copyright 2014 The Chromium Authors
1+ # Copyright 2014 The Chromium Authors. All rights reserved.
22# Use of this source code is governed by a BSD-style license that can be
33# found in the LICENSE file.
44
55import (" //build/config/android/config.gni" )
66import (" //build/config/arm.gni" )
77import (" //build/config/chromeos/ui_mode.gni" )
8+ import (" //build/config/ios/config.gni" )
89import (" //build/config/sanitizers/sanitizers.gni" )
910import (" //third_party/libvpx/libvpx_srcs.gni" )
1011import (" //third_party/nasm/nasm_assemble.gni" )
@@ -19,7 +20,7 @@ if (current_cpu == "x86") {
1920 cpu_arch_full = " x64"
2021 }
2122} else if (current_cpu == " arm" ) {
22- if (is_chromeos ) {
23+ if (is_chromeos_ash ) {
2324 # ChromeOS gets highbd vp9 but other arm targets do not.
2425 cpu_arch_full = " arm-neon-highbd"
2526 } else if (arm_use_neon ) {
@@ -30,18 +31,11 @@ if (current_cpu == "x86") {
3031 cpu_arch_full = " arm"
3132 }
3233} else if (current_cpu == " arm64" ) {
33- if (is_win || is_chromeos || is_mac ) {
34- # This is necessary for CrOS and macOS as they reuse the Linux
35- # configuration, of which there are two (see the later definition of
36- # os_category).
34+ if (is_chromeos_ash || is_mac ) {
3735 cpu_arch_full = " arm64-highbd"
3836 } else {
3937 cpu_arch_full = current_cpu
4038 }
41- } else if (current_cpu == " riscv64" ) {
42- cpu_arch_full = " generic"
43- } else if (current_cpu == " loong64" ) {
44- cpu_arch_full = " loongarch"
4539} else {
4640 cpu_arch_full = current_cpu
4741}
@@ -87,6 +81,16 @@ config("libvpx_config") {
8781 # libvpx has many static functions in header, which trigger this warning.
8882 " -Wno-unused-function" ,
8983 ]
84+
85+ # Fixes a mac / ios simulator link error for vpx_scaled_2d:
86+ # Undefined symbols for architecture x86_64:
87+ # "_vpx_scaled_2d", referenced from:
88+ # _vp9_scale_and_extend_frame_c in libvpx.a(vp9_frame_scale.o)
89+ # (maybe you meant: _vpx_scaled_2d_ssse3)
90+ # ld: symbol(s) not found for architecture x86_64
91+ if (is_mac || (is_ios && (current_cpu == " x86" || current_cpu == " x64" ))) {
92+ cflags += [ " -fno-common" ]
93+ }
9094 } else if (! is_win ) {
9195 cflags = [
9296 " -Wno-unused-function" ,
@@ -252,78 +256,13 @@ if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) {
252256 }
253257}
254258
255- if (current_cpu == " loong64" ) {
256- source_set (" libvpx_loongarch_lsx" ) {
257- configs -= [ " //build/config/compiler:chromium_code" ]
258- configs += [ " //build/config/compiler:no_chromium_code" ]
259- configs += [ " :libvpx_config" ]
260- cflags = [ " -mlsx" ]
261- sources = libvpx_srcs_loongarch_lsx
262- }
263- }
264-
265- if (current_cpu == " arm" || current_cpu == " arm64" ) {
266- source_set (" libvpx_intrinsics_neon" ) {
267- check_includes = false
268- configs -= [ " //build/config/compiler:chromium_code" ]
269- configs += [ " //build/config/compiler:no_chromium_code" ]
270- configs += [ " :libvpx_config" ]
271- if (current_cpu == " arm" ) {
272- configs -= [ " //build/config/compiler:compiler_arm_fpu" ]
273- cflags = [ " -mfpu=neon" ]
274- }
275- if (cpu_arch_full == " arm-neon" ) {
276- sources = libvpx_srcs_arm_neon_neon
277- deps = [ " :libvpx_arm_neon_headers" ]
278- } else if (cpu_arch_full == " arm-neon-highbd" ) {
279- sources = libvpx_srcs_arm_neon_highbd_neon
280- deps = [ " :libvpx_arm_neon_highbd_headers" ]
281- } else if (cpu_arch_full == " arm-neon-cpu-detect" ) {
282- sources = libvpx_srcs_arm_neon_cpu_detect_neon
283- deps = [ " :libvpx_arm_neon_cpu_detect_headers" ]
284- } else if (cpu_arch_full == " arm64" ) {
285- sources = libvpx_srcs_arm64_neon
286- deps = [ " :libvpx_arm64_headers" ]
287- } else if (cpu_arch_full == " arm64-highbd" ) {
288- sources = libvpx_srcs_arm64_highbd_neon
289- deps = [ " :libvpx_arm64_highbd_headers" ]
290- }
291- }
292- }
293-
294- if (current_cpu == " arm64" ) {
295- source_set (" libvpx_intrinsics_neon_dotprod" ) {
296- check_includes = false
297- configs -= [ " //build/config/compiler:chromium_code" ]
298- configs += [ " //build/config/compiler:no_chromium_code" ]
299- configs += [ " :libvpx_config" ]
300- if (! is_win || is_clang ) {
301- cflags = [ " -march=armv8.2-a+dotprod" ]
302- }
303- if (cpu_arch_full == " arm64" ) {
304- sources = libvpx_srcs_arm64_neon_dotprod
305- deps = [ " :libvpx_arm64_headers" ]
306- } else if (cpu_arch_full == " arm64-highbd" ) {
307- sources = libvpx_srcs_arm64_highbd_neon_dotprod
308- deps = [ " :libvpx_arm64_highbd_headers" ]
309- }
310- }
311-
312- source_set (" libvpx_intrinsics_neon_i8mm" ) {
313- check_includes = false
314- configs -= [ " //build/config/compiler:chromium_code" ]
315- configs += [ " //build/config/compiler:no_chromium_code" ]
259+ if (cpu_arch_full == " arm-neon-cpu-detect" ) {
260+ static_library (" libvpx_intrinsics_neon" ) {
261+ configs -= [ " //build/config/compiler:compiler_arm_fpu" ]
316262 configs += [ " :libvpx_config" ]
317- if (! is_win || is_clang ) {
318- cflags = [ " -march=armv8.2-a+i8mm" ]
319- }
320- if (cpu_arch_full == " arm64" ) {
321- sources = libvpx_srcs_arm64_neon_i8mm
322- deps = [ " :libvpx_arm64_headers" ]
323- } else if (cpu_arch_full == " arm64-highbd" ) {
324- sources = libvpx_srcs_arm64_highbd_neon_i8mm
325- deps = [ " :libvpx_arm64_highbd_headers" ]
326- }
263+ cflags = [ " -mfpu=neon" ]
264+ sources = libvpx_srcs_arm_neon_cpu_detect_neon
265+ deps = [ " :libvpx_arm_neon_cpu_detect_headers" ]
327266 }
328267}
329268
@@ -390,10 +329,6 @@ source_set("libvpx_x86_64_headers") {
390329 sources = libvpx_srcs_x86_64_headers
391330}
392331
393- source_set (" libvpx_loongarch_headers" ) {
394- sources = libvpx_srcs_loongarch_headers
395- }
396-
397332source_set (" libvpx_arm_headers" ) {
398333 sources = libvpx_srcs_arm_headers
399334}
@@ -436,7 +371,15 @@ static_library("libvpx") {
436371 configs += [ " //build/config/compiler:optimize_max" ]
437372 }
438373
439- if (is_nacl ) {
374+ # As "nasm" does not embed the required LC_BUILD_VERSION section in object
375+ # files, it is not possible to build optimised version of the code if the
376+ # target is iOS under "catalyst" environment. This version is not shipped,
377+ # so there is no concern about performance.
378+ # TODO(crbug.com/1145197): Remove this exception once "nasm" has support
379+ # for embedding the correct LD_BUILD_VERSION section.
380+ _force_generic_srcs = is_ios && target_environment == " catalyst"
381+
382+ if (is_nacl || _force_generic_srcs ) {
440383 sources = libvpx_srcs_generic
441384 public_deps = [ " :libvpx_generic_headers" ]
442385 } else if (current_cpu == " x86" ) {
@@ -454,7 +397,7 @@ static_library("libvpx") {
454397 sources = libvpx_srcs_mips
455398 public_deps = [ " :libvpx_mips_headers" ]
456399 } else if (current_cpu == " arm" ) {
457- if (is_chromeos ) {
400+ if (is_chromeos_ash ) {
458401 sources = libvpx_srcs_arm_neon_highbd
459402 public_deps = [ " :libvpx_arm_neon_highbd_headers" ]
460403 } else if (arm_use_neon ) {
@@ -468,72 +411,55 @@ static_library("libvpx") {
468411 public_deps = [ " :libvpx_arm_headers" ]
469412 }
470413 } else if (current_cpu == " arm64" ) {
471- if (is_chromeos || is_win || is_mac ) {
414+ if (is_chromeos_ash || is_win || is_mac ) {
472415 sources = libvpx_srcs_arm64_highbd
473416 public_deps = [ " :libvpx_arm64_highbd_headers" ]
474417 } else {
475418 sources = libvpx_srcs_arm64
476419 public_deps = [ " :libvpx_arm64_headers" ]
477420 }
478- } else if (current_cpu == " ppc64" ) {
479- sources = libvpx_srcs_ppc64
480- } else if (current_cpu == " riscv64" ) {
481- sources = libvpx_srcs_generic
482- public_deps = [ " :libvpx_generic_headers" ]
483- } else if (current_cpu == " loong64" ) {
484- sources = libvpx_srcs_loongarch
485- public_deps = [ " :libvpx_loongarch_headers" ]
486421 }
487422
488423 configs -= [ " //build/config/compiler:chromium_code" ]
489424 configs += [ " //build/config/compiler:no_chromium_code" ]
490425 configs += [ " :libvpx_config" ]
491426 deps = []
492- if (current_cpu == " x86" || (current_cpu == " x64" && ! is_msan )) {
493- deps += [
494- " :libvpx_asm" ,
495- " :libvpx_intrinsics_avx" ,
496- " :libvpx_intrinsics_avx2" ,
497- " :libvpx_intrinsics_avx512" ,
498- " :libvpx_intrinsics_mmx" ,
499- " :libvpx_intrinsics_sse2" ,
500- " :libvpx_intrinsics_sse4_1" ,
501- " :libvpx_intrinsics_ssse3" ,
502- ]
427+ if (! _force_generic_srcs ) {
428+ if (current_cpu == " x86" || (current_cpu == " x64" && ! is_msan )) {
429+ deps += [
430+ " :libvpx_asm" ,
431+ " :libvpx_intrinsics_avx" ,
432+ " :libvpx_intrinsics_avx2" ,
433+ " :libvpx_intrinsics_avx512" ,
434+ " :libvpx_intrinsics_mmx" ,
435+ " :libvpx_intrinsics_sse2" ,
436+ " :libvpx_intrinsics_sse4_1" ,
437+ " :libvpx_intrinsics_ssse3" ,
438+ ]
439+ }
503440 }
504- if (cpu_arch_full == " arm-neon-highbd" || cpu_arch_full == " arm-neon" ||
505- cpu_arch_full == " arm-neon-cpu-detect" || current_cpu == " arm64" ) {
441+ if (cpu_arch_full == " arm-neon-cpu-detect" ) {
506442 deps += [ " :libvpx_intrinsics_neon" ]
507443 }
508- if (current_cpu == " arm64" ) {
509- deps += [ " :libvpx_intrinsics_neon_dotprod" ]
510- deps += [ " :libvpx_intrinsics_neon_i8mm" ]
511- }
512444 if (is_android ) {
513- deps += [ " //third_party/cpu_features:ndk_compat " ]
445+ deps += [ " //third_party/android_ndk:cpu_features " ]
514446 }
515447 if (current_cpu == " arm" && arm_assembly_sources != []) {
516448 deps += [ " :libvpx_assembly_arm" ]
517449 }
518- if (current_cpu == " loong64" ) {
519- deps += [ " :libvpx_loongarch_lsx" ]
520- }
521450
522451 public_configs = [ " :libvpx_external_config" ]
523452}
524453
525- static_library (" libvpxrc " ) {
454+ static_library (" libvp9rc " ) {
526455 if (! is_debug && is_win ) {
527456 configs -= [ " //build/config/compiler:default_optimization" ]
528457 configs += [ " //build/config/compiler:optimize_max" ]
529458 }
530459
531460 sources = [
532- " //third_party/libvpx/source/libvpx/vp8/vp8_ratectrl_rtc.cc" ,
533- " //third_party/libvpx/source/libvpx/vp8/vp8_ratectrl_rtc.h" ,
534461 " //third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.cc" ,
535462 " //third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.h" ,
536- " //third_party/libvpx/source/libvpx/vpx/internal/vpx_ratectrl_rtc.h" ,
537463 ]
538464
539465 configs -= [ " //build/config/compiler:chromium_code" ]
0 commit comments