cannam@154
|
1 /***********************************************************************
|
cannam@154
|
2 Copyright (C) 2014 Vidyo
|
cannam@154
|
3 Redistribution and use in source and binary forms, with or without
|
cannam@154
|
4 modification, are permitted provided that the following conditions
|
cannam@154
|
5 are met:
|
cannam@154
|
6 - Redistributions of source code must retain the above copyright notice,
|
cannam@154
|
7 this list of conditions and the following disclaimer.
|
cannam@154
|
8 - Redistributions in binary form must reproduce the above copyright
|
cannam@154
|
9 notice, this list of conditions and the following disclaimer in the
|
cannam@154
|
10 documentation and/or other materials provided with the distribution.
|
cannam@154
|
11 - Neither the name of Internet Society, IETF or IETF Trust, nor the
|
cannam@154
|
12 names of specific contributors, may be used to endorse or promote
|
cannam@154
|
13 products derived from this software without specific prior written
|
cannam@154
|
14 permission.
|
cannam@154
|
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
cannam@154
|
16 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
cannam@154
|
17 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
cannam@154
|
18 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
cannam@154
|
19 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
cannam@154
|
20 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
cannam@154
|
21 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
cannam@154
|
22 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
cannam@154
|
23 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
cannam@154
|
24 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
cannam@154
|
25 POSSIBILITY OF SUCH DAMAGE.
|
cannam@154
|
26 ***********************************************************************/
|
cannam@154
|
27 #ifndef SILK_NSQ_NEON_H
|
cannam@154
|
28 #define SILK_NSQ_NEON_H
|
cannam@154
|
29
|
cannam@154
|
30 #include "cpu_support.h"
|
cannam@154
|
31 #include "SigProc_FIX.h"
|
cannam@154
|
32
|
cannam@154
|
33 #undef silk_short_prediction_create_arch_coef
|
cannam@154
|
34 /* For vectorized calc, reverse a_Q12 coefs, convert to 32-bit, and shift for vqdmulhq_s32. */
|
cannam@154
|
35 static OPUS_INLINE void silk_short_prediction_create_arch_coef_neon(opus_int32 *out, const opus_int16 *in, opus_int order)
|
cannam@154
|
36 {
|
cannam@154
|
37 out[15] = silk_LSHIFT32(in[0], 15);
|
cannam@154
|
38 out[14] = silk_LSHIFT32(in[1], 15);
|
cannam@154
|
39 out[13] = silk_LSHIFT32(in[2], 15);
|
cannam@154
|
40 out[12] = silk_LSHIFT32(in[3], 15);
|
cannam@154
|
41 out[11] = silk_LSHIFT32(in[4], 15);
|
cannam@154
|
42 out[10] = silk_LSHIFT32(in[5], 15);
|
cannam@154
|
43 out[9] = silk_LSHIFT32(in[6], 15);
|
cannam@154
|
44 out[8] = silk_LSHIFT32(in[7], 15);
|
cannam@154
|
45 out[7] = silk_LSHIFT32(in[8], 15);
|
cannam@154
|
46 out[6] = silk_LSHIFT32(in[9], 15);
|
cannam@154
|
47
|
cannam@154
|
48 if (order == 16)
|
cannam@154
|
49 {
|
cannam@154
|
50 out[5] = silk_LSHIFT32(in[10], 15);
|
cannam@154
|
51 out[4] = silk_LSHIFT32(in[11], 15);
|
cannam@154
|
52 out[3] = silk_LSHIFT32(in[12], 15);
|
cannam@154
|
53 out[2] = silk_LSHIFT32(in[13], 15);
|
cannam@154
|
54 out[1] = silk_LSHIFT32(in[14], 15);
|
cannam@154
|
55 out[0] = silk_LSHIFT32(in[15], 15);
|
cannam@154
|
56 }
|
cannam@154
|
57 else
|
cannam@154
|
58 {
|
cannam@154
|
59 out[5] = 0;
|
cannam@154
|
60 out[4] = 0;
|
cannam@154
|
61 out[3] = 0;
|
cannam@154
|
62 out[2] = 0;
|
cannam@154
|
63 out[1] = 0;
|
cannam@154
|
64 out[0] = 0;
|
cannam@154
|
65 }
|
cannam@154
|
66 }
|
cannam@154
|
67
|
cannam@154
|
68 #if defined(OPUS_ARM_PRESUME_NEON_INTR)
|
cannam@154
|
69
|
cannam@154
|
70 #define silk_short_prediction_create_arch_coef(out, in, order) \
|
cannam@154
|
71 (silk_short_prediction_create_arch_coef_neon(out, in, order))
|
cannam@154
|
72
|
cannam@154
|
73 #elif defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
|
cannam@154
|
74
|
cannam@154
|
75 #define silk_short_prediction_create_arch_coef(out, in, order) \
|
cannam@154
|
76 do { if (arch == OPUS_ARCH_ARM_NEON) { silk_short_prediction_create_arch_coef_neon(out, in, order); } } while (0)
|
cannam@154
|
77
|
cannam@154
|
78 #endif
|
cannam@154
|
79
|
cannam@154
|
80 opus_int32 silk_noise_shape_quantizer_short_prediction_neon(const opus_int32 *buf32, const opus_int32 *coef32, opus_int order);
|
cannam@154
|
81
|
cannam@154
|
82 opus_int32 silk_NSQ_noise_shape_feedback_loop_neon(const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef, opus_int order);
|
cannam@154
|
83
|
cannam@154
|
84 #if defined(OPUS_ARM_PRESUME_NEON_INTR)
|
cannam@154
|
85 #undef silk_noise_shape_quantizer_short_prediction
|
cannam@154
|
86 #define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) \
|
cannam@154
|
87 ((void)arch,silk_noise_shape_quantizer_short_prediction_neon(in, coefRev, order))
|
cannam@154
|
88
|
cannam@154
|
89 #undef silk_NSQ_noise_shape_feedback_loop
|
cannam@154
|
90 #define silk_NSQ_noise_shape_feedback_loop(data0, data1, coef, order, arch) ((void)arch,silk_NSQ_noise_shape_feedback_loop_neon(data0, data1, coef, order))
|
cannam@154
|
91
|
cannam@154
|
92 #elif defined(OPUS_HAVE_RTCD) && defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
|
cannam@154
|
93
|
cannam@154
|
94 /* silk_noise_shape_quantizer_short_prediction implementations take different parameters based on arch
|
cannam@154
|
95 (coef vs. coefRev) so can't use the usual IMPL table implementation */
|
cannam@154
|
96 #undef silk_noise_shape_quantizer_short_prediction
|
cannam@154
|
97 #define silk_noise_shape_quantizer_short_prediction(in, coef, coefRev, order, arch) \
|
cannam@154
|
98 (arch == OPUS_ARCH_ARM_NEON ? \
|
cannam@154
|
99 silk_noise_shape_quantizer_short_prediction_neon(in, coefRev, order) : \
|
cannam@154
|
100 silk_noise_shape_quantizer_short_prediction_c(in, coef, order))
|
cannam@154
|
101
|
cannam@154
|
102 extern opus_int32
|
cannam@154
|
103 (*const SILK_NSQ_NOISE_SHAPE_FEEDBACK_LOOP_IMPL[OPUS_ARCHMASK+1])(
|
cannam@154
|
104 const opus_int32 *data0, opus_int32 *data1, const opus_int16 *coef,
|
cannam@154
|
105 opus_int order);
|
cannam@154
|
106
|
cannam@154
|
107 #undef silk_NSQ_noise_shape_feedback_loop
|
cannam@154
|
108 #define silk_NSQ_noise_shape_feedback_loop(data0, data1, coef, order, arch) \
|
cannam@154
|
109 (SILK_NSQ_NOISE_SHAPE_FEEDBACK_LOOP_IMPL[(arch)&OPUS_ARCHMASK](data0, data1, \
|
cannam@154
|
110 coef, order))
|
cannam@154
|
111
|
cannam@154
|
112 #endif
|
cannam@154
|
113
|
cannam@154
|
114 #endif /* SILK_NSQ_NEON_H */
|