00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef AVUTIL_INTERNAL_H
00027 #define AVUTIL_INTERNAL_H
00028
00029 #if !defined(DEBUG) && !defined(NDEBUG)
00030 # define NDEBUG
00031 #endif
00032
00033 #include <limits.h>
00034 #include <stdint.h>
00035 #include <stddef.h>
00036 #include <assert.h>
00037 #include "config.h"
00038 #include "attributes.h"
00039 #include "timer.h"
00040 #include "cpu.h"
00041 #include "dict.h"
00042
00043 #ifndef attribute_align_arg
00044 #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
00045 # define attribute_align_arg __attribute__((force_align_arg_pointer))
00046 #else
00047 # define attribute_align_arg
00048 #endif
00049 #endif
00050
00051 #if defined(_MSC_VER) && CONFIG_SHARED
00052 # define av_export __declspec(dllimport)
00053 #else
00054 # define av_export
00055 #endif
00056
00057 #ifndef INT_BIT
00058 # define INT_BIT (CHAR_BIT * sizeof(int))
00059 #endif
00060
00061 #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
00062 {\
00063 p = av_malloc(size);\
00064 if (p == NULL && (size) != 0) {\
00065 av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
00066 goto label;\
00067 }\
00068 }
00069
00070 #define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\
00071 {\
00072 p = av_mallocz(size);\
00073 if (p == NULL && (size) != 0) {\
00074 av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
00075 goto label;\
00076 }\
00077 }
00078
00079 #include "libm.h"
00080
00086 #if CONFIG_SMALL
00087 # define NULL_IF_CONFIG_SMALL(x) NULL
00088 #else
00089 # define NULL_IF_CONFIG_SMALL(x) x
00090 #endif
00091
00109 #if HAVE_SYMVER_ASM_LABEL
00110 # define FF_SYMVER(type, name, args, ver) \
00111 type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver); \
00112 type ff_##name args
00113 #elif HAVE_SYMVER_GNU_ASM
00114 # define FF_SYMVER(type, name, args, ver) \
00115 __asm__ (".symver ff_" #name "," EXTERN_PREFIX #name "@" ver); \
00116 type ff_##name args; \
00117 type ff_##name args
00118 #endif
00119
00125 #if HAVE_THREADS
00126 # define ONLY_IF_THREADS_ENABLED(x) x
00127 #else
00128 # define ONLY_IF_THREADS_ENABLED(x) NULL
00129 #endif
00130
00131 #if HAVE_MMX_INLINE
00137 static av_always_inline void emms_c(void)
00138 {
00139 if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
00140 __asm__ volatile ("emms" ::: "memory");
00141 }
00142 #elif HAVE_MMX && HAVE_MM_EMPTY
00143 # include <mmintrin.h>
00144 # define emms_c _mm_empty
00145 #else
00146 # define emms_c()
00147 #endif
00148
00149 #endif