1/*
2 *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 *
10 */
11
12#include "dl/api/omxtypes.h"
13
14void x86SP_FFT_CToC_FC32_Inv_Radix4_fs(
15    const OMX_F32 *in,
16    OMX_F32 *out,
17    OMX_INT n) {
18  OMX_INT i;
19  OMX_INT n_by_4 = n >> 2;
20  OMX_F32 *out0 = out;
21
22  for (i = 0; i < n_by_4; i++) {
23    const OMX_F32 *in0 = in + i;
24    const OMX_F32 *in1 = in0 + n_by_4;
25    const OMX_F32 *in2 = in1 + n_by_4;
26    const OMX_F32 *in3 = in2 + n_by_4;
27    OMX_F32 *out1 = out0 + n_by_4;
28    OMX_F32 *out2 = out1 + n_by_4;
29    OMX_F32 *out3 = out2 + n_by_4;
30
31    OMX_FC32 t0;
32    OMX_FC32 t1;
33    OMX_FC32 t2;
34    OMX_FC32 t3;
35
36    // CADD t0, in0, in2
37    t0.Re = in0[0] + in2[0];
38    t0.Im = in0[n] + in2[n];
39
40    // CSUB t1, in0, in2
41    t1.Re = in0[0] - in2[0];
42    t1.Im = in0[n] - in2[n];
43
44    // CADD t2, in1, in3
45    t2.Re = in1[0] + in3[0];
46    t2.Im = in1[n] + in3[n];
47
48    // CSUB t3, in1, in3
49    t3.Re = in1[0] - in3[0];
50    t3.Im = in1[n] - in3[n];
51
52    // CADD out0, t0, t2
53    out0[0] = t0.Re + t2.Re;
54    out0[n] = t0.Im + t2.Im;
55
56    // CSUB out2, t0, t2
57    out2[0] = t0.Re - t2.Re;
58    out2[n] = t0.Im - t2.Im;
59
60    // CSUB_ADD_X out1, t1, t3
61    out1[0] = t1.Re - t3.Im;
62    out1[n] = t1.Im + t3.Re;
63
64    // CADD_SUB_X out3, t1, t3
65    out3[0] = t1.Re + t3.Im;
66    out3[n] = t1.Im - t3.Re;
67
68    out0 += 1;
69  }
70}
71