annotate common.h @ 2497:69adfbbdcdeb libavcodec

- samples from mplayer ftp in the "adv" profile seem to have profile=2, which isn't the advanced one; and indeed, using adv. profile parser fails. Using normal parser works, and that's what is done - attempt at taking care of stride for NORM2 bitplane decoding - duplication of much code from msmpeg4.c; this code isn't yet used, but goes down as far as the block layer (mainly Transform Type stuff, the remains are wild editing without checking). Unusable yet, and lacks the AC decoding (but a step further in bitstream parsing) patch by anonymous
author michael
date Fri, 04 Feb 2005 02:20:38 +0000
parents 35ca0ef0c279
children e25782262d7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1083
diff changeset
1 /**
1e39f273ecd6 per file doxy
michaelni
parents: 1083
diff changeset
2 * @file common.h
1e39f273ecd6 per file doxy
michaelni
parents: 1083
diff changeset
3 * common internal api header.
1e39f273ecd6 per file doxy
michaelni
parents: 1083
diff changeset
4 */
1e39f273ecd6 per file doxy
michaelni
parents: 1083
diff changeset
5
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 #ifndef COMMON_H
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 #define COMMON_H
986e461dc072 Initial revision
glantau
parents:
diff changeset
8
213
e80ad397d30e Cygwin's mangling by Felix Buenemann <atmosfear@users.sourceforge.net>
nickols_k
parents: 199
diff changeset
9 #if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
10 # define CONFIG_WIN32
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
11 #endif
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
12
1758
d49aae2f9027 freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents: 1756
diff changeset
13 #ifndef M_PI
d49aae2f9027 freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents: 1756
diff changeset
14 #define M_PI 3.14159265358979323846
d49aae2f9027 freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents: 1756
diff changeset
15 #endif
d49aae2f9027 freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents: 1756
diff changeset
16
10
f439e6867cac added HAVE_AV_CONFIG_H
glantau
parents: 2
diff changeset
17 #ifdef HAVE_AV_CONFIG_H
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
18 /* only include the following when compiling package */
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
19 # include "config.h"
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
20
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
21 # include <stdlib.h>
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
22 # include <stdio.h>
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
23 # include <string.h>
1444
958d9c0cedba ctype.h is a common header
bellard
parents: 1413
diff changeset
24 # include <ctype.h>
2112
michael
parents: 2102
diff changeset
25 # include <limits.h>
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
26 # ifndef __BEOS__
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
27 # include <errno.h>
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
28 # else
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
29 # include "berrno.h"
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
30 # endif
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
31 # include <math.h>
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
32
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
33 # ifndef ENODATA
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
34 # define ENODATA 61
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
35 # endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
36
1059
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
37 #include <stddef.h>
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
38 #ifndef offsetof
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
39 # define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F))
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
40 #endif
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
41
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
42 #define AVOPTION_CODEC_BOOL(name, help, field) \
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
43 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_BOOL }
1130
c8dfb8579606 * added more options
kabi
parents: 1126
diff changeset
44 #define AVOPTION_CODEC_DOUBLE(name, help, field, minv, maxv, defval) \
c8dfb8579606 * added more options
kabi
parents: 1126
diff changeset
45 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_DOUBLE, minv, maxv, defval }
1059
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
46 #define AVOPTION_CODEC_FLAG(name, help, field, flag, defval) \
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
47 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_FLAG, flag, 0, defval }
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
48 #define AVOPTION_CODEC_INT(name, help, field, minv, maxv, defval) \
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
49 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_INT, minv, maxv, defval }
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
50 #define AVOPTION_CODEC_STRING(name, help, field, str, val) \
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
51 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_STRING, .defval = val, .defstr = str }
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
52 #define AVOPTION_CODEC_RCOVERRIDE(name, help, field) \
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
53 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_RCOVERRIDE, .defval = 0, .defstr = NULL }
1114
e4762efc3617 * more generic avoption_parse
kabi
parents: 1112
diff changeset
54 #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr }
1059
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
55 #define AVOPTION_END() AVOPTION_SUB(NULL)
890b9fb44e84 * still unfinished code for Options
kabi
parents: 1039
diff changeset
56
1124
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
57 struct AVOption;
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
58 #ifdef HAVE_MMX
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
59 extern const struct AVOption avoptions_common[3 + 5];
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
60 #else
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
61 extern const struct AVOption avoptions_common[3];
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
62 #endif
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
63 extern const struct AVOption avoptions_workaround_bug[11];
64c7c76ed17c * 'externaly' visible option list begins avoptions_ prefix
kabi
parents: 1118
diff changeset
64
390
48e08d9871da added proper memory handling functions - fixed include paths
glantau
parents: 370
diff changeset
65 #endif /* HAVE_AV_CONFIG_H */
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
66
517
389e30fe7269 * Move "restrict" fallback to common.h
mellum
parents: 512
diff changeset
67 /* Suppress restrict if it was not defined in config.h. */
389e30fe7269 * Move "restrict" fallback to common.h
mellum
parents: 512
diff changeset
68 #ifndef restrict
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
69 # define restrict
517
389e30fe7269 * Move "restrict" fallback to common.h
mellum
parents: 512
diff changeset
70 #endif
389e30fe7269 * Move "restrict" fallback to common.h
mellum
parents: 512
diff changeset
71
1982
800db77ec7c8 avoid macro conflicts
alex
parents: 1965
diff changeset
72 #ifndef always_inline
550
b746a7d75ce6 Force inlining on get_vlc2.
mellum
parents: 542
diff changeset
73 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
74 # define always_inline __attribute__((always_inline)) inline
550
b746a7d75ce6 Force inlining on get_vlc2.
mellum
parents: 542
diff changeset
75 #else
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
76 # define always_inline inline
550
b746a7d75ce6 Force inlining on get_vlc2.
mellum
parents: 542
diff changeset
77 #endif
1982
800db77ec7c8 avoid macro conflicts
alex
parents: 1965
diff changeset
78 #endif
550
b746a7d75ce6 Force inlining on get_vlc2.
mellum
parents: 542
diff changeset
79
1982
800db77ec7c8 avoid macro conflicts
alex
parents: 1965
diff changeset
80 #ifndef attribute_used
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1840
diff changeset
81 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1840
diff changeset
82 # define attribute_used __attribute__((used))
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1840
diff changeset
83 #else
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1840
diff changeset
84 # define attribute_used
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1840
diff changeset
85 #endif
1982
800db77ec7c8 avoid macro conflicts
alex
parents: 1965
diff changeset
86 #endif
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1840
diff changeset
87
1738
378e98870df4 more sane inttypes emulation behavior if libavcodec is used outside ffmpeg
michael
parents: 1735
diff changeset
88 #ifndef EMULATE_INTTYPES
1735
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
89 # include <inttypes.h>
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
90 #else
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
91 typedef signed char int8_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
92 typedef signed short int16_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
93 typedef signed int int32_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
94 typedef unsigned char uint8_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
95 typedef unsigned short uint16_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
96 typedef unsigned int uint32_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
97
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
98 # ifdef CONFIG_WIN32
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
99 typedef signed __int64 int64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
100 typedef unsigned __int64 uint64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
101 # else /* other OS */
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
102 typedef signed long long int64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
103 typedef unsigned long long uint64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
104 # endif /* other OS */
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
105 #endif /* HAVE_INTTYPES_H */
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
106
2318
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
107 #ifndef INT16_MIN
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
108 #define INT16_MIN (-0x7fff-1)
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
109 #endif
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
110
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
111 #ifndef INT16_MAX
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
112 #define INT16_MAX 0x7fff
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
113 #endif
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
114
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
115 #ifndef INT64_MIN
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
116 #define INT64_MIN (-0x7fffffffffffffffLL-1)
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
117 #endif
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
118
1761
3620e301643a int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1758
diff changeset
119 #ifndef INT64_MAX
1840
0287241a0c18 int64_t_C patch by (Gael Chardon <gael-announcements+ffmpeg at 4now dot net>)
michael
parents: 1824
diff changeset
120 #define INT64_MAX int64_t_C(9223372036854775807)
1761
3620e301643a int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1758
diff changeset
121 #endif
3620e301643a int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1758
diff changeset
122
2016
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
123 #ifndef UINT64_MAX
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
124 #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF)
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
125 #endif
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
126
1603
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
127 #ifdef EMULATE_FAST_INT
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
128 /* note that we don't emulate 64bit ints */
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
129 typedef signed char int_fast8_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
130 typedef signed int int_fast16_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
131 typedef signed int int_fast32_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
132 typedef unsigned char uint_fast8_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
133 typedef unsigned int uint_fast16_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
134 typedef unsigned int uint_fast32_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
135 #endif
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
136
2093
82816cad0e29 optimization
michael
parents: 2016
diff changeset
137 #ifndef INT_BIT
2112
michael
parents: 2102
diff changeset
138 # if INT_MAX != 2147483647
2093
82816cad0e29 optimization
michael
parents: 2016
diff changeset
139 # define INT_BIT 64
82816cad0e29 optimization
michael
parents: 2016
diff changeset
140 # else
82816cad0e29 optimization
michael
parents: 2016
diff changeset
141 # define INT_BIT 32
82816cad0e29 optimization
michael
parents: 2016
diff changeset
142 # endif
82816cad0e29 optimization
michael
parents: 2016
diff changeset
143 #endif
82816cad0e29 optimization
michael
parents: 2016
diff changeset
144
1603
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
145 #if defined(CONFIG_OS2) || defined(CONFIG_SUNOS)
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
146 static inline float floorf(float f) {
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
147 return floor(f);
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
148 }
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
149 #endif
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
150
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
151 #ifdef CONFIG_WIN32
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
152
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
153 /* windows */
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
154
1961
603d4a0e974c libavcodec Cygwin compilation failure (II) patch by (Sascha Sommer)
michael
parents: 1954
diff changeset
155 # if !defined(__MINGW32__) && !defined(__CYGWIN__)
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
156 # define int64_t_C(c) (c ## i64)
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
157 # define uint64_t_C(c) (c ## i64)
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
158
1509
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
159 # ifdef HAVE_AV_CONFIG_H
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
160 # define inline __inline
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
161 # endif
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
162
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
163 # else
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
164 # define int64_t_C(c) (c ## LL)
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
165 # define uint64_t_C(c) (c ## ULL)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
166 # endif /* __MINGW32__ */
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
167
1509
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
168 # ifdef HAVE_AV_CONFIG_H
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
169 # ifdef _DEBUG
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
170 # define DEBUG
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
171 # endif
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
172
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
173 # define snprintf _snprintf
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
174 # define vsnprintf _vsnprintf
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
175 # endif
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
176
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
177 /* CONFIG_WIN32 end */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
178 #elif defined (CONFIG_OS2)
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
179 /* OS/2 EMX */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
180
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
181 #ifndef int64_t_C
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
182 #define int64_t_C(c) (c ## LL)
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
183 #define uint64_t_C(c) (c ## ULL)
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
184 #endif
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
185
1413
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
186 #ifdef HAVE_AV_CONFIG_H
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
187
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
188 #ifdef USE_FASTMEMCPY
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
189 #include "fastmemcpy.h"
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
190 #endif
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
191
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
192 #include <float.h>
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
193
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
194 #endif /* HAVE_AV_CONFIG_H */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
195
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
196 /* CONFIG_OS2 end */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
197 #else
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
198
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
199 /* unix */
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
200
1413
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
201 #ifndef int64_t_C
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
202 #define int64_t_C(c) (c ## LL)
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
203 #define uint64_t_C(c) (c ## ULL)
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
204 #endif
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
205
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
206 #ifdef HAVE_AV_CONFIG_H
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
207
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
208 # ifdef USE_FASTMEMCPY
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
209 # include "fastmemcpy.h"
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
210 # endif
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
211 # endif /* HAVE_AV_CONFIG_H */
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
212
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
213 #endif /* !CONFIG_WIN32 && !CONFIG_OS2 */
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
214
488
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
215 #ifdef HAVE_AV_CONFIG_H
192
1e5f64be86fc another bitstream reader code (faster on intel cpus) - patch by Michael Niedermayer <michaelni@gmx.at>
uid46427
parents: 151
diff changeset
216
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
217 # include "bswap.h"
426
a69ba632a048 better logic for bswap
glantau
parents: 423
diff changeset
218
2391
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
219 // Use rip-relative addressing if compiling PIC code on x86-64.
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
220 # if defined(__MINGW32__) || defined(__CYGWIN__) || \
1226
dbc7e3c814a9 Tiny patch for OpenBSD by (Bj?rn Sandell <biorn at dce dot chalmers dot se>)
michaelni
parents: 1177
diff changeset
221 defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__))
2391
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
222 # if defined(ARCH_X86_64) && defined(PIC)
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
223 # define MANGLE(a) "_" #a"(%%rip)"
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
224 # else
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
225 # define MANGLE(a) "_" #a
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
226 # endif
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
227 # else
2391
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
228 # if defined(ARCH_X86_64) && defined(PIC)
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
229 # define MANGLE(a) #a"(%%rip)"
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
230 # else
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
231 # define MANGLE(a) #a
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
232 # endif
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
233 # endif
432
b245457fb912 fixed mangle issue
bellard
parents: 426
diff changeset
234
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
235 /* debug stuff */
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
236
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
237 # ifndef DEBUG
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
238 # define NDEBUG
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
239 # endif
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
240 # include <assert.h>
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
241
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
242 /* dprintf macros */
1964
2b16a3c32318 cygwin patch by ("Sascha Sommer" <saschasommer at freenet dot de>)
michael
parents: 1961
diff changeset
243 # if defined(CONFIG_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
244
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
245 inline void dprintf(const char* fmt,...) {}
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
246
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
247 # else
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
248
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
249 # ifdef DEBUG
1940
2511d3e4513e t/dprintf printf -> av_log
michael
parents: 1921
diff changeset
250 # define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
251 # else
1545
b340e83b8d0d gcc->C99 and warning fixes patch by (Dan Christiansen <danchr at daimi dot au dot dk>)
michael
parents: 1522
diff changeset
252 # define dprintf(fmt,...)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
253 # endif
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
254
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
255 # endif /* !CONFIG_WIN32 */
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
256
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1548
diff changeset
257 # define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
423
ed6098c4216a Add an av_abort macro that aborts, but also prints out the location of the abort.
philipjsg
parents: 408
diff changeset
258
753
8e1f0939d15d complete mpeg4 GMC decoding support
michaelni
parents: 708
diff changeset
259 //rounded divison & shift
1954
e943363932d9 RSHIFT(x,0) fix
michael
parents: 1940
diff changeset
260 #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 327
diff changeset
261 /* assume b>0 */
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 327
diff changeset
262 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
359
df0736462b9f move ABS() to common.h
michaelni
parents: 358
diff changeset
263 #define ABS(a) ((a) >= 0 ? (a) : (-(a)))
823
5344ecb2c677 put MIN/MAX under ifndef MAX/MIN
michaelni
parents: 753
diff changeset
264
847
f3c369b8ddca reversing header game
michaelni
parents: 840
diff changeset
265 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
f3c369b8ddca reversing header game
michaelni
parents: 840
diff changeset
266 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 327
diff changeset
267
1261
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
268 extern const uint32_t inverse[256];
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
269
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2288
diff changeset
270 #if defined(ARCH_X86) || defined(ARCH_X86_64)
1261
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
271 # define FASTDIV(a,b) \
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
272 ({\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
273 int ret,dmy;\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
274 asm volatile(\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
275 "mull %3"\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
276 :"=d"(ret),"=a"(dmy)\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
277 :"1"(a),"g"(inverse[b])\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
278 );\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
279 ret;\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
280 })
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
281 #elif defined(CONFIG_FASTDIV)
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
282 # define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*inverse[b])>>32))
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
283 #else
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
284 # define FASTDIV(a,b) ((a)/(b))
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
285 #endif
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
286
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
287 /* define it to include statistics code (useful only for optimizing
986e461dc072 Initial revision
glantau
parents:
diff changeset
288 codec efficiency */
986e461dc072 Initial revision
glantau
parents:
diff changeset
289 //#define STATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
290
986e461dc072 Initial revision
glantau
parents:
diff changeset
291 #ifdef STATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
292
986e461dc072 Initial revision
glantau
parents:
diff changeset
293 enum {
986e461dc072 Initial revision
glantau
parents:
diff changeset
294 ST_UNKNOWN,
986e461dc072 Initial revision
glantau
parents:
diff changeset
295 ST_DC,
986e461dc072 Initial revision
glantau
parents:
diff changeset
296 ST_INTRA_AC,
986e461dc072 Initial revision
glantau
parents:
diff changeset
297 ST_INTER_AC,
986e461dc072 Initial revision
glantau
parents:
diff changeset
298 ST_INTRA_MB,
986e461dc072 Initial revision
glantau
parents:
diff changeset
299 ST_INTER_MB,
986e461dc072 Initial revision
glantau
parents:
diff changeset
300 ST_MV,
986e461dc072 Initial revision
glantau
parents:
diff changeset
301 ST_NB,
986e461dc072 Initial revision
glantau
parents:
diff changeset
302 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
303
986e461dc072 Initial revision
glantau
parents:
diff changeset
304 extern int st_current_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
305 extern unsigned int st_bit_counts[ST_NB];
986e461dc072 Initial revision
glantau
parents:
diff changeset
306 extern unsigned int st_out_bit_counts[ST_NB];
986e461dc072 Initial revision
glantau
parents:
diff changeset
307
986e461dc072 Initial revision
glantau
parents:
diff changeset
308 void print_stats(void);
986e461dc072 Initial revision
glantau
parents:
diff changeset
309 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
310
986e461dc072 Initial revision
glantau
parents:
diff changeset
311 /* misc math functions */
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
312 extern const uint8_t ff_log2_tab[256];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
313
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 144
diff changeset
314 static inline int av_log2(unsigned int v)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
315 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
316 int n;
986e461dc072 Initial revision
glantau
parents:
diff changeset
317
986e461dc072 Initial revision
glantau
parents:
diff changeset
318 n = 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
319 if (v & 0xffff0000) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
320 v >>= 16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
321 n += 16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
322 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
323 if (v & 0xff00) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
324 v >>= 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
325 n += 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 }
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
327 n += ff_log2_tab[v];
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
328
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
329 return n;
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
331
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
332 static inline int av_log2_16bit(unsigned int v)
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
333 {
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
334 int n;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
335
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
336 n = 0;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
337 if (v & 0xff00) {
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
338 v >>= 8;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
339 n += 8;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
340 }
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
341 n += ff_log2_tab[v];
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
342
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
343 return n;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
344 }
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
345
277
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
346 /* median of 3 */
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
347 static inline int mid_pred(int a, int b, int c)
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
348 {
1756
43a856190778 optimization
michael
parents: 1738
diff changeset
349 #if 0
43a856190778 optimization
michael
parents: 1738
diff changeset
350 int t= (a-b)&((a-b)>>31);
43a856190778 optimization
michael
parents: 1738
diff changeset
351 a-=t;
43a856190778 optimization
michael
parents: 1738
diff changeset
352 b+=t;
43a856190778 optimization
michael
parents: 1738
diff changeset
353 b-= (b-c)&((b-c)>>31);
43a856190778 optimization
michael
parents: 1738
diff changeset
354 b+= (a-b)&((a-b)>>31);
277
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
355
1756
43a856190778 optimization
michael
parents: 1738
diff changeset
356 return b;
43a856190778 optimization
michael
parents: 1738
diff changeset
357 #else
43a856190778 optimization
michael
parents: 1738
diff changeset
358 if(a>b){
43a856190778 optimization
michael
parents: 1738
diff changeset
359 if(c>b){
43a856190778 optimization
michael
parents: 1738
diff changeset
360 if(c>a) b=a;
43a856190778 optimization
michael
parents: 1738
diff changeset
361 else b=c;
43a856190778 optimization
michael
parents: 1738
diff changeset
362 }
43a856190778 optimization
michael
parents: 1738
diff changeset
363 }else{
43a856190778 optimization
michael
parents: 1738
diff changeset
364 if(b>c){
43a856190778 optimization
michael
parents: 1738
diff changeset
365 if(c>a) b=c;
43a856190778 optimization
michael
parents: 1738
diff changeset
366 else b=a;
43a856190778 optimization
michael
parents: 1738
diff changeset
367 }
43a856190778 optimization
michael
parents: 1738
diff changeset
368 }
43a856190778 optimization
michael
parents: 1738
diff changeset
369 return b;
43a856190778 optimization
michael
parents: 1738
diff changeset
370 #endif
277
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
371 }
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
372
327
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
373 static inline int clip(int a, int amin, int amax)
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
374 {
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
375 if (a < amin)
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
376 return amin;
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
377 else if (a > amax)
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
378 return amax;
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
379 else
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
380 return a;
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
381 }
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
382
1898
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
383 static inline int clip_uint8(int a)
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
384 {
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
385 if (a&(~255)) return (-a)>>31;
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
386 else return a;
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
387 }
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
388
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 306
diff changeset
389 /* math */
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
390 extern const uint8_t ff_sqrt_tab[128];
609
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
391
1126
77ccf7fe3bd0 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 1124
diff changeset
392 int64_t ff_gcd(int64_t a, int64_t b);
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 306
diff changeset
393
451
michaelni
parents: 437
diff changeset
394 static inline int ff_sqrt(int a)
michaelni
parents: 437
diff changeset
395 {
michaelni
parents: 437
diff changeset
396 int ret=0;
michaelni
parents: 437
diff changeset
397 int s;
michaelni
parents: 437
diff changeset
398 int ret_sq=0;
609
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
399
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
400 if(a<128) return ff_sqrt_tab[a];
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
401
451
michaelni
parents: 437
diff changeset
402 for(s=15; s>=0; s--){
michaelni
parents: 437
diff changeset
403 int b= ret_sq + (1<<(s*2)) + (ret<<s)*2;
michaelni
parents: 437
diff changeset
404 if(b<=a){
michaelni
parents: 437
diff changeset
405 ret_sq=b;
michaelni
parents: 437
diff changeset
406 ret+= 1<<s;
michaelni
parents: 437
diff changeset
407 }
michaelni
parents: 437
diff changeset
408 }
michaelni
parents: 437
diff changeset
409 return ret;
michaelni
parents: 437
diff changeset
410 }
701
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
411
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
412 /**
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
413 * converts fourcc string to int
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
414 */
865
704f13bfc652 * minor warning fix
kabi
parents: 862
diff changeset
415 static inline int ff_get_fourcc(const char *s){
701
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
416 assert( strlen(s)==4 );
1401
f5a107782a66 reverse earlier patch
tmmm
parents: 1398
diff changeset
417
701
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
418 return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24);
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
419 }
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
420
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 1130
diff changeset
421 #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 1130
diff changeset
422 #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 1130
diff changeset
423
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 1130
diff changeset
424
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2288
diff changeset
425 #if defined(ARCH_X86) || defined(ARCH_X86_64)
706
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
426 #define MASK_ABS(mask, level)\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
427 asm volatile(\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
428 "cdq \n\t"\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
429 "xorl %1, %0 \n\t"\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
430 "subl %1, %0 \n\t"\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
431 : "+a" (level), "=&d" (mask)\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
432 );
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
433 #else
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
434 #define MASK_ABS(mask, level)\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
435 mask= level>>31;\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
436 level= (level^mask)-mask;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
437 #endif
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
438
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
439
451
michaelni
parents: 437
diff changeset
440 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT)
michaelni
parents: 437
diff changeset
441 #define COPY3_IF_LT(x,y,a,b,c,d)\
michaelni
parents: 437
diff changeset
442 asm volatile (\
michaelni
parents: 437
diff changeset
443 "cmpl %0, %3 \n\t"\
michaelni
parents: 437
diff changeset
444 "cmovl %3, %0 \n\t"\
michaelni
parents: 437
diff changeset
445 "cmovl %4, %1 \n\t"\
michaelni
parents: 437
diff changeset
446 "cmovl %5, %2 \n\t"\
michaelni
parents: 437
diff changeset
447 : "+r" (x), "+r" (a), "+r" (c)\
michaelni
parents: 437
diff changeset
448 : "r" (y), "r" (b), "r" (d)\
michaelni
parents: 437
diff changeset
449 );
michaelni
parents: 437
diff changeset
450 #else
michaelni
parents: 437
diff changeset
451 #define COPY3_IF_LT(x,y,a,b,c,d)\
michaelni
parents: 437
diff changeset
452 if((y)<(x)){\
michaelni
parents: 437
diff changeset
453 (x)=(y);\
michaelni
parents: 437
diff changeset
454 (a)=(b);\
michaelni
parents: 437
diff changeset
455 (c)=(d);\
michaelni
parents: 437
diff changeset
456 }
michaelni
parents: 437
diff changeset
457 #endif
michaelni
parents: 437
diff changeset
458
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2288
diff changeset
459 #if defined(ARCH_X86) || defined(ARCH_X86_64)
2288
3d4a1f8e6a27 * fixing a few of gcc 'clean-code' warnings
kabi
parents: 2140
diff changeset
460 static inline long long rdtsc(void)
1281
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
461 {
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
462 long long l;
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
463 asm volatile( "rdtsc\n\t"
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
464 : "=A" (l)
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
465 );
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
466 return l;
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
467 }
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
468
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
469 #define START_TIMER \
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
470 uint64_t tend;\
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
471 uint64_t tstart= rdtsc();\
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
472
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
473 #define STOP_TIMER(id) \
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
474 tend= rdtsc();\
1823
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
475 {\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
476 static uint64_t tsum=0;\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
477 static int tcount=0;\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
478 static int tskip_count=0;\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
479 if(tcount<2 || tend - tstart < 8*tsum/tcount){\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
480 tsum+= tend - tstart;\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
481 tcount++;\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
482 }else\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
483 tskip_count++;\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
484 if(256*256*256*64%(tcount+tskip_count)==0){\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
485 av_log(NULL, AV_LOG_DEBUG, "%Ld dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
486 }\
1281
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
487 }
2140
cd1a71898311 TIMER dummies for non-x86
michael
parents: 2112
diff changeset
488 #else
cd1a71898311 TIMER dummies for non-x86
michael
parents: 2112
diff changeset
489 #define START_TIMER
cd1a71898311 TIMER dummies for non-x86
michael
parents: 2112
diff changeset
490 #define STOP_TIMER(id) {}
1281
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
491 #endif
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
492
370
0eca28d16cbd clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
al3x
parents: 359
diff changeset
493 #define CLAMP_TO_8BIT(d) ((d > 0xff) ? 0xff : (d < 0) ? 0 : d)
0eca28d16cbd clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
al3x
parents: 359
diff changeset
494
1031
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
495 /* avoid usage of various functions */
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
496 #define malloc please_use_av_malloc
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
497 #define free please_use_av_free
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
498 #define realloc please_use_av_realloc
1921
7aaf242d5b51 time & (s)rand is forbidden
michael
parents: 1898
diff changeset
499 #define time time_is_forbidden_due_to_security_issues
7aaf242d5b51 time & (s)rand is forbidden
michael
parents: 1898
diff changeset
500 #define rand rand_is_forbidden_due_to_state_trashing
7aaf242d5b51 time & (s)rand is forbidden
michael
parents: 1898
diff changeset
501 #define srand srand_is_forbidden_due_to_state_trashing
2423
87b7fbed8609 dissallow sprintf
michael
parents: 2398
diff changeset
502 #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf
2424
35ca0ef0c279 disallow strcat
michael
parents: 2423
diff changeset
503 #define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat
1823
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
504 #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H))
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
505 #define printf please_use_av_log
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
506 #define fprintf please_use_av_log
a660ef952580 (f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents: 1799
diff changeset
507 #endif
1031
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
508
1177
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
509 #define CHECKED_ALLOCZ(p, size)\
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
510 {\
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
511 p= av_mallocz(size);\
1332
018ebc066952 fix CHECKED_ALLOCZ(0)
michaelni
parents: 1281
diff changeset
512 if(p==NULL && (size)!=0){\
1177
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
513 perror("malloc");\
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
514 goto fail;\
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
515 }\
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
516 }
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1171
diff changeset
517
488
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
518 #endif /* HAVE_AV_CONFIG_H */
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
519
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
520 #endif /* COMMON_H */