tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

x86_celt_map.c (5555B)


      1 /* Copyright (c) 2014, Cisco Systems, INC
      2   Written by XiangMingZhu WeiZhou MinPeng YanWang
      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 
      8   - Redistributions of source code must retain the above copyright
      9   notice, this list of conditions and the following disclaimer.
     10 
     11   - Redistributions in binary form must reproduce the above copyright
     12   notice, this list of conditions and the following disclaimer in the
     13   documentation and/or other materials provided with the distribution.
     14 
     15   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     18   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
     19   OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     20   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     21   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     22   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     23   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     24   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     25   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26 */
     27 
     28 #if defined(HAVE_CONFIG_H)
     29 #include "config.h"
     30 #endif
     31 
     32 #include "x86/x86cpu.h"
     33 #include "celt_lpc.h"
     34 #include "pitch.h"
     35 #include "pitch_sse.h"
     36 #include "vq.h"
     37 
     38 #if defined(OPUS_HAVE_RTCD)
     39 
     40 # if defined(FIXED_POINT)
     41 
     42 #if defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)
     43 
     44 void (*const CELT_FIR_IMPL[OPUS_ARCHMASK + 1])(
     45         const opus_val16 *x,
     46         const opus_val16 *num,
     47         opus_val16       *y,
     48         int              N,
     49         int              ord,
     50         int              arch
     51 ) = {
     52  celt_fir_c,                /* non-sse */
     53  celt_fir_c,
     54  celt_fir_c,
     55  MAY_HAVE_SSE4_1(celt_fir), /* sse4.1  */
     56  MAY_HAVE_SSE4_1(celt_fir)  /* avx  */
     57 };
     58 
     59 void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
     60         const opus_val16 *x,
     61         const opus_val16 *y,
     62         opus_val32       sum[4],
     63         int              len
     64 ) = {
     65  xcorr_kernel_c,                /* non-sse */
     66  xcorr_kernel_c,
     67  xcorr_kernel_c,
     68  MAY_HAVE_SSE4_1(xcorr_kernel), /* sse4.1  */
     69  MAY_HAVE_SSE4_1(xcorr_kernel)  /* avx  */
     70 };
     71 
     72 #endif
     73 
     74 #if (defined(OPUS_X86_MAY_HAVE_SSE4_1) && !defined(OPUS_X86_PRESUME_SSE4_1)) ||  \
     75 (!defined(OPUS_X86_MAY_HAVE_SSE_4_1) && defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2))
     76 
     77 opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])(
     78         const opus_val16 *x,
     79         const opus_val16 *y,
     80         int              N
     81 ) = {
     82  celt_inner_prod_c,                /* non-sse */
     83  celt_inner_prod_c,
     84  MAY_HAVE_SSE2(celt_inner_prod),
     85  MAY_HAVE_SSE4_1(celt_inner_prod), /* sse4.1  */
     86  MAY_HAVE_SSE4_1(celt_inner_prod)  /* avx  */
     87 };
     88 
     89 #endif
     90 
     91 # else
     92 
     93 #if defined(OPUS_X86_MAY_HAVE_AVX2) && !defined(OPUS_X86_PRESUME_AVX2)
     94 
     95 void (*const PITCH_XCORR_IMPL[OPUS_ARCHMASK + 1])(
     96         const float *_x,
     97         const float *_y,
     98         float *xcorr,
     99         int len,
    100         int max_pitch,
    101         int arch
    102 ) = {
    103  celt_pitch_xcorr_c,                /* non-sse */
    104  celt_pitch_xcorr_c,
    105  celt_pitch_xcorr_c,
    106  celt_pitch_xcorr_c,
    107  MAY_HAVE_AVX2(celt_pitch_xcorr)
    108 };
    109 
    110 #endif
    111 
    112 
    113 #if defined(OPUS_X86_MAY_HAVE_SSE) && !defined(OPUS_X86_PRESUME_SSE)
    114 
    115 void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
    116         const opus_val16 *x,
    117         const opus_val16 *y,
    118         opus_val32       sum[4],
    119         int              len
    120 ) = {
    121  xcorr_kernel_c,                /* non-sse */
    122  MAY_HAVE_SSE(xcorr_kernel),
    123  MAY_HAVE_SSE(xcorr_kernel),
    124  MAY_HAVE_SSE(xcorr_kernel),
    125  MAY_HAVE_SSE(xcorr_kernel)
    126 };
    127 
    128 opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])(
    129         const opus_val16 *x,
    130         const opus_val16 *y,
    131         int              N
    132 ) = {
    133  celt_inner_prod_c,                /* non-sse */
    134  MAY_HAVE_SSE(celt_inner_prod),
    135  MAY_HAVE_SSE(celt_inner_prod),
    136  MAY_HAVE_SSE(celt_inner_prod),
    137  MAY_HAVE_SSE(celt_inner_prod)
    138 };
    139 
    140 void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK + 1])(
    141                    const opus_val16 *x,
    142                    const opus_val16 *y01,
    143                    const opus_val16 *y02,
    144                    int               N,
    145                    opus_val32       *xy1,
    146                    opus_val32       *xy2
    147 ) = {
    148  dual_inner_prod_c,                /* non-sse */
    149  MAY_HAVE_SSE(dual_inner_prod),
    150  MAY_HAVE_SSE(dual_inner_prod),
    151  MAY_HAVE_SSE(dual_inner_prod),
    152  MAY_HAVE_SSE(dual_inner_prod)
    153 };
    154 
    155 void (*const COMB_FILTER_CONST_IMPL[OPUS_ARCHMASK + 1])(
    156              opus_val32 *y,
    157              opus_val32 *x,
    158              int         T,
    159              int         N,
    160              opus_val16  g10,
    161              opus_val16  g11,
    162              opus_val16  g12
    163 ) = {
    164  comb_filter_const_c,                /* non-sse */
    165  MAY_HAVE_SSE(comb_filter_const),
    166  MAY_HAVE_SSE(comb_filter_const),
    167  MAY_HAVE_SSE(comb_filter_const),
    168  MAY_HAVE_SSE(comb_filter_const)
    169 };
    170 
    171 
    172 #endif
    173 
    174 #if defined(OPUS_X86_MAY_HAVE_SSE2) && !defined(OPUS_X86_PRESUME_SSE2)
    175 opus_val16 (*const OP_PVQ_SEARCH_IMPL[OPUS_ARCHMASK + 1])(
    176      celt_norm *_X, int *iy, int K, int N, int arch
    177 ) = {
    178  op_pvq_search_c,                /* non-sse */
    179  op_pvq_search_c,
    180  MAY_HAVE_SSE2(op_pvq_search),
    181  MAY_HAVE_SSE2(op_pvq_search),
    182  MAY_HAVE_SSE2(op_pvq_search)
    183 };
    184 #endif
    185 
    186 #endif
    187 #endif