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