summaryrefslogtreecommitdiffstats
path: root/libSYS/include/machine_type.h
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 /libSYS/include/machine_type.h
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 'libSYS/include/machine_type.h')
-rw-r--r--libSYS/include/machine_type.h295
1 files changed, 295 insertions, 0 deletions
diff --git a/libSYS/include/machine_type.h b/libSYS/include/machine_type.h
new file mode 100644
index 0000000..6b9b7e6
--- /dev/null
+++ b/libSYS/include/machine_type.h
@@ -0,0 +1,295 @@
+/************************** Fraunhofer IIS FDK SysLib **********************
+
+ (C) Copyright Fraunhofer IIS (2003)
+ 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):
+
+ 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.
+
+******************************************************************************/
+
+/** \file machine_type.h
+ * \brief Type defines for various processors and compiler tools.
+ */
+
+#if !defined(__MACHINE_TYPE_H__)
+#define __MACHINE_TYPE_H__
+
+
+/* Library calling convention spec. __cdecl and friends might be added here as required. */
+ #define LINKSPEC_H
+ #define LINKSPEC_CPP
+
+
+/**
+ * collate all corresponding compiler specific macros to detect a debug build, and set the DEBUG macro if that is the case.
+ */
+#if defined(_DEBUG)
+#define DEBUG
+#endif
+
+
+/* for doxygen the following docu parts must be separated */
+/** \var SCHAR
+ * Data type representing at least 1 byte signed integer on all supported platforms.
+ */
+/** \var UCHAR
+ * Data type representing at least 1 byte unsigned integer on all supported platforms.
+ */
+/** \var INT
+ * Data type representing at least 4 byte signed integer on all supported platforms.
+ */
+/** \var UINT
+ * Data type representing at least 4 byte unsigned integer on all supported platforms.
+ */
+/** \var LONG
+ * Data type representing 4 byte signed integer on all supported platforms.
+ */
+/** \var ULONG
+ * Data type representing 4 byte unsigned integer on all supported platforms.
+ */
+/** \var SHORT
+ * Data type representing 2 byte signed integer on all supported platforms.
+ */
+/** \var USHORT
+ * Data type representing 2 byte unsigned integer on all supported platforms.
+ */
+/** \var INT64
+ * Data type representing 8 byte signed integer on all supported platforms.
+ */
+/** \var UINT64
+ * Data type representing 8 byte unsigned integer on all supported platforms.
+ */
+/** \def SHORT_BITS
+ * Number of bits the data type short represents. sizeof() is not suited to get this info,
+ * because a byte is not always defined as 8 bits.
+ */
+/** \def CHAR_BITS
+ * Number of bits the data type char represents. sizeof() is not suited to get this info,
+ * because a byte is not always defined as 8 bits.
+ */
+/** \var INT_PCM
+ * Data type representing the width of input and output PCM samples.
+ */
+
+
+ typedef signed int INT;
+ typedef unsigned int UINT;
+#ifdef __x86_64__
+ /* force FDK long-datatypes to 4 byte */
+ /* jdr: Use defines to avoid type alias problems on 64 bit machines. */
+ #define LONG INT
+ #define ULONG UINT
+#else /* __x86_64__ */
+ typedef signed long LONG;
+ typedef unsigned long ULONG;
+#endif /* __x86_64__ */
+ typedef signed short SHORT;
+ typedef unsigned short USHORT;
+ typedef signed char SCHAR;
+ typedef unsigned char UCHAR;
+
+ #define SHORT_BITS 16
+ #define CHAR_BITS 8
+
+
+/* Define 64 bit base integer type. */
+#ifdef _WIN32
+ typedef __int64 INT64;
+ typedef unsigned __int64 UINT64;
+#else
+ typedef long long INT64;
+ typedef unsigned long long UINT64;
+#endif
+
+#ifndef NULL
+ #ifdef __cplusplus
+ #define NULL 0
+ #else
+ #define NULL ((void *)0)
+ #endif
+#endif
+
+/* Assert is functional on x86 PC's and also when debugging is turned on. */
+#if defined(DEBUG) || defined(__i686__) || defined(__i586__) || defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(FDK_DEBUG) || defined(FDK_ASSERT_ENABLE)
+ #include <assert.h>
+ #define FDK_ASSERT(x) assert(x)
+#else
+ #define FDK_ASSERT(ignore)
+#endif
+
+ typedef SHORT INT_PCM;
+ #define WAV_BITS 16
+ #define SAMPLE_BITS 16
+ #define SAMPLE_MAX (((LONG)1<<(SAMPLE_BITS-1))-1)
+ #define SAMPLE_MIN (~SAMPLE_MAX)
+
+/*!
+* \def RAM_ALIGN
+* Used to align memory as prefix before memory declaration. For example:
+ \code
+ RAM_ALIGN
+ int myArray[16];
+ \endcode
+
+ Note, that not all platforms support this mechanism. For example with TI compilers
+ a preprocessor pragma is used, but to do something like
+
+ \code
+ #define RAM_ALIGN #pragma DATA_ALIGN(x)
+ \encode
+
+ would require the preprocessor to process this line twice to fully resolve it. Hence,
+ a fully platform-independant way to use alignment is not supported.
+
+* \def ALIGNMENT_DEFAULT
+* Default alignment in bytes.
+*/
+#if defined(__GNUC__) /* cppp replaced: elif */
+ #define ALIGNMENT_DEFAULT 8
+ #define RAM_ALIGN __attribute__((aligned(ALIGNMENT_DEFAULT)))
+#else
+ #define ALIGNMENT_DEFAULT 8
+ #define RAM_ALIGN
+#endif
+
+
+/*!
+* \def RESTRICT
+* The restrict keyword is supported by some platforms and RESTRICT maps to
+* either the corresponding keyword on each platform or to void if the
+* compiler does not provide such feature.
+*
+* \def WORD_ALIGNED(x)
+* Tells the compiler that pointer x is WORD aligned.
+* At the moment only supported by TI compilers.
+*
+* \def DWORD_ALIGNED(x)
+* Tells the compiler that pointer x is DWORD aligned.
+* At the moment only supported by TI compilers.
+*/
+ #define RESTRICT
+ #define WORD_ALIGNED(x)
+ #define DWORD_ALIGNED(x)
+
+
+/*-----------------------------------------------------------------------------------
+ * ALIGN_SIZE
+ *-----------------------------------------------------------------------------------*/
+/*!
+ * \brief This macro aligns a given value depending on ::ALIGNMENT_DEFAULT.
+ *
+ * For example if #ALIGNMENT_DEFAULT equals 8, then:
+ * - ALIGN_SIZE(3) returns 8
+ * - ALIGN_SIZE(8) returns 8
+ * - ALIGN_SIZE(9) returns 16
+ */
+#define ALIGN_SIZE(a) ((a)+ (((INT)ALIGNMENT_DEFAULT - ((INT)(a) & (ALIGNMENT_DEFAULT-1)) ) & (ALIGNMENT_DEFAULT-1)))
+
+/*-----------------------------------------------------------------------------------
+ * ALIGN_PTR
+ * cast (a) to width of pointer
+ *-----------------------------------------------------------------------------------*/
+/*!
+ * \brief This macro aligns a given address depending on ::ALIGNMENT_DEFAULT.
+ */
+#define ALIGN_PTR(a) ( (unsigned char*)(a) + (((INT)ALIGNMENT_DEFAULT - ((INT)(UINT64)(a) & (ALIGNMENT_DEFAULT-1)) ) & (ALIGNMENT_DEFAULT-1)) )
+
+ /* Alignment macro for libSYS heap implementation */
+#define ALIGNMENT_EXTRES ( ALIGNMENT_DEFAULT )
+#define ALGN_SIZE_EXTRES(a) ((a)+ (((INT)ALIGNMENT_EXTRES - ((INT)(a) & (ALIGNMENT_EXTRES-1)) ) & (ALIGNMENT_EXTRES-1)))
+
+
+/*!
+ * \def FORCEINLINE
+ * Sometimes compiler do not do what they are told to do, and in case of inlining some
+ * additional command might be necessary depending on the platform.
+ *
+ * \def FDK_INLINE
+ * Defines how the compiler is told to inline stuff.
+ */
+#ifdef DEBUG
+#undef FORCEINLINE
+#define FORCEINLINE
+#else
+#ifndef FORCEINLINE
+ #if defined(__GNUC__) /* cppp replaced: elif */
+ #define FORCEINLINE __attribute((always_inline))
+ #else
+ #define FORCEINLINE
+ #endif
+#endif
+#endif
+
+ /* for all other platforms */
+ #define FDK_INLINE inline
+
+
+/*!
+ * \def LNK_SECTION_DATA_L1
+ * The LNK_SECTION_* defines allow memory to be drawn from specific memory
+ * sections. Used as prefix before variable declaration.
+ *
+ * \def LNK_SECTION_DATA_L2
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_L1_DATA_A
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_L1_DATA_B
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_CONSTDATA_L1
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_CONSTDATA
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_CODE_L1
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_CODE_L2
+ * See ::LNK_SECTION_DATA_L1
+ * \def LNK_SECTION_INITCODE
+ * See ::LNK_SECTION_DATA_L1
+ */
+/**************************************************
+ * Code Section macros
+ **************************************************/
+ #define LNK_SECTION_CODE_L1
+ #define LNK_SECTION_CODE_L2
+ #define LNK_SECTION_INITCODE
+
+/* Memory section macros. */
+
+ /* default fall back */
+ #define LNK_SECTION_DATA_L1
+ #define LNK_SECTION_DATA_L2
+ #define LNK_SECTION_CONSTDATA
+ #define LNK_SECTION_CONSTDATA_L1
+
+ #define LNK_SECTION_L1_DATA_A
+ #define LNK_SECTION_L1_DATA_B
+
+
+#ifdef _MSC_VER
+ /*
+ * Sometimes certain features are excluded from compilation and therefore the warning 4065 may occur:
+ * "switch statement contains 'default' but no 'case' labels"
+ * We consider this warning irrelevant and disable it.
+ */
+ #pragma warning( disable : 4065 )
+#endif
+
+#endif /* __MACHINE_TYPE_H__ */