1- # Copyright 2014 The Chromium Authors. All rights reserved.
1+ # Copyright 2014 The Chromium Authors
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" )
98import (" //build/config/sanitizers/sanitizers.gni" )
109import (" //third_party/libvpx/libvpx_srcs.gni" )
1110import (" //third_party/nasm/nasm_assemble.gni" )
@@ -20,7 +19,7 @@ if (current_cpu == "x86") {
2019 cpu_arch_full = " x64"
2120 }
2221} else if (current_cpu == " arm" ) {
23- if (is_chromeos_ash ) {
22+ if (is_chromeos ) {
2423 # ChromeOS gets highbd vp9 but other arm targets do not.
2524 cpu_arch_full = " arm-neon-highbd"
2625 } else if (arm_use_neon ) {
@@ -31,11 +30,18 @@ if (current_cpu == "x86") {
3130 cpu_arch_full = " arm"
3231 }
3332} else if (current_cpu == " arm64" ) {
34- if (is_chromeos_ash || is_mac ) {
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).
3537 cpu_arch_full = " arm64-highbd"
3638 } else {
3739 cpu_arch_full = current_cpu
3840 }
41+ } else if (current_cpu == " riscv64" ) {
42+ cpu_arch_full = " generic"
43+ } else if (current_cpu == " loong64" ) {
44+ cpu_arch_full = " loongarch"
3945} else {
4046 cpu_arch_full = current_cpu
4147}
@@ -81,16 +87,6 @@ config("libvpx_config") {
8187 # libvpx has many static functions in header, which trigger this warning.
8288 " -Wno-unused-function" ,
8389 ]
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- }
9490 } else if (! is_win ) {
9591 cflags = [
9692 " -Wno-unused-function" ,
@@ -256,13 +252,78 @@ if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) {
256252 }
257253}
258254
259- if (cpu_arch_full == " arm-neon-cpu-detect" ) {
260- static_library (" libvpx_intrinsics_neon" ) {
261- configs -= [ " //build/config/compiler:compiler_arm_fpu" ]
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" ]
262316 configs += [ " :libvpx_config" ]
263- cflags = [ " -mfpu=neon" ]
264- sources = libvpx_srcs_arm_neon_cpu_detect_neon
265- deps = [ " :libvpx_arm_neon_cpu_detect_headers" ]
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+ }
266327 }
267328}
268329
@@ -329,6 +390,10 @@ source_set("libvpx_x86_64_headers") {
329390 sources = libvpx_srcs_x86_64_headers
330391}
331392
393+ source_set (" libvpx_loongarch_headers" ) {
394+ sources = libvpx_srcs_loongarch_headers
395+ }
396+
332397source_set (" libvpx_arm_headers" ) {
333398 sources = libvpx_srcs_arm_headers
334399}
@@ -371,15 +436,7 @@ static_library("libvpx") {
371436 configs += [ " //build/config/compiler:optimize_max" ]
372437 }
373438
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 ) {
439+ if (is_nacl ) {
383440 sources = libvpx_srcs_generic
384441 public_deps = [ " :libvpx_generic_headers" ]
385442 } else if (current_cpu == " x86" ) {
@@ -397,7 +454,7 @@ static_library("libvpx") {
397454 sources = libvpx_srcs_mips
398455 public_deps = [ " :libvpx_mips_headers" ]
399456 } else if (current_cpu == " arm" ) {
400- if (is_chromeos_ash ) {
457+ if (is_chromeos ) {
401458 sources = libvpx_srcs_arm_neon_highbd
402459 public_deps = [ " :libvpx_arm_neon_highbd_headers" ]
403460 } else if (arm_use_neon ) {
@@ -411,55 +468,72 @@ static_library("libvpx") {
411468 public_deps = [ " :libvpx_arm_headers" ]
412469 }
413470 } else if (current_cpu == " arm64" ) {
414- if (is_chromeos_ash || is_win || is_mac ) {
471+ if (is_chromeos || is_win || is_mac ) {
415472 sources = libvpx_srcs_arm64_highbd
416473 public_deps = [ " :libvpx_arm64_highbd_headers" ]
417474 } else {
418475 sources = libvpx_srcs_arm64
419476 public_deps = [ " :libvpx_arm64_headers" ]
420477 }
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" ]
421486 }
422487
423488 configs -= [ " //build/config/compiler:chromium_code" ]
424489 configs += [ " //build/config/compiler:no_chromium_code" ]
425490 configs += [ " :libvpx_config" ]
426491 deps = []
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- }
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+ ]
440503 }
441- if (cpu_arch_full == " arm-neon-cpu-detect" ) {
504+ if (cpu_arch_full == " arm-neon-highbd" || cpu_arch_full == " arm-neon" ||
505+ cpu_arch_full == " arm-neon-cpu-detect" || current_cpu == " arm64" ) {
442506 deps += [ " :libvpx_intrinsics_neon" ]
443507 }
508+ if (current_cpu == " arm64" ) {
509+ deps += [ " :libvpx_intrinsics_neon_dotprod" ]
510+ deps += [ " :libvpx_intrinsics_neon_i8mm" ]
511+ }
444512 if (is_android ) {
445- deps += [ " //third_party/android_ndk: cpu_features" ]
513+ deps += [ " //third_party/cpu_features:ndk_compat " ]
446514 }
447515 if (current_cpu == " arm" && arm_assembly_sources != []) {
448516 deps += [ " :libvpx_assembly_arm" ]
449517 }
518+ if (current_cpu == " loong64" ) {
519+ deps += [ " :libvpx_loongarch_lsx" ]
520+ }
450521
451522 public_configs = [ " :libvpx_external_config" ]
452523}
453524
454- static_library (" libvp9rc " ) {
525+ static_library (" libvpxrc " ) {
455526 if (! is_debug && is_win ) {
456527 configs -= [ " //build/config/compiler:default_optimization" ]
457528 configs += [ " //build/config/compiler:optimize_max" ]
458529 }
459530
460531 sources = [
532+ " //third_party/libvpx/source/libvpx/vp8/vp8_ratectrl_rtc.cc" ,
533+ " //third_party/libvpx/source/libvpx/vp8/vp8_ratectrl_rtc.h" ,
461534 " //third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.cc" ,
462535 " //third_party/libvpx/source/libvpx/vp9/ratectrl_rtc.h" ,
536+ " //third_party/libvpx/source/libvpx/vpx/internal/vpx_ratectrl_rtc.h" ,
463537 ]
464538
465539 configs -= [ " //build/config/compiler:chromium_code" ]
0 commit comments