Fix Android ARM Neon build.

Add the GN file copied over from the clankium repository.
Fix an issue with assembly-defined functions visibility.

BUG=4183
R=andrew@webrtc.org, rtoy@google.com

Review URL: https://webrtc-codereview.appspot.com/35729004

git-svn-id: http://webrtc.googlecode.com/svn/deps/third_party/openmax@8111 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/dl/BUILD.gn b/dl/BUILD.gn
new file mode 100644
index 0000000..8e63bd7
--- /dev/null
+++ b/dl/BUILD.gn
@@ -0,0 +1,256 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/arm.gni")
+
+declare_args() {
+  # Override this value to build with small float FFT tables
+  openmax_big_float_fft = true
+}
+
+config("dl_config") {
+  include_dirs = [ ".." ]
+  if (cpu_arch == "arm") {
+    if (arm_use_neon) {
+      # Enable build-time NEON selection.
+      defines = [ "DL_ARM_NEON" ]
+    } else if (arm_optionally_use_neon) {
+      # Enable run-time NEON selection.
+      defines = [ "DL_ARM_NEON_OPTIONAL" ]
+    }
+  } else if (cpu_arch == "arm64") {
+    # Enable build-time NEON selection.
+    defines = [ "DL_ARM_NEON" ]
+  }
+}
+
+# GYP: third_party/openmax_dl/dl/dl.gyp:openmax_dl
+source_set("dl") {
+  public_configs = [ ":dl_config" ]
+  sources = [
+    "api/omxtypes.h",
+    "sp/api/omxSP.h",
+    "sp/src/armSP_FFT_F32TwiddleTable.c",
+  ]
+
+  cflags = []
+  deps = []
+  defines = []
+
+  if (openmax_big_float_fft) {
+    defines += [ "BIG_FFT_TABLE" ]
+  }
+
+  if (cpu_arch == "arm" || cpu_arch == "arm64") {
+    sources += [
+      # Common files that are used by both arm and arm64 code.
+      "api/arm/armOMX.h",
+      "api/arm/omxtypes_s.h",
+      "sp/api/armSP.h",
+      "sp/src/arm/armSP_FFT_S32TwiddleTable.c",
+      "sp/src/arm/omxSP_FFTGetBufSize_C_FC32.c",
+      "sp/src/arm/omxSP_FFTGetBufSize_C_SC32.c",
+      "sp/src/arm/omxSP_FFTGetBufSize_R_F32.c",
+      "sp/src/arm/omxSP_FFTGetBufSize_R_S32.c",
+      "sp/src/arm/omxSP_FFTInit_C_FC32.c",
+      "sp/src/arm/omxSP_FFTInit_R_F32.c",
+    ]
+  }
+
+  if (cpu_arch == "arm") {
+    sources += [
+      # Common files that are used by both the NEON and non-NEON code.
+      "api/armCOMM_s.h",
+      "sp/src/arm/omxSP_FFTGetBufSize_C_SC16.c",
+      "sp/src/arm/omxSP_FFTGetBufSize_R_S16.c",
+      "sp/src/arm/omxSP_FFTGetBufSize_R_S16S32.c",
+      "sp/src/arm/omxSP_FFTInit_C_SC16.c",
+      "sp/src/arm/omxSP_FFTInit_C_SC32.c",
+      "sp/src/arm/omxSP_FFTInit_R_S16.c",
+      "sp/src/arm/omxSP_FFTInit_R_S16S32.c",
+      "sp/src/arm/omxSP_FFTInit_R_S32.c",
+    ]
+
+    deps += [
+      ":openmax_dl_armv7",
+      ":openmax_dl_neon"
+    ]
+  }
+
+  if (cpu_arch == "arm64") {
+    sources += [
+      "api/arm/arm64COMM_s.h",
+
+      # Complex floating-point FFT
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_fs_s.S",
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_ls_s.S",
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_s.S",
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_fs_s.S",
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_ls_s.S",
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_s.S",
+      "sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix8_fs_s.S",
+      "sp/src/arm/arm64/omxSP_FFTInv_CToC_FC32.c",
+      "sp/src/arm/arm64/omxSP_FFTFwd_CToC_FC32.c",
+
+      # Real floating-point FFT
+      "sp/src/arm/arm64/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_s.S",
+      "sp/src/arm/arm64/omxSP_FFTFwd_RToCCS_F32.c",
+      "sp/src/arm/arm64/ComplexToRealFixup.S",
+      "sp/src/arm/arm64/omxSP_FFTInv_CCSToR_F32.c",
+    ]
+  }
+
+  if (cpu_arch == "ia32" || cpu_arch == "x64") {
+    cflags += [ "-msse2" ]
+
+    sources += [
+      # Real 32-bit floating-point FFT.
+      "sp/api/x86SP.h",
+      "sp/src/x86/omxSP_FFTFwd_RToCCS_F32_Sfs.c",
+      "sp/src/x86/omxSP_FFTGetBufSize_R_F32.c",
+      "sp/src/x86/omxSP_FFTInit_R_F32.c",
+      "sp/src/x86/omxSP_FFTInv_CCSToR_F32_Sfs.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix2_fs.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix2_ls.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix2_ls_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix2_ms.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix4_fs.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix4_fs_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix4_ls.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix4_ls_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix4_ms.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Fwd_Radix4_ms_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix2_fs.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix2_ls.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix2_ls_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix2_ms.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix4_fs.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix4_fs_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix4_ls.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix4_ls_sse.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix4_ms.c",
+      "sp/src/x86/x86SP_FFT_CToC_FC32_Inv_Radix4_ms_sse.c",
+      "sp/src/x86/x86SP_FFT_F32_radix2_kernel.c",
+      "sp/src/x86/x86SP_FFT_F32_radix4_kernel.c",
+      "sp/src/x86/x86SP_SSE_Math.h",
+    ]
+  }
+
+  if (cpu_arch == "mipsel") {
+    cflags += [ "-std=c99" ]
+    sources -= [ "sp/src/armSP_FFT_F32TwiddleTable.c" ]
+
+    sources += [
+      "sp/api/mipsSP.h",
+      "sp/src/mips/mips_FFTFwd_RToCCS_F32_complex.c",
+      "sp/src/mips/mips_FFTFwd_RToCCS_F32_real.c",
+      "sp/src/mips/mips_FFTInv_CCSToR_F32_complex.c",
+      "sp/src/mips/mips_FFTInv_CCSToR_F32_real.c",
+      "sp/src/mips/omxSP_FFT_F32TwiddleTable.c",
+      "sp/src/mips/omxSP_FFTFwd_RToCCS_F32_Sfs.c",
+      "sp/src/mips/omxSP_FFTGetBufSize_R_F32.c",
+      "sp/src/mips/omxSP_FFTInit_R_F32.c",
+      "sp/src/mips/omxSP_FFTInv_CCSToR_F32_Sfs.c",
+    ]
+  }
+}
+
+if (cpu_arch == "arm") {
+  # GYP: third_party/openmax_dl/dl/dl.gyp:openmax_dl_armv7
+  # Non-NEON implementation of FFT. This library is NOT
+  # standalone. Applications must link with openmax_dl.
+  source_set("openmax_dl_armv7") {
+    configs += [ ":dl_config" ]
+    visibility = [ ":*" ]
+
+    sources = [
+      # Complex floating-point FFT
+      "sp/src/arm/armv7/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S",
+      "sp/src/arm/armv7/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S",
+      "sp/src/arm/armv7/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S",
+      "sp/src/arm/armv7/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S",
+      "sp/src/arm/armv7/omxSP_FFTInv_CToC_FC32_Sfs_s.S",
+      "sp/src/arm/armv7/omxSP_FFTFwd_CToC_FC32_Sfs_s.S",
+
+      # Real floating-point FFT
+      "sp/src/arm/armv7/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S",
+      "sp/src/arm/armv7/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S",
+      "sp/src/arm/armv7/omxSP_FFTInv_CCSToR_F32_Sfs_s.S",
+    ]
+    if (arm_optionally_use_neon) {
+      # Run-time NEON detection.
+      deps = [ "//third_party/android_tools:cpu_features" ]
+      # To get the __android_log_print routine
+      libs = [ "log" ]
+      # Detection routine
+      sources += [ "sp/src/arm/detect.c" ]
+    }
+  }
+
+  # GYP: third_party/openmax_dl/dl/dl.gyp:openmax_dl_neon
+  # NEON implementation of FFT. This library is NOT
+  # standalone. Applications must link with openmax_dl.
+  source_set("openmax_dl_neon") {
+    configs += [ ":dl_config" ]
+    visibility = [ ":*" ]
+
+    if (!arm_use_neon) {
+      configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
+      cflags += [ "-mfpu=neon" ]
+    }
+
+    sources = [
+      # Complex 32-bit fixed-point FFT.
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_ls_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_fs_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_ls_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix8_fs_unsafe_s.S",
+      "sp/src/arm/neon/omxSP_FFTFwd_CToC_SC32_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CToC_SC32_Sfs_s.S",
+
+      # Real 32-bit fixed-point FFT
+      "sp/src/arm/neon/armSP_FFTInv_CCSToR_S32_preTwiddleRadix2_unsafe_s.S",
+      "sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S32_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CCSToR_S32_Sfs_s.S",
+
+      # Complex 16-bit fixed-point FFT
+      "sp/src/arm/neon/armSP_FFTInv_CCSToR_S16_preTwiddleRadix2_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_fs_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_ls_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_ps_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_fs_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_ls_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix8_fs_unsafe_s.S",
+      "sp/src/arm/neon/omxSP_FFTFwd_CToC_SC16_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CToC_SC16_Sfs_s.S",
+
+      # Real 16-bit fixed-point FFT
+      "sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S16_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CCSToR_S16_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S16S32_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CCSToR_S32S16_Sfs_s.S",
+
+      # Complex floating-point FFT
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S",
+      "sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S",
+      "sp/src/arm/neon/omxSP_FFTFwd_CToC_FC32_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CToC_FC32_Sfs_s.S",
+
+      # Real floating-point FFT
+      "sp/src/arm/neon/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S",
+      "sp/src/arm/neon/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S",
+      "sp/src/arm/neon/omxSP_FFTInv_CCSToR_F32_Sfs_s.S",
+    ]
+  }
+}
diff --git a/dl/api/arm/arm64COMM_s.h b/dl/api/arm/arm64COMM_s.h
index a5422d5..29dbd54 100644
--- a/dl/api/arm/arm64COMM_s.h
+++ b/dl/api/arm/arm64COMM_s.h
@@ -106,6 +106,7 @@
 
 	// Define the function and make it external.
 	.global	\name
+	.hidden \name
 	.section	.text.\name,"ax",%progbits
 	.align	4
 \name :		
diff --git a/dl/api/arm/armCOMM_s.h b/dl/api/arm/armCOMM_s.h
index e26ceb2..98fff3f 100644
--- a/dl/api/arm/armCOMM_s.h
+++ b/dl/api/arm/armCOMM_s.h
@@ -169,6 +169,7 @@
 	@ Define the function and make it external.
 	.arm
 	.global	\name
+	.hidden \name
 	.section	.text.\name,"ax",%progbits
 	.align	2
 \name :		
diff --git a/dl/dl.gyp b/dl/dl.gyp
index f389cb4..f5a3aee 100644
--- a/dl/dl.gyp
+++ b/dl/dl.gyp
@@ -26,7 +26,7 @@
               'defines': ['DL_ARM_NEON',],
             },
           }],
-          ['arm_neon==0 and OS=="android"', {
+          ['arm_neon==0 and arm_neon_optional==1', {
             # Enable run-time NEON selection.
             'defines': ['DL_ARM_NEON_OPTIONAL',],
             'direct_dependent_settings': {
@@ -46,6 +46,7 @@
   },
   'targets': [
     {
+      # GN version: //third_party/opendmax_dl/dl
       'target_name': 'openmax_dl',
       'type': 'static_library',
       'direct_dependent_settings': {
@@ -80,90 +81,42 @@
           ],
         }],
         ['target_arch=="arm"', {
-          'conditions': [
-            ['arm_neon==0 or OS=="android"', {
-              'dependencies': [
-                'openmax_dl_armv7',
-              ],
-            }],
-            ['arm_neon==1 or OS=="android"', {
-              'cflags!': [
-                '-mfpu=vfpv3-d16',
-              ],
-              'cflags': [
-                '-mfpu=neon',
-              ],
-              'sources': [
-                # Common files that are used by both the NEON and non-NEON code.
-                'api/armCOMM_s.h',
-                'sp/src/arm/omxSP_FFTGetBufSize_C_SC16.c',
-                'sp/src/arm/omxSP_FFTGetBufSize_R_S16.c',
-                'sp/src/arm/omxSP_FFTGetBufSize_R_S16S32.c',
-                'sp/src/arm/omxSP_FFTInit_C_SC16.c',
-                'sp/src/arm/omxSP_FFTInit_C_SC32.c',
-                'sp/src/arm/omxSP_FFTInit_R_S16.c',
-                'sp/src/arm/omxSP_FFTInit_R_S16S32.c',
-                'sp/src/arm/omxSP_FFTInit_R_S32.c',
+          'sources': [
+            # Common files that are used by both the NEON and non-NEON code.
+            'api/armCOMM_s.h',
+            'sp/src/arm/omxSP_FFTGetBufSize_C_SC16.c',
+            'sp/src/arm/omxSP_FFTGetBufSize_R_S16.c',
+            'sp/src/arm/omxSP_FFTGetBufSize_R_S16S32.c',
+            'sp/src/arm/omxSP_FFTInit_C_SC16.c',
+            'sp/src/arm/omxSP_FFTInit_C_SC32.c',
+            'sp/src/arm/omxSP_FFTInit_R_S16.c',
+            'sp/src/arm/omxSP_FFTInit_R_S16S32.c',
+            'sp/src/arm/omxSP_FFTInit_R_S32.c',
+          ],
+          'dependencies': [
+            'openmax_dl_armv7',
+            'openmax_dl_neon',
+          ],
+        }],
+        ['target_arch=="arm64"', {
+          'sources':[
+            'api/arm/arm64COMM_s.h',
 
-                # Complex 32-bit fixed-point FFT.
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_ls_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_ls_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix8_fs_unsafe_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CToC_SC32_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTFwd_CToC_SC32_Sfs_s.S',
-                # Real 32-bit fixed-point FFT
-                'sp/src/arm/neon/armSP_FFTInv_CCSToR_S32_preTwiddleRadix2_unsafe_s.S',
-                'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S32_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CCSToR_S32_Sfs_s.S',
-                # Complex 16-bit fixed-point FFT
-                'sp/src/arm/neon/armSP_FFTInv_CCSToR_S16_preTwiddleRadix2_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_ls_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_ps_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_ls_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix8_fs_unsafe_s.S',
-                'sp/src/arm/neon/omxSP_FFTFwd_CToC_SC16_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CToC_SC16_Sfs_s.S',
-                # Real 16-bit fixed-point FFT
-                'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S16_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CCSToR_S16_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S16S32_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CCSToR_S32S16_Sfs_s.S',
-                # Complex floating-point FFT
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S',
-                'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CToC_FC32_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTFwd_CToC_FC32_Sfs_s.S',
-                # Real floating-point FFT
-                'sp/src/arm/neon/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S',
-                'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S',
-                'sp/src/arm/neon/omxSP_FFTInv_CCSToR_F32_Sfs_s.S',
-              ],
-              'conditions': [
-                # Disable LTO due to Neon issues
-                # crbug.com/408997
-                ['use_lto==1', {
-                  'cflags!': [
-                    '-flto',
-                    '-ffat-lto-objects',
-                  ],
-                }],
-              ],
-            }],
+            # Complex floating-point FFT
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_fs_s.S',
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_ls_s.S',
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_s.S',
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_fs_s.S',
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_ls_s.S',
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_s.S',
+            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix8_fs_s.S',
+            'sp/src/arm/arm64/omxSP_FFTInv_CToC_FC32.c',
+            'sp/src/arm/arm64/omxSP_FFTFwd_CToC_FC32.c',
+            # Real floating-point FFT
+            'sp/src/arm/arm64/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_s.S',
+            'sp/src/arm/arm64/omxSP_FFTFwd_RToCCS_F32.c',
+            'sp/src/arm/arm64/ComplexToRealFixup.S',
+            'sp/src/arm/arm64/omxSP_FFTInv_CCSToR_F32.c',
           ],
         }],
         ['target_arch=="ia32" or target_arch=="x64"', {
@@ -202,27 +155,6 @@
             'sp/src/x86/x86SP_SSE_Math.h',
           ],
         }],
-        ['target_arch=="arm64"', {
-          'sources':[
-            'api/arm/arm64COMM_s.h',
-
-            # Complex floating-point FFT
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_fs_s.S',
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_ls_s.S',
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix2_s.S',
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_fs_s.S',
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_ls_s.S',
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix4_s.S',
-            'sp/src/arm/arm64/armSP_FFT_CToC_FC32_Radix8_fs_s.S',
-            'sp/src/arm/arm64/omxSP_FFTInv_CToC_FC32.c',
-            'sp/src/arm/arm64/omxSP_FFTFwd_CToC_FC32.c',
-            # Real floating-point FFT
-            'sp/src/arm/arm64/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_s.S',
-            'sp/src/arm/arm64/omxSP_FFTFwd_RToCCS_F32.c',
-            'sp/src/arm/arm64/ComplexToRealFixup.S',
-            'sp/src/arm/arm64/omxSP_FFTInv_CCSToR_F32.c',
-          ],
-        }],
         ['target_arch=="mipsel"', {
           'cflags': [
             '-std=c99',
@@ -250,13 +182,11 @@
     ['target_arch=="arm"', {
       'targets': [
         {
+          # GN version: //third_party/opendmax_dl/openmax_dl_armv7
           # Non-NEON implementation of FFT. This library is NOT
           # standalone. Applications must link with openmax_dl.
           'target_name': 'openmax_dl_armv7',
           'type': 'static_library',
-          'cflags!': [
-            '-mfpu=neon',
-          ],
           'sources': [
             # Complex floating-point FFT
             'sp/src/arm/armv7/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S',
@@ -272,8 +202,8 @@
             'sp/src/arm/armv7/omxSP_FFTInv_CCSToR_F32_Sfs_s.S',
           ],
           'conditions': [
-            ['OS=="android"', {
-              # We only do run-time NEON detection on Android.
+            ['arm_neon_optional==1', {
+              # Run-time NEON detection.
               'includes': [
                 '../../../build/android/cpufeatures.gypi',
               ],
@@ -290,6 +220,78 @@
             }],
           ],
         },
+        {
+          # GN version: //third_party/opendmax_dl/openmax_dl_neon
+          # NEON implementation of FFT. This library is NOT
+          # standalone. Applications must link with openmax_dl.
+          'target_name': 'openmax_dl_neon',
+          'type': 'static_library',
+          'cflags!': [
+            '-mfpu=vfpv3-d16',
+          ],
+          'cflags': [
+            '-mfpu=neon',
+          ],
+          'sources': [
+            # Complex 32-bit fixed-point FFT.
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_ls_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_ls_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix2_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix4_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC32_Radix8_fs_unsafe_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CToC_SC32_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTFwd_CToC_SC32_Sfs_s.S',
+            # Real 32-bit fixed-point FFT
+            'sp/src/arm/neon/armSP_FFTInv_CCSToR_S32_preTwiddleRadix2_unsafe_s.S',
+            'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S32_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CCSToR_S32_Sfs_s.S',
+            # Complex 16-bit fixed-point FFT
+            'sp/src/arm/neon/armSP_FFTInv_CCSToR_S16_preTwiddleRadix2_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_ls_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_ps_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix2_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_ls_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix4_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_SC16_Radix8_fs_unsafe_s.S',
+            'sp/src/arm/neon/omxSP_FFTFwd_CToC_SC16_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CToC_SC16_Sfs_s.S',
+            # Real 16-bit fixed-point FFT
+            'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S16_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CCSToR_S16_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_S16S32_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CCSToR_S32S16_Sfs_s.S',
+            # Complex floating-point FFT
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_ls_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_fs_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_ls_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix2_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix4_unsafe_s.S',
+            'sp/src/arm/neon/armSP_FFT_CToC_FC32_Radix8_fs_unsafe_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CToC_FC32_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTFwd_CToC_FC32_Sfs_s.S',
+            # Real floating-point FFT
+            'sp/src/arm/neon/armSP_FFTInv_CCSToR_F32_preTwiddleRadix2_unsafe_s.S',
+            'sp/src/arm/neon/omxSP_FFTFwd_RToCCS_F32_Sfs_s.S',
+            'sp/src/arm/neon/omxSP_FFTInv_CCSToR_F32_Sfs_s.S',
+          ],
+          'conditions': [
+            # Disable LTO due to NEON issues
+            # crbug.com/408997
+            ['use_lto==1', {
+              'cflags!': [
+                '-flto',
+                '-ffat-lto-objects',
+              ],
+            }],
+          ],
+        },
       ],
     }],
   ],