diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2007-01-13 21:19:52 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2007-01-13 21:19:52 +0000 |
commit | 6e8ff6e5c232de4b8235626af31ab85345120a93 (patch) | |
tree | 25930156aa9f4f2014bf6fe3d65c183262626b8d /src/libffmpeg/libavutil | |
parent | 2f5905081ee2040537f043fe4afabbb66d26354e (diff) | |
download | xine-lib-6e8ff6e5c232de4b8235626af31ab85345120a93.tar.gz xine-lib-6e8ff6e5c232de4b8235626af31ab85345120a93.tar.bz2 |
* ffmpeg update to 51.28.0
* Workaround ffmpeg buggy codecs that don't release their DR1 frames.
* Fix several segfaults and freezing problem with H264 streams that use a lot
of reference frames (eg. 15)
* Initial support to enable/disable ffmpeg codecs. Codecs may be disabled in
groups by --disable-ffmpeg-uncommon-codecs/--disable-ffmpeg-popular-codecs
Think of "uncommon" codecs what people would never want to play with their
PDAs (they will save memory by removing them).
Note: currently both uncommon/popular codecs are _build_ but disabled.
that is, build system still need some improvements to really save memory.
warning: non-autoconf guru playing with the build system, likely breakage.
CVS patchset: 8499
CVS date: 2007/01/13 21:19:52
Diffstat (limited to 'src/libffmpeg/libavutil')
-rw-r--r-- | src/libffmpeg/libavutil/Makefile.am | 3 | ||||
-rw-r--r-- | src/libffmpeg/libavutil/bswap.h | 14 | ||||
-rw-r--r-- | src/libffmpeg/libavutil/common.h | 129 | ||||
-rw-r--r-- | src/libffmpeg/libavutil/internal.h | 93 | ||||
-rw-r--r-- | src/libffmpeg/libavutil/intreadwrite.h | 42 | ||||
-rw-r--r-- | src/libffmpeg/libavutil/rational.c | 8 |
6 files changed, 163 insertions, 126 deletions
diff --git a/src/libffmpeg/libavutil/Makefile.am b/src/libffmpeg/libavutil/Makefile.am index 76340cf14..6e507cb67 100644 --- a/src/libffmpeg/libavutil/Makefile.am +++ b/src/libffmpeg/libavutil/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/misc/Makefile.common -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) +AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg AM_CFLAGS = -fno-strict-aliasing ASFLAGS = @@ -28,6 +28,7 @@ noinst_HEADERS = \ integer.h \ internal.h \ intfloat_readwrite.h \ + intreadwrite.h \ lls.h \ log.h \ mathematics.h \ diff --git a/src/libffmpeg/libavutil/bswap.h b/src/libffmpeg/libavutil/bswap.h index 4614c9045..03d613db2 100644 --- a/src/libffmpeg/libavutil/bswap.h +++ b/src/libffmpeg/libavutil/bswap.h @@ -37,7 +37,7 @@ #endif #if defined(ARCH_X86) -static always_inline uint16_t bswap_16(uint16_t x) +static av_always_inline uint16_t bswap_16(uint16_t x) { __asm("rorw $8, %0" : LEGACY_REGS (x) : @@ -45,7 +45,7 @@ static always_inline uint16_t bswap_16(uint16_t x) return x; } -static always_inline uint32_t bswap_32(uint32_t x) +static av_always_inline uint32_t bswap_32(uint32_t x) { #if __CPU__ != 386 __asm("bswap %0": @@ -82,12 +82,12 @@ static inline uint64_t bswap_64(uint64_t x) #elif defined(ARCH_SH4) -static always_inline uint16_t bswap_16(uint16_t x) { +static av_always_inline uint16_t bswap_16(uint16_t x) { __asm__("swap.b %0,%0":"=r"(x):"0"(x)); return x; } -static always_inline uint32_t bswap_32(uint32_t x) { +static av_always_inline uint32_t bswap_32(uint32_t x) { __asm__( "swap.b %0,%0\n" "swap.w %0,%0\n" @@ -110,12 +110,12 @@ static inline uint64_t bswap_64(uint64_t x) } #else -static always_inline uint16_t bswap_16(uint16_t x){ +static av_always_inline uint16_t bswap_16(uint16_t x){ return (x>>8) | (x<<8); } #ifdef ARCH_ARM -static always_inline uint32_t bswap_32(uint32_t x){ +static av_always_inline uint32_t bswap_32(uint32_t x){ uint32_t t; __asm__ ( "eor %1, %0, %0, ror #16 \n\t" @@ -126,7 +126,7 @@ static always_inline uint32_t bswap_32(uint32_t x){ return x; } #else -static always_inline uint32_t bswap_32(uint32_t x){ +static av_always_inline uint32_t bswap_32(uint32_t x){ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); return (x>>16) | (x<<16); } diff --git a/src/libffmpeg/libavutil/common.h b/src/libffmpeg/libavutil/common.h index d167404b6..0e093616c 100644 --- a/src/libffmpeg/libavutil/common.h +++ b/src/libffmpeg/libavutil/common.h @@ -26,9 +26,7 @@ #ifndef COMMON_H #define COMMON_H -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include <inttypes.h> #ifdef HAVE_AV_CONFIG_H /* only include the following when compiling package */ @@ -47,34 +45,17 @@ # include <math.h> #endif /* HAVE_AV_CONFIG_H */ -/* Suppress restrict if it was not defined in config.h. */ -#ifndef restrict -# define restrict -#endif - -#ifndef always_inline -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define always_inline __attribute__((always_inline)) inline -#else -# define always_inline inline -#endif -#endif - -#ifndef attribute_used +#ifndef av_always_inline #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_used __attribute__((used)) +# define av_always_inline __attribute__((always_inline)) inline #else -# define attribute_used +# define av_always_inline inline #endif #endif -#ifndef attribute_unused -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_unused __attribute__((unused)) -#else -# define attribute_unused -#endif -#endif +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ #ifndef attribute_deprecated #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) @@ -84,91 +65,9 @@ #endif #endif -# include <inttypes.h> - -#ifndef PRId64 -#define PRId64 "lld" -#endif - -#ifndef PRIu64 -#define PRIu64 "llu" -#endif - -#ifndef PRIx64 -#define PRIx64 "llx" -#endif - -#ifndef PRIX64 -#define PRIX64 "llX" -#endif - -#ifndef PRId32 -#define PRId32 "d" -#endif - -#ifndef PRIdFAST16 -#define PRIdFAST16 PRId32 -#endif - -#ifndef PRIdFAST32 -#define PRIdFAST32 PRId32 -#endif - -#ifndef INT16_MIN -#define INT16_MIN (-0x7fff-1) -#endif - -#ifndef INT16_MAX -#define INT16_MAX 0x7fff -#endif - -#ifndef INT32_MIN -#define INT32_MIN (-0x7fffffff-1) -#endif - -#ifndef INT32_MAX -#define INT32_MAX 0x7fffffff -#endif - -#ifndef UINT32_MAX -#define UINT32_MAX 0xffffffff -#endif - -#ifndef INT64_MIN -#define INT64_MIN (-0x7fffffffffffffffLL-1) -#endif - -#ifndef INT64_MAX -#define INT64_MAX int64_t_C(9223372036854775807) -#endif - -#ifndef UINT64_MAX -#define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) -#endif - -#ifndef INT_BIT -# if INT_MAX != 2147483647 -# define INT_BIT 64 -# else -# define INT_BIT 32 -# endif -#endif - -#ifndef int64_t_C -#define int64_t_C(c) (c ## LL) -#define uint64_t_C(c) (c ## ULL) -#endif - -#if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV) -# define FF_IMPORT_ATTR __declspec(dllimport) -#else -# define FF_IMPORT_ATTR -#endif - - -#ifdef HAVE_AV_CONFIG_H -/* only include the following when compiling package */ -# include "internal.h" +#ifndef INT64_C +#define INT64_C(c) (c ## LL) +#define UINT64_C(c) (c ## ULL) #endif //rounded divison & shift @@ -184,7 +83,7 @@ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) /* misc math functions */ -extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256]; +extern const uint8_t ff_log2_tab[256]; static inline int av_log2(unsigned int v) { @@ -375,7 +274,7 @@ static inline uint64_t read_time(void) ); return (d << 32) | (a & 0xffffffff); } -#elif defined(ARCH_X86) +#elif defined(ARCH_X86_32) static inline long long read_time(void) { long long l; @@ -465,4 +364,8 @@ void av_freep(void *ptr); # define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t" #endif +/* xine: another config.h with codecs to use */ +#include "ffmpeg_config.h" + #endif /* COMMON_H */ + diff --git a/src/libffmpeg/libavutil/internal.h b/src/libffmpeg/libavutil/internal.h index 7d850141b..0c4b44170 100644 --- a/src/libffmpeg/libavutil/internal.h +++ b/src/libffmpeg/libavutil/internal.h @@ -26,6 +26,94 @@ #ifndef INTERNAL_H #define INTERNAL_H +#ifndef attribute_used +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +# define attribute_used __attribute__((used)) +#else +# define attribute_used +#endif +#endif + +#ifndef attribute_unused +#if defined(__GNUC__) +# define attribute_unused __attribute__((unused)) +#else +# define attribute_unused +#endif +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#ifndef PRId64 +#define PRId64 "lld" +#endif + +#ifndef PRIu64 +#define PRIu64 "llu" +#endif + +#ifndef PRIx64 +#define PRIx64 "llx" +#endif + +#ifndef PRIX64 +#define PRIX64 "llX" +#endif + +#ifndef PRId32 +#define PRId32 "d" +#endif + +#ifndef PRIdFAST16 +#define PRIdFAST16 PRId32 +#endif + +#ifndef PRIdFAST32 +#define PRIdFAST32 PRId32 +#endif + +#ifndef INT16_MIN +#define INT16_MIN (-0x7fff-1) +#endif + +#ifndef INT16_MAX +#define INT16_MAX 0x7fff +#endif + +#ifndef INT32_MIN +#define INT32_MIN (-0x7fffffff-1) +#endif + +#ifndef INT32_MAX +#define INT32_MAX 0x7fffffff +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + +#ifndef INT64_MIN +#define INT64_MIN (-0x7fffffffffffffffLL-1) +#endif + +#ifndef INT64_MAX +#define INT64_MAX INT64_C(9223372036854775807) +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) +#endif + +#ifndef INT_BIT +# if INT_MAX != 2147483647 +# define INT_BIT 64 +# else +# define INT_BIT 32 +# endif +#endif + #if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC) # define PIC #endif @@ -34,6 +122,7 @@ # define ENODATA 61 #endif +#include "intreadwrite.h" #include "bswap.h" #include <stddef.h> @@ -136,7 +225,7 @@ extern const uint32_t ff_inverse[256]; # define FASTDIV(a,b) ((a)/(b)) #endif -extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128]; +extern const uint8_t ff_sqrt_tab[128]; static inline int ff_sqrt(int a) { @@ -216,7 +305,7 @@ if((y)<(x)){\ /* XXX: add ISOC specific test to avoid specific BSD testing. */ /* better than nothing implementation. */ /* btw, rintf() is existing on fbsd too -- alex */ -static always_inline long int lrintf(float x) +static av_always_inline long int lrintf(float x) { #ifdef __MINGW32__ # ifdef ARCH_X86_32 diff --git a/src/libffmpeg/libavutil/intreadwrite.h b/src/libffmpeg/libavutil/intreadwrite.h new file mode 100644 index 000000000..c43f9d651 --- /dev/null +++ b/src/libffmpeg/libavutil/intreadwrite.h @@ -0,0 +1,42 @@ +#ifndef INTREADWRITE_H +#define INTREADWRITE_H + +#ifdef __GNUC__ + +struct unaligned_64 { uint64_t l; } __attribute__((packed)); +struct unaligned_32 { uint32_t l; } __attribute__((packed)); +struct unaligned_16 { uint16_t l; } __attribute__((packed)); + +#define LD16(a) (((const struct unaligned_16 *) (a))->l) +#define LD32(a) (((const struct unaligned_32 *) (a))->l) +#define LD64(a) (((const struct unaligned_64 *) (a))->l) + +#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b) +#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) + +#else /* __GNUC__ */ + +#define LD16(a) (*((uint16_t*)(a))) +#define LD32(a) (*((uint32_t*)(a))) +#define LD64(a) (*((uint64_t*)(a))) + +#define ST16(a, b) *((uint16_t*)(a)) = (b) +#define ST32(a, b) *((uint32_t*)(a)) = (b) + +#endif /* !__GNUC__ */ + +/* endian macros */ +#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32) +#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) +#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ + (((uint8_t*)(x))[1] << 16) | \ + (((uint8_t*)(x))[2] << 8) | \ + ((uint8_t*)(x))[3]) +#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) +#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ + (((uint8_t*)(x))[2] << 16) | \ + (((uint8_t*)(x))[1] << 8) | \ + ((uint8_t*)(x))[0]) +#endif + +#endif /* INTREADWRITE_H */ diff --git a/src/libffmpeg/libavutil/rational.c b/src/libffmpeg/libavutil/rational.c index 0e018c41b..0480aa882 100644 --- a/src/libffmpeg/libavutil/rational.c +++ b/src/libffmpeg/libavutil/rational.c @@ -38,8 +38,10 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) int sign= (nom<0) ^ (den<0); int64_t gcd= ff_gcd(FFABS(nom), FFABS(den)); - nom = FFABS(nom)/gcd; - den = FFABS(den)/gcd; + if(gcd){ + nom = FFABS(nom)/gcd; + den = FFABS(den)/gcd; + } if(nom<=max && den<=max){ a1= (AVRational){nom, den}; den=0; @@ -65,7 +67,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max) nom= den; den= next_den; } - assert(ff_gcd(a1.num, a1.den) == 1); + assert(ff_gcd(a1.num, a1.den) <= 1U); *dst_nom = sign ? -a1.num : a1.num; *dst_den = a1.den; |