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