summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libffmpeg/libavcodec/common.h')
-rw-r--r--src/libffmpeg/libavcodec/common.h101
1 files changed, 67 insertions, 34 deletions
diff --git a/src/libffmpeg/libavcodec/common.h b/src/libffmpeg/libavcodec/common.h
index 870a3279c..5f51ba25d 100644
--- a/src/libffmpeg/libavcodec/common.h
+++ b/src/libffmpeg/libavcodec/common.h
@@ -18,6 +18,10 @@
//#define A32_BITSTREAM_READER
#define LIBMPEG2_BITSTREAM_READER_HACK //add BERO
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
#ifdef HAVE_AV_CONFIG_H
/* only include the following when compiling package */
# include "config.h"
@@ -37,10 +41,6 @@
# define ENODATA 61
# endif
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
#include <stddef.h>
#ifndef offsetof
# define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F))
@@ -82,19 +82,49 @@ extern const struct AVOption avoptions_workaround_bug[11];
# define always_inline inline
#endif
+#ifndef EMULATE_INTTYPES
+# include <inttypes.h>
+#else
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+
+# ifdef CONFIG_WIN32
+ typedef signed __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+# else /* other OS */
+ typedef signed long long int64_t;
+ typedef unsigned long long uint64_t;
+# endif /* other OS */
+#endif /* HAVE_INTTYPES_H */
+
+#ifndef INT64_MAX
+#define INT64_MAX 9223372036854775807LL
+#endif
+
+#ifdef EMULATE_FAST_INT
+/* note that we don't emulate 64bit ints */
+typedef signed char int_fast8_t;
+typedef signed int int_fast16_t;
+typedef signed int int_fast32_t;
+typedef unsigned char uint_fast8_t;
+typedef unsigned int uint_fast16_t;
+typedef unsigned int uint_fast32_t;
+#endif
+
+#if defined(CONFIG_OS2) || defined(CONFIG_SUNOS)
+static inline float floorf(float f) {
+ return floor(f);
+}
+#endif
+
#ifdef CONFIG_WIN32
/* windows */
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-typedef unsigned char uint8_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
-typedef signed char int8_t;
-typedef signed int int32_t;
-typedef signed __int64 int64_t;
-
# ifndef __MINGW32__
# define int64_t_C(c) (c ## i64)
# define uint64_t_C(c) (c ## i64)
@@ -121,8 +151,6 @@ typedef signed __int64 int64_t;
#elif defined (CONFIG_OS2)
/* OS/2 EMX */
-#include <inttypes.h>
-
#ifndef int64_t_C
#define int64_t_C(c) (c ## LL)
#define uint64_t_C(c) (c ## ULL)
@@ -143,8 +171,6 @@ typedef signed __int64 int64_t;
/* unix */
-#include <inttypes.h>
-
#ifndef int64_t_C
#define int64_t_C(c) (c ## LL)
#define uint64_t_C(c) (c ## ULL)
@@ -202,7 +228,7 @@ inline void dprintf(const char* fmt,...) {}
# endif /* !CONFIG_WIN32 */
-# define av_abort() do { fprintf(stderr, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
+# define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
//rounded divison & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b))
@@ -268,12 +294,11 @@ typedef struct PutBitContext {
int bit_left;
uint8_t *buf, *buf_ptr, *buf_end;
#endif
- int64_t data_out_size; /* in bytes */
} PutBitContext;
void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size);
-int64_t get_bit_count(PutBitContext *s); /* XXX: change function name */
+int get_bit_count(PutBitContext *s); /* XXX: change function name */
void align_put_bits(PutBitContext *s);
void flush_put_bits(PutBitContext *s);
void put_string(PutBitContext * pbc, char *s);
@@ -1001,23 +1026,31 @@ static inline int av_log2_16bit(unsigned int v)
return n;
}
-
/* median of 3 */
static inline int mid_pred(int a, int b, int c)
{
- int vmin, vmax;
- vmax = vmin = a;
- if (b < vmin)
- vmin = b;
- else
- vmax = b;
-
- if (c < vmin)
- vmin = c;
- else if (c > vmax)
- vmax = c;
-
- return a + b + c - vmin - vmax;
+#if 0
+ int t= (a-b)&((a-b)>>31);
+ a-=t;
+ b+=t;
+ b-= (b-c)&((b-c)>>31);
+ b+= (a-b)&((a-b)>>31);
+
+ return b;
+#else
+ if(a>b){
+ if(c>b){
+ if(c>a) b=a;
+ else b=c;
+ }
+ }else{
+ if(b>c){
+ if(c>a) b=c;
+ else b=a;
+ }
+ }
+ return b;
+#endif
}
static inline int clip(int a, int amin, int amax)