Index: third_party/opus/src/celt/fixed_c5x.h |
diff --git a/third_party/opus/src/celt/arm/fft_arm.h b/third_party/opus/src/celt/fixed_c5x.h |
similarity index 52% |
copy from third_party/opus/src/celt/arm/fft_arm.h |
copy to third_party/opus/src/celt/fixed_c5x.h |
index 0cb55d8e22d2b87e69c0e55806da49e58a58dfd4..ea95a998c3c3f879e10ccd72eff200d1cece9720 100644 |
--- a/third_party/opus/src/celt/arm/fft_arm.h |
+++ b/third_party/opus/src/celt/fixed_c5x.h |
@@ -1,10 +1,8 @@ |
-/* Copyright (c) 2015 Xiph.Org Foundation |
- Written by Viswanath Puttagunta */ |
+/* Copyright (C) 2003 Jean-Marc Valin */ |
/** |
- @file fft_arm.h |
- @brief ARM Neon Intrinsic optimizations for fft using NE10 library |
- */ |
- |
+ @file fixed_c5x.h |
+ @brief Fixed-point operations for the TI C5x DSP family |
+*/ |
/* |
Redistribution and use in source and binary forms, with or without |
modification, are permitted provided that the following conditions |
@@ -30,43 +28,52 @@ |
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
+#ifndef FIXED_C5X_H |
+#define FIXED_C5X_H |
-#if !defined(FFT_ARM_H) |
-#define FFT_ARM_H |
+#include "dsplib.h" |
-#include "config.h" |
-#include "kiss_fft.h" |
+#undef IMUL32 |
+static OPUS_INLINE long IMUL32(long i, long j) |
+{ |
+ long ac0, ac1; |
+ ac0 = _lmpy(i>>16,j); |
+ ac1 = ac0 + _lmpy(i,j>>16); |
+ return _lmpyu(i,j) + (ac1<<16); |
+} |
-#if defined(HAVE_ARM_NE10) |
+#undef MAX16 |
+#define MAX16(a,b) _max(a,b) |
-int opus_fft_alloc_arm_neon(kiss_fft_state *st); |
-void opus_fft_free_arm_neon(kiss_fft_state *st); |
+#undef MIN16 |
+#define MIN16(a,b) _min(a,b) |
-void opus_fft_neon(const kiss_fft_state *st, |
- const kiss_fft_cpx *fin, |
- kiss_fft_cpx *fout); |
+#undef MAX32 |
+#define MAX32(a,b) _lmax(a,b) |
-void opus_ifft_neon(const kiss_fft_state *st, |
- const kiss_fft_cpx *fin, |
- kiss_fft_cpx *fout); |
+#undef MIN32 |
+#define MIN32(a,b) _lmin(a,b) |
-#if !defined(OPUS_HAVE_RTCD) |
-#define OVERRIDE_OPUS_FFT (1) |
+#undef VSHR32 |
+#define VSHR32(a, shift) _lshl(a,-(shift)) |
-#define opus_fft_alloc_arch(_st, arch) \ |
- ((void)(arch), opus_fft_alloc_arm_neon(_st)) |
+#undef MULT16_16_Q15 |
+#define MULT16_16_Q15(a,b) (_smpy(a,b)) |
-#define opus_fft_free_arch(_st, arch) \ |
- ((void)(arch), opus_fft_free_arm_neon(_st)) |
+#undef MULT16_16SU |
+#define MULT16_16SU(a,b) _lmpysu(a,b) |
-#define opus_fft(_st, _fin, _fout, arch) \ |
- ((void)(arch), opus_fft_neon(_st, _fin, _fout)) |
+#undef MULT_16_16 |
+#define MULT_16_16(a,b) _lmpy(a,b) |
-#define opus_ifft(_st, _fin, _fout, arch) \ |
- ((void)(arch), opus_ifft_neon(_st, _fin, _fout)) |
+/* FIXME: This is technically incorrect and is bound to cause problems. Is there any cleaner solution? */ |
+#undef MULT16_32_Q15 |
+#define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_16SU((a),(b)),15)) |
-#endif /* OPUS_HAVE_RTCD */ |
+#define celt_ilog2(x) (30 - _lnorm(x)) |
+#define OVERRIDE_CELT_ILOG2 |
-#endif /* HAVE_ARM_NE10 */ |
+#define celt_maxabs16(x, len) MAX32(EXTEND32(maxval((DATA *)x, len)),-EXTEND32(minval((DATA *)x, len))) |
+#define OVERRIDE_CELT_MAXABS16 |
-#endif |
+#endif /* FIXED_C5X_H */ |