xref: /aosp_15_r20/external/libopus/silk/x86/SigProc_FIX_sse.h (revision a58d3d2adb790c104798cd88c8a3aff4fa8b82cc)
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 #ifndef SIGPROC_FIX_SSE_H
29 # define SIGPROC_FIX_SSE_H
30 
31 # ifdef HAVE_CONFIG_H
32 #  include "config.h"
33 # endif
34 
35 # if defined(OPUS_X86_MAY_HAVE_SSE4_1)
36 void silk_burg_modified_sse4_1(
37     opus_int32                  *res_nrg,           /* O    Residual energy                                             */
38     opus_int                    *res_nrg_Q,         /* O    Residual energy Q value                                     */
39     opus_int32                  A_Q16[],            /* O    Prediction coefficients (length order)                      */
40     const opus_int16            x[],                /* I    Input signal, length: nb_subfr * ( D + subfr_length )       */
41     const opus_int32            minInvGain_Q30,     /* I    Inverse of max prediction gain                              */
42     const opus_int              subfr_length,       /* I    Input signal subframe length (incl. D preceding samples)    */
43     const opus_int              nb_subfr,           /* I    Number of subframes stacked in x                            */
44     const opus_int              D,                  /* I    Order                                                       */
45     int                         arch                /* I    Run-time architecture                                       */
46 );
47 
48 #  if defined(OPUS_X86_PRESUME_SSE4_1)
49 
50 #   define OVERRIDE_silk_burg_modified
51 #   define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
52        ((void)(arch), silk_burg_modified_sse4_1(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
53 
54 #  elif defined(OPUS_HAVE_RTCD)
55 
56 extern void (*const SILK_BURG_MODIFIED_IMPL[OPUS_ARCHMASK + 1])(
57     opus_int32                  *res_nrg,           /* O    Residual energy                                             */
58     opus_int                    *res_nrg_Q,         /* O    Residual energy Q value                                     */
59     opus_int32                  A_Q16[],            /* O    Prediction coefficients (length order)                      */
60     const opus_int16            x[],                /* I    Input signal, length: nb_subfr * ( D + subfr_length )       */
61     const opus_int32            minInvGain_Q30,     /* I    Inverse of max prediction gain                              */
62     const opus_int              subfr_length,       /* I    Input signal subframe length (incl. D preceding samples)    */
63     const opus_int              nb_subfr,           /* I    Number of subframes stacked in x                            */
64     const opus_int              D,                  /* I    Order                                                       */
65     int                         arch                /* I    Run-time architecture                                       */);
66 
67 #   define OVERRIDE_silk_burg_modified
68 #   define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
69      ((*SILK_BURG_MODIFIED_IMPL[(arch) & OPUS_ARCHMASK])(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
70 
71 #  endif
72 
73 opus_int64 silk_inner_prod16_sse4_1(
74     const opus_int16 *inVec1,
75     const opus_int16 *inVec2,
76     const opus_int   len
77 );
78 
79 
80 #  if defined(OPUS_X86_PRESUME_SSE4_1)
81 
82 #   define OVERRIDE_silk_inner_prod16
83 #   define silk_inner_prod16(inVec1, inVec2, len, arch) \
84        ((void)(arch),silk_inner_prod16_sse4_1(inVec1, inVec2, len))
85 
86 #  elif defined(OPUS_HAVE_RTCD)
87 
88 extern opus_int64 (*const SILK_INNER_PROD16_IMPL[OPUS_ARCHMASK + 1])(
89                     const opus_int16 *inVec1,
90                     const opus_int16 *inVec2,
91                     const opus_int   len);
92 
93 #   define OVERRIDE_silk_inner_prod16
94 #   define silk_inner_prod16(inVec1, inVec2, len, arch) \
95      ((*SILK_INNER_PROD16_IMPL[(arch) & OPUS_ARCHMASK])(inVec1, inVec2, len))
96 
97 #  endif
98 # endif
99 #endif
100