diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/pitch.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/pitch.h | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/pitch.h b/lib/rbcodec/codecs/libopus/celt/pitch.h index 96dbc0d794..e425f56aea 100644 --- a/lib/rbcodec/codecs/libopus/celt/pitch.h +++ b/lib/rbcodec/codecs/libopus/celt/pitch.h | |||
@@ -37,7 +37,8 @@ | |||
37 | #include "modes.h" | 37 | #include "modes.h" |
38 | #include "cpu_support.h" | 38 | #include "cpu_support.h" |
39 | 39 | ||
40 | #if defined(__SSE__) && !defined(FIXED_POINT) | 40 | #if (defined(OPUS_X86_MAY_HAVE_SSE) && !defined(FIXED_POINT)) \ |
41 | || ((defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)) && defined(FIXED_POINT)) | ||
41 | #include "x86/pitch_sse.h" | 42 | #include "x86/pitch_sse.h" |
42 | #endif | 43 | #endif |
43 | 44 | ||
@@ -45,8 +46,8 @@ | |||
45 | #include "mips/pitch_mipsr1.h" | 46 | #include "mips/pitch_mipsr1.h" |
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #if defined(OPUS_ARM_ASM) && defined(FIXED_POINT) | 49 | #if (defined(OPUS_ARM_ASM) || defined(OPUS_ARM_MAY_HAVE_NEON_INTR)) |
49 | //# include "arm/pitch_arm.h" | 50 | # include "arm/pitch_arm.h" |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, | 53 | void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, |
@@ -56,12 +57,12 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR | |||
56 | int len, int max_pitch, int *pitch, int arch); | 57 | int len, int max_pitch, int *pitch, int arch); |
57 | 58 | ||
58 | opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, | 59 | opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, |
59 | int N, int *T0, int prev_period, opus_val16 prev_gain); | 60 | int N, int *T0, int prev_period, opus_val16 prev_gain, int arch); |
61 | |||
60 | 62 | ||
61 | /* OPT: This is the kernel you really want to optimize. It gets used a lot | 63 | /* OPT: This is the kernel you really want to optimize. It gets used a lot |
62 | by the prefilter and by the PLC. */ | 64 | by the prefilter and by the PLC. */ |
63 | #ifndef OVERRIDE_XCORR_KERNEL | 65 | static OPUS_INLINE void xcorr_kernel_c(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len) |
64 | static OPUS_INLINE void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len) | ||
65 | { | 66 | { |
66 | int j; | 67 | int j; |
67 | opus_val16 y_0, y_1, y_2, y_3; | 68 | opus_val16 y_0, y_1, y_2, y_3; |
@@ -126,10 +127,14 @@ static OPUS_INLINE void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, | |||
126 | sum[3] = MAC16_16(sum[3],tmp,y_1); | 127 | sum[3] = MAC16_16(sum[3],tmp,y_1); |
127 | } | 128 | } |
128 | } | 129 | } |
130 | |||
131 | #ifndef OVERRIDE_XCORR_KERNEL | ||
132 | #define xcorr_kernel(x, y, sum, len, arch) \ | ||
133 | ((void)(arch),xcorr_kernel_c(x, y, sum, len)) | ||
129 | #endif /* OVERRIDE_XCORR_KERNEL */ | 134 | #endif /* OVERRIDE_XCORR_KERNEL */ |
130 | 135 | ||
131 | #ifndef OVERRIDE_DUAL_INNER_PROD | 136 | |
132 | static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, | 137 | static OPUS_INLINE void dual_inner_prod_c(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, |
133 | int N, opus_val32 *xy1, opus_val32 *xy2) | 138 | int N, opus_val32 *xy1, opus_val32 *xy2) |
134 | { | 139 | { |
135 | int i; | 140 | int i; |
@@ -143,11 +148,16 @@ static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y | |||
143 | *xy1 = xy01; | 148 | *xy1 = xy01; |
144 | *xy2 = xy02; | 149 | *xy2 = xy02; |
145 | } | 150 | } |
151 | |||
152 | #ifndef OVERRIDE_DUAL_INNER_PROD | ||
153 | # define dual_inner_prod(x, y01, y02, N, xy1, xy2, arch) \ | ||
154 | ((void)(arch),dual_inner_prod_c(x, y01, y02, N, xy1, xy2)) | ||
146 | #endif | 155 | #endif |
147 | 156 | ||
148 | #ifndef OVERRIDE_CELT_INNER_PROD | 157 | /*We make sure a C version is always available for cases where the overhead of |
149 | static OPUS_INLINE opus_val32 celt_inner_prod(const opus_val16 *x, const opus_val16 *y, | 158 | vectorization and passing around an arch flag aren't worth it.*/ |
150 | int N) | 159 | static OPUS_INLINE opus_val32 celt_inner_prod_c(const opus_val16 *x, |
160 | const opus_val16 *y, int N) | ||
151 | { | 161 | { |
152 | int i; | 162 | int i; |
153 | opus_val32 xy=0; | 163 | opus_val32 xy=0; |
@@ -155,35 +165,28 @@ static OPUS_INLINE opus_val32 celt_inner_prod(const opus_val16 *x, const opus_va | |||
155 | xy = MAC16_16(xy, x[i], y[i]); | 165 | xy = MAC16_16(xy, x[i], y[i]); |
156 | return xy; | 166 | return xy; |
157 | } | 167 | } |
168 | |||
169 | #if !defined(OVERRIDE_CELT_INNER_PROD) | ||
170 | # define celt_inner_prod(x, y, N, arch) \ | ||
171 | ((void)(arch),celt_inner_prod_c(x, y, N)) | ||
172 | #endif | ||
173 | |||
174 | #ifdef NON_STATIC_COMB_FILTER_CONST_C | ||
175 | void comb_filter_const_c(opus_val32 *y, opus_val32 *x, int T, int N, | ||
176 | opus_val16 g10, opus_val16 g11, opus_val16 g12); | ||
158 | #endif | 177 | #endif |
159 | 178 | ||
179 | |||
160 | #ifdef FIXED_POINT | 180 | #ifdef FIXED_POINT |
161 | opus_val32 | 181 | opus_val32 |
162 | #else | 182 | #else |
163 | void | 183 | void |
164 | #endif | 184 | #endif |
165 | celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, | 185 | celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, |
166 | opus_val32 *xcorr, int len, int max_pitch); | 186 | opus_val32 *xcorr, int len, int max_pitch, int arch); |
167 | 187 | ||
168 | #if !defined(OVERRIDE_PITCH_XCORR) | 188 | #ifndef OVERRIDE_PITCH_XCORR |
169 | /*Is run-time CPU detection enabled on this platform?*/ | 189 | # define celt_pitch_xcorr celt_pitch_xcorr_c |
170 | # if defined(OPUS_HAVE_RTCD) | ||
171 | extern | ||
172 | # if defined(FIXED_POINT) | ||
173 | opus_val32 | ||
174 | # else | ||
175 | void | ||
176 | # endif | ||
177 | (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, | ||
178 | const opus_val16 *, opus_val32 *, int, int); | ||
179 | |||
180 | # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ | ||
181 | ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \ | ||
182 | xcorr, len, max_pitch)) | ||
183 | # else | ||
184 | # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ | ||
185 | ((void)(arch),celt_pitch_xcorr_c(_x, _y, xcorr, len, max_pitch)) | ||
186 | # endif | ||
187 | #endif | 190 | #endif |
188 | 191 | ||
189 | #endif | 192 | #endif |