From 7423ce59e5ac9aebf8ad6d87b268f62461f34afb Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@amazon.com>
Date: Fri, 17 Nov 2023 16:59:45 -0500
Subject: [PATCH] Use celt_pitch_xcorr_avx2() when guaranteed

No RTCD yet
---
 celt/x86/pitch_avx.c |  2 +-
 celt/x86/pitch_sse.h | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/celt/x86/pitch_avx.c b/celt/x86/pitch_avx.c
index 63dea97f1..7bb4ac18a 100644
--- a/celt/x86/pitch_avx.c
+++ b/celt/x86/pitch_avx.c
@@ -81,7 +81,7 @@ static void xcorr_kernel_avx(const float *x, const float *y, float sum[8], int l
     _mm256_storeu_ps(sum, xsum0);
 }
 
-void celt_pitch_xcorr_avx(const float *_x, const float *_y, float *xcorr, int len, int max_pitch, int arch)
+void celt_pitch_xcorr_avx2(const float *_x, const float *_y, float *xcorr, int len, int max_pitch, int arch)
 {
    int i;
    celt_assert(max_pitch>0);
diff --git a/celt/x86/pitch_sse.h b/celt/x86/pitch_sse.h
index 964aef50d..5baae8045 100644
--- a/celt/x86/pitch_sse.h
+++ b/celt/x86/pitch_sse.h
@@ -187,6 +187,15 @@ extern void (*const COMB_FILTER_CONST_IMPL[OPUS_ARCHMASK + 1])(
 #define NON_STATIC_COMB_FILTER_CONST_C
 
 #endif
-#endif
+
+#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 */
+
+#endif /* OPUS_X86_MAY_HAVE_SSE && !FIXED_POINT */
 
 #endif
-- 
GitLab