diff options
7 files changed, 95 insertions, 33 deletions
diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 790b1a9536..9a2bf79d36 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -530,6 +530,10 @@ source_set("isacfix") { "../../system_wrappers", ] + if (current_cpu == "arm64") { + deps += [ ":isac_neon" ] + } + if (rtc_build_armv7_neon) { deps += [ ":isac_neon" ] @@ -585,20 +589,44 @@ source_set("isacfix") { } } -if (rtc_build_armv7_neon) { +if (rtc_build_armv7_neon || current_cpu == "arm64") { source_set("isac_neon") { - sources = [ - "codecs/isac/fix/source/entropy_coding_neon.c", - "codecs/isac/fix/source/filterbanks_neon.S", - "codecs/isac/fix/source/filters_neon.S", - "codecs/isac/fix/source/lattice_neon.S", - "codecs/isac/fix/source/lpc_masking_model_neon.S", - "codecs/isac/fix/source/transform_neon.S", - ] + sources = [ "codecs/isac/fix/source/entropy_coding_neon.c" ] - include_dirs = [ - "../../..", - ] + if (rtc_build_armv7_neon) { + sources += [ + "codecs/isac/fix/source/filterbanks_neon.S", + "codecs/isac/fix/source/filters_neon.S", + "codecs/isac/fix/source/lattice_neon.S", + "codecs/isac/fix/source/lpc_masking_model_neon.S", + "codecs/isac/fix/source/transform_neon.S", + ] + + # Enable compilation for the ARM v7 Neon instruction set. This is needed + # since //build/config/arm.gni only enables Neon for iOS, not Android. + # This provides the same functionality as webrtc/build/arm_neon.gypi. + # TODO(kjellander): Investigate if this can be moved into webrtc.gni or + # //build/config/arm.gni instead, to reduce code duplication. + # Remove the -mfpu=vfpv3-d16 cflag. + configs -= [ "//build/config/compiler:compiler_arm_fpu" ] + cflags = [ + "-mfpu=neon", + ] + } + + if (current_cpu == "arm64") { + sources += [ + "codecs/isac/fix/source/filters_neon.c", + "codecs/isac/fix/source/lattice_neon.c", + "codecs/isac/fix/source/transform_neon.c", + ] + # Disable AllpassFilter2FixDec16Neon function due to a clang bug. + # Refer more details at: + # https://code.google.com/p/webrtc/issues/detail?id=4567 + if (!is_clang) { + sources += [ "codecs/isac/fix/source/filterbanks_neon.c", ] + } + } # Disable LTO in audio_processing_neon target due to compiler bug. if (rtc_use_lto) { @@ -608,17 +636,6 @@ if (rtc_build_armv7_neon) { ] } - # Enable compilation for the ARM v7 Neon instruction set. This is needed - # since //build/config/arm.gni only enables Neon for iOS, not Android. - # This provides the same functionality as webrtc/build/arm_neon.gypi. - # TODO(kjellander): Investigate if this can be moved into webrtc.gni or - # //build/config/arm.gni instead, to reduce code duplication. - # Remove the -mfpu=vfpv3-d16 cflag. - configs -= [ "//build/config/compiler:compiler_arm_fpu" ] - cflags = [ - "-mfpu=neon", - ] - configs += [ "../..:common_config" ] public_configs = [ "../..:common_inherited_config" ] diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h index 488ee2e76a..cf1266a626 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h @@ -90,7 +90,8 @@ void WebRtcIsacfix_Spec2TimeC(int16_t* inreQ7, int32_t* outre1Q16, int32_t* outre2Q16); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) +#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ + (defined WEBRTC_ARCH_ARM64_NEON) void WebRtcIsacfix_Time2SpecNeon(int16_t* inre1Q9, int16_t* inre2Q9, int16_t* outre, @@ -174,7 +175,8 @@ void WebRtcIsacfix_FilterMaLoopC(int16_t input0, int32_t* ptr1, int32_t* ptr2); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) +#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ + (defined WEBRTC_ARCH_ARM64_NEON) int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r, const int16_t* __restrict x, int16_t N, diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h index 741646f01a..63fe61fc78 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h @@ -147,7 +147,8 @@ void WebRtcIsacfix_MatrixProduct2C(const int16_t matrix0[], const int matrix0_index_factor, const int matrix0_index_step); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) +#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ + (defined WEBRTC_ARCH_ARM64_NEON) void WebRtcIsacfix_MatrixProduct1Neon(const int16_t matrix0[], const int32_t matrix1[], int32_t matrix_product[], diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h index 2aa587fc0d..fb042dee7b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h @@ -60,7 +60,12 @@ void WebRtcIsacfix_AllpassFilter2FixDec16C( int32_t *filter_state_ch1, int32_t *filter_state_ch2); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) +// Disable AllpassFilter2FixDec16Neon function due to a clang bug. +// Refer more details at: +// https://code.google.com/p/webrtc/issues/detail?id=4567 +#if !(defined __clang__) +#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ + (defined WEBRTC_ARCH_ARM64_NEON) void WebRtcIsacfix_AllpassFilter2FixDec16Neon( int16_t *data_ch1, int16_t *data_ch2, @@ -70,6 +75,7 @@ void WebRtcIsacfix_AllpassFilter2FixDec16Neon( int32_t *filter_state_ch1, int32_t *filter_state_ch2); #endif +#endif #if defined(MIPS_DSP_R1_LE) void WebRtcIsacfix_AllpassFilter2FixDec16MIPS( diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc index 3276331e79..79a590ff24 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc @@ -64,6 +64,11 @@ class FilterBanksTest : public testing::Test { TEST_F(FilterBanksTest, AllpassFilter2FixDec16Test) { CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16C); + +// Disable AllpassFilter2FixDec16Neon function due to a clang bug. +// Refer more details at: +// https://code.google.com/p/webrtc/issues/detail?id=4567 +#if !(defined __clang__) #ifdef WEBRTC_DETECT_ARM_NEON if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon); @@ -71,6 +76,7 @@ TEST_F(FilterBanksTest, AllpassFilter2FixDec16Test) { #elif defined(WEBRTC_ARCH_ARM_NEON) CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon); #endif +#endif } TEST_F(FilterBanksTest, HighpassFilterFixDec32Test) { diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c index 922e0299ba..c211162378 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c @@ -198,16 +198,24 @@ int16_t WebRtcIsacfix_FreeInternal(ISACFIX_MainStruct *ISAC_main_inst) * This function initializes function pointers for ARM Neon platform. */ -#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON) +#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON) || \ + (defined WEBRTC_ARCH_ARM64_NEON) static void WebRtcIsacfix_InitNeon(void) { WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrNeon; WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopNeon; WebRtcIsacfix_Spec2Time = WebRtcIsacfix_Spec2TimeNeon; WebRtcIsacfix_Time2Spec = WebRtcIsacfix_Time2SpecNeon; +#if !(defined WEBRTC_ARCH_ARM64_NEON) WebRtcIsacfix_CalculateResidualEnergy = WebRtcIsacfix_CalculateResidualEnergyNeon; +#endif +// Disable AllpassFilter2FixDec16Neon function due to a clang bug. +// Refer more details at: +// https://code.google.com/p/webrtc/issues/detail?id=4567 +#if !(defined __clang__) WebRtcIsacfix_AllpassFilter2FixDec16 = WebRtcIsacfix_AllpassFilter2FixDec16Neon; +#endif WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1Neon; WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2Neon; } @@ -334,7 +342,7 @@ int16_t WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst, if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { WebRtcIsacfix_InitNeon(); } -#elif defined(WEBRTC_ARCH_ARM_NEON) +#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON) WebRtcIsacfix_InitNeon(); #endif diff --git a/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi b/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi index de5ada6e1d..cc2af97f88 100644 --- a/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi +++ b/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi @@ -95,6 +95,9 @@ }], ], }], + ['target_arch=="arm64"', { + 'dependencies': ['isac_neon', ], + }], ['target_arch=="mipsel" and mips_arch_variant!="r6"', { 'sources': [ 'fix/source/entropy_coding_mips.c', @@ -128,7 +131,7 @@ }, ], 'conditions': [ - ['target_arch=="arm" and arm_version>=7', { + ['target_arch=="arm" and arm_version>=7 or target_arch=="arm64"', { 'targets': [ { 'target_name': 'isac_neon', @@ -137,9 +140,6 @@ 'dependencies': [ '<(webrtc_root)/common_audio/common_audio.gyp:common_audio', ], - 'include_dirs': [ - '<(webrtc_root)', - ], 'sources': [ 'fix/source/entropy_coding_neon.c', 'fix/source/filterbanks_neon.S', @@ -156,6 +156,28 @@ '-ffat-lto-objects', ], }], + ['target_arch=="arm64"', { + 'sources!': [ + 'fix/source/filterbanks_neon.S', + 'fix/source/filters_neon.S', + 'fix/source/lattice_neon.S', + 'fix/source/lpc_masking_model_neon.S', + 'fix/source/transform_neon.S', + ], + 'sources': [ + 'fix/source/filters_neon.c', + 'fix/source/lattice_neon.c', + 'fix/source/transform_neon.c', + ], + 'conditions': [ + # Disable AllpassFilter2FixDec16Neon function due to a clang + # bug. Refer more details at: + # https://code.google.com/p/webrtc/issues/detail?id=4567 + ['clang==0', { + 'sources': ['fix/source/filterbanks_neon.c',], + }], + ], + }] ], }, ], |