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