Index: third_party/opus/src/silk/arm/biquad_alt_arm.h |
diff --git a/third_party/opus/src/silk/biquad_alt.c b/third_party/opus/src/silk/arm/biquad_alt_arm.h |
similarity index 50% |
copy from third_party/opus/src/silk/biquad_alt.c |
copy to third_party/opus/src/silk/arm/biquad_alt_arm.h |
index d55f5ee92ec2d9b4217810377a1c4a390f8104f9..66ea9f43dd0b37b2d633087f1a25e9986fce2d6e 100644 |
--- a/third_party/opus/src/silk/biquad_alt.c |
+++ b/third_party/opus/src/silk/arm/biquad_alt_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,54 +25,44 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
POSSIBILITY OF SUCH DAMAGE. |
***********************************************************************/ |
-/* * |
- * silk_biquad_alt.c * |
- * * |
- * Second order ARMA filter * |
- * Can handle slowly varying filter coefficients * |
- * */ |
+#ifndef SILK_BIQUAD_ALT_ARM_H |
+# define SILK_BIQUAD_ALT_ARM_H |
-#ifdef HAVE_CONFIG_H |
-#include "config.h" |
-#endif |
+# include "celt/arm/armcpu.h" |
-#include "SigProc_FIX.h" |
- |
-/* Second order ARMA filter, alternative implementation */ |
-void silk_biquad_alt( |
+# if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) |
+void silk_biquad_alt_stride2_neon( |
const opus_int16 *in, /* I input signal */ |
const opus_int32 *B_Q28, /* I MA coefficients [3] */ |
const opus_int32 *A_Q28, /* I AR coefficients [2] */ |
- opus_int32 *S, /* I/O State vector [2] */ |
+ opus_int32 *S, /* I/O State vector [4] */ |
opus_int16 *out, /* O output signal */ |
- const opus_int32 len, /* I signal length (must be even) */ |
- opus_int stride /* I Operate on interleaved signal if > 1 */ |
-) |
-{ |
- /* DIRECT FORM II TRANSPOSED (uses 2 element state vector) */ |
- opus_int k; |
- opus_int32 inval, A0_U_Q28, A0_L_Q28, A1_U_Q28, A1_L_Q28, out32_Q14; |
- |
- /* Negate A_Q28 values and split in two parts */ |
- A0_L_Q28 = ( -A_Q28[ 0 ] ) & 0x00003FFF; /* lower part */ |
- A0_U_Q28 = silk_RSHIFT( -A_Q28[ 0 ], 14 ); /* upper part */ |
- A1_L_Q28 = ( -A_Q28[ 1 ] ) & 0x00003FFF; /* lower part */ |
- A1_U_Q28 = silk_RSHIFT( -A_Q28[ 1 ], 14 ); /* upper part */ |
- |
- for( k = 0; k < len; k++ ) { |
- /* S[ 0 ], S[ 1 ]: Q12 */ |
- inval = in[ k * stride ]; |
- out32_Q14 = silk_LSHIFT( silk_SMLAWB( S[ 0 ], B_Q28[ 0 ], inval ), 2 ); |
+ const opus_int32 len /* I signal length (must be even) */ |
+); |
- S[ 0 ] = S[1] + silk_RSHIFT_ROUND( silk_SMULWB( out32_Q14, A0_L_Q28 ), 14 ); |
- S[ 0 ] = silk_SMLAWB( S[ 0 ], out32_Q14, A0_U_Q28 ); |
- S[ 0 ] = silk_SMLAWB( S[ 0 ], B_Q28[ 1 ], inval); |
+# if !defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_PRESUME_NEON) |
+# define OVERRIDE_silk_biquad_alt_stride2 (1) |
+# define silk_biquad_alt_stride2(in, B_Q28, A_Q28, S, out, len, arch) ((void)(arch), PRESUME_NEON(silk_biquad_alt_stride2)(in, B_Q28, A_Q28, S, out, len)) |
+# endif |
+# endif |
- S[ 1 ] = silk_RSHIFT_ROUND( silk_SMULWB( out32_Q14, A1_L_Q28 ), 14 ); |
- S[ 1 ] = silk_SMLAWB( S[ 1 ], out32_Q14, A1_U_Q28 ); |
- S[ 1 ] = silk_SMLAWB( S[ 1 ], B_Q28[ 2 ], inval ); |
+# if !defined(OVERRIDE_silk_biquad_alt_stride2) |
+/*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_BIQUAD_ALT_STRIDE2_IMPL[OPUS_ARCHMASK+1])( |
+ const opus_int16 *in, /* I input signal */ |
+ const opus_int32 *B_Q28, /* I MA coefficients [3] */ |
+ const opus_int32 *A_Q28, /* I AR coefficients [2] */ |
+ opus_int32 *S, /* I/O State vector [4] */ |
+ opus_int16 *out, /* O output signal */ |
+ const opus_int32 len /* I signal length (must be even) */ |
+ ); |
+# define OVERRIDE_silk_biquad_alt_stride2 (1) |
+# define silk_biquad_alt_stride2(in, B_Q28, A_Q28, S, out, len, arch) ((*SILK_BIQUAD_ALT_STRIDE2_IMPL[(arch)&OPUS_ARCHMASK])(in, B_Q28, A_Q28, S, out, len)) |
+# elif defined(OPUS_ARM_PRESUME_NEON_INTR) |
+# define OVERRIDE_silk_biquad_alt_stride2 (1) |
+# define silk_biquad_alt_stride2(in, B_Q28, A_Q28, S, out, len, arch) ((void)(arch), silk_biquad_alt_stride2_neon(in, B_Q28, A_Q28, S, out, len)) |
+# endif |
+# endif |
- /* Scale back to Q0 and saturate */ |
- out[ k * stride ] = (opus_int16)silk_SAT16( silk_RSHIFT( out32_Q14 + (1<<14) - 1, 14 ) ); |
- } |
-} |
+#endif /* end SILK_BIQUAD_ALT_ARM_H */ |