diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-01-04 02:01:18 -0600 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-23 14:23:04 +0000 |
commit | 14c6bb798d6bebc80f07e863236adbaf8d156a9c (patch) | |
tree | 551a4b641906c2626af844fa3239c1b2b1ff0ad3 /lib/rbcodec/codecs/libopus/celt/mdct.c | |
parent | 75d93937965ec4df70d37df6d4feea04577c996b (diff) | |
download | rockbox-14c6bb798d6bebc80f07e863236adbaf8d156a9c.tar.gz rockbox-14c6bb798d6bebc80f07e863236adbaf8d156a9c.zip |
Sync opus codec to upstream git
Change-Id: I0cfcc0005c4ad7bfbb1aaf454188ce70fb043dc1
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/mdct.c')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/mdct.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/mdct.c b/lib/rbcodec/codecs/libopus/celt/mdct.c index 7fa8eaf6bf..5c6dab5b75 100644 --- a/lib/rbcodec/codecs/libopus/celt/mdct.c +++ b/lib/rbcodec/codecs/libopus/celt/mdct.c | |||
@@ -60,7 +60,7 @@ | |||
60 | 60 | ||
61 | #ifdef CUSTOM_MODES | 61 | #ifdef CUSTOM_MODES |
62 | 62 | ||
63 | int clt_mdct_init(mdct_lookup *l,int N, int maxshift) | 63 | int clt_mdct_init(mdct_lookup *l,int N, int maxshift, int arch) |
64 | { | 64 | { |
65 | int i; | 65 | int i; |
66 | kiss_twiddle_scalar *trig; | 66 | kiss_twiddle_scalar *trig; |
@@ -71,9 +71,9 @@ int clt_mdct_init(mdct_lookup *l,int N, int maxshift) | |||
71 | for (i=0;i<=maxshift;i++) | 71 | for (i=0;i<=maxshift;i++) |
72 | { | 72 | { |
73 | if (i==0) | 73 | if (i==0) |
74 | l->kfft[i] = opus_fft_alloc(N>>2>>i, 0, 0); | 74 | l->kfft[i] = opus_fft_alloc(N>>2>>i, 0, 0, arch); |
75 | else | 75 | else |
76 | l->kfft[i] = opus_fft_alloc_twiddles(N>>2>>i, 0, 0, l->kfft[0]); | 76 | l->kfft[i] = opus_fft_alloc_twiddles(N>>2>>i, 0, 0, l->kfft[0], arch); |
77 | #ifndef ENABLE_TI_DSPLIB55 | 77 | #ifndef ENABLE_TI_DSPLIB55 |
78 | if (l->kfft[i]==NULL) | 78 | if (l->kfft[i]==NULL) |
79 | return 0; | 79 | return 0; |
@@ -104,21 +104,20 @@ int clt_mdct_init(mdct_lookup *l,int N, int maxshift) | |||
104 | return 1; | 104 | return 1; |
105 | } | 105 | } |
106 | 106 | ||
107 | void clt_mdct_clear(mdct_lookup *l) | 107 | void clt_mdct_clear(mdct_lookup *l, int arch) |
108 | { | 108 | { |
109 | int i; | 109 | int i; |
110 | for (i=0;i<=l->maxshift;i++) | 110 | for (i=0;i<=l->maxshift;i++) |
111 | opus_fft_free(l->kfft[i]); | 111 | opus_fft_free(l->kfft[i], arch); |
112 | opus_free((kiss_twiddle_scalar*)l->trig); | 112 | opus_free((kiss_twiddle_scalar*)l->trig); |
113 | } | 113 | } |
114 | 114 | ||
115 | #endif /* CUSTOM_MODES */ | 115 | #endif /* CUSTOM_MODES */ |
116 | 116 | ||
117 | #if 0 | ||
118 | /* Forward MDCT trashes the input array */ | 117 | /* Forward MDCT trashes the input array */ |
119 | #ifndef OVERRIDE_clt_mdct_forward | 118 | #ifndef OVERRIDE_clt_mdct_forward |
120 | void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * OPUS_RESTRICT out, | 119 | void clt_mdct_forward_c(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * OPUS_RESTRICT out, |
121 | const opus_val16 *window, int overlap, int shift, int stride) | 120 | const opus_val16 *window, int overlap, int shift, int stride, int arch) |
122 | { | 121 | { |
123 | int i; | 122 | int i; |
124 | int N, N2, N4; | 123 | int N, N2, N4; |
@@ -133,6 +132,7 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar | |||
133 | int scale_shift = st->scale_shift-1; | 132 | int scale_shift = st->scale_shift-1; |
134 | #endif | 133 | #endif |
135 | SAVE_STACK; | 134 | SAVE_STACK; |
135 | (void)arch; | ||
136 | scale = st->scale; | 136 | scale = st->scale; |
137 | 137 | ||
138 | N = l->n; | 138 | N = l->n; |
@@ -237,15 +237,15 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar | |||
237 | RESTORE_STACK; | 237 | RESTORE_STACK; |
238 | } | 238 | } |
239 | #endif /* OVERRIDE_clt_mdct_forward */ | 239 | #endif /* OVERRIDE_clt_mdct_forward */ |
240 | #endif | ||
241 | 240 | ||
242 | #ifndef OVERRIDE_clt_mdct_backward | 241 | #ifndef OVERRIDE_clt_mdct_backward |
243 | void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * OPUS_RESTRICT out, | 242 | void clt_mdct_backward_c(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * OPUS_RESTRICT out, |
244 | const opus_val16 * OPUS_RESTRICT window, int overlap, int shift, int stride) | 243 | const opus_val16 * OPUS_RESTRICT window, int overlap, int shift, int stride, int arch) |
245 | { | 244 | { |
246 | int i; | 245 | int i; |
247 | int N, N2, N4; | 246 | int N, N2, N4; |
248 | const kiss_twiddle_scalar *trig; | 247 | const kiss_twiddle_scalar *trig; |
248 | (void) arch; | ||
249 | 249 | ||
250 | N = l->n; | 250 | N = l->n; |
251 | trig = l->trig; | 251 | trig = l->trig; |
@@ -270,8 +270,8 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala | |||
270 | int rev; | 270 | int rev; |
271 | kiss_fft_scalar yr, yi; | 271 | kiss_fft_scalar yr, yi; |
272 | rev = *bitrev++; | 272 | rev = *bitrev++; |
273 | yr = S_MUL(*xp2, t[i]) + S_MUL(*xp1, t[N4+i]); | 273 | yr = ADD32_ovflw(S_MUL(*xp2, t[i]), S_MUL(*xp1, t[N4+i])); |
274 | yi = S_MUL(*xp1, t[i]) - S_MUL(*xp2, t[N4+i]); | 274 | yi = SUB32_ovflw(S_MUL(*xp1, t[i]), S_MUL(*xp2, t[N4+i])); |
275 | /* We swap real and imag because we use an FFT instead of an IFFT. */ | 275 | /* We swap real and imag because we use an FFT instead of an IFFT. */ |
276 | yp[2*rev+1] = yr; | 276 | yp[2*rev+1] = yr; |
277 | yp[2*rev] = yi; | 277 | yp[2*rev] = yi; |
@@ -301,8 +301,8 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala | |||
301 | t0 = t[i]; | 301 | t0 = t[i]; |
302 | t1 = t[N4+i]; | 302 | t1 = t[N4+i]; |
303 | /* We'd scale up by 2 here, but instead it's done when mixing the windows */ | 303 | /* We'd scale up by 2 here, but instead it's done when mixing the windows */ |
304 | yr = S_MUL(re,t0) + S_MUL(im,t1); | 304 | yr = ADD32_ovflw(S_MUL(re,t0), S_MUL(im,t1)); |
305 | yi = S_MUL(re,t1) - S_MUL(im,t0); | 305 | yi = SUB32_ovflw(S_MUL(re,t1), S_MUL(im,t0)); |
306 | /* We swap real and imag because we're using an FFT instead of an IFFT. */ | 306 | /* We swap real and imag because we're using an FFT instead of an IFFT. */ |
307 | re = yp1[1]; | 307 | re = yp1[1]; |
308 | im = yp1[0]; | 308 | im = yp1[0]; |
@@ -312,8 +312,8 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala | |||
312 | t0 = t[(N4-i-1)]; | 312 | t0 = t[(N4-i-1)]; |
313 | t1 = t[(N2-i-1)]; | 313 | t1 = t[(N2-i-1)]; |
314 | /* We'd scale up by 2 here, but instead it's done when mixing the windows */ | 314 | /* We'd scale up by 2 here, but instead it's done when mixing the windows */ |
315 | yr = S_MUL(re,t0) + S_MUL(im,t1); | 315 | yr = ADD32_ovflw(S_MUL(re,t0), S_MUL(im,t1)); |
316 | yi = S_MUL(re,t1) - S_MUL(im,t0); | 316 | yi = SUB32_ovflw(S_MUL(re,t1), S_MUL(im,t0)); |
317 | yp1[0] = yr; | 317 | yp1[0] = yr; |
318 | yp0[1] = yi; | 318 | yp0[1] = yi; |
319 | yp0 += 2; | 319 | yp0 += 2; |
@@ -333,8 +333,8 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala | |||
333 | kiss_fft_scalar x1, x2; | 333 | kiss_fft_scalar x1, x2; |
334 | x1 = *xp1; | 334 | x1 = *xp1; |
335 | x2 = *yp1; | 335 | x2 = *yp1; |
336 | *yp1++ = MULT16_32_Q15(*wp2, x2) - MULT16_32_Q15(*wp1, x1); | 336 | *yp1++ = SUB32_ovflw(MULT16_32_Q15(*wp2, x2), MULT16_32_Q15(*wp1, x1)); |
337 | *xp1-- = MULT16_32_Q15(*wp1, x2) + MULT16_32_Q15(*wp2, x1); | 337 | *xp1-- = ADD32_ovflw(MULT16_32_Q15(*wp1, x2), MULT16_32_Q15(*wp2, x1)); |
338 | wp1++; | 338 | wp1++; |
339 | wp2--; | 339 | wp2--; |
340 | } | 340 | } |