*/
/**
- * @file internal.h
- * common internal api header.
+ * @file libavutil/internal.h
+ * common internal API header
*/
#ifndef AVUTIL_INTERNAL_H
# define NDEBUG
#endif
+#include <limits.h>
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
+#include "config.h"
#include "common.h"
+#include "mem.h"
#include "timer.h"
#ifndef attribute_align_arg
# define PIC
#endif
-#include "config.h"
-
#ifndef offsetof
# define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F))
#endif
extern const uint8_t ff_sqrt_tab[256];
-static inline int av_log2_16bit(unsigned int v);
-
static inline av_const unsigned int ff_sqrt(unsigned int a)
{
unsigned int b;
}
#endif
-/* avoid usage of various functions */
+/* avoid usage of dangerous/inappropriate system functions */
#undef malloc
#define malloc please_use_av_malloc
#undef free
#define exit exit_is_forbidden
#ifndef LIBAVFORMAT_BUILD
#undef printf
-#define printf please_use_av_log
+#define printf please_use_av_log_instead_of_printf
#undef fprintf
-#define fprintf please_use_av_log
+#define fprintf please_use_av_log_instead_of_fprintf
#undef puts
-#define puts please_use_av_log
+#define puts please_use_av_log_instead_of_puts
#undef perror
#define perror please_use_av_log_instead_of_perror
#endif
}\
}
+#if defined(__ICC) || defined(__SUNPRO_C)
+ #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
+ #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
+#elif defined(__GNUC__)
+ #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
+ #define DECLARE_ASM_CONST(n,t,v) static const t v attribute_used __attribute__ ((aligned (n)))
+#elif defined(_MSC_VER)
+ #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
+#elif HAVE_INLINE_ASM
+ #error The asm code needs alignment, but we do not know how to do it for this compiler.
+#else
+ #define DECLARE_ALIGNED(n,t,v) t v
+ #define DECLARE_ASM_CONST(n,t,v) static const t v
+#endif
+
+
#if !HAVE_LLRINT
static av_always_inline av_const long long llrint(double x)
{
#endif /* HAVE_TRUNCF */
/**
- * Returns NULL if CONFIG_SMALL is true otherwise the argument
- * without modifications, used to disable the definition of strings
+ * Returns NULL if CONFIG_SMALL is true, otherwise the argument
+ * without modification. Used to disable the definition of strings
* (for example AVCodec long_names).
*/
#if CONFIG_SMALL