[opus] [PATCH 2/8] Reorganize pitch_arm.h, so RTCD works for intrinsics functions as well.

Jonathan Lennox jonathan at vidyo.com
Wed Aug 5 11:17:24 PDT 2015


---
 celt/arm/arm_celt_map.c | 24 +++++++++++-
 celt/arm/pitch_arm.h    | 97 +++++++++++++++++++++++++++++++++----------------
 2 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/celt/arm/arm_celt_map.c b/celt/arm/arm_celt_map.c
index 0c9acff..cc6b706 100644
--- a/celt/arm/arm_celt_map.c
+++ b/celt/arm/arm_celt_map.c
@@ -94,9 +94,14 @@ void (*const CLT_MDCT_BACKWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l,
    clt_mdct_backward_neon,        /* Neon with NE10 */
 };
 
-#endif
+#endif /* HAVE_ARM_NE10 */
 
 # if defined(FIXED_POINT)
+
+#if defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_EDSP)
+
+#if !defined(OPUS_ARM_PRESUME_NEON) && (!defined(OPUS_ARM_PRESUME_EDSP) || defined(OPUS_ARM_MAY_HAVE_NEON))
+
 opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
     const opus_val16 *, opus_val32 *, int , int) = {
   celt_pitch_xcorr_c,               /* ARMv4 */
@@ -104,8 +109,23 @@ opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
   MAY_HAVE_MEDIA(celt_pitch_xcorr), /* Media */
   MAY_HAVE_NEON(celt_pitch_xcorr)   /* NEON */
 };
+
+#endif
+
+#elif defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
+
+opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
+    const opus_val16 *, opus_val32 *, int, int) = {
+  celt_pitch_xcorr_c,              /* ARMv4 */
+  celt_pitch_xcorr_c,              /* EDSP */
+  celt_pitch_xcorr_c,              /* Media */
+  celt_pitch_xcorr_fixed_neon      /* Neon */
+};
+
+#endif
+
 # else /* !FIXED_POINT */
-#  if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+#  if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
 void (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
     const opus_val16 *, opus_val32 *, int, int) = {
   celt_pitch_xcorr_c,              /* ARMv4 */
diff --git a/celt/arm/pitch_arm.h b/celt/arm/pitch_arm.h
index fe76f8d..fa2dd17 100644
--- a/celt/arm/pitch_arm.h
+++ b/celt/arm/pitch_arm.h
@@ -32,59 +32,89 @@
 
 # if defined(FIXED_POINT)
 
-#if defined(CPU_AARCH64)
-#define OVERRIDE_PITCH_XCORR (1)
-opus_val32 celt_pitch_xcorr_fixed_neon(const opus_val16 *_x, const opus_val16 *_y,
-                                       opus_val32 *xcorr, int len, int max_pitch);
-#define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
-   ((void)(arch), celt_pitch_xcorr_fixed_neon(_x, _y, xcorr, len, max_pitch))
-
-#else /* End CPU_AARCH64. Begin CPU_ARM */
+#if defined(OPUS_ARM_MAY_HAVE_NEON) || defined(OPUS_ARM_MAY_HAVE_EDSP)
+/* ARM assembly */
 
-#  if defined(OPUS_ARM_MAY_HAVE_NEON)
+#if defined(OPUS_ARM_MAY_HAVE_NEON)
 opus_val32 celt_pitch_xcorr_neon(const opus_val16 *_x, const opus_val16 *_y,
     opus_val32 *xcorr, int len, int max_pitch);
 #  endif
 
-#  if defined(OPUS_ARM_MAY_HAVE_MEDIA)
-#   define celt_pitch_xcorr_media MAY_HAVE_EDSP(celt_pitch_xcorr)
-#  endif
+#if defined(OPUS_ARM_MAY_HAVE_MEDIA)
+# define celt_pitch_xcorr_media MAY_HAVE_EDSP(celt_pitch_xcorr)
+#endif
 
 #  if defined(OPUS_ARM_MAY_HAVE_EDSP)
 opus_val32 celt_pitch_xcorr_edsp(const opus_val16 *_x, const opus_val16 *_y,
     opus_val32 *xcorr, int len, int max_pitch);
 #  endif
 
-#  if !defined(OPUS_HAVE_RTCD)
-#   define OVERRIDE_PITCH_XCORR (1)
+#if defined(OPUS_ARM_PRESUME_NEON)
+
+#define OVERRIDE_PITCH_XCORR (1)
 #   define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
-  ((void)(arch),PRESUME_NEON(celt_pitch_xcorr)(_x, _y, xcorr, len, max_pitch))
-#  endif
-#endif /* End CPU_ARM */
+   ((void)(arch),celt_pitch_xcorr_neon(_x, _y, xcorr, len, max_pitch))
+
+#elif defined(OPUS_ARM_PRESUME_EDSP) && !defined(OPUS_ARM_MAY_HAVE_NEON)
+
+#define OVERRIDE_PITCH_XCORR (1)
+#   define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
+   ((void)(arch),celt_pitch_xcorr_edsp(_x, _y, xcorr, len, max_pitch))
+
+#elif defined(OPUS_HAVE_RTCD)
+
+extern opus_val32
+(*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
+      const opus_val16 *, opus_val32 *, int, int);
+
+#  define OVERRIDE_PITCH_XCORR
+#  define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
+  ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
+        xcorr, len, max_pitch))
+
+#endif /* End OPUS_HAVE_RTCD */
+
+#elif defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
+/* Neon intrinsics */
+
+opus_val32 celt_pitch_xcorr_fixed_neon(const opus_val16 *_x, const opus_val16 *_y,
+                                       opus_val32 *xcorr, int len, int max_pitch);
+
+#if defined(OPUS_ARM_PRESUME_NEON_INTR)
+
+#define OVERRIDE_PITCH_XCORR (1)
+#   define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
+   ((void)(arch),celt_pitch_xcorr_fixed_neon(_x, _y, xcorr, len, max_pitch))
+
+#elif defined(OPUS_HAVE_RTCD)
+
+extern opus_val32
+(*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
+      const opus_val16 *, opus_val32 *, int, int);
+
+#  define OVERRIDE_PITCH_XCORR
+#  define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
+  ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
+        xcorr, len, max_pitch))
+
+#endif /* End OPUS_HAVE_RTCD */
+
+#endif /* End OPUS_ARM_MAY_HAVE_NEON_INTR */
 
 #else /* Start !FIXED_POINT */
-/* Float case */
+
 #if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
 void celt_pitch_xcorr_float_neon(const opus_val16 *_x, const opus_val16 *_y,
                                  opus_val32 *xcorr, int len, int max_pitch);
 #if defined(OPUS_ARM_PRESUME_NEON_INTR)
+
 #define OVERRIDE_PITCH_XCORR (1)
 #   define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
    ((void)(arch),celt_pitch_xcorr_float_neon(_x, _y, xcorr, len, max_pitch))
-#endif
-#endif
 
-#endif /* end !FIXED_POINT */
+#elif defined(OPUS_HAVE_RTCD)
 
-/*Is run-time CPU detection enabled on this platform?*/
-# if defined(OPUS_HAVE_RTCD) && \
-  (defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR))
-extern
-#  if defined(FIXED_POINT)
-opus_val32
-#  else
-void
-#  endif
+extern void
 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
       const opus_val16 *, opus_val32 *, int, int);
 
@@ -92,6 +122,11 @@ void
 #  define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
   ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
         xcorr, len, max_pitch))
-# endif
+
+#endif /* End OPUS_HAVE_RTCD */
+
+#endif /* end OPUS_ARM_MAY_HAVE_NEON_INTR */
+
+#endif /* end !FIXED_POINT */
 
 #endif
-- 
2.3.2 (Apple Git-55)



More information about the opus mailing list