1333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com/* 2333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 3333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * 4333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * Use of this source code is governed by a BSD-style license 5333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * that can be found in the LICENSE file in the root of the source 6333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * tree. An additional intellectual property rights grant can be found 7333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * in the file PATENTS. All contributing project authors may 8333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * be found in the AUTHORS file in the root of the source tree. 9333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * 10333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com */ 11333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com 12333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com#include "dl/api/omxtypes.h" 13333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com#include "dl/sp/api/mipsSP.h" 14333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com#include "dl/sp/api/omxSP.h" 15333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com 16333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.comOMXResult omxSP_FFTGetBufSize_R_F32(OMX_INT order, OMX_INT* pSize) { 179ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com OMX_INT fft_size, offset_lut_size; 18333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com 19333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com if (!pSize || (order < 1) || (order > TWIDDLE_TABLE_ORDER)) 20333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com return OMX_Sts_BadArgErr; 21333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com 22333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com /* For order larger than 4, compute Real FFT as Complex FFT of (order - 1). */ 239ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com if (order > 4) { 24333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com fft_size = 1 << (order - 1); 259ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com offset_lut_size = (SUBTRANSFORM_CONST >> (16 - order)) | 1; 269ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com } else { 27333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com fft_size = 1 << order; 289ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com offset_lut_size = (SUBTRANSFORM_CONST >> (17 - order)) | 1; 299ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com } 30333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com 31333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com *pSize = sizeof(MIPSFFTSpec_R_FC32) + 32333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com /* BitRev Table. */ 33333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com sizeof(OMX_U16) * fft_size + 34333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com /* BitRevInv Table. */ 35333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com sizeof(OMX_U16) * fft_size + 36333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com /* Offsets table. */ 379ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com sizeof(OMX_U16) * offset_lut_size + 389ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com /* Twiddle table */ 399ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com sizeof(OMX_F32) * (1 << (order - 2)) + 40333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com /* pBuf. */ 41333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com sizeof(OMX_F32) * (fft_size << 1) + 42333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com /* 43333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com * Extra bytes to get 32 byte alignment of 449ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com * pBitRev, pBitRevInv, pOffset, pTwiddle and pBuf. 45333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com */ 469ab9ca2eea7faace5864110006fc9044d237f960rtoy@google.com 155; 47333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com 48333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com return OMX_Sts_NoErr; 49333c00b74820c9dc0022d124c5a10a788d74d5cartoy@google.com} 50