Index: third_party/opus/src/silk/SigProc_FIX.h |
diff --git a/third_party/opus/src/silk/SigProc_FIX.h b/third_party/opus/src/silk/SigProc_FIX.h |
index b63299441e930a385e97ef9c13d5755cc0f9c413..f9ae326326d31a81cdf9c4ff2bb5aa827a4ebac1 100644 |
--- a/third_party/opus/src/silk/SigProc_FIX.h |
+++ b/third_party/opus/src/silk/SigProc_FIX.h |
@@ -35,7 +35,7 @@ extern "C" |
/*#define silk_MACRO_COUNT */ /* Used to enable WMOPS counting */ |
-#define SILK_MAX_ORDER_LPC 16 /* max order of the LPC analysis in schur() and k2a() */ |
+#define SILK_MAX_ORDER_LPC 24 /* max order of the LPC analysis in schur() and k2a() */ |
#include <string.h> /* for memset(), memcpy(), memmove() */ |
#include "typedef.h" |
@@ -47,6 +47,11 @@ extern "C" |
#include "x86/SigProc_FIX_sse.h" |
#endif |
+#if (defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)) |
+#include "arm/biquad_alt_arm.h" |
+#include "arm/LPC_inv_pred_gain_arm.h" |
+#endif |
+ |
/********************************************************************/ |
/* SIGNAL PROCESSING FUNCTIONS */ |
/********************************************************************/ |
@@ -96,14 +101,22 @@ void silk_resampler_down2_3( |
* slower than biquad() but uses more precise coefficients |
* can handle (slowly) varying coefficients |
*/ |
-void silk_biquad_alt( |
+void silk_biquad_alt_stride1( |
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_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 */ |
+ const opus_int32 len /* I signal length (must be even) */ |
+); |
+ |
+void silk_biquad_alt_stride2_c( |
+ 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) */ |
); |
/* Variable order MA prediction error filter. */ |
@@ -132,17 +145,11 @@ void silk_bwexpander_32( |
/* Compute inverse of LPC prediction gain, and */ |
/* test if LPC coefficients are stable (all poles within unit circle) */ |
-opus_int32 silk_LPC_inverse_pred_gain( /* O Returns inverse prediction gain in energy domain, Q30 */ |
+opus_int32 silk_LPC_inverse_pred_gain_c( /* O Returns inverse prediction gain in energy domain, Q30 */ |
const opus_int16 *A_Q12, /* I Prediction coefficients, Q12 [order] */ |
const opus_int order /* I Prediction order */ |
); |
-/* For input in Q24 domain */ |
-opus_int32 silk_LPC_inverse_pred_gain_Q24( /* O Returns inverse prediction gain in energy domain, Q30 */ |
- const opus_int32 *A_Q24, /* I Prediction coefficients [order] */ |
- const opus_int order /* I Prediction order */ |
-); |
- |
/* Split signal in two decimated bands using first-order allpass filters */ |
void silk_ana_filt_bank_1( |
const opus_int16 *in, /* I Input signal [N] */ |
@@ -152,6 +159,14 @@ void silk_ana_filt_bank_1( |
const opus_int32 N /* I Number of input samples */ |
); |
+#if !defined(OVERRIDE_silk_biquad_alt_stride2) |
+#define silk_biquad_alt_stride2(in, B_Q28, A_Q28, S, out, len, arch) ((void)(arch), silk_biquad_alt_stride2_c(in, B_Q28, A_Q28, S, out, len)) |
+#endif |
+ |
+#if !defined(OVERRIDE_silk_LPC_inverse_pred_gain) |
+#define silk_LPC_inverse_pred_gain(A_Q12, order, arch) ((void)(arch), silk_LPC_inverse_pred_gain_c(A_Q12, order)) |
+#endif |
+ |
/********************************************************************/ |
/* SCALAR FUNCTIONS */ |
/********************************************************************/ |
@@ -271,7 +286,17 @@ void silk_A2NLSF( |
void silk_NLSF2A( |
opus_int16 *a_Q12, /* O monic whitening filter coefficients in Q12, [ d ] */ |
const opus_int16 *NLSF, /* I normalized line spectral frequencies in Q15, [ d ] */ |
- const opus_int d /* I filter order (should be even) */ |
+ const opus_int d, /* I filter order (should be even) */ |
+ int arch /* I Run-time architecture */ |
+); |
+ |
+/* Convert int32 coefficients to int16 coefs and make sure there's no wrap-around */ |
+void silk_LPC_fit( |
+ opus_int16 *a_QOUT, /* O Output signal */ |
+ opus_int32 *a_QIN, /* I/O Input signal */ |
+ const opus_int QOUT, /* I Input Q domain */ |
+ const opus_int QIN, /* I Input Q domain */ |
+ const opus_int d /* I Filter order */ |
); |
void silk_insertion_sort_increasing( |
@@ -471,8 +496,7 @@ static OPUS_INLINE opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) |
/* Add with saturation for positive input values */ |
#define silk_ADD_POS_SAT8(a, b) ((((a)+(b)) & 0x80) ? silk_int8_MAX : ((a)+(b))) |
#define silk_ADD_POS_SAT16(a, b) ((((a)+(b)) & 0x8000) ? silk_int16_MAX : ((a)+(b))) |
-#define silk_ADD_POS_SAT32(a, b) ((((a)+(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))) |
-#define silk_ADD_POS_SAT64(a, b) ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b))) |
+#define silk_ADD_POS_SAT32(a, b) ((((opus_uint32)(a)+(opus_uint32)(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))) |
#define silk_LSHIFT8(a, shift) ((opus_int8)((opus_uint8)(a)<<(shift))) /* shift >= 0, shift < 8 */ |
#define silk_LSHIFT16(a, shift) ((opus_int16)((opus_uint16)(a)<<(shift))) /* shift >= 0, shift < 16 */ |
@@ -572,7 +596,9 @@ static OPUS_INLINE opus_int64 silk_max_64(opus_int64 a, opus_int64 b) |
/* Make sure to store the result as the seed for the next call (also in between */ |
/* frames), otherwise result won't be random at all. When only using some of the */ |
/* bits, take the most significant bits by right-shifting. */ |
-#define silk_RAND(seed) (silk_MLA_ovflw(907633515, (seed), 196314165)) |
+#define RAND_MULTIPLIER 196314165 |
+#define RAND_INCREMENT 907633515 |
+#define silk_RAND(seed) (silk_MLA_ovflw((RAND_INCREMENT), (seed), (RAND_MULTIPLIER))) |
/* Add some multiplication functions that can be easily mapped to ARM. */ |