summaryrefslogtreecommitdiffstats
path: root/libFDK/include/mips
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-04-17 09:51:45 -0700
committerDave Burke <daveburke@google.com>2012-04-17 23:04:43 -0700
commit9bf37cc9712506b2483650c82d3c41152337ef7e (patch)
tree77db44e2bae06e3d144b255628be2b7a55c581d3 /libFDK/include/mips
parenta37315fe10ee143d6d0b28c19d41a476a23e63ea (diff)
downloadODR-AudioEnc-9bf37cc9712506b2483650c82d3c41152337ef7e.tar.gz
ODR-AudioEnc-9bf37cc9712506b2483650c82d3c41152337ef7e.tar.bz2
ODR-AudioEnc-9bf37cc9712506b2483650c82d3c41152337ef7e.zip
Fraunhofer AAC codec.
License boilerplate update to follow. Change-Id: I2810460c11a58b6d148d84673cc031f3685e79b5
Diffstat (limited to 'libFDK/include/mips')
-rw-r--r--libFDK/include/mips/abs_mips.h44
-rw-r--r--libFDK/include/mips/clz_mips.h55
-rw-r--r--libFDK/include/mips/cplx_mul.h93
-rw-r--r--libFDK/include/mips/fixmadd_mips.h32
-rw-r--r--libFDK/include/mips/fixmul_mips.h53
-rw-r--r--libFDK/include/mips/scale.h48
-rw-r--r--libFDK/include/mips/scramble.h59
7 files changed, 384 insertions, 0 deletions
diff --git a/libFDK/include/mips/abs_mips.h b/libFDK/include/mips/abs_mips.h
new file mode 100644
index 0000000..92729c5
--- /dev/null
+++ b/libFDK/include/mips/abs_mips.h
@@ -0,0 +1,44 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2006)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description: fixed point intrinsics
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+#if defined(__mips__)
+
+#if defined(__GNUC__) && defined(__mips__)
+
+ #if defined(__mips_dsp)
+ #define FUNCTION_fixabs_D
+ #define FUNCTION_fixabs_I
+ #define FUNCTION_fixabs_S
+ inline FIXP_DBL fixabs_D(FIXP_DBL x) { return __builtin_mips_absq_s_w(x); }
+ inline FIXP_SGL fixabs_S(FIXP_SGL x) { return ((x) > (FIXP_SGL)(0)) ? (x) : -(x) ; }
+ inline INT fixabs_I(INT x) { return __builtin_mips_absq_s_w(x); }
+ #endif /* __mips_dsp */
+
+#endif /* defined(__GNUC__) && defined(__mips__) */
+
+#endif /*__mips__ */
+
diff --git a/libFDK/include/mips/clz_mips.h b/libFDK/include/mips/clz_mips.h
new file mode 100644
index 0000000..23e6949
--- /dev/null
+++ b/libFDK/include/mips/clz_mips.h
@@ -0,0 +1,55 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2006)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description: fixed point intrinsics
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+#if defined(__mips__)
+
+#if defined(__mips__) && (__GNUC__==2) && (mips>=32)
+
+ #define FUNCTION_fixnormz_D
+ inline INT fixnormz_D(LONG value)
+ {
+ INT result;
+ __asm__ ("clz %0,%1" : "=d" (result) : "d" (value));
+
+ return result;
+ }
+
+#elif defined(__mips__) && (__GNUC__==3) && (__mips>=32)
+
+ #define FUNCTION_fixnormz_D
+ INT inline fixnormz_D(LONG value)
+ {
+ INT result;
+ __asm__ ("clz %[result], %[value]" : [result] "=r" (result) : [value] "r" (value)) ;
+
+ return result;
+ }
+
+#endif
+
+#endif /* __mips__ */
+
diff --git a/libFDK/include/mips/cplx_mul.h b/libFDK/include/mips/cplx_mul.h
new file mode 100644
index 0000000..f6f46cc
--- /dev/null
+++ b/libFDK/include/mips/cplx_mul.h
@@ -0,0 +1,93 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2006)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description: fixed point intrinsics
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+
+
+#if defined(__GNUC__) && defined(__mips__)
+
+
+//#define FUNCTION_cplxMultDiv2_32x16
+//#define FUNCTION_cplxMultDiv2_32x16X2
+#define FUNCTION_cplxMultDiv2_32x32X2
+//#define FUNCTION_cplxMult_32x16
+//#define FUNCTION_cplxMult_32x16X2
+#define FUNCTION_cplxMult_32x32X2
+
+#if defined(FUNCTION_cplxMultDiv2_32x32X2)
+inline void cplxMultDiv2( FIXP_DBL *c_Re,
+ FIXP_DBL *c_Im,
+ FIXP_DBL a_Re,
+ FIXP_DBL a_Im,
+ FIXP_DBL b_Re,
+ FIXP_DBL b_Im)
+{
+ INT result;
+
+ __asm__ ("mult %[a_Re], %[b_Re];\n"
+ "msub %[a_Im], %[b_Im];\n"
+ : "=hi"(result)
+ : [a_Re]"r"(a_Re), [b_Re]"r"(b_Re), [a_Im]"r"(a_Im), [b_Im]"r"(b_Im)
+ : "lo");
+
+ *c_Re = result;
+
+ __asm__ ("mult %[a_Re], %[b_Im];\n"
+ "madd %[a_Im], %[b_Re];\n"
+ : "=hi"(result)
+ : [a_Re]"r"(a_Re), [b_Im]"r"(b_Im), [a_Im]"r"(a_Im), [b_Re]"r"(b_Re)
+ : "lo");
+ *c_Im = result;
+}
+#endif
+
+#if defined(FUNCTION_cplxMult_32x32X2)
+inline void cplxMult( FIXP_DBL *c_Re,
+ FIXP_DBL *c_Im,
+ FIXP_DBL a_Re,
+ FIXP_DBL a_Im,
+ FIXP_DBL b_Re,
+ FIXP_DBL b_Im)
+{
+ INT result;
+ __asm__ ("mult %[a_Re], %[b_Re];\n"
+ "msub %[a_Im], %[b_Im];\n"
+ : "=hi"(result)
+ : [a_Re]"r"(a_Re), [b_Re]"r"(b_Re), [a_Im]"r"(a_Im), [b_Im]"r"(b_Im)
+ : "lo");
+ *c_Re = result<<1;
+
+ __asm__ ("mult %[a_Re], %[b_Im];\n"
+ "madd %[a_Im], %[b_Re];\n"
+ : "=hi"(result)
+ : [a_Re]"r"(a_Re), [b_Im]"r"(b_Im), [a_Im]"r"(a_Im), [b_Re]"r"(b_Re)
+ : "lo");
+ *c_Im = result<<1;
+}
+#endif
+
+#endif /* defined(__GNUC__) && defined(__mips__) */
+
diff --git a/libFDK/include/mips/fixmadd_mips.h b/libFDK/include/mips/fixmadd_mips.h
new file mode 100644
index 0000000..4d075ad
--- /dev/null
+++ b/libFDK/include/mips/fixmadd_mips.h
@@ -0,0 +1,32 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2006)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description: fixed point intrinsics
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+#if defined(__mips__)
+
+
+#endif /* __mips__ */
+
diff --git a/libFDK/include/mips/fixmul_mips.h b/libFDK/include/mips/fixmul_mips.h
new file mode 100644
index 0000000..067674c
--- /dev/null
+++ b/libFDK/include/mips/fixmul_mips.h
@@ -0,0 +1,53 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2006)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description: fixed point intrinsics
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+#if defined(__mips__)
+
+#if (__GNUC__) && defined(__mips__) /* cppp replaced: elif */
+/* MIPS GCC based compiler */
+
+#define FUNCTION_fixmuldiv2_DD
+
+#define FUNCTION_fixmuldiv2BitExact_DD
+#define fixmuldiv2BitExact_DD(a,b) fixmuldiv2_DD(a,b)
+
+inline INT fixmuldiv2_DD (const INT a, const INT b)
+{
+ INT result ;
+
+ asm ("mult %1,%2;\n"
+ : "=hi" (result)
+ : "d" (a), "r" (b)
+ : "lo");
+
+ return result ;
+}
+
+#endif /* (__GNUC__) && defined(__mips__) */
+
+#endif /* __mips__ */
+
diff --git a/libFDK/include/mips/scale.h b/libFDK/include/mips/scale.h
new file mode 100644
index 0000000..82b1833
--- /dev/null
+++ b/libFDK/include/mips/scale.h
@@ -0,0 +1,48 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2007)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description:
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+
+#ifndef MIPS_SCALE_H
+#define MIPS_SCALE_H
+
+#if defined(__mips_dsp)
+
+/*!
+*
+* \brief Scale input value by 2^{scale} and saturate output to 2^{dBits-1}
+* \return scaled and saturated value
+*
+* This macro scales src value right or left and applies saturation to (2^dBits)-1
+* maxima output.
+*/
+#define SATURATE_RIGHT_SHIFT(src, scale, dBits) \
+ (__builtin_mips_shll_s_w((src)>>scale,(DFRACT_BITS-(dBits)))>>(DFRACT_BITS-(dBits)))
+
+
+#endif /*__mips_dsp */
+
+#endif /* MIPS_SCALE_H */
diff --git a/libFDK/include/mips/scramble.h b/libFDK/include/mips/scramble.h
new file mode 100644
index 0000000..b93031a
--- /dev/null
+++ b/libFDK/include/mips/scramble.h
@@ -0,0 +1,59 @@
+/*************************** Fraunhofer IIS FDK Tools **********************
+
+ (C) Copyright Fraunhofer IIS (2007)
+ All Rights Reserved
+
+ Please be advised that this software and/or program delivery is
+ Confidential Information of Fraunhofer and subject to and covered by the
+
+ Fraunhofer IIS Software Evaluation Agreement
+ between Google Inc. and Fraunhofer
+ effective and in full force since March 1, 2012.
+
+ You may use this software and/or program only under the terms and
+ conditions described in the above mentioned Fraunhofer IIS Software
+ Evaluation Agreement. Any other and/or further use requires a separate agreement.
+
+
+ $Id$
+ Author(s):
+ Description:
+
+ This software and/or program is protected by copyright law and international
+ treaties. Any reproduction or distribution of this software and/or program,
+ or any portion of it, may result in severe civil and criminal penalties, and
+ will be prosecuted to the maximum extent possible under law.
+
+******************************************************************************/
+
+#ifndef MIPS_SCRAMBLE_H
+#define MIPS_SCRAMBLE_H
+
+#define FUNCTION_scramble
+
+#if defined(FUNCTION_scramble)
+inline void scramble(FIXP_DBL *x, INT n) {
+ INT m,j;
+ int ldn=1;
+ do {ldn++;} while((1<<ldn)<n);
+
+ for (m=1,j=0; m<n-1; m++)
+ {
+ j = __builtin_mips_bitrev(m) >> (16-ldn);
+
+ if (j>m)
+ {
+ FIXP_DBL tmp;
+ tmp=x[2*m];
+ x[2*m]=x[2*j];
+ x[2*j]=tmp;
+
+ tmp=x[2*m+1];
+ x[2*m+1]=x[2*j+1];
+ x[2*j+1]=tmp;
+ }
+ }
+}
+#endif
+
+#endif /* MIPS_SCRAMBLE_H */