Chris@69: /* Copyright (c) 2013 Jean-Marc Valin and John Ridges Chris@69: Copyright (c) 2014, Cisco Systems, INC MingXiang WeiZhou MinPeng YanWang*/ Chris@69: /** Chris@69: @file pitch_sse.h Chris@69: @brief Pitch analysis Chris@69: */ Chris@69: Chris@69: /* Chris@69: Redistribution and use in source and binary forms, with or without Chris@69: modification, are permitted provided that the following conditions Chris@69: are met: Chris@69: Chris@69: - Redistributions of source code must retain the above copyright Chris@69: notice, this list of conditions and the following disclaimer. Chris@69: Chris@69: - Redistributions in binary form must reproduce the above copyright Chris@69: notice, this list of conditions and the following disclaimer in the Chris@69: documentation and/or other materials provided with the distribution. Chris@69: Chris@69: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS Chris@69: ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT Chris@69: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR Chris@69: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER Chris@69: OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, Chris@69: EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, Chris@69: PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR Chris@69: PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF Chris@69: LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING Chris@69: NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS Chris@69: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Chris@69: */ Chris@69: Chris@69: #ifndef PITCH_SSE_H Chris@69: #define PITCH_SSE_H Chris@69: Chris@69: #if defined(HAVE_CONFIG_H) Chris@69: #include "config.h" Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT) Chris@69: void xcorr_kernel_sse4_1( Chris@69: const opus_int16 *x, Chris@69: const opus_int16 *y, Chris@69: opus_val32 sum[4], Chris@69: int len); Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT) Chris@69: void xcorr_kernel_sse( Chris@69: const opus_val16 *x, Chris@69: const opus_val16 *y, Chris@69: opus_val32 sum[4], Chris@69: int len); Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_PRESUME_SSE4_1) && defined(FIXED_POINT) Chris@69: #define OVERRIDE_XCORR_KERNEL Chris@69: #define xcorr_kernel(x, y, sum, len, arch) \ Chris@69: ((void)arch, xcorr_kernel_sse4_1(x, y, sum, len)) Chris@69: Chris@69: #elif defined(OPUS_X86_PRESUME_SSE) && !defined(FIXED_POINT) Chris@69: #define OVERRIDE_XCORR_KERNEL Chris@69: #define xcorr_kernel(x, y, sum, len, arch) \ Chris@69: ((void)arch, xcorr_kernel_sse(x, y, sum, len)) Chris@69: Chris@69: #elif (defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT)) || (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)) Chris@69: Chris@69: extern void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])( Chris@69: const opus_val16 *x, Chris@69: const opus_val16 *y, Chris@69: opus_val32 sum[4], Chris@69: int len); Chris@69: Chris@69: #define OVERRIDE_XCORR_KERNEL Chris@69: #define xcorr_kernel(x, y, sum, len, arch) \ Chris@69: ((*XCORR_KERNEL_IMPL[(arch) & OPUS_ARCHMASK])(x, y, sum, len)) Chris@69: Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE4_1) && defined(FIXED_POINT) Chris@69: opus_val32 celt_inner_prod_sse4_1( Chris@69: const opus_int16 *x, Chris@69: const opus_int16 *y, Chris@69: int N); Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE2) && defined(FIXED_POINT) Chris@69: opus_val32 celt_inner_prod_sse2( Chris@69: const opus_int16 *x, Chris@69: const opus_int16 *y, Chris@69: int N); Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(FIXED_POINT) Chris@69: opus_val32 celt_inner_prod_sse( Chris@69: const opus_val16 *x, Chris@69: const opus_val16 *y, Chris@69: int N); Chris@69: #endif Chris@69: Chris@69: Chris@69: #if defined(OPUS_X86_PRESUME_SSE4_1) && defined(FIXED_POINT) Chris@69: #define OVERRIDE_CELT_INNER_PROD Chris@69: #define celt_inner_prod(x, y, N, arch) \ Chris@69: ((void)arch, celt_inner_prod_sse4_1(x, y, N)) Chris@69: Chris@69: #elif defined(OPUS_X86_PRESUME_SSE2) && defined(FIXED_POINT) && !defined(OPUS_X86_MAY_HAVE_SSE4_1) Chris@69: #define OVERRIDE_CELT_INNER_PROD Chris@69: #define celt_inner_prod(x, y, N, arch) \ Chris@69: ((void)arch, celt_inner_prod_sse2(x, y, N)) Chris@69: Chris@69: #elif defined(OPUS_X86_PRESUME_SSE) && !defined(FIXED_POINT) Chris@69: #define OVERRIDE_CELT_INNER_PROD Chris@69: #define celt_inner_prod(x, y, N, arch) \ Chris@69: ((void)arch, celt_inner_prod_sse(x, y, N)) Chris@69: Chris@69: Chris@69: #elif ((defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)) && defined(FIXED_POINT)) || \ Chris@69: (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)) Chris@69: Chris@69: extern opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])( Chris@69: const opus_val16 *x, Chris@69: const opus_val16 *y, Chris@69: int N); Chris@69: Chris@69: #define OVERRIDE_CELT_INNER_PROD Chris@69: #define celt_inner_prod(x, y, N, arch) \ Chris@69: ((*CELT_INNER_PROD_IMPL[(arch) & OPUS_ARCHMASK])(x, y, N)) Chris@69: Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT) Chris@69: Chris@69: #define OVERRIDE_DUAL_INNER_PROD Chris@69: #define OVERRIDE_COMB_FILTER_CONST Chris@69: Chris@69: #undef dual_inner_prod Chris@69: #undef comb_filter_const Chris@69: Chris@69: void dual_inner_prod_sse(const opus_val16 *x, Chris@69: const opus_val16 *y01, Chris@69: const opus_val16 *y02, Chris@69: int N, Chris@69: opus_val32 *xy1, Chris@69: opus_val32 *xy2); Chris@69: Chris@69: void comb_filter_const_sse(opus_val32 *y, Chris@69: opus_val32 *x, Chris@69: int T, Chris@69: int N, Chris@69: opus_val16 g10, Chris@69: opus_val16 g11, Chris@69: opus_val16 g12); Chris@69: Chris@69: Chris@69: #if defined(OPUS_X86_PRESUME_SSE) Chris@69: # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) \ Chris@69: ((void)(arch),dual_inner_prod_sse(x, y01, y02, N, xy1, xy2)) Chris@69: Chris@69: # define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \ Chris@69: ((void)(arch),comb_filter_const_sse(y, x, T, N, g10, g11, g12)) Chris@69: #else Chris@69: Chris@69: extern void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])( Chris@69: const opus_val16 *x, Chris@69: const opus_val16 *y01, Chris@69: const opus_val16 *y02, Chris@69: int N, Chris@69: opus_val32 *xy1, Chris@69: opus_val32 *xy2); Chris@69: Chris@69: #define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) \ Chris@69: ((*DUAL_INNER_PROD_IMPL[(arch) & OPUS_ARCHMASK])(x, y01, y02, N, xy1, xy2)) Chris@69: Chris@69: extern void (*const COMB_FILTER_CONST_IMPL[OPUS_ARCHMASK + 1])( Chris@69: opus_val32 *y, Chris@69: opus_val32 *x, Chris@69: int T, Chris@69: int N, Chris@69: opus_val16 g10, Chris@69: opus_val16 g11, Chris@69: opus_val16 g12); Chris@69: Chris@69: #define comb_filter_const(y, x, T, N, g10, g11, g12, arch) \ Chris@69: ((*COMB_FILTER_CONST_IMPL[(arch) & OPUS_ARCHMASK])(y, x, T, N, g10, g11, g12)) Chris@69: Chris@69: #define NON_STATIC_COMB_FILTER_CONST_C Chris@69: Chris@69: #endif Chris@69: #endif Chris@69: Chris@69: #endif