xref: /aosp_15_r20/external/libxaac/decoder/ixheaacd_dsp_fft32x32s.c (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
1*15dc779aSAndroid Build Coastguard Worker /******************************************************************************
2*15dc779aSAndroid Build Coastguard Worker  *                                                                            *
3*15dc779aSAndroid Build Coastguard Worker  * Copyright (C) 2018 The Android Open Source Project
4*15dc779aSAndroid Build Coastguard Worker  *
5*15dc779aSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
6*15dc779aSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
7*15dc779aSAndroid Build Coastguard Worker  * You may obtain a copy of the License at:
8*15dc779aSAndroid Build Coastguard Worker  *
9*15dc779aSAndroid Build Coastguard Worker  * http://www.apache.org/licenses/LICENSE-2.0
10*15dc779aSAndroid Build Coastguard Worker  *
11*15dc779aSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
12*15dc779aSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
13*15dc779aSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*15dc779aSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
15*15dc779aSAndroid Build Coastguard Worker  * limitations under the License.
16*15dc779aSAndroid Build Coastguard Worker  *
17*15dc779aSAndroid Build Coastguard Worker  *****************************************************************************
18*15dc779aSAndroid Build Coastguard Worker  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*15dc779aSAndroid Build Coastguard Worker */
20*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_sbr_common.h"
21*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_type_def.h"
22*15dc779aSAndroid Build Coastguard Worker 
23*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_constants.h"
24*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops32.h"
25*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops16.h"
26*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops40.h"
27*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_ops.h"
28*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_common_rom.h"
29*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_dsp_fft32x32s.h"
30*15dc779aSAndroid Build Coastguard Worker #include "ixheaacd_intrinsics.h"
31*15dc779aSAndroid Build Coastguard Worker 
32*15dc779aSAndroid Build Coastguard Worker #include "ixheaac_basic_op.h"
33*15dc779aSAndroid Build Coastguard Worker 
ixheaacd_inv_dit_fft_8pt_dec(WORD32 * y,WORD32 * real,WORD32 * imag)34*15dc779aSAndroid Build Coastguard Worker VOID ixheaacd_inv_dit_fft_8pt_dec(WORD32 *y, WORD32 *real, WORD32 *imag) {
35*15dc779aSAndroid Build Coastguard Worker   WORD32 a0, a1, a2, a3, a00, a10, a20, a30;
36*15dc779aSAndroid Build Coastguard Worker   WORD32 vr, vi;
37*15dc779aSAndroid Build Coastguard Worker 
38*15dc779aSAndroid Build Coastguard Worker   WORD32 x[16];
39*15dc779aSAndroid Build Coastguard Worker 
40*15dc779aSAndroid Build Coastguard Worker   a00 = ixheaac_add32_sat(y[0], y[8]);
41*15dc779aSAndroid Build Coastguard Worker   a0 = ixheaac_sub32_sat(y[0], y[8]);
42*15dc779aSAndroid Build Coastguard Worker 
43*15dc779aSAndroid Build Coastguard Worker   a20 = ixheaac_add32_sat(y[1], y[9]);
44*15dc779aSAndroid Build Coastguard Worker   a3 = ixheaac_sub32_sat(y[1], y[9]);
45*15dc779aSAndroid Build Coastguard Worker 
46*15dc779aSAndroid Build Coastguard Worker   a10 = ixheaac_add32_sat(y[4], y[12]);
47*15dc779aSAndroid Build Coastguard Worker   a2 = ixheaac_sub32_sat(y[4], y[12]);
48*15dc779aSAndroid Build Coastguard Worker 
49*15dc779aSAndroid Build Coastguard Worker   a30 = ixheaac_add32_sat(y[5], y[13]);
50*15dc779aSAndroid Build Coastguard Worker   a1 = ixheaac_sub32_sat(y[5], y[13]);
51*15dc779aSAndroid Build Coastguard Worker 
52*15dc779aSAndroid Build Coastguard Worker   x[0] = ixheaac_add32_sat(a00, a10);
53*15dc779aSAndroid Build Coastguard Worker   x[4] = ixheaac_sub32_sat(a00, a10);
54*15dc779aSAndroid Build Coastguard Worker   x[1] = ixheaac_add32_sat(a20, a30);
55*15dc779aSAndroid Build Coastguard Worker   x[5] = ixheaac_sub32_sat(a20, a30);
56*15dc779aSAndroid Build Coastguard Worker 
57*15dc779aSAndroid Build Coastguard Worker   x[2] = ixheaac_sub32_sat(a0, a1);
58*15dc779aSAndroid Build Coastguard Worker   x[6] = ixheaac_add32_sat(a0, a1);
59*15dc779aSAndroid Build Coastguard Worker   x[3] = ixheaac_add32_sat(a3, a2);
60*15dc779aSAndroid Build Coastguard Worker   x[7] = ixheaac_sub32_sat(a3, a2);
61*15dc779aSAndroid Build Coastguard Worker 
62*15dc779aSAndroid Build Coastguard Worker   a00 = ixheaac_add32_sat(y[2], y[10]);
63*15dc779aSAndroid Build Coastguard Worker   a0 = ixheaac_sub32_sat(y[2], y[10]);
64*15dc779aSAndroid Build Coastguard Worker 
65*15dc779aSAndroid Build Coastguard Worker   a20 = ixheaac_add32_sat(y[3], y[11]);
66*15dc779aSAndroid Build Coastguard Worker   a3 = ixheaac_sub32_sat(y[3], y[11]);
67*15dc779aSAndroid Build Coastguard Worker 
68*15dc779aSAndroid Build Coastguard Worker   a10 = ixheaac_add32_sat(y[6], y[14]);
69*15dc779aSAndroid Build Coastguard Worker   a2 = ixheaac_sub32_sat(y[6], y[14]);
70*15dc779aSAndroid Build Coastguard Worker 
71*15dc779aSAndroid Build Coastguard Worker   a30 = ixheaac_add32_sat(y[7], y[15]);
72*15dc779aSAndroid Build Coastguard Worker   a1 = ixheaac_sub32_sat(y[7], y[15]);
73*15dc779aSAndroid Build Coastguard Worker 
74*15dc779aSAndroid Build Coastguard Worker   x[8] = ixheaac_add32_sat(a00, a10);
75*15dc779aSAndroid Build Coastguard Worker   x[12] = ixheaac_sub32_sat(a00, a10);
76*15dc779aSAndroid Build Coastguard Worker   x[9] = ixheaac_add32_sat(a20, a30);
77*15dc779aSAndroid Build Coastguard Worker   x[13] = ixheaac_sub32_sat(a20, a30);
78*15dc779aSAndroid Build Coastguard Worker 
79*15dc779aSAndroid Build Coastguard Worker   x[10] = ixheaac_sub32_sat(a0, a1);
80*15dc779aSAndroid Build Coastguard Worker   x[14] = ixheaac_add32_sat(a0, a1);
81*15dc779aSAndroid Build Coastguard Worker   x[11] = ixheaac_add32_sat(a3, a2);
82*15dc779aSAndroid Build Coastguard Worker   x[15] = ixheaac_sub32_sat(a3, a2);
83*15dc779aSAndroid Build Coastguard Worker 
84*15dc779aSAndroid Build Coastguard Worker   real[0] = ixheaac_add32_sat(x[0], x[8]);
85*15dc779aSAndroid Build Coastguard Worker   imag[0] = ixheaac_add32_sat(x[1], x[9]);
86*15dc779aSAndroid Build Coastguard Worker   a00 = ixheaac_sub32_sat(x[0], x[8]);
87*15dc779aSAndroid Build Coastguard Worker   a10 = ixheaac_sub32_sat(x[1], x[9]);
88*15dc779aSAndroid Build Coastguard Worker 
89*15dc779aSAndroid Build Coastguard Worker   a0 = ixheaac_sub32_sat(x[4], x[13]);
90*15dc779aSAndroid Build Coastguard Worker   a1 = ixheaac_add32_sat(x[5], x[12]);
91*15dc779aSAndroid Build Coastguard Worker 
92*15dc779aSAndroid Build Coastguard Worker   real[4] = ixheaac_add32_sat(x[4], x[13]);
93*15dc779aSAndroid Build Coastguard Worker   imag[4] = ixheaac_sub32_sat(x[5], x[12]);
94*15dc779aSAndroid Build Coastguard Worker 
95*15dc779aSAndroid Build Coastguard Worker   vr = ixheaac_mult32x16in32_shl_sat(ixheaac_sub32_sat(x[10], x[11]), 0x5A82);
96*15dc779aSAndroid Build Coastguard Worker   vi = ixheaac_mult32x16in32_shl_sat(ixheaac_add32_sat(x[10], x[11]), 0x5A82);
97*15dc779aSAndroid Build Coastguard Worker 
98*15dc779aSAndroid Build Coastguard Worker   real[1] = ixheaac_add32_sat(x[2], vr);
99*15dc779aSAndroid Build Coastguard Worker   imag[1] = ixheaac_add32_sat(x[3], vi);
100*15dc779aSAndroid Build Coastguard Worker 
101*15dc779aSAndroid Build Coastguard Worker   a2 = ixheaac_sub32_sat(x[2], vr);
102*15dc779aSAndroid Build Coastguard Worker   a3 = ixheaac_sub32_sat(x[3], vi);
103*15dc779aSAndroid Build Coastguard Worker 
104*15dc779aSAndroid Build Coastguard Worker   real[2] = ixheaac_add32_sat(a0, a2);
105*15dc779aSAndroid Build Coastguard Worker   imag[2] = ixheaac_add32_sat(a1, a3);
106*15dc779aSAndroid Build Coastguard Worker   vr = ixheaac_mult32x16in32_shl_sat(ixheaac_add32_sat(x[14], x[15]), 0x5A82);
107*15dc779aSAndroid Build Coastguard Worker   vi = ixheaac_mult32x16in32_shl_sat(ixheaac_sub32_sat(x[14], x[15]), 0x5A82);
108*15dc779aSAndroid Build Coastguard Worker 
109*15dc779aSAndroid Build Coastguard Worker   a20 = ixheaac_sub32_sat(x[6], vr);
110*15dc779aSAndroid Build Coastguard Worker   a30 = ixheaac_add32_sat(x[7], vi);
111*15dc779aSAndroid Build Coastguard Worker 
112*15dc779aSAndroid Build Coastguard Worker   real[3] = ixheaac_add32_sat(a00, a20);
113*15dc779aSAndroid Build Coastguard Worker   imag[3] = ixheaac_add32_sat(a10, a30);
114*15dc779aSAndroid Build Coastguard Worker 
115*15dc779aSAndroid Build Coastguard Worker   real[5] = ixheaac_add32_sat(x[6], vr);
116*15dc779aSAndroid Build Coastguard Worker   imag[5] = ixheaac_sub32_sat(x[7], vi);
117*15dc779aSAndroid Build Coastguard Worker }
118