transform.h revision 6cfabd35363c3ef5e3b209b867169a500b3ccc3c
16cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK/* -----------------------------------------------------------------------------
22228e360595641dd906bf1773307f43d304f5b2The Android Open Source ProjectSoftware License for The Fraunhofer FDK AAC Codec Library for Android
32228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
46cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK© Copyright  1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
56cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKForschung e.V. All rights reserved.
62228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
72228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project 1.    INTRODUCTION
86cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKThe Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software
96cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthat implements the MPEG Advanced Audio Coding ("AAC") encoding and decoding
106cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKscheme for digital audio. This FDK AAC Codec software is intended to be used on
116cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKa wide variety of Android devices.
126cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK
136cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKAAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient
146cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKgeneral perceptual audio codecs. AAC-ELD is considered the best-performing
156cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKfull-bandwidth communications codec by independent studies and is widely
166cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKdeployed. AAC has been standardized by ISO and IEC as part of the MPEG
176cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKspecifications.
186cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK
196cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKPatent licenses for necessary patent claims for the FDK AAC Codec (including
206cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthose of Fraunhofer) may be obtained through Via Licensing
216cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK(www.vialicensing.com) or through the respective patent owners individually for
226cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthe purpose of encoding or decoding bit streams in products that are compliant
236cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKwith the ISO/IEC MPEG audio standards. Please note that most manufacturers of
246cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKAndroid devices already license these patent claims through Via Licensing or
256cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKdirectly from the patent owners, and therefore FDK AAC Codec software may
266cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKalready be covered under those patent licenses when it is used for those
276cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKlicensed purposes only.
286cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK
296cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKCommercially-licensed AAC software libraries, including floating-point versions
306cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKwith enhanced sound quality, are also available from Fraunhofer. Users are
316cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKencouraged to check the Fraunhofer website for additional applications
326cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKinformation and documentation.
332228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
342228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project2.    COPYRIGHT LICENSE
352228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
366cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKRedistribution and use in source and binary forms, with or without modification,
376cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKare permitted without payment of copyright license fees provided that you
386cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKsatisfy the following conditions:
392228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
406cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKYou must retain the complete text of this software license in redistributions of
416cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthe FDK AAC Codec or your modifications thereto in source code form.
422228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
436cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKYou must retain the complete text of this software license in the documentation
446cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKand/or other materials provided with redistributions of the FDK AAC Codec or
456cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKyour modifications thereto in binary form. You must make available free of
466cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKcharge copies of the complete source code of the FDK AAC Codec and your
472228e360595641dd906bf1773307f43d304f5b2The Android Open Source Projectmodifications thereto to recipients of copies in binary form.
482228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
496cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKThe name of Fraunhofer may not be used to endorse or promote products derived
506cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKfrom this library without prior written permission.
512228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
526cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKYou may not charge copyright license fees for anyone to use, copy or distribute
536cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthe FDK AAC Codec software or your modifications thereto.
542228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
556cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKYour modified versions of the FDK AAC Codec must carry prominent notices stating
566cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthat you changed the software and the date of any change. For modified versions
576cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKof the FDK AAC Codec, the term "Fraunhofer FDK AAC Codec Library for Android"
586cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKmust be replaced by the term "Third-Party Modified Version of the Fraunhofer FDK
596cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKAAC Codec Library for Android."
602228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
612228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project3.    NO PATENT LICENSE
622228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
636cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKNO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without
646cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKlimitation the patents of Fraunhofer, ARE GRANTED BY THIS SOFTWARE LICENSE.
656cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKFraunhofer provides no warranty of patent non-infringement with respect to this
666cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKsoftware.
672228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
686cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKYou may use this FDK AAC Codec software or modifications thereto only for
696cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKpurposes that are authorized by appropriate patent licenses.
702228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
712228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project4.    DISCLAIMER
722228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
736cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKThis FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright
746cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKholders and contributors "AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
756cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKincluding but not limited to the implied warranties of merchantability and
766cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKfitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
776cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKCONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary,
786cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKor consequential damages, including but not limited to procurement of substitute
796cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKgoods or services; loss of use, data, or profits, or business interruption,
806cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKhowever caused and on any theory of liability, whether in contract, strict
816cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKliability, or tort (including negligence), arising in any way out of the use of
826cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKthis software, even if advised of the possibility of such damage.
832228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
842228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project5.    CONTACT INFORMATION
852228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
862228e360595641dd906bf1773307f43d304f5b2The Android Open Source ProjectFraunhofer Institute for Integrated Circuits IIS
872228e360595641dd906bf1773307f43d304f5b2The Android Open Source ProjectAttention: Audio and Multimedia Departments - FDK AAC LL
882228e360595641dd906bf1773307f43d304f5b2The Android Open Source ProjectAm Wolfsmantel 33
892228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project91058 Erlangen, Germany
902228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
912228e360595641dd906bf1773307f43d304f5b2The Android Open Source Projectwww.iis.fraunhofer.de/amm
922228e360595641dd906bf1773307f43d304f5b2The Android Open Source Projectamm-info@iis.fraunhofer.de
936cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK----------------------------------------------------------------------------- */
946cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK
956cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK/**************************** AAC encoder library ******************************
962228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
976cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK   Author(s):   M. Werner
982228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
996cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK   Description: MDCT Transform
1002228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
1016cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK*******************************************************************************/
1022228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
1036cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK#ifndef TRANSFORM_H
1046cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK#define TRANSFORM_H
1052228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
1066cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK#include "mdct.h"
1072228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project#include "common_fix.h"
1082228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
1092228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project#define WTS0 1
1102228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project#define WTS1 0
1112228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project#define WTS2 -2
1122228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project
1132228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project/**
1142228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project * \brief: Performe MDCT transform of time domain data.
1152228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project * \param timeData pointer to time domain input signal.
1162228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project * \param mdctData pointer to store frequency domain output data.
1172228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project * \param blockType index indicating the type of block. Either
1182228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project *        LONG_WINDOW, START_WINDOW, SHORT_WINDOW or STOP_WINDOW.
1192228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project * \param windowShape index indicating the window slope type to be used.
1202228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project *        Values allowed are either SINE_WINDOW or KBD_WINDOW.
1216cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param previndowShape index indicating the window slope type used
1226cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        in the last frame.
1236cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        Values allowed are either SINE_WINDOW or KBD_WINDOW.
1246cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param frameLength length of the block. Either 1024 or 960.
1256cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param mdctData_e pointer to an INT where the exponent of the frequency
1266cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        domain output data is stored into.
1276cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param filterType xxx
1286cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \return 0 in case of success, non-zero in case of error (inconsistent
1296cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * parameters).
1306cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK */
1316cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKINT FDKaacEnc_Transform_Real(const INT_PCM* pTimeData,
1326cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                             FIXP_DBL* RESTRICT mdctData, const INT blockType,
1336cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                             const INT windowShape, INT* prevWindowShape,
1346cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                             H_MDCT mdctPers, const INT frameLength,
1356cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                             INT* pMdctData_e, INT filterType);
1366cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK
1376cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK/**
1386cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \brief: Performe ELD filterbnank transform of time domain data.
1396cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param timeData pointer to time domain input signal.
1406cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param mdctData pointer to store frequency domain output data.
1416cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param blockType index indicating the type of block. Either
1426cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        LONG_WINDOW, START_WINDOW, SHORT_WINDOW or STOP_WINDOW.
1436cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param windowShape index indicating the window slope type to be used.
1446cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        Values allowed are either SINE_WINDOW or KBD_WINDOW.
1456cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param previndowShape index indicating the window slope type used
1466cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        in the last frame.
1476cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK *        Values allowed are either SINE_WINDOW or KBD_WINDOW.
1486cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param frameLength length of the block. Either 1024 or 960.
1492228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project * \param mdctData_e pointer to an INT where the exponent of the frequency
1502228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project *        domain output data is stored into.
1516cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param filterType xxx
1526cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \param overlapAddBuffer overlap add buffer for overlap of ELD filterbank
1536cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * \return 0 in case of success, non-zero in case of error (inconsistent
1546cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK * parameters).
1552228e360595641dd906bf1773307f43d304f5b2The Android Open Source Project */
1566cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDKINT FDKaacEnc_Transform_Real_Eld(const INT_PCM* pTimeData,
1576cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                                 FIXP_DBL* RESTRICT mdctData,
1586cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                                 const INT blockType, const INT windowShape,
1596cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                                 INT* prevWindowShape, const INT frameLength,
1606cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                                 INT* mdctData_e, INT filterType,
1616cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK                                 FIXP_DBL* RESTRICT overlapAddBuffer);
1626cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK
1636cfabd35363c3ef5e3b209b867169a500b3ccc3cFraunhofer IIS FDK#endif /* #!defined (TRANSFORM_H) */
164