|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef AVUTIL_INTERNAL_H |
|
#define AVUTIL_INTERNAL_H |
|
|
|
#if !defined(DEBUG) && !defined(NDEBUG) |
|
# define NDEBUG |
|
#endif |
|
|
|
|
|
|
|
|
|
#include <limits.h> |
|
#include <stdint.h> |
|
#include <stddef.h> |
|
#include <assert.h> |
|
#include <stdio.h> |
|
#include "config.h" |
|
#include "attributes.h" |
|
#include "macros.h" |
|
#include "pixfmt.h" |
|
|
|
#ifndef attribute_align_arg |
|
#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) |
|
# define attribute_align_arg __attribute__((force_align_arg_pointer)) |
|
#else |
|
# define attribute_align_arg |
|
#endif |
|
#endif |
|
|
|
#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avutil) |
|
# define av_export_avutil __declspec(dllimport) |
|
#else |
|
# define av_export_avutil |
|
#endif |
|
|
|
#if HAVE_PRAGMA_DEPRECATED |
|
# if defined(__ICL) || defined (__INTEL_COMPILER) |
|
# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478)) |
|
# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop)) |
|
# elif defined(_MSC_VER) |
|
# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996)) |
|
# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop)) |
|
# else |
|
# define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") |
|
# define FF_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic pop") |
|
# endif |
|
#else |
|
# define FF_DISABLE_DEPRECATION_WARNINGS |
|
# define FF_ENABLE_DEPRECATION_WARNINGS |
|
#endif |
|
|
|
|
|
#define FF_MEMORY_POISON 0x2a |
|
|
|
|
|
|
|
|
|
#define AV_CHECK_OFFSET(s, m, o) struct check_##o { \ |
|
int x_##o[offsetof(s, m) == o? 1: -1]; \ |
|
} |
|
|
|
|
|
#define FF_ALLOC_TYPED_ARRAY(p, nelem) (p = av_malloc_array(nelem, sizeof(*p))) |
|
#define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_calloc(nelem, sizeof(*p))) |
|
|
|
#define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr)) |
|
|
|
|
|
|
|
|
|
#define FF_FIELD_AT(type, off, obj) (*(type *)((char *)&(obj) + (off))) |
|
|
|
#include "libm.h" |
|
|
|
|
|
|
|
|
|
|
|
#if CONFIG_SMALL |
|
# define NULL_IF_CONFIG_SMALL(x) NULL |
|
#else |
|
# define NULL_IF_CONFIG_SMALL(x) x |
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void avpriv_report_missing_feature(void *avc, |
|
const char *msg, ...) av_printf_format(2, 3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void avpriv_request_sample(void *avc, |
|
const char *msg, ...) av_printf_format(2, 3); |
|
|
|
#if HAVE_LIBC_MSVCRT |
|
#include <crtversion.h> |
|
#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 |
|
#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_strtod") |
|
#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_snprintf") |
|
#endif |
|
|
|
#define PTRDIFF_SPECIFIER "Id" |
|
#define SIZE_SPECIFIER "Iu" |
|
#else |
|
#define PTRDIFF_SPECIFIER "td" |
|
#define SIZE_SPECIFIER "zu" |
|
#endif |
|
|
|
#ifdef DEBUG |
|
# define ff_dlog(ctx, ...) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__) |
|
#else |
|
# define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) |
|
#endif |
|
|
|
#ifdef TRACE |
|
# define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__) |
|
#else |
|
# define ff_tlog(ctx, ...) do { } while(0) |
|
#endif |
|
|
|
|
|
|
|
#ifdef CHECKED |
|
#define SUINT int |
|
#define SUINT32 int32_t |
|
#else |
|
#define SUINT unsigned |
|
#define SUINT32 uint32_t |
|
#endif |
|
|
|
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); |
|
|
|
static av_always_inline av_const int avpriv_mirror(int x, int w) |
|
{ |
|
if (!w) |
|
return 0; |
|
|
|
while ((unsigned)x > (unsigned)w) { |
|
x = -x; |
|
if (x < 0) |
|
x += 2 * w; |
|
} |
|
return x; |
|
} |
|
|
|
#endif |
|
|