Chris@69: /* Copyright (c) 2014, Cisco Systems, INC Chris@69: Written by XiangMingZhu WeiZhou MinPeng YanWang 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: #if defined(HAVE_CONFIG_H) Chris@69: #include "config.h" Chris@69: #endif Chris@69: Chris@69: #include "x86/x86cpu.h" Chris@69: #include "celt_lpc.h" Chris@69: #include "pitch.h" Chris@69: #include "pitch_sse.h" Chris@69: #include "vq.h" Chris@69: Chris@69: #if defined(OPUS_HAVE_RTCD) Chris@69: Chris@69: # if defined(FIXED_POINT) Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1) Chris@69: Chris@69: void (*const CELT_FIR_IMPL[OPUS_ARCHMASK + 1])( Chris@69: const opus_val16 *x, Chris@69: const opus_val16 *num, Chris@69: opus_val16 *y, Chris@69: int N, Chris@69: int ord, Chris@69: int arch Chris@69: ) = { Chris@69: celt_fir_c, /* non-sse */ Chris@69: celt_fir_c, Chris@69: celt_fir_c, Chris@69: MAY_HAVE_SSE4_1(celt_fir), /* sse4.1 */ Chris@69: MAY_HAVE_SSE4_1(celt_fir) /* avx */ Chris@69: }; Chris@69: Chris@69: 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: xcorr_kernel_c, /* non-sse */ Chris@69: xcorr_kernel_c, Chris@69: xcorr_kernel_c, Chris@69: MAY_HAVE_SSE4_1(xcorr_kernel), /* sse4.1 */ Chris@69: MAY_HAVE_SSE4_1(xcorr_kernel) /* avx */ Chris@69: }; Chris@69: Chris@69: #endif Chris@69: Chris@69: #if (defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) || \ Chris@69: (!defined(OPUS_X86_MAY_HAVE_SSE_4_1) && defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)) Chris@69: Chris@69: 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: celt_inner_prod_c, /* non-sse */ Chris@69: celt_inner_prod_c, Chris@69: MAY_HAVE_SSE2(celt_inner_prod), Chris@69: MAY_HAVE_SSE4_1(celt_inner_prod), /* sse4.1 */ Chris@69: MAY_HAVE_SSE4_1(celt_inner_prod) /* avx */ Chris@69: }; Chris@69: Chris@69: #endif Chris@69: Chris@69: # else Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE) Chris@69: Chris@69: 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: xcorr_kernel_c, /* non-sse */ Chris@69: MAY_HAVE_SSE(xcorr_kernel), Chris@69: MAY_HAVE_SSE(xcorr_kernel), Chris@69: MAY_HAVE_SSE(xcorr_kernel), Chris@69: MAY_HAVE_SSE(xcorr_kernel) Chris@69: }; Chris@69: Chris@69: 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: celt_inner_prod_c, /* non-sse */ Chris@69: MAY_HAVE_SSE(celt_inner_prod), Chris@69: MAY_HAVE_SSE(celt_inner_prod), Chris@69: MAY_HAVE_SSE(celt_inner_prod), Chris@69: MAY_HAVE_SSE(celt_inner_prod) Chris@69: }; Chris@69: Chris@69: 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: dual_inner_prod_c, /* non-sse */ Chris@69: MAY_HAVE_SSE(dual_inner_prod), Chris@69: MAY_HAVE_SSE(dual_inner_prod), Chris@69: MAY_HAVE_SSE(dual_inner_prod), Chris@69: MAY_HAVE_SSE(dual_inner_prod) Chris@69: }; Chris@69: Chris@69: 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: comb_filter_const_c, /* non-sse */ Chris@69: MAY_HAVE_SSE(comb_filter_const), Chris@69: MAY_HAVE_SSE(comb_filter_const), Chris@69: MAY_HAVE_SSE(comb_filter_const), Chris@69: MAY_HAVE_SSE(comb_filter_const) Chris@69: }; Chris@69: Chris@69: Chris@69: #endif Chris@69: Chris@69: #if defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2) Chris@69: opus_val16 (*const OP_PVQ_SEARCH_IMPL[OPUS_ARCHMASK + 1])( Chris@69: celt_norm *_X, int *iy, int K, int N, int arch Chris@69: ) = { Chris@69: op_pvq_search_c, /* non-sse */ Chris@69: op_pvq_search_c, Chris@69: MAY_HAVE_SSE2(op_pvq_search), Chris@69: MAY_HAVE_SSE2(op_pvq_search), Chris@69: MAY_HAVE_SSE2(op_pvq_search) Chris@69: }; Chris@69: #endif Chris@69: Chris@69: #endif Chris@69: #endif