annotate common.h @ 2522:e25782262d7d libavcodec

kill warnings patch by (Mns Rullgrd <mru inprovide com>)
author michael
date Thu, 24 Feb 2005 19:08:50 +0000
parents 35ca0ef0c279
children 9a7770ebed14
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
2522
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
88 #ifndef attribute_unused
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
89 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
90 # define attribute_unused __attribute__((unused))
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
91 #else
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
92 # define attribute_unused
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
93 #endif
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
94 #endif
e25782262d7d kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents: 2424
diff changeset
95
1738
378e98870df4 more sane inttypes emulation behavior if libavcodec is used outside ffmpeg
michael
parents: 1735
diff changeset
96 #ifndef EMULATE_INTTYPES
1735
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
97 # include <inttypes.h>
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
98 #else
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
99 typedef signed char int8_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
100 typedef signed short int16_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
101 typedef signed int int32_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
102 typedef unsigned char uint8_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
103 typedef unsigned short uint16_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
104 typedef unsigned int uint32_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
105
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
106 # ifdef CONFIG_WIN32
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
107 typedef signed __int64 int64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
108 typedef unsigned __int64 uint64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
109 # else /* other OS */
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
110 typedef signed long long int64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
111 typedef unsigned long long uint64_t;
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
112 # endif /* other OS */
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
113 #endif /* HAVE_INTTYPES_H */
cb0abe523bc6 inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents: 1660
diff changeset
114
2318
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
115 #ifndef INT16_MIN
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
116 #define INT16_MIN (-0x7fff-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
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
119 #ifndef INT16_MAX
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
120 #define INT16_MAX 0x7fff
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
121 #endif
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
122
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
123 #ifndef INT64_MIN
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
124 #define INT64_MIN (-0x7fffffffffffffffLL-1)
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
125 #endif
1925d732ea42 INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents: 2293
diff changeset
126
1761
3620e301643a int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1758
diff changeset
127 #ifndef INT64_MAX
1840
0287241a0c18 int64_t_C patch by (Gael Chardon <gael-announcements+ffmpeg at 4now dot net>)
michael
parents: 1824
diff changeset
128 #define INT64_MAX int64_t_C(9223372036854775807)
1761
3620e301643a int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1758
diff changeset
129 #endif
3620e301643a int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1758
diff changeset
130
2016
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
131 #ifndef UINT64_MAX
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
132 #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF)
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
133 #endif
f8ef6f664234 UINT64_MAX fix
michael
parents: 1982
diff changeset
134
1603
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
135 #ifdef EMULATE_FAST_INT
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
136 /* note that we don't emulate 64bit ints */
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
137 typedef signed char int_fast8_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
138 typedef signed int int_fast16_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
139 typedef signed int int_fast32_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
140 typedef unsigned char uint_fast8_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
141 typedef unsigned int uint_fast16_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
142 typedef unsigned int uint_fast32_t;
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
143 #endif
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
144
2093
82816cad0e29 optimization
michael
parents: 2016
diff changeset
145 #ifndef INT_BIT
2112
michael
parents: 2102
diff changeset
146 # if INT_MAX != 2147483647
2093
82816cad0e29 optimization
michael
parents: 2016
diff changeset
147 # define INT_BIT 64
82816cad0e29 optimization
michael
parents: 2016
diff changeset
148 # else
82816cad0e29 optimization
michael
parents: 2016
diff changeset
149 # define INT_BIT 32
82816cad0e29 optimization
michael
parents: 2016
diff changeset
150 # endif
82816cad0e29 optimization
michael
parents: 2016
diff changeset
151 #endif
82816cad0e29 optimization
michael
parents: 2016
diff changeset
152
1603
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
153 #if defined(CONFIG_OS2) || defined(CONFIG_SUNOS)
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
154 static inline float floorf(float f) {
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
155 return floor(f);
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
156 }
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
157 #endif
3a633a3feef6 * fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents: 1598
diff changeset
158
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
159 #ifdef CONFIG_WIN32
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
160
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
161 /* windows */
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
162
1961
603d4a0e974c libavcodec Cygwin compilation failure (II) patch by (Sascha Sommer)
michael
parents: 1954
diff changeset
163 # if !defined(__MINGW32__) && !defined(__CYGWIN__)
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
164 # define int64_t_C(c) (c ## i64)
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
165 # define uint64_t_C(c) (c ## i64)
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
166
1509
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
167 # ifdef HAVE_AV_CONFIG_H
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
168 # define inline __inline
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
169 # endif
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
170
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
171 # else
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
172 # define int64_t_C(c) (c ## LL)
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
173 # define uint64_t_C(c) (c ## ULL)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
174 # endif /* __MINGW32__ */
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
175
1509
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
176 # ifdef HAVE_AV_CONFIG_H
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
177 # ifdef _DEBUG
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
178 # define DEBUG
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
179 # endif
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
180
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
181 # define snprintf _snprintf
750b460ceb66 recommit of
michael
parents: 1444
diff changeset
182 # define vsnprintf _vsnprintf
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
183 # endif
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
184
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
185 /* CONFIG_WIN32 end */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
186 #elif defined (CONFIG_OS2)
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
187 /* OS/2 EMX */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
188
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
189 #ifndef int64_t_C
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
190 #define int64_t_C(c) (c ## LL)
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1059
diff changeset
191 #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
192 #endif
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
193
1413
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
194 #ifdef HAVE_AV_CONFIG_H
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
195
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
196 #ifdef USE_FASTMEMCPY
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
197 #include "fastmemcpy.h"
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
198 #endif
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
199
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
200 #include <float.h>
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
201
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
202 #endif /* HAVE_AV_CONFIG_H */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
203
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
204 /* CONFIG_OS2 end */
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
205 #else
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
206
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
207 /* unix */
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
208
1413
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
209 #ifndef int64_t_C
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
210 #define int64_t_C(c) (c ## LL)
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
211 #define uint64_t_C(c) (c ## ULL)
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
212 #endif
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
213
724e6477f2a8 export int64_t_C as it is needed by libavformat.h
bellard
parents: 1401
diff changeset
214 #ifdef HAVE_AV_CONFIG_H
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
215
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
216 # ifdef USE_FASTMEMCPY
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
217 # include "fastmemcpy.h"
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
218 # endif
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
219 # endif /* HAVE_AV_CONFIG_H */
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
220
994
7701ff462e3a os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents: 976
diff changeset
221 #endif /* !CONFIG_WIN32 && !CONFIG_OS2 */
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
222
488
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
223 #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
224
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
225 # include "bswap.h"
426
a69ba632a048 better logic for bswap
glantau
parents: 423
diff changeset
226
2391
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
227 // 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
228 # if defined(__MINGW32__) || defined(__CYGWIN__) || \
1226
dbc7e3c814a9 Tiny patch for OpenBSD by (Bjrn Sandell <biorn at dce dot chalmers dot se>)
michaelni
parents: 1177
diff changeset
229 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
230 # 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
231 # 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
232 # else
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
233 # 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
234 # endif
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
235 # else
2391
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
236 # 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
237 # 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
238 # else
336a239ad9a4 fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents: 2370
diff changeset
239 # 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
240 # endif
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
241 # endif
432
b245457fb912 fixed mangle issue
bellard
parents: 426
diff changeset
242
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
243 /* debug stuff */
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
244
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
245 # ifndef DEBUG
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
246 # define NDEBUG
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
247 # endif
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
248 # include <assert.h>
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
249
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
250 /* dprintf macros */
1964
2b16a3c32318 cygwin patch by ("Sascha Sommer" <saschasommer at freenet dot de>)
michael
parents: 1961
diff changeset
251 # if defined(CONFIG_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
252
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
253 inline void dprintf(const char* fmt,...) {}
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
254
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
255 # else
76
0b09bd08ef4b win32 fixes
glantau
parents: 66
diff changeset
256
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
257 # ifdef DEBUG
1940
2511d3e4513e t/dprintf printf -> av_log
michael
parents: 1921
diff changeset
258 # 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
259 # else
1545
b340e83b8d0d gcc->C99 and warning fixes patch by (Dan Christiansen <danchr at daimi dot au dot dk>)
michael
parents: 1522
diff changeset
260 # define dprintf(fmt,...)
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
261 # endif
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
262
708
1aa1cbb8c3c1 indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents: 706
diff changeset
263 # endif /* !CONFIG_WIN32 */
64
5aa6292a1660 win32 fixes
glantau
parents: 21
diff changeset
264
1598
932d306bf1dc av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1548
diff changeset
265 # 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
266
753
8e1f0939d15d complete mpeg4 GMC decoding support
michaelni
parents: 708
diff changeset
267 //rounded divison & shift
1954
e943363932d9 RSHIFT(x,0) fix
michael
parents: 1940
diff changeset
268 #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
269 /* assume b>0 */
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 327
diff changeset
270 #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
271 #define ABS(a) ((a) >= 0 ? (a) : (-(a)))
823
5344ecb2c677 put MIN/MAX under ifndef MAX/MIN
michaelni
parents: 753
diff changeset
272
847
f3c369b8ddca reversing header game
michaelni
parents: 840
diff changeset
273 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
f3c369b8ddca reversing header game
michaelni
parents: 840
diff changeset
274 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
344
9f6071a87e17 fixed msmpeg4 infinite loop if buggy stream
michaelni
parents: 327
diff changeset
275
1261
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
276 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
277
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
278 #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
279 # 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
280 ({\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
281 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
282 asm volatile(\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
283 "mull %3"\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
284 :"=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
285 :"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
286 );\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
287 ret;\
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
288 })
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
289 #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
290 # 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
291 #else
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
292 # 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
293 #endif
362947395f5c fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents: 1257
diff changeset
294
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
295 /* define it to include statistics code (useful only for optimizing
986e461dc072 Initial revision
glantau
parents:
diff changeset
296 codec efficiency */
986e461dc072 Initial revision
glantau
parents:
diff changeset
297 //#define STATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
298
986e461dc072 Initial revision
glantau
parents:
diff changeset
299 #ifdef STATS
986e461dc072 Initial revision
glantau
parents:
diff changeset
300
986e461dc072 Initial revision
glantau
parents:
diff changeset
301 enum {
986e461dc072 Initial revision
glantau
parents:
diff changeset
302 ST_UNKNOWN,
986e461dc072 Initial revision
glantau
parents:
diff changeset
303 ST_DC,
986e461dc072 Initial revision
glantau
parents:
diff changeset
304 ST_INTRA_AC,
986e461dc072 Initial revision
glantau
parents:
diff changeset
305 ST_INTER_AC,
986e461dc072 Initial revision
glantau
parents:
diff changeset
306 ST_INTRA_MB,
986e461dc072 Initial revision
glantau
parents:
diff changeset
307 ST_INTER_MB,
986e461dc072 Initial revision
glantau
parents:
diff changeset
308 ST_MV,
986e461dc072 Initial revision
glantau
parents:
diff changeset
309 ST_NB,
986e461dc072 Initial revision
glantau
parents:
diff changeset
310 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
311
986e461dc072 Initial revision
glantau
parents:
diff changeset
312 extern int st_current_index;
986e461dc072 Initial revision
glantau
parents:
diff changeset
313 extern unsigned int st_bit_counts[ST_NB];
986e461dc072 Initial revision
glantau
parents:
diff changeset
314 extern unsigned int st_out_bit_counts[ST_NB];
986e461dc072 Initial revision
glantau
parents:
diff changeset
315
986e461dc072 Initial revision
glantau
parents:
diff changeset
316 void print_stats(void);
986e461dc072 Initial revision
glantau
parents:
diff changeset
317 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
318
986e461dc072 Initial revision
glantau
parents:
diff changeset
319 /* misc math functions */
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
320 extern const uint8_t ff_log2_tab[256];
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
321
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 144
diff changeset
322 static inline int av_log2(unsigned int v)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
323 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
324 int n;
986e461dc072 Initial revision
glantau
parents:
diff changeset
325
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 n = 0;
986e461dc072 Initial revision
glantau
parents:
diff changeset
327 if (v & 0xffff0000) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
328 v >>= 16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
329 n += 16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
331 if (v & 0xff00) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
332 v >>= 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
333 n += 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
334 }
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
335 n += ff_log2_tab[v];
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
336
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
337 return n;
986e461dc072 Initial revision
glantau
parents:
diff changeset
338 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
339
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
340 static inline int av_log2_16bit(unsigned int v)
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
341 {
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
342 int n;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
343
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
344 n = 0;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
345 if (v & 0xff00) {
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
346 v >>= 8;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
347 n += 8;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
348 }
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
349 n += ff_log2_tab[v];
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
350
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
351 return n;
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
352 }
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
353
277
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
354 /* median of 3 */
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
355 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
356 {
1756
43a856190778 optimization
michael
parents: 1738
diff changeset
357 #if 0
43a856190778 optimization
michael
parents: 1738
diff changeset
358 int t= (a-b)&((a-b)>>31);
43a856190778 optimization
michael
parents: 1738
diff changeset
359 a-=t;
43a856190778 optimization
michael
parents: 1738
diff changeset
360 b+=t;
43a856190778 optimization
michael
parents: 1738
diff changeset
361 b-= (b-c)&((b-c)>>31);
43a856190778 optimization
michael
parents: 1738
diff changeset
362 b+= (a-b)&((a-b)>>31);
277
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
363
1756
43a856190778 optimization
michael
parents: 1738
diff changeset
364 return b;
43a856190778 optimization
michael
parents: 1738
diff changeset
365 #else
43a856190778 optimization
michael
parents: 1738
diff changeset
366 if(a>b){
43a856190778 optimization
michael
parents: 1738
diff changeset
367 if(c>b){
43a856190778 optimization
michael
parents: 1738
diff changeset
368 if(c>a) b=a;
43a856190778 optimization
michael
parents: 1738
diff changeset
369 else b=c;
43a856190778 optimization
michael
parents: 1738
diff changeset
370 }
43a856190778 optimization
michael
parents: 1738
diff changeset
371 }else{
43a856190778 optimization
michael
parents: 1738
diff changeset
372 if(b>c){
43a856190778 optimization
michael
parents: 1738
diff changeset
373 if(c>a) b=c;
43a856190778 optimization
michael
parents: 1738
diff changeset
374 else b=a;
43a856190778 optimization
michael
parents: 1738
diff changeset
375 }
43a856190778 optimization
michael
parents: 1738
diff changeset
376 }
43a856190778 optimization
michael
parents: 1738
diff changeset
377 return b;
43a856190778 optimization
michael
parents: 1738
diff changeset
378 #endif
277
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
379 }
5cb2978e701f new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents: 264
diff changeset
380
327
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
381 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
382 {
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
383 if (a < amin)
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
384 return amin;
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
385 else if (a > amax)
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
386 return amax;
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
387 else
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
388 return a;
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
389 }
d359db02fc90 much better ME for b frames (a bit slow though)
michaelni
parents: 324
diff changeset
390
1898
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
391 static inline int clip_uint8(int a)
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
392 {
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
393 if (a&(~255)) return (-a)>>31;
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
394 else return a;
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
395 }
7d2907127da3 h264 loop filter optimizations
michael
parents: 1895
diff changeset
396
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 306
diff changeset
397 /* math */
1037
44a230c11d83 optimizing av_log2
michaelni
parents: 1031
diff changeset
398 extern const uint8_t ff_sqrt_tab[128];
609
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
399
1126
77ccf7fe3bd0 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 1124
diff changeset
400 int64_t ff_gcd(int64_t a, int64_t b);
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 306
diff changeset
401
451
michaelni
parents: 437
diff changeset
402 static inline int ff_sqrt(int a)
michaelni
parents: 437
diff changeset
403 {
michaelni
parents: 437
diff changeset
404 int ret=0;
michaelni
parents: 437
diff changeset
405 int s;
michaelni
parents: 437
diff changeset
406 int ret_sq=0;
609
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
407
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
408 if(a<128) return ff_sqrt_tab[a];
153a7ffd289b faster ff_sqrt()
michaelni
parents: 580
diff changeset
409
451
michaelni
parents: 437
diff changeset
410 for(s=15; s>=0; s--){
michaelni
parents: 437
diff changeset
411 int b= ret_sq + (1<<(s*2)) + (ret<<s)*2;
michaelni
parents: 437
diff changeset
412 if(b<=a){
michaelni
parents: 437
diff changeset
413 ret_sq=b;
michaelni
parents: 437
diff changeset
414 ret+= 1<<s;
michaelni
parents: 437
diff changeset
415 }
michaelni
parents: 437
diff changeset
416 }
michaelni
parents: 437
diff changeset
417 return ret;
michaelni
parents: 437
diff changeset
418 }
701
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
419
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
420 /**
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
421 * converts fourcc string to int
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
422 */
865
704f13bfc652 * minor warning fix
kabi
parents: 862
diff changeset
423 static inline int ff_get_fourcc(const char *s){
701
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
424 assert( strlen(s)==4 );
1401
f5a107782a66 reverse earlier patch
tmmm
parents: 1398
diff changeset
425
701
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
426 return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24);
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
427 }
85b071dfc7e3 ff_get_fourcc() & XVIX support
michaelni
parents: 609
diff changeset
428
1139
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 1130
diff changeset
429 #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
430 #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
431
6842feb093c1 rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 1130
diff changeset
432
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
433 #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
434 #define MASK_ABS(mask, level)\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
435 asm volatile(\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
436 "cdq \n\t"\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
437 "xorl %1, %0 \n\t"\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
438 "subl %1, %0 \n\t"\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
439 : "+a" (level), "=&d" (mask)\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
440 );
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
441 #else
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
442 #define MASK_ABS(mask, level)\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
443 mask= level>>31;\
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
444 level= (level^mask)-mask;
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
445 #endif
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
446
e65798d228ea idct permutation cleanup, idct can be selected per context now
michaelni
parents: 701
diff changeset
447
451
michaelni
parents: 437
diff changeset
448 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT)
michaelni
parents: 437
diff changeset
449 #define COPY3_IF_LT(x,y,a,b,c,d)\
michaelni
parents: 437
diff changeset
450 asm volatile (\
michaelni
parents: 437
diff changeset
451 "cmpl %0, %3 \n\t"\
michaelni
parents: 437
diff changeset
452 "cmovl %3, %0 \n\t"\
michaelni
parents: 437
diff changeset
453 "cmovl %4, %1 \n\t"\
michaelni
parents: 437
diff changeset
454 "cmovl %5, %2 \n\t"\
michaelni
parents: 437
diff changeset
455 : "+r" (x), "+r" (a), "+r" (c)\
michaelni
parents: 437
diff changeset
456 : "r" (y), "r" (b), "r" (d)\
michaelni
parents: 437
diff changeset
457 );
michaelni
parents: 437
diff changeset
458 #else
michaelni
parents: 437
diff changeset
459 #define COPY3_IF_LT(x,y,a,b,c,d)\
michaelni
parents: 437
diff changeset
460 if((y)<(x)){\
michaelni
parents: 437
diff changeset
461 (x)=(y);\
michaelni
parents: 437
diff changeset
462 (a)=(b);\
michaelni
parents: 437
diff changeset
463 (c)=(d);\
michaelni
parents: 437
diff changeset
464 }
michaelni
parents: 437
diff changeset
465 #endif
michaelni
parents: 437
diff changeset
466
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
467 #if defined(ARCH_X86) || defined(ARCH_X86_64)
2288
3d4a1f8e6a27 * fixing a few of gcc 'clean-code' warnings
kabi
parents: 2140
diff changeset
468 static inline long long rdtsc(void)
1281
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
469 {
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
470 long long l;
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
471 asm volatile( "rdtsc\n\t"
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
472 : "=A" (l)
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
473 );
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
474 return l;
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
475 }
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
476
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
477 #define START_TIMER \
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
478 uint64_t tend;\
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
479 uint64_t tstart= rdtsc();\
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
480
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
481 #define STOP_TIMER(id) \
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
482 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
483 {\
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 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
485 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
486 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
487 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
488 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
489 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
490 }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
491 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
492 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
493 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
494 }\
1281
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
495 }
2140
cd1a71898311 TIMER dummies for non-x86
michael
parents: 2112
diff changeset
496 #else
cd1a71898311 TIMER dummies for non-x86
michael
parents: 2112
diff changeset
497 #define START_TIMER
cd1a71898311 TIMER dummies for non-x86
michael
parents: 2112
diff changeset
498 #define STOP_TIMER(id) {}
1281
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
499 #endif
37176fafe11e some benchmarking code
michaelni
parents: 1273
diff changeset
500
370
0eca28d16cbd clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
al3x
parents: 359
diff changeset
501 #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
502
1031
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
503 /* avoid usage of various functions */
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
504 #define malloc please_use_av_malloc
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
505 #define free please_use_av_free
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
506 #define realloc please_use_av_realloc
1921
7aaf242d5b51 time & (s)rand is forbidden
michael
parents: 1898
diff changeset
507 #define time time_is_forbidden_due_to_security_issues
7aaf242d5b51 time & (s)rand is forbidden
michael
parents: 1898
diff changeset
508 #define rand rand_is_forbidden_due_to_state_trashing
7aaf242d5b51 time & (s)rand is forbidden
michael
parents: 1898
diff changeset
509 #define srand srand_is_forbidden_due_to_state_trashing
2423
87b7fbed8609 dissallow sprintf
michael
parents: 2398
diff changeset
510 #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf
2424
35ca0ef0c279 disallow strcat
michael
parents: 2423
diff changeset
511 #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
512 #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
513 #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
514 #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
515 #endif
1031
19de1445beb2 use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents: 1025
diff changeset
516
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
517 #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
518 {\
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
519 p= av_mallocz(size);\
1332
018ebc066952 fix CHECKED_ALLOCZ(0)
michaelni
parents: 1281
diff changeset
520 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
521 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
522 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
523 }\
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
524 }
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
525
488
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
526 #endif /* HAVE_AV_CONFIG_H */
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
527
90227eb98bf9 do not export internal functions - use stdint.h
bellard
parents: 451
diff changeset
528 #endif /* COMMON_H */