arm_celt_map.c 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. #ifdef HAVE_CONFIG_H
  25. #include "config.h"
  26. #endif
  27. #include "pitch.h"
  28. #include "kiss_fft.h"
  29. #include "mdct.h"
  30. #if defined(OPUS_HAVE_RTCD)
  31. # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
  32. opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const opus_val16 *y, int N) = {
  33. celt_inner_prod_c, /* ARMv4 */
  34. celt_inner_prod_c, /* EDSP */
  35. celt_inner_prod_c, /* Media */
  36. celt_inner_prod_neon /* NEON */
  37. };
  38. void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02,
  39. int N, opus_val32 *xy1, opus_val32 *xy2) = {
  40. dual_inner_prod_c, /* ARMv4 */
  41. dual_inner_prod_c, /* EDSP */
  42. dual_inner_prod_c, /* Media */
  43. dual_inner_prod_neon /* NEON */
  44. };
  45. # endif
  46. # if defined(FIXED_POINT)
  47. # if ((defined(OPUS_ARM_MAY_HAVE_NEON) && !defined(OPUS_ARM_PRESUME_NEON)) || \
  48. (defined(OPUS_ARM_MAY_HAVE_MEDIA) && !defined(OPUS_ARM_PRESUME_MEDIA)) || \
  49. (defined(OPUS_ARM_MAY_HAVE_EDSP) && !defined(OPUS_ARM_PRESUME_EDSP)))
  50. opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
  51. const opus_val16 *, opus_val32 *, int, int, int) = {
  52. celt_pitch_xcorr_c, /* ARMv4 */
  53. MAY_HAVE_EDSP(celt_pitch_xcorr), /* EDSP */
  54. MAY_HAVE_MEDIA(celt_pitch_xcorr), /* Media */
  55. MAY_HAVE_NEON(celt_pitch_xcorr) /* NEON */
  56. };
  57. # endif
  58. # else /* !FIXED_POINT */
  59. # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
  60. void (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
  61. const opus_val16 *, opus_val32 *, int, int, int) = {
  62. celt_pitch_xcorr_c, /* ARMv4 */
  63. celt_pitch_xcorr_c, /* EDSP */
  64. celt_pitch_xcorr_c, /* Media */
  65. celt_pitch_xcorr_float_neon /* Neon */
  66. };
  67. # endif
  68. # endif /* FIXED_POINT */
  69. #if defined(FIXED_POINT) && defined(OPUS_HAVE_RTCD) && \
  70. defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
  71. void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
  72. const opus_val16 *x,
  73. const opus_val16 *y,
  74. opus_val32 sum[4],
  75. int len
  76. ) = {
  77. xcorr_kernel_c, /* ARMv4 */
  78. xcorr_kernel_c, /* EDSP */
  79. xcorr_kernel_c, /* Media */
  80. xcorr_kernel_neon_fixed, /* Neon */
  81. };
  82. #endif
  83. # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
  84. # if defined(HAVE_ARM_NE10)
  85. # if defined(CUSTOM_MODES)
  86. int (*const OPUS_FFT_ALLOC_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = {
  87. opus_fft_alloc_arch_c, /* ARMv4 */
  88. opus_fft_alloc_arch_c, /* EDSP */
  89. opus_fft_alloc_arch_c, /* Media */
  90. opus_fft_alloc_arm_neon /* Neon with NE10 library support */
  91. };
  92. void (*const OPUS_FFT_FREE_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = {
  93. opus_fft_free_arch_c, /* ARMv4 */
  94. opus_fft_free_arch_c, /* EDSP */
  95. opus_fft_free_arch_c, /* Media */
  96. opus_fft_free_arm_neon /* Neon with NE10 */
  97. };
  98. # endif /* CUSTOM_MODES */
  99. void (*const OPUS_FFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg,
  100. const kiss_fft_cpx *fin,
  101. kiss_fft_cpx *fout) = {
  102. opus_fft_c, /* ARMv4 */
  103. opus_fft_c, /* EDSP */
  104. opus_fft_c, /* Media */
  105. opus_fft_neon /* Neon with NE10 */
  106. };
  107. void (*const OPUS_IFFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg,
  108. const kiss_fft_cpx *fin,
  109. kiss_fft_cpx *fout) = {
  110. opus_ifft_c, /* ARMv4 */
  111. opus_ifft_c, /* EDSP */
  112. opus_ifft_c, /* Media */
  113. opus_ifft_neon /* Neon with NE10 */
  114. };
  115. void (*const CLT_MDCT_FORWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l,
  116. kiss_fft_scalar *in,
  117. kiss_fft_scalar * OPUS_RESTRICT out,
  118. const opus_val16 *window,
  119. int overlap, int shift,
  120. int stride, int arch) = {
  121. clt_mdct_forward_c, /* ARMv4 */
  122. clt_mdct_forward_c, /* EDSP */
  123. clt_mdct_forward_c, /* Media */
  124. clt_mdct_forward_neon /* Neon with NE10 */
  125. };
  126. void (*const CLT_MDCT_BACKWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l,
  127. kiss_fft_scalar *in,
  128. kiss_fft_scalar * OPUS_RESTRICT out,
  129. const opus_val16 *window,
  130. int overlap, int shift,
  131. int stride, int arch) = {
  132. clt_mdct_backward_c, /* ARMv4 */
  133. clt_mdct_backward_c, /* EDSP */
  134. clt_mdct_backward_c, /* Media */
  135. clt_mdct_backward_neon /* Neon with NE10 */
  136. };
  137. # endif /* HAVE_ARM_NE10 */
  138. # endif /* OPUS_ARM_MAY_HAVE_NEON_INTR */
  139. #endif /* OPUS_HAVE_RTCD */