/*
 * Copyright (c) 2018, Alliance for Open Media. All rights reserved.
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

#include "aom_dsp/aom_dsp_common.h"
#include "aom_dsp/fft_common.h"
#include "config/aom_dsp_rtcd.h"

static INLINE void simple_transpose(const float *A, float *B, int n) {
  for (int y = 0; y < n; y++) {
    for (int x = 0; x < n; x++) {
      B[y * n + x] = A[x * n + y];
    }
  }
}

// The 1d transform is real to complex and packs the complex results in
// a way to take advantage of conjugate symmetry (e.g., the n/2 + 1 real
// components, followed by the n/2 - 1 imaginary components). After the
// transform is done on the rows, the first n/2 + 1 columns are real, and
// the remaining are the imaginary components. After the transform on the
// columns, the region of [0, n/2]x[0, n/2] contains the real part of
// fft of the real columns. The real part of the 2d fft also includes the
// imaginary part of transformed imaginary columns. This function assembles
// the correct outputs while putting the real and imaginary components
// next to each other.
static INLINE void unpack_2d_output(const float *col_fft, float *output,
                                    int n) {
  for (int y = 0; y <= n / 2; ++y) {
    const int y2 = y + n / 2;
    const int y_extra = y2 > n / 2 && y2 < n;

    for (int x = 0; x <= n / 2; ++x) {
      const int x2 = x + n / 2;
      const int x_extra = x2 > n / 2 && x2 < n;
      output[2 * (y * n + x)] =
          col_fft[y * n + x] - (x_extra && y_extra ? col_fft[y2 * n + x2] : 0);
      output[2 * (y * n + x) + 1] = (y_extra ? col_fft[y2 * n + x] : 0) +
                                    (x_extra ? col_fft[y * n + x2] : 0);
      if (y_extra) {
        output[2 * ((n - y) * n + x)] =
            col_fft[y * n + x] +
            (x_extra && y_extra ? col_fft[y2 * n + x2] : 0);
        output[2 * ((n - y) * n + x) + 1] =
            -(y_extra ? col_fft[y2 * n + x] : 0) +
            (x_extra ? col_fft[y * n + x2] : 0);
      }
    }
  }
}

void aom_fft_2d_gen(const float *input, float *temp, float *output, int n,
                    aom_fft_1d_func_t tform, aom_fft_transpose_func_t transpose,
                    aom_fft_unpack_func_t unpack, int vec_size) {
  for (int x = 0; x < n; x += vec_size) {
    tform(input + x, output + x, n);
  }
  transpose(output, temp, n);

  for (int x = 0; x < n; x += vec_size) {
    tform(temp + x, output + x, n);
  }
  transpose(output, temp, n);

  unpack(temp, output, n);
}

static INLINE void store_float(float *output, float input) { *output = input; }
static INLINE float add_float(float a, float b) { return a + b; }
static INLINE float sub_float(float a, float b) { return a - b; }
static INLINE float mul_float(float a, float b) { return a * b; }

GEN_FFT_2(void, float, float, float, *, store_float)
GEN_FFT_4(void, float, float, float, *, store_float, (float), add_float,
          sub_float)
GEN_FFT_8(void, float, float, float, *, store_float, (float), add_float,
          sub_float, mul_float)
GEN_FFT_16(void, float, float, float, *, store_float, (float), add_float,
           sub_float, mul_float)
GEN_FFT_32(void, float, float, float, *, store_float, (float), add_float,
           sub_float, mul_float)

void aom_fft2x2_float_c(const float *input, float *temp, float *output) {
  aom_fft_2d_gen(input, temp, output, 2, aom_fft1d_2_float, simple_transpose,
                 unpack_2d_output, 1);
}

void aom_fft4x4_float_c(const float *input, float *temp, float *output) {
  aom_fft_2d_gen(input, temp, output, 4, aom_fft1d_4_float, simple_transpose,
                 unpack_2d_output, 1);
}

void aom_fft8x8_float_c(const float *input, float *temp, float *output) {
  aom_fft_2d_gen(input, temp, output, 8, aom_fft1d_8_float, simple_transpose,
                 unpack_2d_output, 1);
}

void aom_fft16x16_float_c(const float *input, float *temp, float *output) {
  aom_fft_2d_gen(input, temp, output, 16, aom_fft1d_16_float, simple_transpose,
                 unpack_2d_output, 1);
}

void aom_fft32x32_float_c(const float *input, float *temp, float *output) {
  aom_fft_2d_gen(input, temp, output, 32, aom_fft1d_32_float, simple_transpose,
                 unpack_2d_output, 1);
}

void aom_ifft_2d_gen(const float *input, float *temp, float *output, int n,
                     aom_fft_1d_func_t fft_single, aom_fft_1d_func_t fft_multi,
                     aom_fft_1d_func_t ifft_multi,
                     aom_fft_transpose_func_t transpose, int vec_size) {
  // Column 0 and n/2 have conjugate symmetry, so we can directly do the ifft
  // and get real outputs.
  for (int y = 0; y <= n / 2; ++y) {
    output[y * n] = input[2 * y * n];
    output[y * n + 1] = input[2 * (y * n + n / 2)];
  }
  for (int y = n / 2 + 1; y < n; ++y) {
    output[y * n] = input[2 * (y - n / 2) * n + 1];
    output[y * n + 1] = input[2 * ((y - n / 2) * n + n / 2) + 1];
  }

  for (int i = 0; i < 2; i += vec_size) {
    ifft_multi(output + i, temp + i, n);
  }

  // For the other columns, since we don't have a full ifft for complex inputs
  // we have to split them into the real and imaginary counterparts.
  // Pack the real component, then the imaginary components.
  for (int y = 0; y < n; ++y) {
    for (int x = 1; x < n / 2; ++x) {
      output[y * n + (x + 1)] = input[2 * (y * n + x)];
    }
    for (int x = 1; x < n / 2; ++x) {
      output[y * n + (x + n / 2)] = input[2 * (y * n + x) + 1];
    }
  }
  for (int y = 2; y < vec_size; y++) {
    fft_single(output + y, temp + y, n);
  }
  // This is the part that can be sped up with SIMD
  for (int y = AOMMAX(2, vec_size); y < n; y += vec_size) {
    fft_multi(output + y, temp + y, n);
  }

  // Put the 0 and n/2 th results in the correct place.
  for (int x = 0; x < n; ++x) {
    output[x] = temp[x * n];
    output[(n / 2) * n + x] = temp[x * n + 1];
  }
  // This rearranges and transposes.
  for (int y = 1; y < n / 2; ++y) {
    // Fill in the real columns
    for (int x = 0; x <= n / 2; ++x) {
      output[x + y * n] =
          temp[(y + 1) + x * n] +
          ((x > 0 && x < n / 2) ? temp[(y + n / 2) + (x + n / 2) * n] : 0);
    }
    for (int x = n / 2 + 1; x < n; ++x) {
      output[x + y * n] = temp[(y + 1) + (n - x) * n] -
                          temp[(y + n / 2) + ((n - x) + n / 2) * n];
    }
    // Fill in the imag columns
    for (int x = 0; x <= n / 2; ++x) {
      output[x + (y + n / 2) * n] =
          temp[(y + n / 2) + x * n] -
          ((x > 0 && x < n / 2) ? temp[(y + 1) + (x + n / 2) * n] : 0);
    }
    for (int x = n / 2 + 1; x < n; ++x) {
      output[x + (y + n / 2) * n] = temp[(y + 1) + ((n - x) + n / 2) * n] +
                                    temp[(y + n / 2) + (n - x) * n];
    }
  }
  for (int y = 0; y < n; y += vec_size) {
    ifft_multi(output + y, temp + y, n);
  }
  transpose(temp, output, n);
}

GEN_IFFT_2(void, float, float, float, *, store_float)
GEN_IFFT_4(void, float, float, float, *, store_float, (float), add_float,
           sub_float)
GEN_IFFT_8(void, float, float, float, *, store_float, (float), add_float,
           sub_float, mul_float)
GEN_IFFT_16(void, float, float, float, *, store_float, (float), add_float,
            sub_float, mul_float)
GEN_IFFT_32(void, float, float, float, *, store_float, (float), add_float,
            sub_float, mul_float)

void aom_ifft2x2_float_c(const float *input, float *temp, float *output) {
  aom_ifft_2d_gen(input, temp, output, 2, aom_fft1d_2_float, aom_fft1d_2_float,
                  aom_ifft1d_2_float, simple_transpose, 1);
}

void aom_ifft4x4_float_c(const float *input, float *temp, float *output) {
  aom_ifft_2d_gen(input, temp, output, 4, aom_fft1d_4_float, aom_fft1d_4_float,
                  aom_ifft1d_4_float, simple_transpose, 1);
}

void aom_ifft8x8_float_c(const float *input, float *temp, float *output) {
  aom_ifft_2d_gen(input, temp, output, 8, aom_fft1d_8_float, aom_fft1d_8_float,
                  aom_ifft1d_8_float, simple_transpose, 1);
}

void aom_ifft16x16_float_c(const float *input, float *temp, float *output) {
  aom_ifft_2d_gen(input, temp, output, 16, aom_fft1d_16_float,
                  aom_fft1d_16_float, aom_ifft1d_16_float, simple_transpose, 1);
}

void aom_ifft32x32_float_c(const float *input, float *temp, float *output) {
  aom_ifft_2d_gen(input, temp, output, 32, aom_fft1d_32_float,
                  aom_fft1d_32_float, aom_ifft1d_32_float, simple_transpose, 1);
}
