shithub: opus

Download patch

ref: b2cfd87783713793f4a170bb5a13a1470896436e
parent: 029385467de35c342d7939196ca2f88cf8998e59
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Fri Nov 17 14:36:19 EST 2023

Add rtcd support for celt_pitch_xcorr_avx2()

--- a/celt/x86/pitch_sse.h
+++ b/celt/x86/pitch_sse.h
@@ -186,13 +186,30 @@
 
 #endif
 
+void celt_pitch_xcorr_avx2(const float *_x, const float *_y, float *xcorr, int len, int max_pitch, int arch);
+
 #if defined(OPUS_X86_PRESUME_AVX2)
 
-void celt_pitch_xcorr_avx2(const float *_x, const float *_y, float *xcorr, int len, int max_pitch, int arch);
 #define OVERRIDE_PITCH_XCORR
 # define celt_pitch_xcorr celt_pitch_xcorr_avx2
 
-#endif /* OPUS_X86_PRESUME_AVX2 */
+#elif defined(OPUS_HAVE_RTCD) && defined(OPUS_X86_MAY_HAVE_AVX2)
+
+#define OVERRIDE_PITCH_XCORR
+extern void (*const PITCH_XCORR_IMPL[OPUS_ARCHMASK + 1])(
+              const float *_x,
+              const float *_y,
+              float *xcorr,
+              int len,
+              int max_pitch,
+              int arch
+              );
+
+#define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
+    ((*PITCH_XCORR_IMPL[(arch) & OPUS_ARCHMASK])(_x, _y, xcorr, len, max_pitch, arch))
+
+
+#endif /* OPUS_X86_PRESUME_AVX2 && !OPUS_HAVE_RTCD */
 
 #endif /* OPUS_X86_MAY_HAVE_SSE && !FIXED_POINT */
 
--- a/celt/x86/x86_celt_map.c
+++ b/celt/x86/x86_celt_map.c
@@ -90,6 +90,26 @@
 
 # else
 
+#if defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(OPUS_X86_PRESUME_AVX2)
+
+void (*const PITCH_XCORR_IMPL[OPUS_ARCHMASK + 1])(
+         const float *_x,
+         const float *_y,
+         float *xcorr,
+         int len,
+         int max_pitch,
+         int arch
+) = {
+  celt_pitch_xcorr_c,                /* non-sse */
+  celt_pitch_xcorr_c,
+  celt_pitch_xcorr_c,
+  celt_pitch_xcorr_c,
+  MAY_HAVE_AVX2(celt_pitch_xcorr)
+};
+
+#endif
+
+
 #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)
 
 void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
--