1 /* 2 * Copyright (c) 2018, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 12 #ifndef AOM_AOM_DSP_FFT_COMMON_H_ 13 #define AOM_AOM_DSP_FFT_COMMON_H_ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /*!\brief A function pointer for computing 1d fft and ifft. 20 * 21 * The function will point to an implementation for a specific transform size, 22 * and may perform the transforms using vectorized instructions. 23 * 24 * For a non-vectorized forward transforms of size n, the input and output 25 * buffers will be size n. The output takes advantage of conjugate symmetry and 26 * packs the results as: [r_0, r_1, ..., r_{n/2}, i_1, ..., i_{n/2-1}], where 27 * (r_{j}, i_{j}) is the complex output for index j. 28 * 29 * An inverse transform will assume that the complex "input" is packed 30 * similarly. Its output will be real. 31 * 32 * Non-vectorized transforms (e.g., on a single row) would use a stride = 1. 33 * 34 * Vectorized implementations are parallelized along the columns so that the fft 35 * can be performed on multiple columns at a time. In such cases the data block 36 * for input and output is typically square (n x n) and the stride will 37 * correspond to the spacing between rows. At minimum, the input size must be 38 * n x simd_vector_length. 39 * 40 * \param[in] input Input buffer. See above for size restrictions. 41 * \param[out] output Output buffer. See above for size restrictions. 42 * \param[in] stride The spacing in number of elements between rows 43 * (or elements) 44 */ 45 typedef void (*aom_fft_1d_func_t)(const float *input, float *output, 46 int stride); 47 48 // Declare some of the forward non-vectorized transforms which are used in some 49 // of the vectorized implementations 50 void aom_fft1d_4_float(const float *input, float *output, int stride); 51 void aom_fft1d_8_float(const float *input, float *output, int stride); 52 void aom_fft1d_16_float(const float *input, float *output, int stride); 53 void aom_fft1d_32_float(const float *input, float *output, int stride); 54 55 /**\!brief Function pointer for transposing a matrix of floats. 56 * 57 * \param[in] input Input buffer (size n x n) 58 * \param[out] output Output buffer (size n x n) 59 * \param[in] n Extent of one dimension of the square matrix. 60 */ 61 typedef void (*aom_fft_transpose_func_t)(const float *input, float *output, 62 int n); 63 64 /**\!brief Function pointer for re-arranging intermediate 2d transform results. 65 * 66 * After re-arrangement, the real and imaginary components will be packed 67 * tightly next to each other. 68 * 69 * \param[in] input Input buffer (size n x n) 70 * \param[out] output Output buffer (size 2 x n x n) 71 * \param[in] n Extent of one dimension of the square matrix. 72 */ 73 typedef void (*aom_fft_unpack_func_t)(const float *input, float *output, int n); 74 75 /*!\brief Performs a 2d fft with the given functions. 76 * 77 * This generator function allows for multiple different implementations of 2d 78 * fft with different vector operations, without having to redefine the main 79 * body multiple times. 80 * 81 * \param[in] input Input buffer to run the transform on (size n x n) 82 * \param[out] temp Working buffer for computing the transform (size n x n) 83 * \param[out] output Output buffer (size 2 x n x n) 84 * \param[in] tform Forward transform function 85 * \param[in] transpose Transpose function (for n x n matrix) 86 * \param[in] unpack Unpack function used to massage outputs to correct form 87 * \param[in] vec_size Vector size (the transform is done vec_size units at 88 * a time) 89 */ 90 void aom_fft_2d_gen(const float *input, float *temp, float *output, int n, 91 aom_fft_1d_func_t tform, aom_fft_transpose_func_t transpose, 92 aom_fft_unpack_func_t unpack, int vec_size); 93 94 /*!\brief Perform a 2d inverse fft with the given helper functions 95 * 96 * \param[in] input Input buffer to run the transform on (size 2 x n x n) 97 * \param[out] temp Working buffer for computations (size 2 x n x n) 98 * \param[out] output Output buffer (size n x n) 99 * \param[in] fft_single Forward transform function (non vectorized) 100 * \param[in] fft_multi Forward transform function (vectorized) 101 * \param[in] ifft_multi Inverse transform function (vectorized) 102 * \param[in] transpose Transpose function (for n x n matrix) 103 * \param[in] vec_size Vector size (the transform is done vec_size 104 * units at a time) 105 */ 106 void aom_ifft_2d_gen(const float *input, float *temp, float *output, int n, 107 aom_fft_1d_func_t fft_single, aom_fft_1d_func_t fft_multi, 108 aom_fft_1d_func_t ifft_multi, 109 aom_fft_transpose_func_t transpose, int vec_size); 110 #ifdef __cplusplus 111 } 112 #endif 113 114 // The macros below define 1D fft/ifft for different data types and for 115 // different simd vector intrinsic types. 116 117 #define GEN_FFT_2(ret, suffix, T, T_VEC, load, store) \ 118 ret aom_fft1d_2_##suffix(const T *input, T *output, int stride) { \ 119 const T_VEC i0 = load(input + 0 * stride); \ 120 const T_VEC i1 = load(input + 1 * stride); \ 121 store(output + 0 * stride, i0 + i1); \ 122 store(output + 1 * stride, i0 - i1); \ 123 } 124 125 #define GEN_FFT_4(ret, suffix, T, T_VEC, load, store, constant, add, sub) \ 126 ret aom_fft1d_4_##suffix(const T *input, T *output, int stride) { \ 127 const T_VEC kWeight0 = constant(0.0f); \ 128 const T_VEC i0 = load(input + 0 * stride); \ 129 const T_VEC i1 = load(input + 1 * stride); \ 130 const T_VEC i2 = load(input + 2 * stride); \ 131 const T_VEC i3 = load(input + 3 * stride); \ 132 const T_VEC w0 = add(i0, i2); \ 133 const T_VEC w1 = sub(i0, i2); \ 134 const T_VEC w2 = add(i1, i3); \ 135 const T_VEC w3 = sub(i1, i3); \ 136 store(output + 0 * stride, add(w0, w2)); \ 137 store(output + 1 * stride, w1); \ 138 store(output + 2 * stride, sub(w0, w2)); \ 139 store(output + 3 * stride, sub(kWeight0, w3)); \ 140 } 141 142 #define GEN_FFT_8(ret, suffix, T, T_VEC, load, store, constant, add, sub, mul) \ 143 ret aom_fft1d_8_##suffix(const T *input, T *output, int stride) { \ 144 const T_VEC kWeight0 = constant(0.0f); \ 145 const T_VEC kWeight2 = constant(0.707107f); \ 146 const T_VEC i0 = load(input + 0 * stride); \ 147 const T_VEC i1 = load(input + 1 * stride); \ 148 const T_VEC i2 = load(input + 2 * stride); \ 149 const T_VEC i3 = load(input + 3 * stride); \ 150 const T_VEC i4 = load(input + 4 * stride); \ 151 const T_VEC i5 = load(input + 5 * stride); \ 152 const T_VEC i6 = load(input + 6 * stride); \ 153 const T_VEC i7 = load(input + 7 * stride); \ 154 const T_VEC w0 = add(i0, i4); \ 155 const T_VEC w1 = sub(i0, i4); \ 156 const T_VEC w2 = add(i2, i6); \ 157 const T_VEC w3 = sub(i2, i6); \ 158 const T_VEC w4 = add(w0, w2); \ 159 const T_VEC w5 = sub(w0, w2); \ 160 const T_VEC w7 = add(i1, i5); \ 161 const T_VEC w8 = sub(i1, i5); \ 162 const T_VEC w9 = add(i3, i7); \ 163 const T_VEC w10 = sub(i3, i7); \ 164 const T_VEC w11 = add(w7, w9); \ 165 const T_VEC w12 = sub(w7, w9); \ 166 store(output + 0 * stride, add(w4, w11)); \ 167 store(output + 1 * stride, add(w1, mul(kWeight2, sub(w8, w10)))); \ 168 store(output + 2 * stride, w5); \ 169 store(output + 3 * stride, sub(w1, mul(kWeight2, sub(w8, w10)))); \ 170 store(output + 4 * stride, sub(w4, w11)); \ 171 store(output + 5 * stride, \ 172 sub(sub(kWeight0, w3), mul(kWeight2, add(w10, w8)))); \ 173 store(output + 6 * stride, sub(kWeight0, w12)); \ 174 store(output + 7 * stride, sub(w3, mul(kWeight2, add(w10, w8)))); \ 175 } 176 177 #define GEN_FFT_16(ret, suffix, T, T_VEC, load, store, constant, add, sub, \ 178 mul) \ 179 ret aom_fft1d_16_##suffix(const T *input, T *output, int stride) { \ 180 const T_VEC kWeight0 = constant(0.0f); \ 181 const T_VEC kWeight2 = constant(0.707107f); \ 182 const T_VEC kWeight3 = constant(0.92388f); \ 183 const T_VEC kWeight4 = constant(0.382683f); \ 184 const T_VEC i0 = load(input + 0 * stride); \ 185 const T_VEC i1 = load(input + 1 * stride); \ 186 const T_VEC i2 = load(input + 2 * stride); \ 187 const T_VEC i3 = load(input + 3 * stride); \ 188 const T_VEC i4 = load(input + 4 * stride); \ 189 const T_VEC i5 = load(input + 5 * stride); \ 190 const T_VEC i6 = load(input + 6 * stride); \ 191 const T_VEC i7 = load(input + 7 * stride); \ 192 const T_VEC i8 = load(input + 8 * stride); \ 193 const T_VEC i9 = load(input + 9 * stride); \ 194 const T_VEC i10 = load(input + 10 * stride); \ 195 const T_VEC i11 = load(input + 11 * stride); \ 196 const T_VEC i12 = load(input + 12 * stride); \ 197 const T_VEC i13 = load(input + 13 * stride); \ 198 const T_VEC i14 = load(input + 14 * stride); \ 199 const T_VEC i15 = load(input + 15 * stride); \ 200 const T_VEC w0 = add(i0, i8); \ 201 const T_VEC w1 = sub(i0, i8); \ 202 const T_VEC w2 = add(i4, i12); \ 203 const T_VEC w3 = sub(i4, i12); \ 204 const T_VEC w4 = add(w0, w2); \ 205 const T_VEC w5 = sub(w0, w2); \ 206 const T_VEC w7 = add(i2, i10); \ 207 const T_VEC w8 = sub(i2, i10); \ 208 const T_VEC w9 = add(i6, i14); \ 209 const T_VEC w10 = sub(i6, i14); \ 210 const T_VEC w11 = add(w7, w9); \ 211 const T_VEC w12 = sub(w7, w9); \ 212 const T_VEC w14 = add(w4, w11); \ 213 const T_VEC w15 = sub(w4, w11); \ 214 const T_VEC w16[2] = { add(w1, mul(kWeight2, sub(w8, w10))), \ 215 sub(sub(kWeight0, w3), \ 216 mul(kWeight2, add(w10, w8))) }; \ 217 const T_VEC w18[2] = { sub(w1, mul(kWeight2, sub(w8, w10))), \ 218 sub(w3, mul(kWeight2, add(w10, w8))) }; \ 219 const T_VEC w19 = add(i1, i9); \ 220 const T_VEC w20 = sub(i1, i9); \ 221 const T_VEC w21 = add(i5, i13); \ 222 const T_VEC w22 = sub(i5, i13); \ 223 const T_VEC w23 = add(w19, w21); \ 224 const T_VEC w24 = sub(w19, w21); \ 225 const T_VEC w26 = add(i3, i11); \ 226 const T_VEC w27 = sub(i3, i11); \ 227 const T_VEC w28 = add(i7, i15); \ 228 const T_VEC w29 = sub(i7, i15); \ 229 const T_VEC w30 = add(w26, w28); \ 230 const T_VEC w31 = sub(w26, w28); \ 231 const T_VEC w33 = add(w23, w30); \ 232 const T_VEC w34 = sub(w23, w30); \ 233 const T_VEC w35[2] = { add(w20, mul(kWeight2, sub(w27, w29))), \ 234 sub(sub(kWeight0, w22), \ 235 mul(kWeight2, add(w29, w27))) }; \ 236 const T_VEC w37[2] = { sub(w20, mul(kWeight2, sub(w27, w29))), \ 237 sub(w22, mul(kWeight2, add(w29, w27))) }; \ 238 store(output + 0 * stride, add(w14, w33)); \ 239 store(output + 1 * stride, \ 240 add(w16[0], add(mul(kWeight3, w35[0]), mul(kWeight4, w35[1])))); \ 241 store(output + 2 * stride, add(w5, mul(kWeight2, sub(w24, w31)))); \ 242 store(output + 3 * stride, \ 243 add(w18[0], add(mul(kWeight4, w37[0]), mul(kWeight3, w37[1])))); \ 244 store(output + 4 * stride, w15); \ 245 store(output + 5 * stride, \ 246 add(w18[0], sub(sub(kWeight0, mul(kWeight4, w37[0])), \ 247 mul(kWeight3, w37[1])))); \ 248 store(output + 6 * stride, sub(w5, mul(kWeight2, sub(w24, w31)))); \ 249 store(output + 7 * stride, \ 250 add(w16[0], sub(sub(kWeight0, mul(kWeight3, w35[0])), \ 251 mul(kWeight4, w35[1])))); \ 252 store(output + 8 * stride, sub(w14, w33)); \ 253 store(output + 9 * stride, \ 254 add(w16[1], sub(mul(kWeight3, w35[1]), mul(kWeight4, w35[0])))); \ 255 store(output + 10 * stride, \ 256 sub(sub(kWeight0, w12), mul(kWeight2, add(w31, w24)))); \ 257 store(output + 11 * stride, \ 258 add(w18[1], sub(mul(kWeight4, w37[1]), mul(kWeight3, w37[0])))); \ 259 store(output + 12 * stride, sub(kWeight0, w34)); \ 260 store(output + 13 * stride, \ 261 sub(sub(kWeight0, w18[1]), \ 262 sub(mul(kWeight3, w37[0]), mul(kWeight4, w37[1])))); \ 263 store(output + 14 * stride, sub(w12, mul(kWeight2, add(w31, w24)))); \ 264 store(output + 15 * stride, \ 265 sub(sub(kWeight0, w16[1]), \ 266 sub(mul(kWeight4, w35[0]), mul(kWeight3, w35[1])))); \ 267 } 268 269 #define GEN_FFT_32(ret, suffix, T, T_VEC, load, store, constant, add, sub, \ 270 mul) \ 271 ret aom_fft1d_32_##suffix(const T *input, T *output, int stride) { \ 272 const T_VEC kWeight0 = constant(0.0f); \ 273 const T_VEC kWeight2 = constant(0.707107f); \ 274 const T_VEC kWeight3 = constant(0.92388f); \ 275 const T_VEC kWeight4 = constant(0.382683f); \ 276 const T_VEC kWeight5 = constant(0.980785f); \ 277 const T_VEC kWeight6 = constant(0.19509f); \ 278 const T_VEC kWeight7 = constant(0.83147f); \ 279 const T_VEC kWeight8 = constant(0.55557f); \ 280 const T_VEC i0 = load(input + 0 * stride); \ 281 const T_VEC i1 = load(input + 1 * stride); \ 282 const T_VEC i2 = load(input + 2 * stride); \ 283 const T_VEC i3 = load(input + 3 * stride); \ 284 const T_VEC i4 = load(input + 4 * stride); \ 285 const T_VEC i5 = load(input + 5 * stride); \ 286 const T_VEC i6 = load(input + 6 * stride); \ 287 const T_VEC i7 = load(input + 7 * stride); \ 288 const T_VEC i8 = load(input + 8 * stride); \ 289 const T_VEC i9 = load(input + 9 * stride); \ 290 const T_VEC i10 = load(input + 10 * stride); \ 291 const T_VEC i11 = load(input + 11 * stride); \ 292 const T_VEC i12 = load(input + 12 * stride); \ 293 const T_VEC i13 = load(input + 13 * stride); \ 294 const T_VEC i14 = load(input + 14 * stride); \ 295 const T_VEC i15 = load(input + 15 * stride); \ 296 const T_VEC i16 = load(input + 16 * stride); \ 297 const T_VEC i17 = load(input + 17 * stride); \ 298 const T_VEC i18 = load(input + 18 * stride); \ 299 const T_VEC i19 = load(input + 19 * stride); \ 300 const T_VEC i20 = load(input + 20 * stride); \ 301 const T_VEC i21 = load(input + 21 * stride); \ 302 const T_VEC i22 = load(input + 22 * stride); \ 303 const T_VEC i23 = load(input + 23 * stride); \ 304 const T_VEC i24 = load(input + 24 * stride); \ 305 const T_VEC i25 = load(input + 25 * stride); \ 306 const T_VEC i26 = load(input + 26 * stride); \ 307 const T_VEC i27 = load(input + 27 * stride); \ 308 const T_VEC i28 = load(input + 28 * stride); \ 309 const T_VEC i29 = load(input + 29 * stride); \ 310 const T_VEC i30 = load(input + 30 * stride); \ 311 const T_VEC i31 = load(input + 31 * stride); \ 312 const T_VEC w0 = add(i0, i16); \ 313 const T_VEC w1 = sub(i0, i16); \ 314 const T_VEC w2 = add(i8, i24); \ 315 const T_VEC w3 = sub(i8, i24); \ 316 const T_VEC w4 = add(w0, w2); \ 317 const T_VEC w5 = sub(w0, w2); \ 318 const T_VEC w7 = add(i4, i20); \ 319 const T_VEC w8 = sub(i4, i20); \ 320 const T_VEC w9 = add(i12, i28); \ 321 const T_VEC w10 = sub(i12, i28); \ 322 const T_VEC w11 = add(w7, w9); \ 323 const T_VEC w12 = sub(w7, w9); \ 324 const T_VEC w14 = add(w4, w11); \ 325 const T_VEC w15 = sub(w4, w11); \ 326 const T_VEC w16[2] = { add(w1, mul(kWeight2, sub(w8, w10))), \ 327 sub(sub(kWeight0, w3), \ 328 mul(kWeight2, add(w10, w8))) }; \ 329 const T_VEC w18[2] = { sub(w1, mul(kWeight2, sub(w8, w10))), \ 330 sub(w3, mul(kWeight2, add(w10, w8))) }; \ 331 const T_VEC w19 = add(i2, i18); \ 332 const T_VEC w20 = sub(i2, i18); \ 333 const T_VEC w21 = add(i10, i26); \ 334 const T_VEC w22 = sub(i10, i26); \ 335 const T_VEC w23 = add(w19, w21); \ 336 const T_VEC w24 = sub(w19, w21); \ 337 const T_VEC w26 = add(i6, i22); \ 338 const T_VEC w27 = sub(i6, i22); \ 339 const T_VEC w28 = add(i14, i30); \ 340 const T_VEC w29 = sub(i14, i30); \ 341 const T_VEC w30 = add(w26, w28); \ 342 const T_VEC w31 = sub(w26, w28); \ 343 const T_VEC w33 = add(w23, w30); \ 344 const T_VEC w34 = sub(w23, w30); \ 345 const T_VEC w35[2] = { add(w20, mul(kWeight2, sub(w27, w29))), \ 346 sub(sub(kWeight0, w22), \ 347 mul(kWeight2, add(w29, w27))) }; \ 348 const T_VEC w37[2] = { sub(w20, mul(kWeight2, sub(w27, w29))), \ 349 sub(w22, mul(kWeight2, add(w29, w27))) }; \ 350 const T_VEC w38 = add(w14, w33); \ 351 const T_VEC w39 = sub(w14, w33); \ 352 const T_VEC w40[2] = { \ 353 add(w16[0], add(mul(kWeight3, w35[0]), mul(kWeight4, w35[1]))), \ 354 add(w16[1], sub(mul(kWeight3, w35[1]), mul(kWeight4, w35[0]))) \ 355 }; \ 356 const T_VEC w41[2] = { add(w5, mul(kWeight2, sub(w24, w31))), \ 357 sub(sub(kWeight0, w12), \ 358 mul(kWeight2, add(w31, w24))) }; \ 359 const T_VEC w42[2] = { \ 360 add(w18[0], add(mul(kWeight4, w37[0]), mul(kWeight3, w37[1]))), \ 361 add(w18[1], sub(mul(kWeight4, w37[1]), mul(kWeight3, w37[0]))) \ 362 }; \ 363 const T_VEC w44[2] = { \ 364 add(w18[0], \ 365 sub(sub(kWeight0, mul(kWeight4, w37[0])), mul(kWeight3, w37[1]))), \ 366 sub(sub(kWeight0, w18[1]), \ 367 sub(mul(kWeight3, w37[0]), mul(kWeight4, w37[1]))) \ 368 }; \ 369 const T_VEC w45[2] = { sub(w5, mul(kWeight2, sub(w24, w31))), \ 370 sub(w12, mul(kWeight2, add(w31, w24))) }; \ 371 const T_VEC w46[2] = { \ 372 add(w16[0], \ 373 sub(sub(kWeight0, mul(kWeight3, w35[0])), mul(kWeight4, w35[1]))), \ 374 sub(sub(kWeight0, w16[1]), \ 375 sub(mul(kWeight4, w35[0]), mul(kWeight3, w35[1]))) \ 376 }; \ 377 const T_VEC w47 = add(i1, i17); \ 378 const T_VEC w48 = sub(i1, i17); \ 379 const T_VEC w49 = add(i9, i25); \ 380 const T_VEC w50 = sub(i9, i25); \ 381 const T_VEC w51 = add(w47, w49); \ 382 const T_VEC w52 = sub(w47, w49); \ 383 const T_VEC w54 = add(i5, i21); \ 384 const T_VEC w55 = sub(i5, i21); \ 385 const T_VEC w56 = add(i13, i29); \ 386 const T_VEC w57 = sub(i13, i29); \ 387 const T_VEC w58 = add(w54, w56); \ 388 const T_VEC w59 = sub(w54, w56); \ 389 const T_VEC w61 = add(w51, w58); \ 390 const T_VEC w62 = sub(w51, w58); \ 391 const T_VEC w63[2] = { add(w48, mul(kWeight2, sub(w55, w57))), \ 392 sub(sub(kWeight0, w50), \ 393 mul(kWeight2, add(w57, w55))) }; \ 394 const T_VEC w65[2] = { sub(w48, mul(kWeight2, sub(w55, w57))), \ 395 sub(w50, mul(kWeight2, add(w57, w55))) }; \ 396 const T_VEC w66 = add(i3, i19); \ 397 const T_VEC w67 = sub(i3, i19); \ 398 const T_VEC w68 = add(i11, i27); \ 399 const T_VEC w69 = sub(i11, i27); \ 400 const T_VEC w70 = add(w66, w68); \ 401 const T_VEC w71 = sub(w66, w68); \ 402 const T_VEC w73 = add(i7, i23); \ 403 const T_VEC w74 = sub(i7, i23); \ 404 const T_VEC w75 = add(i15, i31); \ 405 const T_VEC w76 = sub(i15, i31); \ 406 const T_VEC w77 = add(w73, w75); \ 407 const T_VEC w78 = sub(w73, w75); \ 408 const T_VEC w80 = add(w70, w77); \ 409 const T_VEC w81 = sub(w70, w77); \ 410 const T_VEC w82[2] = { add(w67, mul(kWeight2, sub(w74, w76))), \ 411 sub(sub(kWeight0, w69), \ 412 mul(kWeight2, add(w76, w74))) }; \ 413 const T_VEC w84[2] = { sub(w67, mul(kWeight2, sub(w74, w76))), \ 414 sub(w69, mul(kWeight2, add(w76, w74))) }; \ 415 const T_VEC w85 = add(w61, w80); \ 416 const T_VEC w86 = sub(w61, w80); \ 417 const T_VEC w87[2] = { \ 418 add(w63[0], add(mul(kWeight3, w82[0]), mul(kWeight4, w82[1]))), \ 419 add(w63[1], sub(mul(kWeight3, w82[1]), mul(kWeight4, w82[0]))) \ 420 }; \ 421 const T_VEC w88[2] = { add(w52, mul(kWeight2, sub(w71, w78))), \ 422 sub(sub(kWeight0, w59), \ 423 mul(kWeight2, add(w78, w71))) }; \ 424 const T_VEC w89[2] = { \ 425 add(w65[0], add(mul(kWeight4, w84[0]), mul(kWeight3, w84[1]))), \ 426 add(w65[1], sub(mul(kWeight4, w84[1]), mul(kWeight3, w84[0]))) \ 427 }; \ 428 const T_VEC w91[2] = { \ 429 add(w65[0], \ 430 sub(sub(kWeight0, mul(kWeight4, w84[0])), mul(kWeight3, w84[1]))), \ 431 sub(sub(kWeight0, w65[1]), \ 432 sub(mul(kWeight3, w84[0]), mul(kWeight4, w84[1]))) \ 433 }; \ 434 const T_VEC w92[2] = { sub(w52, mul(kWeight2, sub(w71, w78))), \ 435 sub(w59, mul(kWeight2, add(w78, w71))) }; \ 436 const T_VEC w93[2] = { \ 437 add(w63[0], \ 438 sub(sub(kWeight0, mul(kWeight3, w82[0])), mul(kWeight4, w82[1]))), \ 439 sub(sub(kWeight0, w63[1]), \ 440 sub(mul(kWeight4, w82[0]), mul(kWeight3, w82[1]))) \ 441 }; \ 442 store(output + 0 * stride, add(w38, w85)); \ 443 store(output + 1 * stride, \ 444 add(w40[0], add(mul(kWeight5, w87[0]), mul(kWeight6, w87[1])))); \ 445 store(output + 2 * stride, \ 446 add(w41[0], add(mul(kWeight3, w88[0]), mul(kWeight4, w88[1])))); \ 447 store(output + 3 * stride, \ 448 add(w42[0], add(mul(kWeight7, w89[0]), mul(kWeight8, w89[1])))); \ 449 store(output + 4 * stride, add(w15, mul(kWeight2, sub(w62, w81)))); \ 450 store(output + 5 * stride, \ 451 add(w44[0], add(mul(kWeight8, w91[0]), mul(kWeight7, w91[1])))); \ 452 store(output + 6 * stride, \ 453 add(w45[0], add(mul(kWeight4, w92[0]), mul(kWeight3, w92[1])))); \ 454 store(output + 7 * stride, \ 455 add(w46[0], add(mul(kWeight6, w93[0]), mul(kWeight5, w93[1])))); \ 456 store(output + 8 * stride, w39); \ 457 store(output + 9 * stride, \ 458 add(w46[0], sub(sub(kWeight0, mul(kWeight6, w93[0])), \ 459 mul(kWeight5, w93[1])))); \ 460 store(output + 10 * stride, \ 461 add(w45[0], sub(sub(kWeight0, mul(kWeight4, w92[0])), \ 462 mul(kWeight3, w92[1])))); \ 463 store(output + 11 * stride, \ 464 add(w44[0], sub(sub(kWeight0, mul(kWeight8, w91[0])), \ 465 mul(kWeight7, w91[1])))); \ 466 store(output + 12 * stride, sub(w15, mul(kWeight2, sub(w62, w81)))); \ 467 store(output + 13 * stride, \ 468 add(w42[0], sub(sub(kWeight0, mul(kWeight7, w89[0])), \ 469 mul(kWeight8, w89[1])))); \ 470 store(output + 14 * stride, \ 471 add(w41[0], sub(sub(kWeight0, mul(kWeight3, w88[0])), \ 472 mul(kWeight4, w88[1])))); \ 473 store(output + 15 * stride, \ 474 add(w40[0], sub(sub(kWeight0, mul(kWeight5, w87[0])), \ 475 mul(kWeight6, w87[1])))); \ 476 store(output + 16 * stride, sub(w38, w85)); \ 477 store(output + 17 * stride, \ 478 add(w40[1], sub(mul(kWeight5, w87[1]), mul(kWeight6, w87[0])))); \ 479 store(output + 18 * stride, \ 480 add(w41[1], sub(mul(kWeight3, w88[1]), mul(kWeight4, w88[0])))); \ 481 store(output + 19 * stride, \ 482 add(w42[1], sub(mul(kWeight7, w89[1]), mul(kWeight8, w89[0])))); \ 483 store(output + 20 * stride, \ 484 sub(sub(kWeight0, w34), mul(kWeight2, add(w81, w62)))); \ 485 store(output + 21 * stride, \ 486 add(w44[1], sub(mul(kWeight8, w91[1]), mul(kWeight7, w91[0])))); \ 487 store(output + 22 * stride, \ 488 add(w45[1], sub(mul(kWeight4, w92[1]), mul(kWeight3, w92[0])))); \ 489 store(output + 23 * stride, \ 490 add(w46[1], sub(mul(kWeight6, w93[1]), mul(kWeight5, w93[0])))); \ 491 store(output + 24 * stride, sub(kWeight0, w86)); \ 492 store(output + 25 * stride, \ 493 sub(sub(kWeight0, w46[1]), \ 494 sub(mul(kWeight5, w93[0]), mul(kWeight6, w93[1])))); \ 495 store(output + 26 * stride, \ 496 sub(sub(kWeight0, w45[1]), \ 497 sub(mul(kWeight3, w92[0]), mul(kWeight4, w92[1])))); \ 498 store(output + 27 * stride, \ 499 sub(sub(kWeight0, w44[1]), \ 500 sub(mul(kWeight7, w91[0]), mul(kWeight8, w91[1])))); \ 501 store(output + 28 * stride, sub(w34, mul(kWeight2, add(w81, w62)))); \ 502 store(output + 29 * stride, \ 503 sub(sub(kWeight0, w42[1]), \ 504 sub(mul(kWeight8, w89[0]), mul(kWeight7, w89[1])))); \ 505 store(output + 30 * stride, \ 506 sub(sub(kWeight0, w41[1]), \ 507 sub(mul(kWeight4, w88[0]), mul(kWeight3, w88[1])))); \ 508 store(output + 31 * stride, \ 509 sub(sub(kWeight0, w40[1]), \ 510 sub(mul(kWeight6, w87[0]), mul(kWeight5, w87[1])))); \ 511 } 512 513 #define GEN_IFFT_2(ret, suffix, T, T_VEC, load, store) \ 514 ret aom_ifft1d_2_##suffix(const T *input, T *output, int stride) { \ 515 const T_VEC i0 = load(input + 0 * stride); \ 516 const T_VEC i1 = load(input + 1 * stride); \ 517 store(output + 0 * stride, i0 + i1); \ 518 store(output + 1 * stride, i0 - i1); \ 519 } 520 521 #define GEN_IFFT_4(ret, suffix, T, T_VEC, load, store, constant, add, sub) \ 522 ret aom_ifft1d_4_##suffix(const T *input, T *output, int stride) { \ 523 const T_VEC kWeight0 = constant(0.0f); \ 524 const T_VEC i0 = load(input + 0 * stride); \ 525 const T_VEC i1 = load(input + 1 * stride); \ 526 const T_VEC i2 = load(input + 2 * stride); \ 527 const T_VEC i3 = load(input + 3 * stride); \ 528 const T_VEC w2 = add(i0, i2); \ 529 const T_VEC w3 = sub(i0, i2); \ 530 const T_VEC w4[2] = { add(i1, i1), sub(i3, i3) }; \ 531 const T_VEC w5[2] = { sub(i1, i1), sub(sub(kWeight0, i3), i3) }; \ 532 store(output + 0 * stride, add(w2, w4[0])); \ 533 store(output + 1 * stride, add(w3, w5[1])); \ 534 store(output + 2 * stride, sub(w2, w4[0])); \ 535 store(output + 3 * stride, sub(w3, w5[1])); \ 536 } 537 538 #define GEN_IFFT_8(ret, suffix, T, T_VEC, load, store, constant, add, sub, \ 539 mul) \ 540 ret aom_ifft1d_8_##suffix(const T *input, T *output, int stride) { \ 541 const T_VEC kWeight0 = constant(0.0f); \ 542 const T_VEC kWeight2 = constant(0.707107f); \ 543 const T_VEC i0 = load(input + 0 * stride); \ 544 const T_VEC i1 = load(input + 1 * stride); \ 545 const T_VEC i2 = load(input + 2 * stride); \ 546 const T_VEC i3 = load(input + 3 * stride); \ 547 const T_VEC i4 = load(input + 4 * stride); \ 548 const T_VEC i5 = load(input + 5 * stride); \ 549 const T_VEC i6 = load(input + 6 * stride); \ 550 const T_VEC i7 = load(input + 7 * stride); \ 551 const T_VEC w6 = add(i0, i4); \ 552 const T_VEC w7 = sub(i0, i4); \ 553 const T_VEC w8[2] = { add(i2, i2), sub(i6, i6) }; \ 554 const T_VEC w9[2] = { sub(i2, i2), sub(sub(kWeight0, i6), i6) }; \ 555 const T_VEC w10[2] = { add(w6, w8[0]), w8[1] }; \ 556 const T_VEC w11[2] = { sub(w6, w8[0]), sub(kWeight0, w8[1]) }; \ 557 const T_VEC w12[2] = { add(w7, w9[1]), sub(kWeight0, w9[0]) }; \ 558 const T_VEC w13[2] = { sub(w7, w9[1]), w9[0] }; \ 559 const T_VEC w14[2] = { add(i1, i3), sub(i7, i5) }; \ 560 const T_VEC w15[2] = { sub(i1, i3), sub(sub(kWeight0, i5), i7) }; \ 561 const T_VEC w16[2] = { add(i3, i1), sub(i5, i7) }; \ 562 const T_VEC w17[2] = { sub(i3, i1), sub(sub(kWeight0, i7), i5) }; \ 563 const T_VEC w18[2] = { add(w14[0], w16[0]), add(w14[1], w16[1]) }; \ 564 const T_VEC w19[2] = { sub(w14[0], w16[0]), sub(w14[1], w16[1]) }; \ 565 const T_VEC w20[2] = { add(w15[0], w17[1]), sub(w15[1], w17[0]) }; \ 566 const T_VEC w21[2] = { sub(w15[0], w17[1]), add(w15[1], w17[0]) }; \ 567 store(output + 0 * stride, add(w10[0], w18[0])); \ 568 store(output + 1 * stride, \ 569 add(w12[0], mul(kWeight2, add(w20[0], w20[1])))); \ 570 store(output + 2 * stride, add(w11[0], w19[1])); \ 571 store(output + 3 * stride, \ 572 sub(w13[0], mul(kWeight2, sub(w21[0], w21[1])))); \ 573 store(output + 4 * stride, sub(w10[0], w18[0])); \ 574 store(output + 5 * stride, \ 575 add(w12[0], sub(sub(kWeight0, mul(kWeight2, w20[0])), \ 576 mul(kWeight2, w20[1])))); \ 577 store(output + 6 * stride, sub(w11[0], w19[1])); \ 578 store(output + 7 * stride, \ 579 add(w13[0], mul(kWeight2, sub(w21[0], w21[1])))); \ 580 } 581 582 #define GEN_IFFT_16(ret, suffix, T, T_VEC, load, store, constant, add, sub, \ 583 mul) \ 584 ret aom_ifft1d_16_##suffix(const T *input, T *output, int stride) { \ 585 const T_VEC kWeight0 = constant(0.0f); \ 586 const T_VEC kWeight2 = constant(0.707107f); \ 587 const T_VEC kWeight3 = constant(0.92388f); \ 588 const T_VEC kWeight4 = constant(0.382683f); \ 589 const T_VEC i0 = load(input + 0 * stride); \ 590 const T_VEC i1 = load(input + 1 * stride); \ 591 const T_VEC i2 = load(input + 2 * stride); \ 592 const T_VEC i3 = load(input + 3 * stride); \ 593 const T_VEC i4 = load(input + 4 * stride); \ 594 const T_VEC i5 = load(input + 5 * stride); \ 595 const T_VEC i6 = load(input + 6 * stride); \ 596 const T_VEC i7 = load(input + 7 * stride); \ 597 const T_VEC i8 = load(input + 8 * stride); \ 598 const T_VEC i9 = load(input + 9 * stride); \ 599 const T_VEC i10 = load(input + 10 * stride); \ 600 const T_VEC i11 = load(input + 11 * stride); \ 601 const T_VEC i12 = load(input + 12 * stride); \ 602 const T_VEC i13 = load(input + 13 * stride); \ 603 const T_VEC i14 = load(input + 14 * stride); \ 604 const T_VEC i15 = load(input + 15 * stride); \ 605 const T_VEC w14 = add(i0, i8); \ 606 const T_VEC w15 = sub(i0, i8); \ 607 const T_VEC w16[2] = { add(i4, i4), sub(i12, i12) }; \ 608 const T_VEC w17[2] = { sub(i4, i4), sub(sub(kWeight0, i12), i12) }; \ 609 const T_VEC w18[2] = { add(w14, w16[0]), w16[1] }; \ 610 const T_VEC w19[2] = { sub(w14, w16[0]), sub(kWeight0, w16[1]) }; \ 611 const T_VEC w20[2] = { add(w15, w17[1]), sub(kWeight0, w17[0]) }; \ 612 const T_VEC w21[2] = { sub(w15, w17[1]), w17[0] }; \ 613 const T_VEC w22[2] = { add(i2, i6), sub(i14, i10) }; \ 614 const T_VEC w23[2] = { sub(i2, i6), sub(sub(kWeight0, i10), i14) }; \ 615 const T_VEC w24[2] = { add(i6, i2), sub(i10, i14) }; \ 616 const T_VEC w25[2] = { sub(i6, i2), sub(sub(kWeight0, i14), i10) }; \ 617 const T_VEC w26[2] = { add(w22[0], w24[0]), add(w22[1], w24[1]) }; \ 618 const T_VEC w27[2] = { sub(w22[0], w24[0]), sub(w22[1], w24[1]) }; \ 619 const T_VEC w28[2] = { add(w23[0], w25[1]), sub(w23[1], w25[0]) }; \ 620 const T_VEC w29[2] = { sub(w23[0], w25[1]), add(w23[1], w25[0]) }; \ 621 const T_VEC w30[2] = { add(w18[0], w26[0]), add(w18[1], w26[1]) }; \ 622 const T_VEC w31[2] = { sub(w18[0], w26[0]), sub(w18[1], w26[1]) }; \ 623 const T_VEC w32[2] = { add(w20[0], mul(kWeight2, add(w28[0], w28[1]))), \ 624 add(w20[1], mul(kWeight2, sub(w28[1], w28[0]))) }; \ 625 const T_VEC w33[2] = { add(w20[0], \ 626 sub(sub(kWeight0, mul(kWeight2, w28[0])), \ 627 mul(kWeight2, w28[1]))), \ 628 add(w20[1], mul(kWeight2, sub(w28[0], w28[1]))) }; \ 629 const T_VEC w34[2] = { add(w19[0], w27[1]), sub(w19[1], w27[0]) }; \ 630 const T_VEC w35[2] = { sub(w19[0], w27[1]), add(w19[1], w27[0]) }; \ 631 const T_VEC w36[2] = { sub(w21[0], mul(kWeight2, sub(w29[0], w29[1]))), \ 632 sub(w21[1], mul(kWeight2, add(w29[1], w29[0]))) }; \ 633 const T_VEC w37[2] = { add(w21[0], mul(kWeight2, sub(w29[0], w29[1]))), \ 634 add(w21[1], mul(kWeight2, add(w29[1], w29[0]))) }; \ 635 const T_VEC w38[2] = { add(i1, i7), sub(i15, i9) }; \ 636 const T_VEC w39[2] = { sub(i1, i7), sub(sub(kWeight0, i9), i15) }; \ 637 const T_VEC w40[2] = { add(i5, i3), sub(i11, i13) }; \ 638 const T_VEC w41[2] = { sub(i5, i3), sub(sub(kWeight0, i13), i11) }; \ 639 const T_VEC w42[2] = { add(w38[0], w40[0]), add(w38[1], w40[1]) }; \ 640 const T_VEC w43[2] = { sub(w38[0], w40[0]), sub(w38[1], w40[1]) }; \ 641 const T_VEC w44[2] = { add(w39[0], w41[1]), sub(w39[1], w41[0]) }; \ 642 const T_VEC w45[2] = { sub(w39[0], w41[1]), add(w39[1], w41[0]) }; \ 643 const T_VEC w46[2] = { add(i3, i5), sub(i13, i11) }; \ 644 const T_VEC w47[2] = { sub(i3, i5), sub(sub(kWeight0, i11), i13) }; \ 645 const T_VEC w48[2] = { add(i7, i1), sub(i9, i15) }; \ 646 const T_VEC w49[2] = { sub(i7, i1), sub(sub(kWeight0, i15), i9) }; \ 647 const T_VEC w50[2] = { add(w46[0], w48[0]), add(w46[1], w48[1]) }; \ 648 const T_VEC w51[2] = { sub(w46[0], w48[0]), sub(w46[1], w48[1]) }; \ 649 const T_VEC w52[2] = { add(w47[0], w49[1]), sub(w47[1], w49[0]) }; \ 650 const T_VEC w53[2] = { sub(w47[0], w49[1]), add(w47[1], w49[0]) }; \ 651 const T_VEC w54[2] = { add(w42[0], w50[0]), add(w42[1], w50[1]) }; \ 652 const T_VEC w55[2] = { sub(w42[0], w50[0]), sub(w42[1], w50[1]) }; \ 653 const T_VEC w56[2] = { add(w44[0], mul(kWeight2, add(w52[0], w52[1]))), \ 654 add(w44[1], mul(kWeight2, sub(w52[1], w52[0]))) }; \ 655 const T_VEC w57[2] = { add(w44[0], \ 656 sub(sub(kWeight0, mul(kWeight2, w52[0])), \ 657 mul(kWeight2, w52[1]))), \ 658 add(w44[1], mul(kWeight2, sub(w52[0], w52[1]))) }; \ 659 const T_VEC w58[2] = { add(w43[0], w51[1]), sub(w43[1], w51[0]) }; \ 660 const T_VEC w59[2] = { sub(w43[0], w51[1]), add(w43[1], w51[0]) }; \ 661 const T_VEC w60[2] = { sub(w45[0], mul(kWeight2, sub(w53[0], w53[1]))), \ 662 sub(w45[1], mul(kWeight2, add(w53[1], w53[0]))) }; \ 663 const T_VEC w61[2] = { add(w45[0], mul(kWeight2, sub(w53[0], w53[1]))), \ 664 add(w45[1], mul(kWeight2, add(w53[1], w53[0]))) }; \ 665 store(output + 0 * stride, add(w30[0], w54[0])); \ 666 store(output + 1 * stride, \ 667 add(w32[0], add(mul(kWeight3, w56[0]), mul(kWeight4, w56[1])))); \ 668 store(output + 2 * stride, \ 669 add(w34[0], mul(kWeight2, add(w58[0], w58[1])))); \ 670 store(output + 3 * stride, \ 671 add(w36[0], add(mul(kWeight4, w60[0]), mul(kWeight3, w60[1])))); \ 672 store(output + 4 * stride, add(w31[0], w55[1])); \ 673 store(output + 5 * stride, \ 674 sub(w33[0], sub(mul(kWeight4, w57[0]), mul(kWeight3, w57[1])))); \ 675 store(output + 6 * stride, \ 676 sub(w35[0], mul(kWeight2, sub(w59[0], w59[1])))); \ 677 store(output + 7 * stride, \ 678 sub(w37[0], sub(mul(kWeight3, w61[0]), mul(kWeight4, w61[1])))); \ 679 store(output + 8 * stride, sub(w30[0], w54[0])); \ 680 store(output + 9 * stride, \ 681 add(w32[0], sub(sub(kWeight0, mul(kWeight3, w56[0])), \ 682 mul(kWeight4, w56[1])))); \ 683 store(output + 10 * stride, \ 684 add(w34[0], sub(sub(kWeight0, mul(kWeight2, w58[0])), \ 685 mul(kWeight2, w58[1])))); \ 686 store(output + 11 * stride, \ 687 add(w36[0], sub(sub(kWeight0, mul(kWeight4, w60[0])), \ 688 mul(kWeight3, w60[1])))); \ 689 store(output + 12 * stride, sub(w31[0], w55[1])); \ 690 store(output + 13 * stride, \ 691 add(w33[0], sub(mul(kWeight4, w57[0]), mul(kWeight3, w57[1])))); \ 692 store(output + 14 * stride, \ 693 add(w35[0], mul(kWeight2, sub(w59[0], w59[1])))); \ 694 store(output + 15 * stride, \ 695 add(w37[0], sub(mul(kWeight3, w61[0]), mul(kWeight4, w61[1])))); \ 696 } 697 #define GEN_IFFT_32(ret, suffix, T, T_VEC, load, store, constant, add, sub, \ 698 mul) \ 699 ret aom_ifft1d_32_##suffix(const T *input, T *output, int stride) { \ 700 const T_VEC kWeight0 = constant(0.0f); \ 701 const T_VEC kWeight2 = constant(0.707107f); \ 702 const T_VEC kWeight3 = constant(0.92388f); \ 703 const T_VEC kWeight4 = constant(0.382683f); \ 704 const T_VEC kWeight5 = constant(0.980785f); \ 705 const T_VEC kWeight6 = constant(0.19509f); \ 706 const T_VEC kWeight7 = constant(0.83147f); \ 707 const T_VEC kWeight8 = constant(0.55557f); \ 708 const T_VEC i0 = load(input + 0 * stride); \ 709 const T_VEC i1 = load(input + 1 * stride); \ 710 const T_VEC i2 = load(input + 2 * stride); \ 711 const T_VEC i3 = load(input + 3 * stride); \ 712 const T_VEC i4 = load(input + 4 * stride); \ 713 const T_VEC i5 = load(input + 5 * stride); \ 714 const T_VEC i6 = load(input + 6 * stride); \ 715 const T_VEC i7 = load(input + 7 * stride); \ 716 const T_VEC i8 = load(input + 8 * stride); \ 717 const T_VEC i9 = load(input + 9 * stride); \ 718 const T_VEC i10 = load(input + 10 * stride); \ 719 const T_VEC i11 = load(input + 11 * stride); \ 720 const T_VEC i12 = load(input + 12 * stride); \ 721 const T_VEC i13 = load(input + 13 * stride); \ 722 const T_VEC i14 = load(input + 14 * stride); \ 723 const T_VEC i15 = load(input + 15 * stride); \ 724 const T_VEC i16 = load(input + 16 * stride); \ 725 const T_VEC i17 = load(input + 17 * stride); \ 726 const T_VEC i18 = load(input + 18 * stride); \ 727 const T_VEC i19 = load(input + 19 * stride); \ 728 const T_VEC i20 = load(input + 20 * stride); \ 729 const T_VEC i21 = load(input + 21 * stride); \ 730 const T_VEC i22 = load(input + 22 * stride); \ 731 const T_VEC i23 = load(input + 23 * stride); \ 732 const T_VEC i24 = load(input + 24 * stride); \ 733 const T_VEC i25 = load(input + 25 * stride); \ 734 const T_VEC i26 = load(input + 26 * stride); \ 735 const T_VEC i27 = load(input + 27 * stride); \ 736 const T_VEC i28 = load(input + 28 * stride); \ 737 const T_VEC i29 = load(input + 29 * stride); \ 738 const T_VEC i30 = load(input + 30 * stride); \ 739 const T_VEC i31 = load(input + 31 * stride); \ 740 const T_VEC w30 = add(i0, i16); \ 741 const T_VEC w31 = sub(i0, i16); \ 742 const T_VEC w32[2] = { add(i8, i8), sub(i24, i24) }; \ 743 const T_VEC w33[2] = { sub(i8, i8), sub(sub(kWeight0, i24), i24) }; \ 744 const T_VEC w34[2] = { add(w30, w32[0]), w32[1] }; \ 745 const T_VEC w35[2] = { sub(w30, w32[0]), sub(kWeight0, w32[1]) }; \ 746 const T_VEC w36[2] = { add(w31, w33[1]), sub(kWeight0, w33[0]) }; \ 747 const T_VEC w37[2] = { sub(w31, w33[1]), w33[0] }; \ 748 const T_VEC w38[2] = { add(i4, i12), sub(i28, i20) }; \ 749 const T_VEC w39[2] = { sub(i4, i12), sub(sub(kWeight0, i20), i28) }; \ 750 const T_VEC w40[2] = { add(i12, i4), sub(i20, i28) }; \ 751 const T_VEC w41[2] = { sub(i12, i4), sub(sub(kWeight0, i28), i20) }; \ 752 const T_VEC w42[2] = { add(w38[0], w40[0]), add(w38[1], w40[1]) }; \ 753 const T_VEC w43[2] = { sub(w38[0], w40[0]), sub(w38[1], w40[1]) }; \ 754 const T_VEC w44[2] = { add(w39[0], w41[1]), sub(w39[1], w41[0]) }; \ 755 const T_VEC w45[2] = { sub(w39[0], w41[1]), add(w39[1], w41[0]) }; \ 756 const T_VEC w46[2] = { add(w34[0], w42[0]), add(w34[1], w42[1]) }; \ 757 const T_VEC w47[2] = { sub(w34[0], w42[0]), sub(w34[1], w42[1]) }; \ 758 const T_VEC w48[2] = { add(w36[0], mul(kWeight2, add(w44[0], w44[1]))), \ 759 add(w36[1], mul(kWeight2, sub(w44[1], w44[0]))) }; \ 760 const T_VEC w49[2] = { add(w36[0], \ 761 sub(sub(kWeight0, mul(kWeight2, w44[0])), \ 762 mul(kWeight2, w44[1]))), \ 763 add(w36[1], mul(kWeight2, sub(w44[0], w44[1]))) }; \ 764 const T_VEC w50[2] = { add(w35[0], w43[1]), sub(w35[1], w43[0]) }; \ 765 const T_VEC w51[2] = { sub(w35[0], w43[1]), add(w35[1], w43[0]) }; \ 766 const T_VEC w52[2] = { sub(w37[0], mul(kWeight2, sub(w45[0], w45[1]))), \ 767 sub(w37[1], mul(kWeight2, add(w45[1], w45[0]))) }; \ 768 const T_VEC w53[2] = { add(w37[0], mul(kWeight2, sub(w45[0], w45[1]))), \ 769 add(w37[1], mul(kWeight2, add(w45[1], w45[0]))) }; \ 770 const T_VEC w54[2] = { add(i2, i14), sub(i30, i18) }; \ 771 const T_VEC w55[2] = { sub(i2, i14), sub(sub(kWeight0, i18), i30) }; \ 772 const T_VEC w56[2] = { add(i10, i6), sub(i22, i26) }; \ 773 const T_VEC w57[2] = { sub(i10, i6), sub(sub(kWeight0, i26), i22) }; \ 774 const T_VEC w58[2] = { add(w54[0], w56[0]), add(w54[1], w56[1]) }; \ 775 const T_VEC w59[2] = { sub(w54[0], w56[0]), sub(w54[1], w56[1]) }; \ 776 const T_VEC w60[2] = { add(w55[0], w57[1]), sub(w55[1], w57[0]) }; \ 777 const T_VEC w61[2] = { sub(w55[0], w57[1]), add(w55[1], w57[0]) }; \ 778 const T_VEC w62[2] = { add(i6, i10), sub(i26, i22) }; \ 779 const T_VEC w63[2] = { sub(i6, i10), sub(sub(kWeight0, i22), i26) }; \ 780 const T_VEC w64[2] = { add(i14, i2), sub(i18, i30) }; \ 781 const T_VEC w65[2] = { sub(i14, i2), sub(sub(kWeight0, i30), i18) }; \ 782 const T_VEC w66[2] = { add(w62[0], w64[0]), add(w62[1], w64[1]) }; \ 783 const T_VEC w67[2] = { sub(w62[0], w64[0]), sub(w62[1], w64[1]) }; \ 784 const T_VEC w68[2] = { add(w63[0], w65[1]), sub(w63[1], w65[0]) }; \ 785 const T_VEC w69[2] = { sub(w63[0], w65[1]), add(w63[1], w65[0]) }; \ 786 const T_VEC w70[2] = { add(w58[0], w66[0]), add(w58[1], w66[1]) }; \ 787 const T_VEC w71[2] = { sub(w58[0], w66[0]), sub(w58[1], w66[1]) }; \ 788 const T_VEC w72[2] = { add(w60[0], mul(kWeight2, add(w68[0], w68[1]))), \ 789 add(w60[1], mul(kWeight2, sub(w68[1], w68[0]))) }; \ 790 const T_VEC w73[2] = { add(w60[0], \ 791 sub(sub(kWeight0, mul(kWeight2, w68[0])), \ 792 mul(kWeight2, w68[1]))), \ 793 add(w60[1], mul(kWeight2, sub(w68[0], w68[1]))) }; \ 794 const T_VEC w74[2] = { add(w59[0], w67[1]), sub(w59[1], w67[0]) }; \ 795 const T_VEC w75[2] = { sub(w59[0], w67[1]), add(w59[1], w67[0]) }; \ 796 const T_VEC w76[2] = { sub(w61[0], mul(kWeight2, sub(w69[0], w69[1]))), \ 797 sub(w61[1], mul(kWeight2, add(w69[1], w69[0]))) }; \ 798 const T_VEC w77[2] = { add(w61[0], mul(kWeight2, sub(w69[0], w69[1]))), \ 799 add(w61[1], mul(kWeight2, add(w69[1], w69[0]))) }; \ 800 const T_VEC w78[2] = { add(w46[0], w70[0]), add(w46[1], w70[1]) }; \ 801 const T_VEC w79[2] = { sub(w46[0], w70[0]), sub(w46[1], w70[1]) }; \ 802 const T_VEC w80[2] = { \ 803 add(w48[0], add(mul(kWeight3, w72[0]), mul(kWeight4, w72[1]))), \ 804 add(w48[1], sub(mul(kWeight3, w72[1]), mul(kWeight4, w72[0]))) \ 805 }; \ 806 const T_VEC w81[2] = { \ 807 add(w48[0], \ 808 sub(sub(kWeight0, mul(kWeight3, w72[0])), mul(kWeight4, w72[1]))), \ 809 add(w48[1], sub(mul(kWeight4, w72[0]), mul(kWeight3, w72[1]))) \ 810 }; \ 811 const T_VEC w82[2] = { add(w50[0], mul(kWeight2, add(w74[0], w74[1]))), \ 812 add(w50[1], mul(kWeight2, sub(w74[1], w74[0]))) }; \ 813 const T_VEC w83[2] = { add(w50[0], \ 814 sub(sub(kWeight0, mul(kWeight2, w74[0])), \ 815 mul(kWeight2, w74[1]))), \ 816 add(w50[1], mul(kWeight2, sub(w74[0], w74[1]))) }; \ 817 const T_VEC w84[2] = { \ 818 add(w52[0], add(mul(kWeight4, w76[0]), mul(kWeight3, w76[1]))), \ 819 add(w52[1], sub(mul(kWeight4, w76[1]), mul(kWeight3, w76[0]))) \ 820 }; \ 821 const T_VEC w85[2] = { \ 822 add(w52[0], \ 823 sub(sub(kWeight0, mul(kWeight4, w76[0])), mul(kWeight3, w76[1]))), \ 824 add(w52[1], sub(mul(kWeight3, w76[0]), mul(kWeight4, w76[1]))) \ 825 }; \ 826 const T_VEC w86[2] = { add(w47[0], w71[1]), sub(w47[1], w71[0]) }; \ 827 const T_VEC w87[2] = { sub(w47[0], w71[1]), add(w47[1], w71[0]) }; \ 828 const T_VEC w88[2] = { \ 829 sub(w49[0], sub(mul(kWeight4, w73[0]), mul(kWeight3, w73[1]))), \ 830 add(w49[1], \ 831 sub(sub(kWeight0, mul(kWeight4, w73[1])), mul(kWeight3, w73[0]))) \ 832 }; \ 833 const T_VEC w89[2] = { \ 834 add(w49[0], sub(mul(kWeight4, w73[0]), mul(kWeight3, w73[1]))), \ 835 add(w49[1], add(mul(kWeight4, w73[1]), mul(kWeight3, w73[0]))) \ 836 }; \ 837 const T_VEC w90[2] = { sub(w51[0], mul(kWeight2, sub(w75[0], w75[1]))), \ 838 sub(w51[1], mul(kWeight2, add(w75[1], w75[0]))) }; \ 839 const T_VEC w91[2] = { add(w51[0], mul(kWeight2, sub(w75[0], w75[1]))), \ 840 add(w51[1], mul(kWeight2, add(w75[1], w75[0]))) }; \ 841 const T_VEC w92[2] = { \ 842 sub(w53[0], sub(mul(kWeight3, w77[0]), mul(kWeight4, w77[1]))), \ 843 add(w53[1], \ 844 sub(sub(kWeight0, mul(kWeight3, w77[1])), mul(kWeight4, w77[0]))) \ 845 }; \ 846 const T_VEC w93[2] = { \ 847 add(w53[0], sub(mul(kWeight3, w77[0]), mul(kWeight4, w77[1]))), \ 848 add(w53[1], add(mul(kWeight3, w77[1]), mul(kWeight4, w77[0]))) \ 849 }; \ 850 const T_VEC w94[2] = { add(i1, i15), sub(i31, i17) }; \ 851 const T_VEC w95[2] = { sub(i1, i15), sub(sub(kWeight0, i17), i31) }; \ 852 const T_VEC w96[2] = { add(i9, i7), sub(i23, i25) }; \ 853 const T_VEC w97[2] = { sub(i9, i7), sub(sub(kWeight0, i25), i23) }; \ 854 const T_VEC w98[2] = { add(w94[0], w96[0]), add(w94[1], w96[1]) }; \ 855 const T_VEC w99[2] = { sub(w94[0], w96[0]), sub(w94[1], w96[1]) }; \ 856 const T_VEC w100[2] = { add(w95[0], w97[1]), sub(w95[1], w97[0]) }; \ 857 const T_VEC w101[2] = { sub(w95[0], w97[1]), add(w95[1], w97[0]) }; \ 858 const T_VEC w102[2] = { add(i5, i11), sub(i27, i21) }; \ 859 const T_VEC w103[2] = { sub(i5, i11), sub(sub(kWeight0, i21), i27) }; \ 860 const T_VEC w104[2] = { add(i13, i3), sub(i19, i29) }; \ 861 const T_VEC w105[2] = { sub(i13, i3), sub(sub(kWeight0, i29), i19) }; \ 862 const T_VEC w106[2] = { add(w102[0], w104[0]), add(w102[1], w104[1]) }; \ 863 const T_VEC w107[2] = { sub(w102[0], w104[0]), sub(w102[1], w104[1]) }; \ 864 const T_VEC w108[2] = { add(w103[0], w105[1]), sub(w103[1], w105[0]) }; \ 865 const T_VEC w109[2] = { sub(w103[0], w105[1]), add(w103[1], w105[0]) }; \ 866 const T_VEC w110[2] = { add(w98[0], w106[0]), add(w98[1], w106[1]) }; \ 867 const T_VEC w111[2] = { sub(w98[0], w106[0]), sub(w98[1], w106[1]) }; \ 868 const T_VEC w112[2] = { \ 869 add(w100[0], mul(kWeight2, add(w108[0], w108[1]))), \ 870 add(w100[1], mul(kWeight2, sub(w108[1], w108[0]))) \ 871 }; \ 872 const T_VEC w113[2] = { \ 873 add(w100[0], \ 874 sub(sub(kWeight0, mul(kWeight2, w108[0])), mul(kWeight2, w108[1]))), \ 875 add(w100[1], mul(kWeight2, sub(w108[0], w108[1]))) \ 876 }; \ 877 const T_VEC w114[2] = { add(w99[0], w107[1]), sub(w99[1], w107[0]) }; \ 878 const T_VEC w115[2] = { sub(w99[0], w107[1]), add(w99[1], w107[0]) }; \ 879 const T_VEC w116[2] = { \ 880 sub(w101[0], mul(kWeight2, sub(w109[0], w109[1]))), \ 881 sub(w101[1], mul(kWeight2, add(w109[1], w109[0]))) \ 882 }; \ 883 const T_VEC w117[2] = { \ 884 add(w101[0], mul(kWeight2, sub(w109[0], w109[1]))), \ 885 add(w101[1], mul(kWeight2, add(w109[1], w109[0]))) \ 886 }; \ 887 const T_VEC w118[2] = { add(i3, i13), sub(i29, i19) }; \ 888 const T_VEC w119[2] = { sub(i3, i13), sub(sub(kWeight0, i19), i29) }; \ 889 const T_VEC w120[2] = { add(i11, i5), sub(i21, i27) }; \ 890 const T_VEC w121[2] = { sub(i11, i5), sub(sub(kWeight0, i27), i21) }; \ 891 const T_VEC w122[2] = { add(w118[0], w120[0]), add(w118[1], w120[1]) }; \ 892 const T_VEC w123[2] = { sub(w118[0], w120[0]), sub(w118[1], w120[1]) }; \ 893 const T_VEC w124[2] = { add(w119[0], w121[1]), sub(w119[1], w121[0]) }; \ 894 const T_VEC w125[2] = { sub(w119[0], w121[1]), add(w119[1], w121[0]) }; \ 895 const T_VEC w126[2] = { add(i7, i9), sub(i25, i23) }; \ 896 const T_VEC w127[2] = { sub(i7, i9), sub(sub(kWeight0, i23), i25) }; \ 897 const T_VEC w128[2] = { add(i15, i1), sub(i17, i31) }; \ 898 const T_VEC w129[2] = { sub(i15, i1), sub(sub(kWeight0, i31), i17) }; \ 899 const T_VEC w130[2] = { add(w126[0], w128[0]), add(w126[1], w128[1]) }; \ 900 const T_VEC w131[2] = { sub(w126[0], w128[0]), sub(w126[1], w128[1]) }; \ 901 const T_VEC w132[2] = { add(w127[0], w129[1]), sub(w127[1], w129[0]) }; \ 902 const T_VEC w133[2] = { sub(w127[0], w129[1]), add(w127[1], w129[0]) }; \ 903 const T_VEC w134[2] = { add(w122[0], w130[0]), add(w122[1], w130[1]) }; \ 904 const T_VEC w135[2] = { sub(w122[0], w130[0]), sub(w122[1], w130[1]) }; \ 905 const T_VEC w136[2] = { \ 906 add(w124[0], mul(kWeight2, add(w132[0], w132[1]))), \ 907 add(w124[1], mul(kWeight2, sub(w132[1], w132[0]))) \ 908 }; \ 909 const T_VEC w137[2] = { \ 910 add(w124[0], \ 911 sub(sub(kWeight0, mul(kWeight2, w132[0])), mul(kWeight2, w132[1]))), \ 912 add(w124[1], mul(kWeight2, sub(w132[0], w132[1]))) \ 913 }; \ 914 const T_VEC w138[2] = { add(w123[0], w131[1]), sub(w123[1], w131[0]) }; \ 915 const T_VEC w139[2] = { sub(w123[0], w131[1]), add(w123[1], w131[0]) }; \ 916 const T_VEC w140[2] = { \ 917 sub(w125[0], mul(kWeight2, sub(w133[0], w133[1]))), \ 918 sub(w125[1], mul(kWeight2, add(w133[1], w133[0]))) \ 919 }; \ 920 const T_VEC w141[2] = { \ 921 add(w125[0], mul(kWeight2, sub(w133[0], w133[1]))), \ 922 add(w125[1], mul(kWeight2, add(w133[1], w133[0]))) \ 923 }; \ 924 const T_VEC w142[2] = { add(w110[0], w134[0]), add(w110[1], w134[1]) }; \ 925 const T_VEC w143[2] = { sub(w110[0], w134[0]), sub(w110[1], w134[1]) }; \ 926 const T_VEC w144[2] = { \ 927 add(w112[0], add(mul(kWeight3, w136[0]), mul(kWeight4, w136[1]))), \ 928 add(w112[1], sub(mul(kWeight3, w136[1]), mul(kWeight4, w136[0]))) \ 929 }; \ 930 const T_VEC w145[2] = { \ 931 add(w112[0], \ 932 sub(sub(kWeight0, mul(kWeight3, w136[0])), mul(kWeight4, w136[1]))), \ 933 add(w112[1], sub(mul(kWeight4, w136[0]), mul(kWeight3, w136[1]))) \ 934 }; \ 935 const T_VEC w146[2] = { \ 936 add(w114[0], mul(kWeight2, add(w138[0], w138[1]))), \ 937 add(w114[1], mul(kWeight2, sub(w138[1], w138[0]))) \ 938 }; \ 939 const T_VEC w147[2] = { \ 940 add(w114[0], \ 941 sub(sub(kWeight0, mul(kWeight2, w138[0])), mul(kWeight2, w138[1]))), \ 942 add(w114[1], mul(kWeight2, sub(w138[0], w138[1]))) \ 943 }; \ 944 const T_VEC w148[2] = { \ 945 add(w116[0], add(mul(kWeight4, w140[0]), mul(kWeight3, w140[1]))), \ 946 add(w116[1], sub(mul(kWeight4, w140[1]), mul(kWeight3, w140[0]))) \ 947 }; \ 948 const T_VEC w149[2] = { \ 949 add(w116[0], \ 950 sub(sub(kWeight0, mul(kWeight4, w140[0])), mul(kWeight3, w140[1]))), \ 951 add(w116[1], sub(mul(kWeight3, w140[0]), mul(kWeight4, w140[1]))) \ 952 }; \ 953 const T_VEC w150[2] = { add(w111[0], w135[1]), sub(w111[1], w135[0]) }; \ 954 const T_VEC w151[2] = { sub(w111[0], w135[1]), add(w111[1], w135[0]) }; \ 955 const T_VEC w152[2] = { \ 956 sub(w113[0], sub(mul(kWeight4, w137[0]), mul(kWeight3, w137[1]))), \ 957 add(w113[1], \ 958 sub(sub(kWeight0, mul(kWeight4, w137[1])), mul(kWeight3, w137[0]))) \ 959 }; \ 960 const T_VEC w153[2] = { \ 961 add(w113[0], sub(mul(kWeight4, w137[0]), mul(kWeight3, w137[1]))), \ 962 add(w113[1], add(mul(kWeight4, w137[1]), mul(kWeight3, w137[0]))) \ 963 }; \ 964 const T_VEC w154[2] = { \ 965 sub(w115[0], mul(kWeight2, sub(w139[0], w139[1]))), \ 966 sub(w115[1], mul(kWeight2, add(w139[1], w139[0]))) \ 967 }; \ 968 const T_VEC w155[2] = { \ 969 add(w115[0], mul(kWeight2, sub(w139[0], w139[1]))), \ 970 add(w115[1], mul(kWeight2, add(w139[1], w139[0]))) \ 971 }; \ 972 const T_VEC w156[2] = { \ 973 sub(w117[0], sub(mul(kWeight3, w141[0]), mul(kWeight4, w141[1]))), \ 974 add(w117[1], \ 975 sub(sub(kWeight0, mul(kWeight3, w141[1])), mul(kWeight4, w141[0]))) \ 976 }; \ 977 const T_VEC w157[2] = { \ 978 add(w117[0], sub(mul(kWeight3, w141[0]), mul(kWeight4, w141[1]))), \ 979 add(w117[1], add(mul(kWeight3, w141[1]), mul(kWeight4, w141[0]))) \ 980 }; \ 981 store(output + 0 * stride, add(w78[0], w142[0])); \ 982 store(output + 1 * stride, \ 983 add(w80[0], add(mul(kWeight5, w144[0]), mul(kWeight6, w144[1])))); \ 984 store(output + 2 * stride, \ 985 add(w82[0], add(mul(kWeight3, w146[0]), mul(kWeight4, w146[1])))); \ 986 store(output + 3 * stride, \ 987 add(w84[0], add(mul(kWeight7, w148[0]), mul(kWeight8, w148[1])))); \ 988 store(output + 4 * stride, \ 989 add(w86[0], mul(kWeight2, add(w150[0], w150[1])))); \ 990 store(output + 5 * stride, \ 991 add(w88[0], add(mul(kWeight8, w152[0]), mul(kWeight7, w152[1])))); \ 992 store(output + 6 * stride, \ 993 add(w90[0], add(mul(kWeight4, w154[0]), mul(kWeight3, w154[1])))); \ 994 store(output + 7 * stride, \ 995 add(w92[0], add(mul(kWeight6, w156[0]), mul(kWeight5, w156[1])))); \ 996 store(output + 8 * stride, add(w79[0], w143[1])); \ 997 store(output + 9 * stride, \ 998 sub(w81[0], sub(mul(kWeight6, w145[0]), mul(kWeight5, w145[1])))); \ 999 store(output + 10 * stride, \ 1000 sub(w83[0], sub(mul(kWeight4, w147[0]), mul(kWeight3, w147[1])))); \ 1001 store(output + 11 * stride, \ 1002 sub(w85[0], sub(mul(kWeight8, w149[0]), mul(kWeight7, w149[1])))); \ 1003 store(output + 12 * stride, \ 1004 sub(w87[0], mul(kWeight2, sub(w151[0], w151[1])))); \ 1005 store(output + 13 * stride, \ 1006 sub(w89[0], sub(mul(kWeight7, w153[0]), mul(kWeight8, w153[1])))); \ 1007 store(output + 14 * stride, \ 1008 sub(w91[0], sub(mul(kWeight3, w155[0]), mul(kWeight4, w155[1])))); \ 1009 store(output + 15 * stride, \ 1010 sub(w93[0], sub(mul(kWeight5, w157[0]), mul(kWeight6, w157[1])))); \ 1011 store(output + 16 * stride, sub(w78[0], w142[0])); \ 1012 store(output + 17 * stride, \ 1013 add(w80[0], sub(sub(kWeight0, mul(kWeight5, w144[0])), \ 1014 mul(kWeight6, w144[1])))); \ 1015 store(output + 18 * stride, \ 1016 add(w82[0], sub(sub(kWeight0, mul(kWeight3, w146[0])), \ 1017 mul(kWeight4, w146[1])))); \ 1018 store(output + 19 * stride, \ 1019 add(w84[0], sub(sub(kWeight0, mul(kWeight7, w148[0])), \ 1020 mul(kWeight8, w148[1])))); \ 1021 store(output + 20 * stride, \ 1022 add(w86[0], sub(sub(kWeight0, mul(kWeight2, w150[0])), \ 1023 mul(kWeight2, w150[1])))); \ 1024 store(output + 21 * stride, \ 1025 add(w88[0], sub(sub(kWeight0, mul(kWeight8, w152[0])), \ 1026 mul(kWeight7, w152[1])))); \ 1027 store(output + 22 * stride, \ 1028 add(w90[0], sub(sub(kWeight0, mul(kWeight4, w154[0])), \ 1029 mul(kWeight3, w154[1])))); \ 1030 store(output + 23 * stride, \ 1031 add(w92[0], sub(sub(kWeight0, mul(kWeight6, w156[0])), \ 1032 mul(kWeight5, w156[1])))); \ 1033 store(output + 24 * stride, sub(w79[0], w143[1])); \ 1034 store(output + 25 * stride, \ 1035 add(w81[0], sub(mul(kWeight6, w145[0]), mul(kWeight5, w145[1])))); \ 1036 store(output + 26 * stride, \ 1037 add(w83[0], sub(mul(kWeight4, w147[0]), mul(kWeight3, w147[1])))); \ 1038 store(output + 27 * stride, \ 1039 add(w85[0], sub(mul(kWeight8, w149[0]), mul(kWeight7, w149[1])))); \ 1040 store(output + 28 * stride, \ 1041 add(w87[0], mul(kWeight2, sub(w151[0], w151[1])))); \ 1042 store(output + 29 * stride, \ 1043 add(w89[0], sub(mul(kWeight7, w153[0]), mul(kWeight8, w153[1])))); \ 1044 store(output + 30 * stride, \ 1045 add(w91[0], sub(mul(kWeight3, w155[0]), mul(kWeight4, w155[1])))); \ 1046 store(output + 31 * stride, \ 1047 add(w93[0], sub(mul(kWeight5, w157[0]), mul(kWeight6, w157[1])))); \ 1048 } 1049 1050 #endif // AOM_AOM_DSP_FFT_COMMON_H_ 1051