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_Fwd_Radix2_ls(
15    const OMX_F32 *in,
16    OMX_F32 *out,
17    const OMX_F32 *twiddle,
18    OMX_INT n) {
19  OMX_INT i;
20  OMX_F32 *out0 = out;
21
22  for (i = 0; i < n; i += 2) {
23    OMX_FC32 t;
24    const OMX_F32 *tw = twiddle + i;
25    const OMX_F32 *in0 = in + i;
26    const OMX_F32 *in1 = in0 + 1;
27    OMX_F32 *out1 = out0 + (n >> 1);
28
29    // CMUL t, tw, in1
30    t.Re = tw[0] * in1[0] - tw[n << 1] * in1[n];
31    t.Im = tw[0] * in1[n] + tw[n << 1] * in1[0];
32
33    // CADD out0, in0, t
34    out0[0] = in0[0] + t.Re;
35    out0[n] = in0[n] + t.Im;
36
37    // CSUB out1, in0, t
38    out1[0] = in0[0] - t.Re;
39    out1[n] = in0[n] - t.Im;
40
41    out0 += 1;
42  }
43}
44