pitch_arm.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* Copyright (c) 2010 Xiph.Org Foundation
  2. * Copyright (c) 2013 Parrot */
  3. /*
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. - Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  13. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  14. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  15. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  16. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  17. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  19. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  20. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  21. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  22. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #if !defined(PITCH_ARM_H)
  25. # define PITCH_ARM_H
  26. # include "armcpu.h"
  27. # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
  28. opus_val32 celt_inner_prod_neon(const opus_val16 *x, const opus_val16 *y, int N);
  29. void dual_inner_prod_neon(const opus_val16 *x, const opus_val16 *y01,
  30. const opus_val16 *y02, int N, opus_val32 *xy1, opus_val32 *xy2);
  31. # if !defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_PRESUME_NEON)
  32. # define OVERRIDE_CELT_INNER_PROD (1)
  33. # define OVERRIDE_DUAL_INNER_PROD (1)
  34. # define celt_inner_prod(x, y, N, arch) ((void)(arch), PRESUME_NEON(celt_inner_prod)(x, y, N))
  35. # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) ((void)(arch), PRESUME_NEON(dual_inner_prod)(x, y01, y02, N, xy1, xy2))
  36. # endif
  37. # endif
  38. # if !defined(OVERRIDE_CELT_INNER_PROD)
  39. # if defined(OPUS_HAVE_RTCD) && (defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR))
  40. extern opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const opus_val16 *y, int N);
  41. # define OVERRIDE_CELT_INNER_PROD (1)
  42. # define celt_inner_prod(x, y, N, arch) ((*CELT_INNER_PROD_IMPL[(arch)&OPUS_ARCHMASK])(x, y, N))
  43. # elif defined(OPUS_ARM_PRESUME_NEON_INTR)
  44. # define OVERRIDE_CELT_INNER_PROD (1)
  45. # define celt_inner_prod(x, y, N, arch) ((void)(arch), celt_inner_prod_neon(x, y, N))
  46. # endif
  47. # endif
  48. # if !defined(OVERRIDE_DUAL_INNER_PROD)
  49. # if defined(OPUS_HAVE_RTCD) && (defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR))
  50. extern void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x,
  51. const opus_val16 *y01, const opus_val16 *y02, int N, opus_val32 *xy1, opus_val32 *xy2);
  52. # define OVERRIDE_DUAL_INNER_PROD (1)
  53. # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) ((*DUAL_INNER_PROD_IMPL[(arch)&OPUS_ARCHMASK])(x, y01, y02, N, xy1, xy2))
  54. # elif defined(OPUS_ARM_PRESUME_NEON_INTR)
  55. # define OVERRIDE_DUAL_INNER_PROD (1)
  56. # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) ((void)(arch), dual_inner_prod_neon(x, y01, y02, N, xy1, xy2))
  57. # endif
  58. # endif
  59. # if defined(FIXED_POINT)
  60. # if defined(OPUS_ARM_MAY_HAVE_NEON)
  61. opus_val32 celt_pitch_xcorr_neon(const opus_val16 *_x, const opus_val16 *_y,
  62. opus_val32 *xcorr, int len, int max_pitch, int arch);
  63. # endif
  64. # if defined(OPUS_ARM_MAY_HAVE_MEDIA)
  65. # define celt_pitch_xcorr_media MAY_HAVE_EDSP(celt_pitch_xcorr)
  66. # endif
  67. # if defined(OPUS_ARM_MAY_HAVE_EDSP)
  68. opus_val32 celt_pitch_xcorr_edsp(const opus_val16 *_x, const opus_val16 *_y,
  69. opus_val32 *xcorr, int len, int max_pitch, int arch);
  70. # endif
  71. # if defined(OPUS_HAVE_RTCD) && \
  72. ((defined(OPUS_ARM_MAY_HAVE_NEON) && !defined(OPUS_ARM_PRESUME_NEON)) || \
  73. (defined(OPUS_ARM_MAY_HAVE_MEDIA) && !defined(OPUS_ARM_PRESUME_MEDIA)) || \
  74. (defined(OPUS_ARM_MAY_HAVE_EDSP) && !defined(OPUS_ARM_PRESUME_EDSP)))
  75. extern opus_val32
  76. (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
  77. const opus_val16 *, opus_val32 *, int, int, int);
  78. # define OVERRIDE_PITCH_XCORR (1)
  79. # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
  80. ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
  81. xcorr, len, max_pitch, arch))
  82. # elif defined(OPUS_ARM_PRESUME_EDSP) || \
  83. defined(OPUS_ARM_PRESUME_MEDIA) || \
  84. defined(OPUS_ARM_PRESUME_NEON)
  85. # define OVERRIDE_PITCH_XCORR (1)
  86. # define celt_pitch_xcorr (PRESUME_NEON(celt_pitch_xcorr))
  87. # endif
  88. # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
  89. void xcorr_kernel_neon_fixed(
  90. const opus_val16 *x,
  91. const opus_val16 *y,
  92. opus_val32 sum[4],
  93. int len);
  94. # endif
  95. # if defined(OPUS_HAVE_RTCD) && \
  96. (defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR))
  97. extern void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
  98. const opus_val16 *x,
  99. const opus_val16 *y,
  100. opus_val32 sum[4],
  101. int len);
  102. # define OVERRIDE_XCORR_KERNEL (1)
  103. # define xcorr_kernel(x, y, sum, len, arch) \
  104. ((*XCORR_KERNEL_IMPL[(arch) & OPUS_ARCHMASK])(x, y, sum, len))
  105. # elif defined(OPUS_ARM_PRESUME_NEON_INTR)
  106. # define OVERRIDE_XCORR_KERNEL (1)
  107. # define xcorr_kernel(x, y, sum, len, arch) \
  108. ((void)arch, xcorr_kernel_neon_fixed(x, y, sum, len))
  109. # endif
  110. #else /* Start !FIXED_POINT */
  111. /* Float case */
  112. #if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
  113. void celt_pitch_xcorr_float_neon(const opus_val16 *_x, const opus_val16 *_y,
  114. opus_val32 *xcorr, int len, int max_pitch, int arch);
  115. #endif
  116. # if defined(OPUS_HAVE_RTCD) && \
  117. (defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR))
  118. extern void
  119. (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
  120. const opus_val16 *, opus_val32 *, int, int, int);
  121. # define OVERRIDE_PITCH_XCORR (1)
  122. # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
  123. ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
  124. xcorr, len, max_pitch, arch))
  125. # elif defined(OPUS_ARM_PRESUME_NEON_INTR)
  126. # define OVERRIDE_PITCH_XCORR (1)
  127. # define celt_pitch_xcorr celt_pitch_xcorr_float_neon
  128. # endif
  129. #endif /* end !FIXED_POINT */
  130. #endif