CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/ext/at3_standalone/compat.h
Views: 1401
1
#pragma once
2
3
#include <stdlib.h>
4
5
// Compat hacks to make an FFMPEG-like environment, so we can keep the core code mostly unchanged.
6
7
#if defined(__clang__)
8
#define DECLARE_ALIGNED(n, t, v) t __attribute__((aligned(n))) v
9
#define DECLARE_ASM_CONST(n, t, v) static const t av_used __attribute__((aligned(n))) v
10
#define av_restrict __restrict
11
#elif defined(__GNUC__)
12
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
13
#define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
14
#define av_restrict __restrict__
15
#elif defined(_MSC_VER)
16
#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
17
#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
18
#define av_restrict __restrict
19
#else
20
#define DECLARE_ALIGNED(n,t,v) t v
21
#define DECLARE_ASM_CONST(n,t,v) static const t v
22
#define av_restrict
23
#endif
24
25
#define AV_HAVE_FAST_UNALIGNED 0
26
#define AV_INPUT_BUFFER_PADDING_SIZE 32
27
28
// TODO: This should work but doesn't??
29
// #define BITSTREAM_READER_LE
30
31
#define LOCAL_ALIGNED(bits, type, name, subscript) type name subscript
32
#define av_alias
33
#define av_unused
34
#define av_assert0(cond)
35
#define av_assert1(cond)
36
#define av_assert2(cond)
37
#define av_printf_format(a,b)
38
#define avpriv_report_missing_feature(...)
39
40
#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
41
#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
42
43
#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d))
44
45
#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
46
#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
47
48
#define AV_LOG_ERROR 16
49
#define AV_LOG_WARNING 24
50
#define AV_LOG_INFO 32
51
#define AV_LOG_VERBOSE 40
52
#define AV_LOG_DEBUG 48
53
#define AV_LOG_TRACE 56
54
55
void av_log(int level, const char *fmt, ...) av_printf_format(3, 4);
56
57
/**
58
* Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they
59
* are not representable as absolute values of their type. This is the same
60
* as with *abs()
61
* @see FFNABS()
62
*/
63
#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
64
65
#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
66
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
67
68
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
69
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
70
71
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
72
73
#ifdef _MSC_VER
74
#pragma warning(disable:4305)
75
#pragma warning(disable:4244)
76
#pragma warning(disable:4101) // unused variable
77
#endif
78
79
#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))
80
#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16))
81
#define av_be2ne32(x) AV_BSWAP32C((x))
82
83