Index: third_party/opus/src/silk/fixed/arm/warped_autocorrelation_FIX_arm.h |
diff --git a/third_party/opus/src/silk/fixed/warped_autocorrelation_FIX.c b/third_party/opus/src/silk/fixed/arm/warped_autocorrelation_FIX_arm.h |
similarity index 53% |
copy from third_party/opus/src/silk/fixed/warped_autocorrelation_FIX.c |
copy to third_party/opus/src/silk/fixed/arm/warped_autocorrelation_FIX_arm.h |
index 6ca6c1184d865f7fbbc15bcc6cbb329b26b86a02..1992e43288519f8adb5ff4d3c3824804cdfa44c5 100644 |
--- a/third_party/opus/src/silk/fixed/warped_autocorrelation_FIX.c |
+++ b/third_party/opus/src/silk/fixed/arm/warped_autocorrelation_FIX_arm.h |
@@ -1,5 +1,5 @@ |
/*********************************************************************** |
-Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
+Copyright (c) 2017 Google Inc. |
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions |
are met: |
@@ -25,71 +25,44 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGE. |
***********************************************************************/ |
-#ifdef HAVE_CONFIG_H |
-#include "config.h" |
-#endif |
+#ifndef SILK_WARPED_AUTOCORRELATION_FIX_ARM_H |
+# define SILK_WARPED_AUTOCORRELATION_FIX_ARM_H |
-#include "main_FIX.h" |
+# include "celt/arm/armcpu.h" |
-#define QC 10 |
-#define QS 14 |
+# if defined(FIXED_POINT) |
-#if defined(MIPSr1_ASM) |
-#include "mips/warped_autocorrelation_FIX_mipsr1.h" |
-#endif |
- |
- |
-#ifndef OVERRIDE_silk_warped_autocorrelation_FIX |
-/* Autocorrelations for a warped frequency axis */ |
-void silk_warped_autocorrelation_FIX( |
+# if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) |
+void silk_warped_autocorrelation_FIX_neon( |
opus_int32 *corr, /* O Result [order + 1] */ |
opus_int *scale, /* O Scaling of the correlation vector */ |
const opus_int16 *input, /* I Input data to correlate */ |
const opus_int warping_Q16, /* I Warping coefficient */ |
const opus_int length, /* I Length of input */ |
const opus_int order /* I Correlation order (even) */ |
-) |
-{ |
- opus_int n, i, lsh; |
- opus_int32 tmp1_QS, tmp2_QS; |
- opus_int32 state_QS[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; |
- opus_int64 corr_QC[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 }; |
+); |
+ |
+# if !defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_PRESUME_NEON) |
+# define OVERRIDE_silk_warped_autocorrelation_FIX (1) |
+# define silk_warped_autocorrelation_FIX(corr, scale, input, warping_Q16, length, order, arch) \ |
+ ((void)(arch), PRESUME_NEON(silk_warped_autocorrelation_FIX)(corr, scale, input, warping_Q16, length, order)) |
+# endif |
+# endif |
- /* Order must be even */ |
- silk_assert( ( order & 1 ) == 0 ); |
- silk_assert( 2 * QS - QC >= 0 ); |
+# if !defined(OVERRIDE_silk_warped_autocorrelation_FIX) |
+/*Is run-time CPU detection enabled on this platform?*/ |
+# if defined(OPUS_HAVE_RTCD) && (defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)) |
+extern void (*const SILK_WARPED_AUTOCORRELATION_FIX_IMPL[OPUS_ARCHMASK+1])(opus_int32*, opus_int*, const opus_int16*, const opus_int, const opus_int, const opus_int); |
+# define OVERRIDE_silk_warped_autocorrelation_FIX (1) |
+# define silk_warped_autocorrelation_FIX(corr, scale, input, warping_Q16, length, order, arch) \ |
+ ((*SILK_WARPED_AUTOCORRELATION_FIX_IMPL[(arch)&OPUS_ARCHMASK])(corr, scale, input, warping_Q16, length, order)) |
+# elif defined(OPUS_ARM_PRESUME_NEON_INTR) |
+# define OVERRIDE_silk_warped_autocorrelation_FIX (1) |
+# define silk_warped_autocorrelation_FIX(corr, scale, input, warping_Q16, length, order, arch) \ |
+ ((void)(arch), silk_warped_autocorrelation_FIX_neon(corr, scale, input, warping_Q16, length, order)) |
+# endif |
+# endif |
- /* Loop over samples */ |
- for( n = 0; n < length; n++ ) { |
- tmp1_QS = silk_LSHIFT32( (opus_int32)input[ n ], QS ); |
- /* Loop over allpass sections */ |
- for( i = 0; i < order; i += 2 ) { |
- /* Output of allpass section */ |
- tmp2_QS = silk_SMLAWB( state_QS[ i ], state_QS[ i + 1 ] - tmp1_QS, warping_Q16 ); |
- state_QS[ i ] = tmp1_QS; |
- corr_QC[ i ] += silk_RSHIFT64( silk_SMULL( tmp1_QS, state_QS[ 0 ] ), 2 * QS - QC ); |
- /* Output of allpass section */ |
- tmp1_QS = silk_SMLAWB( state_QS[ i + 1 ], state_QS[ i + 2 ] - tmp2_QS, warping_Q16 ); |
- state_QS[ i + 1 ] = tmp2_QS; |
- corr_QC[ i + 1 ] += silk_RSHIFT64( silk_SMULL( tmp2_QS, state_QS[ 0 ] ), 2 * QS - QC ); |
- } |
- state_QS[ order ] = tmp1_QS; |
- corr_QC[ order ] += silk_RSHIFT64( silk_SMULL( tmp1_QS, state_QS[ 0 ] ), 2 * QS - QC ); |
- } |
+# endif /* end FIXED_POINT */ |
- lsh = silk_CLZ64( corr_QC[ 0 ] ) - 35; |
- lsh = silk_LIMIT( lsh, -12 - QC, 30 - QC ); |
- *scale = -( QC + lsh ); |
- silk_assert( *scale >= -30 && *scale <= 12 ); |
- if( lsh >= 0 ) { |
- for( i = 0; i < order + 1; i++ ) { |
- corr[ i ] = (opus_int32)silk_CHECK_FIT32( silk_LSHIFT64( corr_QC[ i ], lsh ) ); |
- } |
- } else { |
- for( i = 0; i < order + 1; i++ ) { |
- corr[ i ] = (opus_int32)silk_CHECK_FIT32( silk_RSHIFT64( corr_QC[ i ], -lsh ) ); |
- } |
- } |
- silk_assert( corr_QC[ 0 ] >= 0 ); /* If breaking, decrease QC*/ |
-} |
-#endif /* OVERRIDE_silk_warped_autocorrelation_FIX */ |
+#endif /* end SILK_WARPED_AUTOCORRELATION_FIX_ARM_H */ |