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 #define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
50     ((void)(arch), silk_burg_modified_sse4_1(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
51 
52 #else
53 
54 extern void (*const SILK_BURG_MODIFIED_IMPL[OPUS_ARCHMASK + 1])(
55     opus_int32                  *res_nrg,           /* O    Residual energy                                             */
56     opus_int                    *res_nrg_Q,         /* O    Residual energy Q value                                     */
57     opus_int32                  A_Q16[],            /* O    Prediction coefficients (length order)                      */
58     const opus_int16            x[],                /* I    Input signal, length: nb_subfr * ( D + subfr_length )       */
59     const opus_int32            minInvGain_Q30,     /* I    Inverse of max prediction gain                              */
60     const opus_int              subfr_length,       /* I    Input signal subframe length (incl. D preceding samples)    */
61     const opus_int              nb_subfr,           /* I    Number of subframes stacked in x                            */
62     const opus_int              D,                  /* I    Order                                                       */
63     int                         arch                /* I    Run-time architecture                                       */);
64 
65 #  define silk_burg_modified(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch) \
66     ((*SILK_BURG_MODIFIED_IMPL[(arch) & OPUS_ARCHMASK])(res_nrg, res_nrg_Q, A_Q16, x, minInvGain_Q30, subfr_length, nb_subfr, D, arch))
67 
68 #endif
69 
70 opus_int64 silk_inner_prod16_aligned_64_sse4_1(
71     const opus_int16 *inVec1,
72     const opus_int16 *inVec2,
73     const opus_int   len
74 );
75 
76 
77 #if defined(OPUS_X86_PRESUME_SSE4_1)
78 
79 #define silk_inner_prod16_aligned_64(inVec1, inVec2, len, arch) \
80     ((void)(arch),silk_inner_prod16_aligned_64_sse4_1(inVec1, inVec2, len))
81 
82 #else
83 
84 extern opus_int64 (*const SILK_INNER_PROD16_ALIGNED_64_IMPL[OPUS_ARCHMASK + 1])(
85                     const opus_int16 *inVec1,
86                     const opus_int16 *inVec2,
87                     const opus_int   len);
88 
89 #  define silk_inner_prod16_aligned_64(inVec1, inVec2, len, arch) \
90     ((*SILK_INNER_PROD16_ALIGNED_64_IMPL[(arch) & OPUS_ARCHMASK])(inVec1, inVec2, len))
91 
92 #endif
93 #endif
94 #endif
95