[FFmpeg-devel] [PATCH 02/14] libavcodec: Implementation of AAC_fixed_decoder (LC-module) [2/5]
Nedeljko Babic
nedeljko.babic at imgtec.com
Fri Aug 1 15:53:08 CEST 2014
From: Djordje Pesut <djordje.pesut at imgtec.com>
Add float emulation
Signed-off-by: Nedeljko Babic <nedeljko.babic at imgtec.com>
---
libavcodec/aac_float_emu.h | 698 +++++++++++++++++++++++++++++++++++++++++++++
libavcodec/float_emu.h | 400 ++++++++++++++++++++++++++
libavcodec/float_emu_tab.c | 296 +++++++++++++++++++
3 files changed, 1394 insertions(+)
create mode 100644 libavcodec/aac_float_emu.h
create mode 100644 libavcodec/float_emu.h
create mode 100644 libavcodec/float_emu_tab.c
diff --git a/libavcodec/aac_float_emu.h b/libavcodec/aac_float_emu.h
new file mode 100644
index 0000000..f7a4fa0
--- /dev/null
+++ b/libavcodec/aac_float_emu.h
@@ -0,0 +1,698 @@
+/*
+ * Copyright (c) 2012
+ * MIPS Technologies, Inc., California.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the MIPS Technologies, Inc., nor the names of is
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Author: Stanislav Ocovaj (stanislav.ocovaj imgtec com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if !defined(_AAC_FLOAT_EMU_)
+#define _AAC_FLOAT_EMU_
+
+#include "libavutil/common.h"
+
+typedef struct aac_float_t {
+ int mant;
+ int expo;
+} aac_float_t;
+
+#define ADD_SUFFIX(a) a ## _fixed
+#define Q30(x) (int)((x)*1073741824.0 + 0.5)
+#define Q31(x) (int)((x)*2147483648.0 + 0.5)
+
+#define ff_log2_tab ADD_SUFFIX(ff_log2_tab)
+#define divTable ADD_SUFFIX(divTable)
+#define sqrtTab ADD_SUFFIX(sqrtTab)
+#define sqrExpMultTab ADD_SUFFIX(sqrExpMultTab)
+#define aac_costbl_1 ADD_SUFFIX(aac_costbl_1)
+#define aac_costbl_2 ADD_SUFFIX(aac_costbl_2)
+#define aac_sintbl_2 ADD_SUFFIX(aac_sintbl_2)
+#define aac_costbl_3 ADD_SUFFIX(aac_costbl_3)
+#define aac_sintbl_3 ADD_SUFFIX(aac_sintbl_3)
+#define aac_costbl_4 ADD_SUFFIX(aac_costbl_4)
+#define aac_sintbl_4 ADD_SUFFIX(aac_sintbl_4)
+
+static const aac_float_t FLOAT_0 = { 0, 0};
+static const aac_float_t FLOAT_05 = { 536870912, 0};
+static const aac_float_t FLOAT_1 = { 536870912, 1};
+static const aac_float_t FLOAT_EPSILON = { 703687442, -16};
+static const aac_float_t FLOAT_1584893192 = { 850883053, 1};
+static const aac_float_t FLOAT_100000 = { 819200000, 17};
+static const aac_float_t FLOAT_0999999 = {1073740750, 0};
+
+static const uint8_t ff_log2_tab[256] = {
+ 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
+};
+
+static int divTable[128] = {
+ Q30(0.9999999995), Q30(0.9922480620), Q30(0.9846153846), Q30(0.9770992366),
+ Q30(0.9696969697), Q30(0.9624060150), Q30(0.9552238807), Q30(0.9481481481),
+ Q30(0.9411764704), Q30(0.9343065694), Q30(0.9275362319), Q30(0.9208633094),
+ Q30(0.9142857143), Q30(0.9078014186), Q30(0.9014084507), Q30(0.8951048949),
+ Q30(0.8888888890), Q30(0.8827586207), Q30(0.8767123288), Q30(0.8707482992),
+ Q30(0.8648648649), Q30(0.8590604025), Q30(0.8533333335), Q30(0.8476821193),
+ Q30(0.8421052634), Q30(0.8366013071), Q30(0.8311688313), Q30(0.8258064515),
+ Q30(0.8205128205), Q30(0.8152866242), Q30(0.8101265822), Q30(0.8050314467),
+ Q30(0.7999999998), Q30(0.7950310558), Q30(0.7901234566), Q30(0.7852760735),
+ Q30(0.7804878047), Q30(0.7757575759), Q30(0.7710843375), Q30(0.7664670660),
+ Q30(0.7619047621), Q30(0.7573964498), Q30(0.7529411763), Q30(0.7485380117),
+ Q30(0.7441860465), Q30(0.7398843933), Q30(0.7356321840), Q30(0.7314285715),
+ Q30(0.7272727271), Q30(0.7231638418), Q30(0.7191011235), Q30(0.7150837989),
+ Q30(0.7111111111), Q30(0.7071823203), Q30(0.7032967033), Q30(0.6994535518),
+ Q30(0.6956521738), Q30(0.6918918919), Q30(0.6881720428), Q30(0.6844919785),
+ Q30(0.6808510637), Q30(0.6772486772), Q30(0.6736842105), Q30(0.6701570679),
+ Q30(0.6666666665), Q30(0.6632124353), Q30(0.6597938146), Q30(0.6564102564),
+ Q30(0.6530612246), Q30(0.6497461931), Q30(0.6464646463), Q30(0.6432160805),
+ Q30(0.6400000001), Q30(0.6368159205), Q30(0.6336633665), Q30(0.6305418718),
+ Q30(0.6274509802), Q30(0.6243902440), Q30(0.6213592235), Q30(0.6183574880),
+ Q30(0.6153846155), Q30(0.6124401912), Q30(0.6095238095), Q30(0.6066350709),
+ Q30(0.6037735851), Q30(0.6009389670), Q30(0.5981308413), Q30(0.5953488373),
+ Q30(0.5925925928), Q30(0.5898617511), Q30(0.5871559633), Q30(0.5844748858),
+ Q30(0.5818181820), Q30(0.5791855203), Q30(0.5765765766), Q30(0.5739910314),
+ Q30(0.5714285714), Q30(0.5688888887), Q30(0.5663716816), Q30(0.5638766522),
+ Q30(0.5614035088), Q30(0.5589519651), Q30(0.5565217393), Q30(0.5541125541),
+ Q30(0.5517241377), Q30(0.5493562231), Q30(0.5470085470), Q30(0.5446808510),
+ Q30(0.5423728814), Q30(0.5400843881), Q30(0.5378151261), Q30(0.5355648533),
+ Q30(0.5333333332), Q30(0.5311203320), Q30(0.5289256200), Q30(0.5267489711),
+ Q30(0.5245901640), Q30(0.5224489798), Q30(0.5203252034), Q30(0.5182186235),
+ Q30(0.5161290322), Q30(0.5140562248), Q30(0.5120000001), Q30(0.5099601592),
+ Q30(0.5079365079), Q30(0.5059288535), Q30(0.5039370079), Q30(0.5019607842)
+};
+
+static int sqrtTab[512+1] = { /* sqrt(x), 0.5<=x<1 */
+ Q30(0.7071067812), Q30(0.7077969783), Q30(0.7084865030), Q30(0.7091753576),
+ Q30(0.7098635430), Q30(0.7105510626), Q30(0.7112379172), Q30(0.7119241091),
+ Q30(0.7126096408), Q30(0.7132945131), Q30(0.7139787287), Q30(0.7146622892),
+ Q30(0.7153451964), Q30(0.7160274521), Q30(0.7167090587), Q30(0.7173900176),
+ Q30(0.7180703310), Q30(0.7187500000), Q30(0.7194290273), Q30(0.7201074138),
+ Q30(0.7207851619), Q30(0.7214622740), Q30(0.7221387504), Q30(0.7228145939),
+ Q30(0.7234898065), Q30(0.7241643891), Q30(0.7248383439), Q30(0.7255116729),
+ Q30(0.7261843774), Q30(0.7268564594), Q30(0.7275279206), Q30(0.7281987625),
+ Q30(0.7288689869), Q30(0.7295385958), Q30(0.7302075904), Q30(0.7308759727),
+ Q30(0.7315437444), Q30(0.7322109072), Q30(0.7328774626), Q30(0.7335434123),
+ Q30(0.7342087580), Q30(0.7348735011), Q30(0.7355376435), Q30(0.7362011867),
+ Q30(0.7368641328), Q30(0.7375264824), Q30(0.7381882383), Q30(0.7388494010),
+ Q30(0.7395099727), Q30(0.7401699550), Q30(0.7408293495), Q30(0.7414881573),
+ Q30(0.7421463802), Q30(0.7428040202), Q30(0.7434610785), Q30(0.7441175561),
+ Q30(0.7447734554), Q30(0.7454287778), Q30(0.7460835241), Q30(0.7467376967),
+ Q30(0.7473912966), Q30(0.7480443250), Q30(0.7486967845), Q30(0.7493486754),
+ Q30(0.7500000000), Q30(0.7506507593), Q30(0.7513009552), Q30(0.7519505885),
+ Q30(0.7525996612), Q30(0.7532481747), Q30(0.7538961302), Q30(0.7545435294),
+ Q30(0.7551903734), Q30(0.7558366638), Q30(0.7564824023), Q30(0.7571275900),
+ Q30(0.7577722282), Q30(0.7584163188), Q30(0.7590598627), Q30(0.7597028613),
+ Q30(0.7603453165), Q30(0.7609872287), Q30(0.7616286003), Q30(0.7622694322),
+ Q30(0.7629097258), Q30(0.7635494824), Q30(0.7641887036), Q30(0.7648273907),
+ Q30(0.7654655445), Q30(0.7661031671), Q30(0.7667402592), Q30(0.7673768224),
+ Q30(0.7680128580), Q30(0.7686483674), Q30(0.7692833515), Q30(0.7699178122),
+ Q30(0.7705517504), Q30(0.7711851676), Q30(0.7718180646), Q30(0.7724504434),
+ Q30(0.7730823047), Q30(0.7737136502), Q30(0.7743444811), Q30(0.7749747979),
+ Q30(0.7756046029), Q30(0.7762338966), Q30(0.7768626809), Q30(0.7774909567),
+ Q30(0.7781187249), Q30(0.7787459870), Q30(0.7793727447), Q30(0.7799989986),
+ Q30(0.7806247496), Q30(0.7812500000), Q30(0.7818747503), Q30(0.7824990018),
+ Q30(0.7831227556), Q30(0.7837460130), Q30(0.7843687749), Q30(0.7849910432),
+ Q30(0.7856128183), Q30(0.7862341017), Q30(0.7868548944), Q30(0.7874751980),
+ Q30(0.7880950132), Q30(0.7887143414), Q30(0.7893331838), Q30(0.7899515415),
+ Q30(0.7905694149), Q30(0.7911868063), Q30(0.7918037162), Q30(0.7924201456),
+ Q30(0.7930360963), Q30(0.7936515687), Q30(0.7942665643), Q30(0.7948810840),
+ Q30(0.7954951287), Q30(0.7961087003), Q30(0.7967217988), Q30(0.7973344265),
+ Q30(0.7979465835), Q30(0.7985582710), Q30(0.7991694906), Q30(0.7997802431),
+ Q30(0.8003905294), Q30(0.8010003511), Q30(0.8016097085), Q30(0.8022186034),
+ Q30(0.8028270360), Q30(0.8034350080), Q30(0.8040425205), Q30(0.8046495742),
+ Q30(0.8052561702), Q30(0.8058623099), Q30(0.8064679937), Q30(0.8070732229),
+ Q30(0.8076779991), Q30(0.8082823223), Q30(0.8088861941), Q30(0.8094896153),
+ Q30(0.8100925875), Q30(0.8106951108), Q30(0.8112971867), Q30(0.8118988159),
+ Q30(0.8125000000), Q30(0.8131007394), Q30(0.8137010355), Q30(0.8143008887),
+ Q30(0.8149003005), Q30(0.8154992717), Q30(0.8160978034), Q30(0.8166958964),
+ Q30(0.8172935518), Q30(0.8178907707), Q30(0.8184875534), Q30(0.8190839016),
+ Q30(0.8196798153), Q30(0.8202752969), Q30(0.8208703459), Q30(0.8214649642),
+ Q30(0.8220591522), Q30(0.8226529113), Q30(0.8232462420), Q30(0.8238391452),
+ Q30(0.8244316224), Q30(0.8250236739), Q30(0.8256153008), Q30(0.8262065044),
+ Q30(0.8267972847), Q30(0.8273876435), Q30(0.8279775814), Q30(0.8285670988),
+ Q30(0.8291561976), Q30(0.8297448778), Q30(0.8303331411), Q30(0.8309209873),
+ Q30(0.8315084185), Q30(0.8320954349), Q30(0.8326820373), Q30(0.8332682266),
+ Q30(0.8338540038), Q30(0.8344393703), Q30(0.8350243261), Q30(0.8356088721),
+ Q30(0.8361930102), Q30(0.8367767399), Q30(0.8373600631), Q30(0.8379429798),
+ Q30(0.8385254918), Q30(0.8391075991), Q30(0.8396893027), Q30(0.8402706035),
+ Q30(0.8408515030), Q30(0.8414320010), Q30(0.8420120990), Q30(0.8425917975),
+ Q30(0.8431710978), Q30(0.8437500000), Q30(0.8443285055), Q30(0.8449066146),
+ Q30(0.8454843285), Q30(0.8460616483), Q30(0.8466385738), Q30(0.8472151072),
+ Q30(0.8477912480), Q30(0.8483669977), Q30(0.8489423566), Q30(0.8495173263),
+ Q30(0.8500919067), Q30(0.8506660992), Q30(0.8512399043), Q30(0.8518133233),
+ Q30(0.8523863559), Q30(0.8529590038), Q30(0.8535312680), Q30(0.8541031480),
+ Q30(0.8546746457), Q30(0.8552457616), Q30(0.8558164961), Q30(0.8563868506),
+ Q30(0.8569568251), Q30(0.8575264211), Q30(0.8580956385), Q30(0.8586644791),
+ Q30(0.8592329426), Q30(0.8598010307), Q30(0.8603687435), Q30(0.8609360820),
+ Q30(0.8615030469), Q30(0.8620696389), Q30(0.8626358588), Q30(0.8632017071),
+ Q30(0.8637671852), Q30(0.8643322927), Q30(0.8648970313), Q30(0.8654614016),
+ Q30(0.8660254036), Q30(0.8665890391), Q30(0.8671523076), Q30(0.8677152111),
+ Q30(0.8682777495), Q30(0.8688399233), Q30(0.8694017339), Q30(0.8699631817),
+ Q30(0.8705242672), Q30(0.8710849914), Q30(0.8716453551), Q30(0.8722053585),
+ Q30(0.8727650028), Q30(0.8733242881), Q30(0.8738832157), Q30(0.8744417862),
+ Q30(0.8750000000), Q30(0.8755578580), Q30(0.8761153608), Q30(0.8766725087),
+ Q30(0.8772293031), Q30(0.8777857441), Q30(0.8783418327), Q30(0.8788975696),
+ Q30(0.8794529550), Q30(0.8800079902), Q30(0.8805626752), Q30(0.8811170114),
+ Q30(0.8816709989), Q30(0.8822246385), Q30(0.8827779307), Q30(0.8833308765),
+ Q30(0.8838834763), Q30(0.8844357310), Q30(0.8849876411), Q30(0.8855392071),
+ Q30(0.8860904300), Q30(0.8866413101), Q30(0.8871918479), Q30(0.8877420444),
+ Q30(0.8882919000), Q30(0.8888414158), Q30(0.8893905920), Q30(0.8899394292),
+ Q30(0.8904879279), Q30(0.8910360895), Q30(0.8915839135), Q30(0.8921314017),
+ Q30(0.8926785537), Q30(0.8932253704), Q30(0.8937718528), Q30(0.8943180013),
+ Q30(0.8948638164), Q30(0.8954092991), Q30(0.8959544492), Q30(0.8964992678),
+ Q30(0.8970437557), Q30(0.8975879136), Q30(0.8981317417), Q30(0.8986752401),
+ Q30(0.8992184107), Q30(0.8997612530), Q30(0.9003037680), Q30(0.9008459565),
+ Q30(0.9013878191), Q30(0.9019293557), Q30(0.9024705673), Q30(0.9030114547),
+ Q30(0.9035520186), Q30(0.9040922588), Q30(0.9046321767), Q30(0.9051717725),
+ Q30(0.9057110464), Q30(0.9062500000), Q30(0.9067886332), Q30(0.9073269465),
+ Q30(0.9078649404), Q30(0.9084026157), Q30(0.9089399735), Q30(0.9094770132),
+ Q30(0.9100137362), Q30(0.9105501426), Q30(0.9110862338), Q30(0.9116220092),
+ Q30(0.9121574699), Q30(0.9126926167), Q30(0.9132274496), Q30(0.9137619697),
+ Q30(0.9142961772), Q30(0.9148300732), Q30(0.9153636573), Q30(0.9158969307),
+ Q30(0.9164298936), Q30(0.9169625468), Q30(0.9174948912), Q30(0.9180269265),
+ Q30(0.9185586534), Q30(0.9190900731), Q30(0.9196211854), Q30(0.9201519913),
+ Q30(0.9206824913), Q30(0.9212126858), Q30(0.9217425752), Q30(0.9222721602),
+ Q30(0.9228014410), Q30(0.9233304188), Q30(0.9238590938), Q30(0.9243874662),
+ Q30(0.9249155368), Q30(0.9254433061), Q30(0.9259707746), Q30(0.9264979423),
+ Q30(0.9270248110), Q30(0.9275513799), Q30(0.9280776503), Q30(0.9286036226),
+ Q30(0.9291292969), Q30(0.9296546737), Q30(0.9301797543), Q30(0.9307045382),
+ Q30(0.9312290265), Q30(0.9317532196), Q30(0.9322771183), Q30(0.9328007223),
+ Q30(0.9333240325), Q30(0.9338470497), Q30(0.9343697741), Q30(0.9348922065),
+ Q30(0.9354143469), Q30(0.9359361958), Q30(0.9364577541), Q30(0.9369790219),
+ Q30(0.9375000000), Q30(0.9380206889), Q30(0.9385410887), Q30(0.9390612002),
+ Q30(0.9395810235), Q30(0.9401005600), Q30(0.9406198091), Q30(0.9411387718),
+ Q30(0.9416574482), Q30(0.9421758396), Q30(0.9426939455), Q30(0.9432117669),
+ Q30(0.9437293042), Q30(0.9442465580), Q30(0.9447635286), Q30(0.9452802162),
+ Q30(0.9457966220), Q30(0.9463127456), Q30(0.9468285879), Q30(0.9473441495),
+ Q30(0.9478594307), Q30(0.9483744316), Q30(0.9488891531), Q30(0.9494035956),
+ Q30(0.9499177597), Q30(0.9504316454), Q30(0.9509452535), Q30(0.9514585841),
+ Q30(0.9519716380), Q30(0.9524844158), Q30(0.9529969175), Q30(0.9535091440),
+ Q30(0.9540210953), Q30(0.9545327718), Q30(0.9550441746), Q30(0.9555553030),
+ Q30(0.9560661586), Q30(0.9565767418), Q30(0.9570870521), Q30(0.9575970904),
+ Q30(0.9581068573), Q30(0.9586163531), Q30(0.9591255784), Q30(0.9596345332),
+ Q30(0.9601432183), Q30(0.9606516343), Q30(0.9611597811), Q30(0.9616676597),
+ Q30(0.9621752701), Q30(0.9626826127), Q30(0.9631896880), Q30(0.9636964966),
+ Q30(0.9642030387), Q30(0.9647093150), Q30(0.9652153258), Q30(0.9657210712),
+ Q30(0.9662265521), Q30(0.9667317686), Q30(0.9672367214), Q30(0.9677414102),
+ Q30(0.9682458364), Q30(0.9687500000), Q30(0.9692539014), Q30(0.9697575406),
+ Q30(0.9702609186), Q30(0.9707640354), Q30(0.9712668918), Q30(0.9717694880),
+ Q30(0.9722718243), Q30(0.9727739012), Q30(0.9732757187), Q30(0.9737772783),
+ Q30(0.9742785795), Q30(0.9747796226), Q30(0.9752804083), Q30(0.9757809374),
+ Q30(0.9762812094), Q30(0.9767812253), Q30(0.9772809856), Q30(0.9777804906),
+ Q30(0.9782797401), Q30(0.9787787353), Q30(0.9792774762), Q30(0.9797759629),
+ Q30(0.9802741962), Q30(0.9807721768), Q30(0.9812699044), Q30(0.9817673797),
+ Q30(0.9822646030), Q30(0.9827615744), Q30(0.9832582953), Q30(0.9837547648),
+ Q30(0.9842509842), Q30(0.9847469535), Q30(0.9852426732), Q30(0.9857381433),
+ Q30(0.9862333648), Q30(0.9867283376), Q30(0.9872230627), Q30(0.9877175395),
+ Q30(0.9882117687), Q30(0.9887057510), Q30(0.9891994870), Q30(0.9896929762),
+ Q30(0.9901862200), Q30(0.9906792180), Q30(0.9911719705), Q30(0.9916644781),
+ Q30(0.9921567417), Q30(0.9926487608), Q30(0.9931405364), Q30(0.9936320684),
+ Q30(0.9941233573), Q30(0.9946144037), Q30(0.9951052079), Q30(0.9955957700),
+ Q30(0.9960860908), Q30(0.9965761700), Q30(0.9970660084), Q30(0.9975556061),
+ Q30(0.9980449639), Q30(0.9985340820), Q30(0.9990229602), Q30(0.9995115995),
+ 0x3FFFFFFF
+};
+
+static int sqrExpMultTab[2] = {
+ Q30(0.5000000000), Q30(0.7071067812)
+};
+
+static int aac_costbl_1[16] = {
+ Q30( 1.000000000000000), Q30( 0.980785280403230), Q30( 0.923879532511287), Q30( 0.831469612302545),
+ Q30( 0.707106781186548), Q30( 0.555570233019602), Q30( 0.382683432365090), Q30( 0.195090322016128),
+ Q30( 0.000000000000000), Q30(-0.195090322016128), Q30(-0.382683432365090), Q30(-0.555570233019602),
+ Q30(-0.707106781186547), Q30(-0.831469612302545), Q30(-0.923879532511287), Q30(-0.980785280403230)
+};
+
+static int aac_costbl_2[32] = {
+ Q30(1.000000000000000), Q30(0.999981175282601), Q30(0.999924701839145), Q30(0.999830581795823),
+ Q30(0.999698818696204), Q30(0.999529417501093), Q30(0.999322384588350), Q30(0.999077727752645),
+ Q30(0.998795456205172), Q30(0.998475580573295), Q30(0.998118112900149), Q30(0.997723066644192),
+ Q30(0.997290456678690), Q30(0.996820299291166), Q30(0.996312612182778), Q30(0.995767414467660),
+ Q30(0.995184726672197), Q30(0.994564570734255), Q30(0.993906970002356), Q30(0.993211949234795),
+ Q30(0.992479534598710), Q30(0.991709753669100), Q30(0.990902635427780), Q30(0.990058210262297),
+ Q30(0.989176509964781), Q30(0.988257567730749), Q30(0.987301418157858), Q30(0.986308097244599),
+ Q30(0.985277642388941), Q30(0.984210092386929), Q30(0.983105487431216), Q30(0.981963869109555)
+};
+
+static int aac_sintbl_2[32] = {
+ Q30(0.000000000000000), Q30(0.006135884649154), Q30(0.012271538285720), Q30(0.018406729905805),
+ Q30(0.024541228522912), Q30(0.030674803176637), Q30(0.036807222941359), Q30(0.042938256934941),
+ Q30(0.049067674327418), Q30(0.055195244349690), Q30(0.061320736302209), Q30(0.067443919563664),
+ Q30(0.073564563599667), Q30(0.079682437971430), Q30(0.085797312344440), Q30(0.091908956497133),
+ Q30(0.098017140329561), Q30(0.104121633872055), Q30(0.110222207293883), Q30(0.116318630911905),
+ Q30(0.122410675199216), Q30(0.128498110793793), Q30(0.134580708507126), Q30(0.140658239332849),
+ Q30(0.146730474455362), Q30(0.152797185258443), Q30(0.158858143333861), Q30(0.164913120489970),
+ Q30(0.170961888760301), Q30(0.177004220412149), Q30(0.183039887955141), Q30(0.189068664149806)
+};
+
+static int aac_costbl_3[32] = {
+ Q30(1.000000000000000), Q30(0.999999981616429), Q30(0.999999926465718), Q30(0.999999834547868),
+ Q30(0.999999705862882), Q30(0.999999540410766), Q30(0.999999338191526), Q30(0.999999099205168),
+ Q30(0.999998823451702), Q30(0.999998510931138), Q30(0.999998161643487), Q30(0.999997775588762),
+ Q30(0.999997352766978), Q30(0.999996893178150), Q30(0.999996396822294), Q30(0.999995863699430),
+ Q30(0.999995293809576), Q30(0.999994687152754), Q30(0.999994043728986), Q30(0.999993363538295),
+ Q30(0.999992646580707), Q30(0.999991892856248), Q30(0.999991102364946), Q30(0.999990275106829),
+ Q30(0.999989411081928), Q30(0.999988510290276), Q30(0.999987572731904), Q30(0.999986598406848),
+ Q30(0.999985587315143), Q30(0.999984539456827), Q30(0.999983454831938), Q30(0.999982333440515)
+};
+
+static int aac_sintbl_3[32] = {
+ Q30(0.000000000000000), Q30(0.000191747597311), Q30(0.000383495187571), Q30(0.000575242763732),
+ Q30(0.000766990318743), Q30(0.000958737845553), Q30(0.001150485337114), Q30(0.001342232786374),
+ Q30(0.001533980186285), Q30(0.001725727529795), Q30(0.001917474809855), Q30(0.002109222019416),
+ Q30(0.002300969151426), Q30(0.002492716198836), Q30(0.002684463154596), Q30(0.002876210011656),
+ Q30(0.003067956762966), Q30(0.003259703401476), Q30(0.003451449920136), Q30(0.003643196311896),
+ Q30(0.003834942569706), Q30(0.004026688686517), Q30(0.004218434655277), Q30(0.004410180468938),
+ Q30(0.004601926120449), Q30(0.004793671602760), Q30(0.004985416908822), Q30(0.005177162031584),
+ Q30(0.005368906963996), Q30(0.005560651699010), Q30(0.005752396229574), Q30(0.005944140548639)
+};
+
+static int aac_costbl_4[33] = {
+ Q30(1.000000000000000), Q30(0.999999999982047), Q30(0.999999999928189), Q30(0.999999999838426),
+ Q30(0.999999999712757), Q30(0.999999999551182), Q30(0.999999999353703), Q30(0.999999999120317),
+ Q30(0.999999998851027), Q30(0.999999998545831), Q30(0.999999998204729), Q30(0.999999997827723),
+ Q30(0.999999997414810), Q30(0.999999996965993), Q30(0.999999996481270), Q30(0.999999995960641),
+ Q30(0.999999995404107), Q30(0.999999994811668), Q30(0.999999994183323), Q30(0.999999993519073),
+ Q30(0.999999992818918), Q30(0.999999992082857), Q30(0.999999991310890), Q30(0.999999990503019),
+ Q30(0.999999989659241), Q30(0.999999988779559), Q30(0.999999987863971), Q30(0.999999986912477),
+ Q30(0.999999985925079), Q30(0.999999984901774), Q30(0.999999983842565), Q30(0.999999982747450),
+ Q30(0.999999981616429)
+};
+
+static int aac_sintbl_4[33] = {
+ Q30(0.000000000000000), Q30(0.000005992112453), Q30(0.000011984224905), Q30(0.000017976337357),
+ Q30(0.000023968449808), Q30(0.000029960562259), Q30(0.000035952674708), Q30(0.000041944787156),
+ Q30(0.000047936899603), Q30(0.000053929012048), Q30(0.000059921124491), Q30(0.000065913236932),
+ Q30(0.000071905349370), Q30(0.000077897461806), Q30(0.000083889574239), Q30(0.000089881686669),
+ Q30(0.000095873799096), Q30(0.000101865911519), Q30(0.000107858023939), Q30(0.000113850136355),
+ Q30(0.000119842248767), Q30(0.000125834361174), Q30(0.000131826473577), Q30(0.000137818585975),
+ Q30(0.000143810698369), Q30(0.000149802810757), Q30(0.000155794923139), Q30(0.000161787035517),
+ Q30(0.000167779147888), Q30(0.000173771260253), Q30(0.000179763372612), Q30(0.000185755484965),
+ Q30(0.000191747597311)
+};
+
+
+static av_always_inline av_const int av_log2_c_emu(unsigned int v)
+{
+ int n = 0;
+ if (v & 0xffff0000) {
+ v >>= 16;
+ n += 16;
+ }
+ if (v & 0xff00) {
+ v >>= 8;
+ n += 8;
+ }
+ n += ff_log2_tab[v];
+
+ return n;
+}
+
+static av_always_inline aac_float_t int2float(const int x, const int exp)
+{
+ aac_float_t ret;
+ int nz;
+
+ if (x == 0)
+ {
+ ret.mant = 0;
+ ret.expo = 0;
+ }
+ else
+ {
+ ret.expo = exp;
+ ret.mant = x;
+ nz = 29 - av_log2_c_emu(FFABS(ret.mant));
+ ret.mant <<= nz;
+ ret.expo -= nz;
+ }
+
+ return ret;
+}
+
+static av_always_inline aac_float_t float_add(aac_float_t a, aac_float_t b)
+{
+ int diff, nz;
+ int expa = a.expo;
+ int expb = b.expo;
+ int manta = a.mant;
+ int mantb = b.mant;
+ aac_float_t res;
+
+ if (manta == 0)
+ return b;
+
+ if (mantb == 0)
+ return a;
+
+ diff = expa - expb;
+ if (diff < 0) // expa < expb
+ {
+ diff = -diff;
+ if (diff >= 31)
+ manta = 0;
+ else if (diff != 0)
+ manta >>= diff;
+ expa = expb;
+ }
+ else // expa >= expb
+ {
+ if (diff >= 31)
+ mantb = 0;
+ else if (diff != 0)
+ mantb >>= diff;
+ }
+
+ manta = manta + mantb;
+ if (manta == 0)
+ expa = 0;
+ else
+ {
+ nz = 30 - av_log2_c_emu(FFABS(manta));
+ manta <<= nz;
+ manta >>= 1;
+ expa -= (nz-1);
+ }
+
+ res.mant = manta;
+ res.expo = expa;
+
+ return res;
+}
+
+static av_always_inline aac_float_t float_sub(aac_float_t a, aac_float_t b)
+{
+ int diff, nz;
+ int expa = a.expo;
+ int expb = b.expo;
+ int manta = a.mant;
+ int mantb = b.mant;
+ aac_float_t res;
+
+ if (manta == 0)
+ {
+ res.mant = -mantb;
+ res.expo = expb;
+ return res;
+ }
+
+ if (mantb == 0)
+ return a;
+
+ diff = expa - expb;
+ if (diff < 0) // expa < expb
+ {
+ diff = -diff;
+ if (diff >= 31)
+ manta = 0;
+ else if (diff != 0)
+ manta >>= diff;
+ expa = expb;
+ }
+ else // expa >= expb
+ {
+ if (diff >= 31)
+ mantb = 0;
+ else if (diff != 0)
+ mantb >>= diff;
+ }
+
+ manta = manta - mantb;
+ if (manta == 0)
+ expa = 0;
+ else
+ {
+ nz = 30 - av_log2_c_emu(FFABS(manta));
+ manta <<= nz;
+ manta >>= 1;
+ expa -= (nz-1);
+ }
+
+ res.mant = manta;
+ res.expo = expa;
+
+ return res;
+}
+
+static av_always_inline aac_float_t float_mul(aac_float_t a, aac_float_t b)
+{
+ aac_float_t res;
+ int mant;
+ int expa = a.expo;
+ int expb = b.expo;
+ long long accu;
+
+ expa = expa + expb;
+ accu = (long long)a.mant * b.mant;
+ mant = (int)((accu + 0x20000000) >> 30);
+ if (mant == 0)
+ expa = 0;
+ else if (mant < 536870912 && mant > -536870912)
+ {
+ mant <<= 1;
+ expa = expa - 1;
+ }
+ res.mant = mant;
+ res.expo = expa;
+
+ return res;
+}
+
+static av_always_inline aac_float_t float_recip(const aac_float_t a)
+{
+ aac_float_t r;
+ int s;
+ int manta, expa;
+
+ manta = a.mant;
+ expa = a.expo;
+
+ expa = 1 - expa;
+ r.expo = expa;
+
+ s = manta >> 31;
+ manta = (manta ^ s) - s;
+
+ manta = divTable[(manta - 0x20000000) >> 22];
+
+ r.mant = (manta ^ s) - s;
+
+ return r;
+}
+
+static av_always_inline aac_float_t float_div(aac_float_t a, aac_float_t b)
+{
+ aac_float_t res;
+ aac_float_t iB, tmp;
+ int mantb;
+
+ mantb = b.mant;
+ if (mantb != 0)
+ {
+ iB = float_recip(b);
+ // newton iteration to double precision
+ tmp = float_sub(FLOAT_1, float_mul(b, iB));
+ iB = float_add(iB, float_mul(iB, tmp));
+ res = float_mul(a, iB);
+ }
+ else
+ {
+ res.mant = 1;
+ res.expo = 2147483647;
+ }
+
+ return res;
+}
+
+static av_always_inline int float_gt(aac_float_t a, aac_float_t b)
+{
+ int expa = a.expo;
+ int expb = b.expo;
+ int manta = a.mant;
+ int mantb = b.mant;
+
+ if (manta == 0)
+ expa = 0x80000000;
+
+ if (mantb == 0)
+ expb = 0x80000000;
+
+ if (expa > expb)
+ return 1;
+ else if (expa < expb)
+ return 0;
+ else // expa == expb
+ {
+ if (manta > mantb)
+ return 1;
+ else
+ return 0;
+ }
+}
+
+static av_always_inline aac_float_t float_sqrt(aac_float_t val)
+{
+ int exp;
+ int tabIndex, rem;
+ int mant;
+ long long accu;
+ aac_float_t res;
+
+ exp = val.expo;
+ mant = val.mant;
+
+ if (mant == 0)
+ {
+ res.mant = 0;
+ res.expo = 0;
+ }
+ else
+ {
+ tabIndex = (mant - 536870912);
+ tabIndex = tabIndex >> 20;
+
+ rem = mant & 0xfffff;
+ accu = (long long)sqrtTab[tabIndex] * (0x100000-rem);
+ accu += (long long)sqrtTab[tabIndex+1] * rem;
+ mant = (int)((accu + 0x80000) >> 20);
+
+ accu = (long long)sqrExpMultTab[exp&1] * mant;
+ mant = (int)((accu + 0x10000000) >> 29);
+ if (mant < 1073741824)
+ exp -= 2;
+ else
+ mant >>= 1;
+
+ res.mant = mant;
+ res.expo = (exp>>1)+1;
+ }
+
+ return res;
+}
+
+static av_always_inline void aac_fixed_sincos(int a, int *s, int *c)
+{
+ int idx, sign;
+ int sv, cv;
+ int st, ct;
+ long long accu;
+
+ idx = a >> 26;
+ sign = (idx << 27) >> 31;
+ cv = aac_costbl_1[idx & 0xf];
+ cv = (cv ^ sign) - sign;
+
+ idx -= 8;
+ sign = (idx << 27) >> 31;
+ sv = aac_costbl_1[idx & 0xf];
+ sv = (sv ^ sign) - sign;
+
+ idx = a >> 21;
+ ct = aac_costbl_2[idx & 0x1f];
+ st = aac_sintbl_2[idx & 0x1f];
+
+ accu = (long long)cv*ct;
+ accu -= (long long)sv*st;
+ idx = (int)((accu + 0x20000000) >> 30);
+
+ accu = (long long)cv*st;
+ accu += (long long)sv*ct;
+ sv = (int)((accu + 0x20000000) >> 30);
+ cv = idx;
+
+ idx = a >> 16;
+ ct = aac_costbl_3[idx & 0x1f];
+ st = aac_sintbl_3[idx & 0x1f];
+
+ accu = (long long)cv*ct;
+ accu -= (long long)sv*st;
+ idx = (int)((accu + 0x20000000) >> 30);
+
+ accu = (long long)cv*st;
+ accu += (long long)sv*ct;
+ sv = (int)((accu + 0x20000000) >> 30);
+ cv = idx;
+
+ idx = a >> 11;
+ accu = (long long)aac_costbl_4[idx & 0x1f]*(0x800 - (a&0x7ff));
+ accu += (long long)aac_costbl_4[(idx & 0x1f)+1]*(a&0x7ff);
+ ct = (int)((accu + 0x400) >> 11);
+ accu = (long long)aac_sintbl_4[idx & 0x1f]*(0x800 - (a&0x7ff));
+ accu += (long long)aac_sintbl_4[(idx & 0x1f)+1]*(a&0x7ff);
+ st = (int)((accu + 0x400) >> 11);
+
+ accu = (long long)cv*ct;
+ accu -= (long long)sv*st;
+ *c = (int)((accu + 0x20000000) >> 30);
+
+ accu = (long long)cv*st;
+ accu += (long long)sv*ct;
+ *s = (int)((accu + 0x20000000) >> 30);
+}
+
+#undef ff_log2_tab
+#undef divTable
+#undef sqrtTab
+#undef sqrExpMultTab
+#undef aac_costbl_1
+#undef aac_costbl_2
+#undef aac_sintbl_2
+#undef aac_costbl_3
+#undef aac_sintbl_3
+#undef aac_costbl_4
+#undef aac_sintbl_4
+
+#endif /* _AAC_FLOAT_EMU_ */
diff --git a/libavcodec/float_emu.h b/libavcodec/float_emu.h
new file mode 100644
index 0000000..23ebf1b
--- /dev/null
+++ b/libavcodec/float_emu.h
@@ -0,0 +1,400 @@
+/*
+ * Copyright (c) 2012
+ * MIPS Technologies, Inc., California.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the MIPS Technologies, Inc., nor the names of is
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Author: Stanislav Ocovaj (stanislav.ocovaj imgtec com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_FLOAT_EMU_H
+#define AVUTIL_FLOAT_EMU_H
+
+#include "libavutil/common.h"
+#include "libavutil/intmath.h"
+
+extern const int divTable[128];
+extern const int sqrtTab[513];
+extern const int sqrExpMultTab[2];
+extern const int aac_costbl_1[16];
+extern const int aac_costbl_2[32];
+extern const int aac_sintbl_2[32];
+extern const int aac_costbl_3[32];
+extern const int aac_sintbl_3[32];
+extern const int aac_costbl_4[33];
+extern const int aac_sintbl_4[33];
+
+typedef struct aac_float_t {
+ int mant;
+ int expo;
+} aac_float_t;
+
+static const aac_float_t FLOAT_0 = { 0, 0};
+static const aac_float_t FLOAT_05 = { 536870912, 0};
+static const aac_float_t FLOAT_1 = { 536870912, 1};
+static const aac_float_t FLOAT_EPSILON = { 703687442, -16};
+static const aac_float_t FLOAT_1584893192 = { 850883053, 1};
+static const aac_float_t FLOAT_100000 = { 819200000, 17};
+static const aac_float_t FLOAT_0999999 = {1073740750, 0};
+
+static av_always_inline aac_float_t int2float(const int x, const int exp)
+{
+ aac_float_t ret;
+ int nz;
+
+ if (x == 0)
+ {
+ ret.mant = 0;
+ ret.expo = 0;
+ }
+ else
+ {
+ ret.expo = exp;
+ ret.mant = x;
+ nz = 29 - ff_log2(FFABS(ret.mant));
+ ret.mant <<= nz;
+ ret.expo -= nz;
+ }
+
+ return ret;
+}
+
+static av_always_inline aac_float_t float_add(aac_float_t a, aac_float_t b)
+{
+ int diff, nz;
+ int expa = a.expo;
+ int expb = b.expo;
+ int manta = a.mant;
+ int mantb = b.mant;
+ aac_float_t res;
+
+ if (manta == 0)
+ return b;
+
+ if (mantb == 0)
+ return a;
+
+ diff = expa - expb;
+ if (diff < 0) // expa < expb
+ {
+ diff = -diff;
+ if (diff >= 31)
+ manta = 0;
+ else if (diff != 0)
+ manta >>= diff;
+ expa = expb;
+ }
+ else // expa >= expb
+ {
+ if (diff >= 31)
+ mantb = 0;
+ else if (diff != 0)
+ mantb >>= diff;
+ }
+
+ manta = manta + mantb;
+ if (manta == 0)
+ expa = 0;
+ else
+ {
+ nz = 30 - ff_log2(FFABS(manta));
+ manta <<= nz;
+ manta >>= 1;
+ expa -= (nz-1);
+ }
+
+ res.mant = manta;
+ res.expo = expa;
+
+ return res;
+}
+
+static av_always_inline aac_float_t float_sub(aac_float_t a, aac_float_t b)
+{
+ int diff, nz;
+ int expa = a.expo;
+ int expb = b.expo;
+ int manta = a.mant;
+ int mantb = b.mant;
+ aac_float_t res;
+
+ if (manta == 0)
+ {
+ res.mant = -mantb;
+ res.expo = expb;
+ return res;
+ }
+
+ if (mantb == 0)
+ return a;
+
+ diff = expa - expb;
+ if (diff < 0) // expa < expb
+ {
+ diff = -diff;
+ if (diff >= 31)
+ manta = 0;
+ else if (diff != 0)
+ manta >>= diff;
+ expa = expb;
+ }
+ else // expa >= expb
+ {
+ if (diff >= 31)
+ mantb = 0;
+ else if (diff != 0)
+ mantb >>= diff;
+ }
+
+ manta = manta - mantb;
+ if (manta == 0)
+ expa = 0;
+ else
+ {
+ nz = 30 - ff_log2(FFABS(manta));
+ manta <<= nz;
+ manta >>= 1;
+ expa -= (nz-1);
+ }
+
+ res.mant = manta;
+ res.expo = expa;
+
+ return res;
+}
+
+static av_always_inline aac_float_t float_mul(aac_float_t a, aac_float_t b)
+{
+ aac_float_t res;
+ int mant;
+ int expa = a.expo;
+ int expb = b.expo;
+ long long accu;
+
+ expa = expa + expb;
+ accu = (long long)a.mant * b.mant;
+ mant = (int)((accu + 0x20000000) >> 30);
+ if (mant == 0)
+ expa = 0;
+ else if (mant < 536870912 && mant > -536870912)
+ {
+ mant <<= 1;
+ expa = expa - 1;
+ }
+ res.mant = mant;
+ res.expo = expa;
+
+ return res;
+}
+
+static av_always_inline aac_float_t float_recip(const aac_float_t a)
+{
+ aac_float_t r;
+ int s;
+ int manta, expa;
+
+ manta = a.mant;
+ expa = a.expo;
+
+ expa = 1 - expa;
+ r.expo = expa;
+
+ s = manta >> 31;
+ manta = (manta ^ s) - s;
+
+ manta = divTable[(manta - 0x20000000) >> 22];
+
+ r.mant = (manta ^ s) - s;
+
+ return r;
+}
+
+static av_always_inline aac_float_t float_div(aac_float_t a, aac_float_t b)
+{
+ aac_float_t res;
+ aac_float_t iB, tmp;
+ int mantb;
+
+ mantb = b.mant;
+ if (mantb != 0)
+ {
+ iB = float_recip(b);
+ // newton iteration to double precision
+ tmp = float_sub(FLOAT_1, float_mul(b, iB));
+ iB = float_add(iB, float_mul(iB, tmp));
+ res = float_mul(a, iB);
+ }
+ else
+ {
+ res.mant = 1;
+ res.expo = 2147483647;
+ }
+
+ return res;
+}
+
+static av_always_inline int float_gt(aac_float_t a, aac_float_t b)
+{
+ int expa = a.expo;
+ int expb = b.expo;
+ int manta = a.mant;
+ int mantb = b.mant;
+
+ if (manta == 0)
+ expa = 0x80000000;
+
+ if (mantb == 0)
+ expb = 0x80000000;
+
+ if (expa > expb)
+ return 1;
+ else if (expa < expb)
+ return 0;
+ else // expa == expb
+ {
+ if (manta > mantb)
+ return 1;
+ else
+ return 0;
+ }
+}
+
+static av_always_inline aac_float_t float_sqrt(aac_float_t val)
+{
+ int exp;
+ int tabIndex, rem;
+ int mant;
+ long long accu;
+ aac_float_t res;
+
+ exp = val.expo;
+ mant = val.mant;
+
+ if (mant == 0)
+ {
+ res.mant = 0;
+ res.expo = 0;
+ }
+ else
+ {
+ tabIndex = (mant - 536870912);
+ tabIndex = tabIndex >> 20;
+
+ rem = mant & 0xfffff;
+ accu = (long long)sqrtTab[tabIndex] * (0x100000-rem);
+ accu += (long long)sqrtTab[tabIndex+1] * rem;
+ mant = (int)((accu + 0x80000) >> 20);
+
+ accu = (long long)sqrExpMultTab[exp&1] * mant;
+ mant = (int)((accu + 0x10000000) >> 29);
+ if (mant < 1073741824)
+ exp -= 2;
+ else
+ mant >>= 1;
+
+ res.mant = mant;
+ res.expo = (exp>>1)+1;
+ }
+
+ return res;
+}
+
+static av_always_inline void aac_fixed_sincos(int a, int *s, int *c)
+{
+ int idx, sign;
+ int sv, cv;
+ int st, ct;
+ long long accu;
+
+ idx = a >> 26;
+ sign = (idx << 27) >> 31;
+ cv = aac_costbl_1[idx & 0xf];
+ cv = (cv ^ sign) - sign;
+
+ idx -= 8;
+ sign = (idx << 27) >> 31;
+ sv = aac_costbl_1[idx & 0xf];
+ sv = (sv ^ sign) - sign;
+
+ idx = a >> 21;
+ ct = aac_costbl_2[idx & 0x1f];
+ st = aac_sintbl_2[idx & 0x1f];
+
+ accu = (long long)cv*ct;
+ accu -= (long long)sv*st;
+ idx = (int)((accu + 0x20000000) >> 30);
+
+ accu = (long long)cv*st;
+ accu += (long long)sv*ct;
+ sv = (int)((accu + 0x20000000) >> 30);
+ cv = idx;
+
+ idx = a >> 16;
+ ct = aac_costbl_3[idx & 0x1f];
+ st = aac_sintbl_3[idx & 0x1f];
+
+ accu = (long long)cv*ct;
+ accu -= (long long)sv*st;
+ idx = (int)((accu + 0x20000000) >> 30);
+
+ accu = (long long)cv*st;
+ accu += (long long)sv*ct;
+ sv = (int)((accu + 0x20000000) >> 30);
+ cv = idx;
+
+ idx = a >> 11;
+ accu = (long long)aac_costbl_4[idx & 0x1f]*(0x800 - (a&0x7ff));
+ accu += (long long)aac_costbl_4[(idx & 0x1f)+1]*(a&0x7ff);
+ ct = (int)((accu + 0x400) >> 11);
+ accu = (long long)aac_sintbl_4[idx & 0x1f]*(0x800 - (a&0x7ff));
+ accu += (long long)aac_sintbl_4[(idx & 0x1f)+1]*(a&0x7ff);
+ st = (int)((accu + 0x400) >> 11);
+
+ accu = (long long)cv*ct;
+ accu -= (long long)sv*st;
+ *c = (int)((accu + 0x20000000) >> 30);
+
+ accu = (long long)cv*st;
+ accu += (long long)sv*ct;
+ *s = (int)((accu + 0x20000000) >> 30);
+}
+
+#endif /* AVUTIL_FLOAT_EMU_H */
diff --git a/libavcodec/float_emu_tab.c b/libavcodec/float_emu_tab.c
new file mode 100644
index 0000000..fb0f829
--- /dev/null
+++ b/libavcodec/float_emu_tab.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2012
+ * MIPS Technologies, Inc., California.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the MIPS Technologies, Inc., nor the names of is
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Author: Stanislav Ocovaj (stanislav.ocovaj imgtec com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+
+#define Q30(x) (int)((x)*1073741824.0 + 0.5)
+
+const int divTable[128] = {
+ Q30(0.9999999995), Q30(0.9922480620), Q30(0.9846153846), Q30(0.9770992366),
+ Q30(0.9696969697), Q30(0.9624060150), Q30(0.9552238807), Q30(0.9481481481),
+ Q30(0.9411764704), Q30(0.9343065694), Q30(0.9275362319), Q30(0.9208633094),
+ Q30(0.9142857143), Q30(0.9078014186), Q30(0.9014084507), Q30(0.8951048949),
+ Q30(0.8888888890), Q30(0.8827586207), Q30(0.8767123288), Q30(0.8707482992),
+ Q30(0.8648648649), Q30(0.8590604025), Q30(0.8533333335), Q30(0.8476821193),
+ Q30(0.8421052634), Q30(0.8366013071), Q30(0.8311688313), Q30(0.8258064515),
+ Q30(0.8205128205), Q30(0.8152866242), Q30(0.8101265822), Q30(0.8050314467),
+ Q30(0.7999999998), Q30(0.7950310558), Q30(0.7901234566), Q30(0.7852760735),
+ Q30(0.7804878047), Q30(0.7757575759), Q30(0.7710843375), Q30(0.7664670660),
+ Q30(0.7619047621), Q30(0.7573964498), Q30(0.7529411763), Q30(0.7485380117),
+ Q30(0.7441860465), Q30(0.7398843933), Q30(0.7356321840), Q30(0.7314285715),
+ Q30(0.7272727271), Q30(0.7231638418), Q30(0.7191011235), Q30(0.7150837989),
+ Q30(0.7111111111), Q30(0.7071823203), Q30(0.7032967033), Q30(0.6994535518),
+ Q30(0.6956521738), Q30(0.6918918919), Q30(0.6881720428), Q30(0.6844919785),
+ Q30(0.6808510637), Q30(0.6772486772), Q30(0.6736842105), Q30(0.6701570679),
+ Q30(0.6666666665), Q30(0.6632124353), Q30(0.6597938146), Q30(0.6564102564),
+ Q30(0.6530612246), Q30(0.6497461931), Q30(0.6464646463), Q30(0.6432160805),
+ Q30(0.6400000001), Q30(0.6368159205), Q30(0.6336633665), Q30(0.6305418718),
+ Q30(0.6274509802), Q30(0.6243902440), Q30(0.6213592235), Q30(0.6183574880),
+ Q30(0.6153846155), Q30(0.6124401912), Q30(0.6095238095), Q30(0.6066350709),
+ Q30(0.6037735851), Q30(0.6009389670), Q30(0.5981308413), Q30(0.5953488373),
+ Q30(0.5925925928), Q30(0.5898617511), Q30(0.5871559633), Q30(0.5844748858),
+ Q30(0.5818181820), Q30(0.5791855203), Q30(0.5765765766), Q30(0.5739910314),
+ Q30(0.5714285714), Q30(0.5688888887), Q30(0.5663716816), Q30(0.5638766522),
+ Q30(0.5614035088), Q30(0.5589519651), Q30(0.5565217393), Q30(0.5541125541),
+ Q30(0.5517241377), Q30(0.5493562231), Q30(0.5470085470), Q30(0.5446808510),
+ Q30(0.5423728814), Q30(0.5400843881), Q30(0.5378151261), Q30(0.5355648533),
+ Q30(0.5333333332), Q30(0.5311203320), Q30(0.5289256200), Q30(0.5267489711),
+ Q30(0.5245901640), Q30(0.5224489798), Q30(0.5203252034), Q30(0.5182186235),
+ Q30(0.5161290322), Q30(0.5140562248), Q30(0.5120000001), Q30(0.5099601592),
+ Q30(0.5079365079), Q30(0.5059288535), Q30(0.5039370079), Q30(0.5019607842)
+};
+
+const int sqrtTab[512+1] = { /* sqrt(x), 0.5<=x<1 */
+ Q30(0.7071067812), Q30(0.7077969783), Q30(0.7084865030), Q30(0.7091753576),
+ Q30(0.7098635430), Q30(0.7105510626), Q30(0.7112379172), Q30(0.7119241091),
+ Q30(0.7126096408), Q30(0.7132945131), Q30(0.7139787287), Q30(0.7146622892),
+ Q30(0.7153451964), Q30(0.7160274521), Q30(0.7167090587), Q30(0.7173900176),
+ Q30(0.7180703310), Q30(0.7187500000), Q30(0.7194290273), Q30(0.7201074138),
+ Q30(0.7207851619), Q30(0.7214622740), Q30(0.7221387504), Q30(0.7228145939),
+ Q30(0.7234898065), Q30(0.7241643891), Q30(0.7248383439), Q30(0.7255116729),
+ Q30(0.7261843774), Q30(0.7268564594), Q30(0.7275279206), Q30(0.7281987625),
+ Q30(0.7288689869), Q30(0.7295385958), Q30(0.7302075904), Q30(0.7308759727),
+ Q30(0.7315437444), Q30(0.7322109072), Q30(0.7328774626), Q30(0.7335434123),
+ Q30(0.7342087580), Q30(0.7348735011), Q30(0.7355376435), Q30(0.7362011867),
+ Q30(0.7368641328), Q30(0.7375264824), Q30(0.7381882383), Q30(0.7388494010),
+ Q30(0.7395099727), Q30(0.7401699550), Q30(0.7408293495), Q30(0.7414881573),
+ Q30(0.7421463802), Q30(0.7428040202), Q30(0.7434610785), Q30(0.7441175561),
+ Q30(0.7447734554), Q30(0.7454287778), Q30(0.7460835241), Q30(0.7467376967),
+ Q30(0.7473912966), Q30(0.7480443250), Q30(0.7486967845), Q30(0.7493486754),
+ Q30(0.7500000000), Q30(0.7506507593), Q30(0.7513009552), Q30(0.7519505885),
+ Q30(0.7525996612), Q30(0.7532481747), Q30(0.7538961302), Q30(0.7545435294),
+ Q30(0.7551903734), Q30(0.7558366638), Q30(0.7564824023), Q30(0.7571275900),
+ Q30(0.7577722282), Q30(0.7584163188), Q30(0.7590598627), Q30(0.7597028613),
+ Q30(0.7603453165), Q30(0.7609872287), Q30(0.7616286003), Q30(0.7622694322),
+ Q30(0.7629097258), Q30(0.7635494824), Q30(0.7641887036), Q30(0.7648273907),
+ Q30(0.7654655445), Q30(0.7661031671), Q30(0.7667402592), Q30(0.7673768224),
+ Q30(0.7680128580), Q30(0.7686483674), Q30(0.7692833515), Q30(0.7699178122),
+ Q30(0.7705517504), Q30(0.7711851676), Q30(0.7718180646), Q30(0.7724504434),
+ Q30(0.7730823047), Q30(0.7737136502), Q30(0.7743444811), Q30(0.7749747979),
+ Q30(0.7756046029), Q30(0.7762338966), Q30(0.7768626809), Q30(0.7774909567),
+ Q30(0.7781187249), Q30(0.7787459870), Q30(0.7793727447), Q30(0.7799989986),
+ Q30(0.7806247496), Q30(0.7812500000), Q30(0.7818747503), Q30(0.7824990018),
+ Q30(0.7831227556), Q30(0.7837460130), Q30(0.7843687749), Q30(0.7849910432),
+ Q30(0.7856128183), Q30(0.7862341017), Q30(0.7868548944), Q30(0.7874751980),
+ Q30(0.7880950132), Q30(0.7887143414), Q30(0.7893331838), Q30(0.7899515415),
+ Q30(0.7905694149), Q30(0.7911868063), Q30(0.7918037162), Q30(0.7924201456),
+ Q30(0.7930360963), Q30(0.7936515687), Q30(0.7942665643), Q30(0.7948810840),
+ Q30(0.7954951287), Q30(0.7961087003), Q30(0.7967217988), Q30(0.7973344265),
+ Q30(0.7979465835), Q30(0.7985582710), Q30(0.7991694906), Q30(0.7997802431),
+ Q30(0.8003905294), Q30(0.8010003511), Q30(0.8016097085), Q30(0.8022186034),
+ Q30(0.8028270360), Q30(0.8034350080), Q30(0.8040425205), Q30(0.8046495742),
+ Q30(0.8052561702), Q30(0.8058623099), Q30(0.8064679937), Q30(0.8070732229),
+ Q30(0.8076779991), Q30(0.8082823223), Q30(0.8088861941), Q30(0.8094896153),
+ Q30(0.8100925875), Q30(0.8106951108), Q30(0.8112971867), Q30(0.8118988159),
+ Q30(0.8125000000), Q30(0.8131007394), Q30(0.8137010355), Q30(0.8143008887),
+ Q30(0.8149003005), Q30(0.8154992717), Q30(0.8160978034), Q30(0.8166958964),
+ Q30(0.8172935518), Q30(0.8178907707), Q30(0.8184875534), Q30(0.8190839016),
+ Q30(0.8196798153), Q30(0.8202752969), Q30(0.8208703459), Q30(0.8214649642),
+ Q30(0.8220591522), Q30(0.8226529113), Q30(0.8232462420), Q30(0.8238391452),
+ Q30(0.8244316224), Q30(0.8250236739), Q30(0.8256153008), Q30(0.8262065044),
+ Q30(0.8267972847), Q30(0.8273876435), Q30(0.8279775814), Q30(0.8285670988),
+ Q30(0.8291561976), Q30(0.8297448778), Q30(0.8303331411), Q30(0.8309209873),
+ Q30(0.8315084185), Q30(0.8320954349), Q30(0.8326820373), Q30(0.8332682266),
+ Q30(0.8338540038), Q30(0.8344393703), Q30(0.8350243261), Q30(0.8356088721),
+ Q30(0.8361930102), Q30(0.8367767399), Q30(0.8373600631), Q30(0.8379429798),
+ Q30(0.8385254918), Q30(0.8391075991), Q30(0.8396893027), Q30(0.8402706035),
+ Q30(0.8408515030), Q30(0.8414320010), Q30(0.8420120990), Q30(0.8425917975),
+ Q30(0.8431710978), Q30(0.8437500000), Q30(0.8443285055), Q30(0.8449066146),
+ Q30(0.8454843285), Q30(0.8460616483), Q30(0.8466385738), Q30(0.8472151072),
+ Q30(0.8477912480), Q30(0.8483669977), Q30(0.8489423566), Q30(0.8495173263),
+ Q30(0.8500919067), Q30(0.8506660992), Q30(0.8512399043), Q30(0.8518133233),
+ Q30(0.8523863559), Q30(0.8529590038), Q30(0.8535312680), Q30(0.8541031480),
+ Q30(0.8546746457), Q30(0.8552457616), Q30(0.8558164961), Q30(0.8563868506),
+ Q30(0.8569568251), Q30(0.8575264211), Q30(0.8580956385), Q30(0.8586644791),
+ Q30(0.8592329426), Q30(0.8598010307), Q30(0.8603687435), Q30(0.8609360820),
+ Q30(0.8615030469), Q30(0.8620696389), Q30(0.8626358588), Q30(0.8632017071),
+ Q30(0.8637671852), Q30(0.8643322927), Q30(0.8648970313), Q30(0.8654614016),
+ Q30(0.8660254036), Q30(0.8665890391), Q30(0.8671523076), Q30(0.8677152111),
+ Q30(0.8682777495), Q30(0.8688399233), Q30(0.8694017339), Q30(0.8699631817),
+ Q30(0.8705242672), Q30(0.8710849914), Q30(0.8716453551), Q30(0.8722053585),
+ Q30(0.8727650028), Q30(0.8733242881), Q30(0.8738832157), Q30(0.8744417862),
+ Q30(0.8750000000), Q30(0.8755578580), Q30(0.8761153608), Q30(0.8766725087),
+ Q30(0.8772293031), Q30(0.8777857441), Q30(0.8783418327), Q30(0.8788975696),
+ Q30(0.8794529550), Q30(0.8800079902), Q30(0.8805626752), Q30(0.8811170114),
+ Q30(0.8816709989), Q30(0.8822246385), Q30(0.8827779307), Q30(0.8833308765),
+ Q30(0.8838834763), Q30(0.8844357310), Q30(0.8849876411), Q30(0.8855392071),
+ Q30(0.8860904300), Q30(0.8866413101), Q30(0.8871918479), Q30(0.8877420444),
+ Q30(0.8882919000), Q30(0.8888414158), Q30(0.8893905920), Q30(0.8899394292),
+ Q30(0.8904879279), Q30(0.8910360895), Q30(0.8915839135), Q30(0.8921314017),
+ Q30(0.8926785537), Q30(0.8932253704), Q30(0.8937718528), Q30(0.8943180013),
+ Q30(0.8948638164), Q30(0.8954092991), Q30(0.8959544492), Q30(0.8964992678),
+ Q30(0.8970437557), Q30(0.8975879136), Q30(0.8981317417), Q30(0.8986752401),
+ Q30(0.8992184107), Q30(0.8997612530), Q30(0.9003037680), Q30(0.9008459565),
+ Q30(0.9013878191), Q30(0.9019293557), Q30(0.9024705673), Q30(0.9030114547),
+ Q30(0.9035520186), Q30(0.9040922588), Q30(0.9046321767), Q30(0.9051717725),
+ Q30(0.9057110464), Q30(0.9062500000), Q30(0.9067886332), Q30(0.9073269465),
+ Q30(0.9078649404), Q30(0.9084026157), Q30(0.9089399735), Q30(0.9094770132),
+ Q30(0.9100137362), Q30(0.9105501426), Q30(0.9110862338), Q30(0.9116220092),
+ Q30(0.9121574699), Q30(0.9126926167), Q30(0.9132274496), Q30(0.9137619697),
+ Q30(0.9142961772), Q30(0.9148300732), Q30(0.9153636573), Q30(0.9158969307),
+ Q30(0.9164298936), Q30(0.9169625468), Q30(0.9174948912), Q30(0.9180269265),
+ Q30(0.9185586534), Q30(0.9190900731), Q30(0.9196211854), Q30(0.9201519913),
+ Q30(0.9206824913), Q30(0.9212126858), Q30(0.9217425752), Q30(0.9222721602),
+ Q30(0.9228014410), Q30(0.9233304188), Q30(0.9238590938), Q30(0.9243874662),
+ Q30(0.9249155368), Q30(0.9254433061), Q30(0.9259707746), Q30(0.9264979423),
+ Q30(0.9270248110), Q30(0.9275513799), Q30(0.9280776503), Q30(0.9286036226),
+ Q30(0.9291292969), Q30(0.9296546737), Q30(0.9301797543), Q30(0.9307045382),
+ Q30(0.9312290265), Q30(0.9317532196), Q30(0.9322771183), Q30(0.9328007223),
+ Q30(0.9333240325), Q30(0.9338470497), Q30(0.9343697741), Q30(0.9348922065),
+ Q30(0.9354143469), Q30(0.9359361958), Q30(0.9364577541), Q30(0.9369790219),
+ Q30(0.9375000000), Q30(0.9380206889), Q30(0.9385410887), Q30(0.9390612002),
+ Q30(0.9395810235), Q30(0.9401005600), Q30(0.9406198091), Q30(0.9411387718),
+ Q30(0.9416574482), Q30(0.9421758396), Q30(0.9426939455), Q30(0.9432117669),
+ Q30(0.9437293042), Q30(0.9442465580), Q30(0.9447635286), Q30(0.9452802162),
+ Q30(0.9457966220), Q30(0.9463127456), Q30(0.9468285879), Q30(0.9473441495),
+ Q30(0.9478594307), Q30(0.9483744316), Q30(0.9488891531), Q30(0.9494035956),
+ Q30(0.9499177597), Q30(0.9504316454), Q30(0.9509452535), Q30(0.9514585841),
+ Q30(0.9519716380), Q30(0.9524844158), Q30(0.9529969175), Q30(0.9535091440),
+ Q30(0.9540210953), Q30(0.9545327718), Q30(0.9550441746), Q30(0.9555553030),
+ Q30(0.9560661586), Q30(0.9565767418), Q30(0.9570870521), Q30(0.9575970904),
+ Q30(0.9581068573), Q30(0.9586163531), Q30(0.9591255784), Q30(0.9596345332),
+ Q30(0.9601432183), Q30(0.9606516343), Q30(0.9611597811), Q30(0.9616676597),
+ Q30(0.9621752701), Q30(0.9626826127), Q30(0.9631896880), Q30(0.9636964966),
+ Q30(0.9642030387), Q30(0.9647093150), Q30(0.9652153258), Q30(0.9657210712),
+ Q30(0.9662265521), Q30(0.9667317686), Q30(0.9672367214), Q30(0.9677414102),
+ Q30(0.9682458364), Q30(0.9687500000), Q30(0.9692539014), Q30(0.9697575406),
+ Q30(0.9702609186), Q30(0.9707640354), Q30(0.9712668918), Q30(0.9717694880),
+ Q30(0.9722718243), Q30(0.9727739012), Q30(0.9732757187), Q30(0.9737772783),
+ Q30(0.9742785795), Q30(0.9747796226), Q30(0.9752804083), Q30(0.9757809374),
+ Q30(0.9762812094), Q30(0.9767812253), Q30(0.9772809856), Q30(0.9777804906),
+ Q30(0.9782797401), Q30(0.9787787353), Q30(0.9792774762), Q30(0.9797759629),
+ Q30(0.9802741962), Q30(0.9807721768), Q30(0.9812699044), Q30(0.9817673797),
+ Q30(0.9822646030), Q30(0.9827615744), Q30(0.9832582953), Q30(0.9837547648),
+ Q30(0.9842509842), Q30(0.9847469535), Q30(0.9852426732), Q30(0.9857381433),
+ Q30(0.9862333648), Q30(0.9867283376), Q30(0.9872230627), Q30(0.9877175395),
+ Q30(0.9882117687), Q30(0.9887057510), Q30(0.9891994870), Q30(0.9896929762),
+ Q30(0.9901862200), Q30(0.9906792180), Q30(0.9911719705), Q30(0.9916644781),
+ Q30(0.9921567417), Q30(0.9926487608), Q30(0.9931405364), Q30(0.9936320684),
+ Q30(0.9941233573), Q30(0.9946144037), Q30(0.9951052079), Q30(0.9955957700),
+ Q30(0.9960860908), Q30(0.9965761700), Q30(0.9970660084), Q30(0.9975556061),
+ Q30(0.9980449639), Q30(0.9985340820), Q30(0.9990229602), Q30(0.9995115995),
+ 0x3FFFFFFF
+};
+
+const int sqrExpMultTab[2] = {
+ Q30(0.5000000000), Q30(0.7071067812)
+};
+
+const int aac_costbl_1[16] = {
+ Q30( 1.000000000000000), Q30( 0.980785280403230), Q30( 0.923879532511287), Q30( 0.831469612302545),
+ Q30( 0.707106781186548), Q30( 0.555570233019602), Q30( 0.382683432365090), Q30( 0.195090322016128),
+ Q30( 0.000000000000000), Q30(-0.195090322016128), Q30(-0.382683432365090), Q30(-0.555570233019602),
+ Q30(-0.707106781186547), Q30(-0.831469612302545), Q30(-0.923879532511287), Q30(-0.980785280403230)
+};
+
+const int aac_costbl_2[32] = {
+ Q30(1.000000000000000), Q30(0.999981175282601), Q30(0.999924701839145), Q30(0.999830581795823),
+ Q30(0.999698818696204), Q30(0.999529417501093), Q30(0.999322384588350), Q30(0.999077727752645),
+ Q30(0.998795456205172), Q30(0.998475580573295), Q30(0.998118112900149), Q30(0.997723066644192),
+ Q30(0.997290456678690), Q30(0.996820299291166), Q30(0.996312612182778), Q30(0.995767414467660),
+ Q30(0.995184726672197), Q30(0.994564570734255), Q30(0.993906970002356), Q30(0.993211949234795),
+ Q30(0.992479534598710), Q30(0.991709753669100), Q30(0.990902635427780), Q30(0.990058210262297),
+ Q30(0.989176509964781), Q30(0.988257567730749), Q30(0.987301418157858), Q30(0.986308097244599),
+ Q30(0.985277642388941), Q30(0.984210092386929), Q30(0.983105487431216), Q30(0.981963869109555)
+};
+
+const int aac_sintbl_2[32] = {
+ Q30(0.000000000000000), Q30(0.006135884649154), Q30(0.012271538285720), Q30(0.018406729905805),
+ Q30(0.024541228522912), Q30(0.030674803176637), Q30(0.036807222941359), Q30(0.042938256934941),
+ Q30(0.049067674327418), Q30(0.055195244349690), Q30(0.061320736302209), Q30(0.067443919563664),
+ Q30(0.073564563599667), Q30(0.079682437971430), Q30(0.085797312344440), Q30(0.091908956497133),
+ Q30(0.098017140329561), Q30(0.104121633872055), Q30(0.110222207293883), Q30(0.116318630911905),
+ Q30(0.122410675199216), Q30(0.128498110793793), Q30(0.134580708507126), Q30(0.140658239332849),
+ Q30(0.146730474455362), Q30(0.152797185258443), Q30(0.158858143333861), Q30(0.164913120489970),
+ Q30(0.170961888760301), Q30(0.177004220412149), Q30(0.183039887955141), Q30(0.189068664149806)
+};
+
+const int aac_costbl_3[32] = {
+ Q30(1.000000000000000), Q30(0.999999981616429), Q30(0.999999926465718), Q30(0.999999834547868),
+ Q30(0.999999705862882), Q30(0.999999540410766), Q30(0.999999338191526), Q30(0.999999099205168),
+ Q30(0.999998823451702), Q30(0.999998510931138), Q30(0.999998161643487), Q30(0.999997775588762),
+ Q30(0.999997352766978), Q30(0.999996893178150), Q30(0.999996396822294), Q30(0.999995863699430),
+ Q30(0.999995293809576), Q30(0.999994687152754), Q30(0.999994043728986), Q30(0.999993363538295),
+ Q30(0.999992646580707), Q30(0.999991892856248), Q30(0.999991102364946), Q30(0.999990275106829),
+ Q30(0.999989411081928), Q30(0.999988510290276), Q30(0.999987572731904), Q30(0.999986598406848),
+ Q30(0.999985587315143), Q30(0.999984539456827), Q30(0.999983454831938), Q30(0.999982333440515)
+};
+
+const int aac_sintbl_3[32] = {
+ Q30(0.000000000000000), Q30(0.000191747597311), Q30(0.000383495187571), Q30(0.000575242763732),
+ Q30(0.000766990318743), Q30(0.000958737845553), Q30(0.001150485337114), Q30(0.001342232786374),
+ Q30(0.001533980186285), Q30(0.001725727529795), Q30(0.001917474809855), Q30(0.002109222019416),
+ Q30(0.002300969151426), Q30(0.002492716198836), Q30(0.002684463154596), Q30(0.002876210011656),
+ Q30(0.003067956762966), Q30(0.003259703401476), Q30(0.003451449920136), Q30(0.003643196311896),
+ Q30(0.003834942569706), Q30(0.004026688686517), Q30(0.004218434655277), Q30(0.004410180468938),
+ Q30(0.004601926120449), Q30(0.004793671602760), Q30(0.004985416908822), Q30(0.005177162031584),
+ Q30(0.005368906963996), Q30(0.005560651699010), Q30(0.005752396229574), Q30(0.005944140548639)
+};
+
+const int aac_costbl_4[33] = {
+ Q30(1.000000000000000), Q30(0.999999999982047), Q30(0.999999999928189), Q30(0.999999999838426),
+ Q30(0.999999999712757), Q30(0.999999999551182), Q30(0.999999999353703), Q30(0.999999999120317),
+ Q30(0.999999998851027), Q30(0.999999998545831), Q30(0.999999998204729), Q30(0.999999997827723),
+ Q30(0.999999997414810), Q30(0.999999996965993), Q30(0.999999996481270), Q30(0.999999995960641),
+ Q30(0.999999995404107), Q30(0.999999994811668), Q30(0.999999994183323), Q30(0.999999993519073),
+ Q30(0.999999992818918), Q30(0.999999992082857), Q30(0.999999991310890), Q30(0.999999990503019),
+ Q30(0.999999989659241), Q30(0.999999988779559), Q30(0.999999987863971), Q30(0.999999986912477),
+ Q30(0.999999985925079), Q30(0.999999984901774), Q30(0.999999983842565), Q30(0.999999982747450),
+ Q30(0.999999981616429)
+};
+
+const int aac_sintbl_4[33] = {
+ Q30(0.000000000000000), Q30(0.000005992112453), Q30(0.000011984224905), Q30(0.000017976337357),
+ Q30(0.000023968449808), Q30(0.000029960562259), Q30(0.000035952674708), Q30(0.000041944787156),
+ Q30(0.000047936899603), Q30(0.000053929012048), Q30(0.000059921124491), Q30(0.000065913236932),
+ Q30(0.000071905349370), Q30(0.000077897461806), Q30(0.000083889574239), Q30(0.000089881686669),
+ Q30(0.000095873799096), Q30(0.000101865911519), Q30(0.000107858023939), Q30(0.000113850136355),
+ Q30(0.000119842248767), Q30(0.000125834361174), Q30(0.000131826473577), Q30(0.000137818585975),
+ Q30(0.000143810698369), Q30(0.000149802810757), Q30(0.000155794923139), Q30(0.000161787035517),
+ Q30(0.000167779147888), Q30(0.000173771260253), Q30(0.000179763372612), Q30(0.000185755484965),
+ Q30(0.000191747597311)
+};
--
1.8.2.1
More information about the ffmpeg-devel
mailing list