mpc_types.h

00001 /*
00002   Copyright (c) 2005-2009, The Musepack Development Team
00003   All rights reserved.
00004 
00005   Redistribution and use in source and binary forms, with or without
00006   modification, are permitted provided that the following conditions are
00007   met:
00008 
00009   * Redistributions of source code must retain the above copyright
00010   notice, this list of conditions and the following disclaimer.
00011 
00012   * Redistributions in binary form must reproduce the above
00013   copyright notice, this list of conditions and the following
00014   disclaimer in the documentation and/or other materials provided
00015   with the distribution.
00016 
00017   * Neither the name of the The Musepack Development Team nor the
00018   names of its contributors may be used to endorse or promote
00019   products derived from this software without specific prior
00020   written permission.
00021 
00022   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 */
00034 #ifndef _MPC_TYPES_H_
00035 #define _MPC_TYPES_H_
00036 #ifdef WIN32
00037 #pragma once
00038 #endif
00039 
00040 #include <stdlib.h>
00041 #include <memory.h>
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 #ifdef _MSC_VER
00048 typedef __int8           mpc_int8_t;
00049 typedef unsigned __int8  mpc_uint8_t;
00050 typedef __int16          mpc_int16_t;
00051 typedef unsigned __int16 mpc_uint16_t;
00052 typedef __int32          mpc_int32_t;
00053 typedef unsigned __int32 mpc_uint32_t;
00054 typedef __int64          mpc_int64_t;
00055 typedef unsigned __int64 mpc_uint64_t;
00056 #define mpc_inline __inline
00057 #else
00058 #include <stdint.h>
00059 typedef int8_t   mpc_int8_t;
00060 typedef uint8_t  mpc_uint8_t;
00061 typedef int16_t  mpc_int16_t;
00062 typedef uint16_t mpc_uint16_t;
00063 typedef int32_t  mpc_int32_t;
00064 typedef uint32_t mpc_uint32_t;
00065 typedef int64_t  mpc_int64_t;
00066 typedef uint64_t  mpc_uint64_t;
00067 #define mpc_inline inline
00068 #endif
00069 
00070 typedef int mpc_int_t;
00071 typedef unsigned int mpc_uint_t;
00072 typedef size_t mpc_size_t;
00073 typedef mpc_uint8_t mpc_bool_t;
00074 
00075 // #define LONG_SEEK_TABLE
00076 #ifdef LONG_SEEK_TABLE  // define as needed (mpc_uint32_t supports files up to 512 MB)
00077 typedef mpc_uint64_t mpc_seek_t;
00078 #else
00079 typedef mpc_uint32_t mpc_seek_t;
00080 #endif
00081 
00082 # define mpc_int64_min -9223372036854775808ll
00083 # define mpc_int64_max 9223372036854775807ll
00084 
00085 typedef struct mpc_quantizer {
00086         mpc_int16_t  L [36];
00087         mpc_int16_t  R [36];
00088 } mpc_quantizer;
00089 
00091 typedef enum mpc_status {
00092     MPC_STATUS_OK        =  0,
00093     MPC_STATUS_FILE      = -1,
00094     MPC_STATUS_SV7BETA   = -2,
00095     MPC_STATUS_CBR       = -3,
00096     MPC_STATUS_IS        = -4,
00097     MPC_STATUS_BLOCKSIZE = -5,
00098     MPC_STATUS_INVALIDSV = -6
00099 } mpc_status;
00100 
00101 
00102 #define MPC_FIXED_POINT_SHIFT 16
00103 
00104 #ifdef MPC_FIXED_POINT
00105 # define MPC_FIXED_POINT_FRACTPART 14
00106 # define MPC_FIXED_POINT_SCALE_SHIFT (MPC_FIXED_POINT_SHIFT + MPC_FIXED_POINT_FRACTPART)
00107 # define MPC_FIXED_POINT_SCALE (1 << (MPC_FIXED_POINT_SCALE_SHIFT - 1))
00108 typedef mpc_int32_t MPC_SAMPLE_FORMAT;
00109 #else
00110 typedef float       MPC_SAMPLE_FORMAT;
00111 #endif
00112 
00113 enum {
00114     MPC_FALSE = 0,
00115     MPC_TRUE  = !MPC_FALSE
00116 };
00117 
00119 #if   defined _WIN32
00120 # define mpc_cdecl           __cdecl
00121 #elif defined __ZTC__
00122 # define mpc_cdecl           _cdecl
00123 #elif defined __TURBOC__
00124 # define mpc_cdecl           cdecl
00125 #else
00126 # define mpc_cdecl
00127 #endif
00128 
00129 #ifdef __GNUC__
00130 # define MPC_API __attribute__ ((visibility("default")))
00131 #else
00132 # define MPC_API
00133 #endif
00134 
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138 #endif

Generated on Sun Jan 16 05:12:53 2011 for libmpcdec by  doxygen 1.4.7