2
0

pitch_sse.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* Copyright (c) 2013 Jean-Marc Valin and John Ridges
  2. Copyright (c) 2014, Cisco Systems, INC MingXiang WeiZhou MinPeng YanWang*/
  3. /**
  4. @file pitch_sse.h
  5. @brief Pitch analysis
  6. */
  7. /*
  8. Redistribution and use in source and binary forms, with or without
  9. modification, are permitted provided that the following conditions
  10. are met:
  11. - Redistributions of source code must retain the above copyright
  12. notice, this list of conditions and the following disclaimer.
  13. - Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  20. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  24. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  25. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef PITCH_SSE_H
  29. #define PITCH_SSE_H
  30. #if defined(HAVE_CONFIG_H)
  31. #include "config.h"
  32. #endif
  33. #if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)
  34. void xcorr_kernel_sse4_1(
  35. const opus_int16 *x,
  36. const opus_int16 *y,
  37. opus_val32 sum[4],
  38. int len);
  39. #endif
  40. #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)
  41. void xcorr_kernel_sse(
  42. const opus_val16 *x,
  43. const opus_val16 *y,
  44. opus_val32 sum[4],
  45. int len);
  46. #endif
  47. #if defined(OPUS_X86_PRESUME_SSE4_1) && defined(FIXED_POINT)
  48. #define OVERRIDE_XCORR_KERNEL
  49. #define xcorr_kernel(x, y, sum, len, arch) \
  50. ((void)arch, xcorr_kernel_sse4_1(x, y, sum, len))
  51. #elif defined(OPUS_X86_PRESUME_SSE) && !defined(FIXED_POINT)
  52. #define OVERRIDE_XCORR_KERNEL
  53. #define xcorr_kernel(x, y, sum, len, arch) \
  54. ((void)arch, xcorr_kernel_sse(x, y, sum, len))
  55. #elif (defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)) || (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT))
  56. extern void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
  57. const opus_val16 *x,
  58. const opus_val16 *y,
  59. opus_val32 sum[4],
  60. int len);
  61. #define OVERRIDE_XCORR_KERNEL
  62. #define xcorr_kernel(x, y, sum, len, arch) \
  63. ((*XCORR_KERNEL_IMPL[(arch) & OPUS_ARCHMASK])(x, y, sum, len))
  64. #endif
  65. #if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)
  66. opus_val32 celt_inner_prod_sse4_1(
  67. const opus_int16 *x,
  68. const opus_int16 *y,
  69. int N);
  70. #endif
  71. #if defined(OPUS_X86_MAY_HAVE_SSE2) && defined(FIXED_POINT)
  72. opus_val32 celt_inner_prod_sse2(
  73. const opus_int16 *x,
  74. const opus_int16 *y,
  75. int N);
  76. #endif
  77. #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)
  78. opus_val32 celt_inner_prod_sse(
  79. const opus_val16 *x,
  80. const opus_val16 *y,
  81. int N);
  82. #endif
  83. #if defined(OPUS_X86_PRESUME_SSE4_1) && defined(FIXED_POINT)
  84. #define OVERRIDE_CELT_INNER_PROD
  85. #define celt_inner_prod(x, y, N, arch) \
  86. ((void)arch, celt_inner_prod_sse4_1(x, y, N))
  87. #elif defined(OPUS_X86_PRESUME_SSE2) && defined(FIXED_POINT) && !defined(OPUS_X86_MAY_HAVE_SSE4_1)
  88. #define OVERRIDE_CELT_INNER_PROD
  89. #define celt_inner_prod(x, y, N, arch) \
  90. ((void)arch, celt_inner_prod_sse2(x, y, N))
  91. #elif defined(OPUS_X86_PRESUME_SSE) && !defined(FIXED_POINT)
  92. #define OVERRIDE_CELT_INNER_PROD
  93. #define celt_inner_prod(x, y, N, arch) \
  94. ((void)arch, celt_inner_prod_sse(x, y, N))
  95. #elif ((defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)) && defined(FIXED_POINT)) || \
  96. (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT))
  97. extern opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])(
  98. const opus_val16 *x,
  99. const opus_val16 *y,
  100. int N);
  101. #define OVERRIDE_CELT_INNER_PROD
  102. #define celt_inner_prod(x, y, N, arch) \
  103. ((*CELT_INNER_PROD_IMPL[(arch) & OPUS_ARCHMASK])(x, y, N))
  104. #endif
  105. #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)
  106. #define OVERRIDE_DUAL_INNER_PROD
  107. #define OVERRIDE_COMB_FILTER_CONST
  108. #undef dual_inner_prod
  109. #undef comb_filter_const
  110. void dual_inner_prod_sse(const opus_val16 *x,
  111. const opus_val16 *y01,
  112. const opus_val16 *y02,
  113. int N,
  114. opus_val32 *xy1,
  115. opus_val32 *xy2);
  116. void comb_filter_const_sse(opus_val32 *y,
  117. opus_val32 *x,
  118. int T,
  119. int N,
  120. opus_val16 g10,
  121. opus_val16 g11,
  122. opus_val16 g12);
  123. #if defined(OPUS_X86_PRESUME_SSE)
  124. # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) \
  125. ((void)(arch),dual_inner_prod_sse(x, y01, y02, N, xy1, xy2))
  126. # define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \
  127. ((void)(arch),comb_filter_const_sse(y, x, T, N, g10, g11, g12))
  128. #else
  129. extern void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])(
  130. const opus_val16 *x,
  131. const opus_val16 *y01,
  132. const opus_val16 *y02,
  133. int N,
  134. opus_val32 *xy1,
  135. opus_val32 *xy2);
  136. #define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) \
  137. ((*DUAL_INNER_PROD_IMPL[(arch) & OPUS_ARCHMASK])(x, y01, y02, N, xy1, xy2))
  138. extern void (*const COMB_FILTER_CONST_IMPL[OPUS_ARCHMASK + 1])(
  139. opus_val32 *y,
  140. opus_val32 *x,
  141. int T,
  142. int N,
  143. opus_val16 g10,
  144. opus_val16 g11,
  145. opus_val16 g12);
  146. #define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \
  147. ((*COMB_FILTER_CONST_IMPL[(arch) & OPUS_ARCHMASK])(y, x, T, N, g10, g11, g12))
  148. #define NON_STATIC_COMB_FILTER_CONST_C
  149. #endif
  150. #endif
  151. #endif