diff options
Diffstat (limited to 'src/libffmpeg/libavutil')
24 files changed, 0 insertions, 2216 deletions
diff --git a/src/libffmpeg/libavutil/.cvsignore b/src/libffmpeg/libavutil/.cvsignore deleted file mode 100644 index 7d926a554..000000000 --- a/src/libffmpeg/libavutil/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/src/libffmpeg/libavutil/Makefile.am b/src/libffmpeg/libavutil/Makefile.am deleted file mode 100644 index 13f645957..000000000 --- a/src/libffmpeg/libavutil/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -AM_CFLAGS = -fno-strict-aliasing -ASFLAGS = - -noinst_LTLIBRARIES = libavutil.la - -libavutil_la_SOURCES = \ - adler32.c \ - crc.c \ - integer.c \ - lls.c \ - log.c \ - mathematics.c \ - md5.c \ - rational.c - -libavutil_la_LDFLAGS = -avoid-version -module - -noinst_HEADERS = \ - adler32.h \ - avutil.h \ - bswap.h \ - common.h \ - crc.h \ - integer.h \ - internal.h \ - intfloat_readwrite.h \ - lls.h \ - log.h \ - mathematics.h \ - md5.h \ - rational.h \ - x86_cpu.h diff --git a/src/libffmpeg/libavutil/adler32.c b/src/libffmpeg/libavutil/adler32.c deleted file mode 100644 index e185a77c4..000000000 --- a/src/libffmpeg/libavutil/adler32.c +++ /dev/null @@ -1,53 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "common.h" -#include "adler32.h" - -#define BASE 65521L /* largest prime smaller than 65536 */ - -#define DO1(buf) {s1 += *buf++; s2 += s1;} -#define DO4(buf) DO1(buf); DO1(buf); DO1(buf); DO1(buf); -#define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf); - -unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len) -{ - unsigned long s1 = adler & 0xffff; - unsigned long s2 = adler >> 16; - - while (len>0) { -#ifdef CONFIG_SMALL - while(len>4 && s2 < (1U<<31)){ - DO4(buf); len-=4; -#else - while(len>16 && s2 < (1U<<31)){ - DO16(buf); len-=16; -#endif - } - DO1(buf); len--; - s1 %= BASE; - s2 %= BASE; - } - return (s2 << 16) | s1; -} - -#ifdef TEST -#include "log.h" -#define LEN 7001 -volatile int checksum; -int main(){ - int i; - char data[LEN]; - av_log_level = AV_LOG_DEBUG; - for(i=0; i<LEN; i++) - data[i]= ((i*i)>>3) + 123*i; - for(i=0; i<1000; i++){ - START_TIMER - checksum= av_adler32_update(1, data, LEN); - STOP_TIMER("adler") - } - av_log(NULL, AV_LOG_DEBUG, "%X == 50E6E508\n", checksum); -} -#endif diff --git a/src/libffmpeg/libavutil/adler32.h b/src/libffmpeg/libavutil/adler32.h deleted file mode 100644 index 4b035dcdf..000000000 --- a/src/libffmpeg/libavutil/adler32.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef ADLER32_H -#define ADLER32_H - -unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, - unsigned int len); - -#endif diff --git a/src/libffmpeg/libavutil/avutil.h b/src/libffmpeg/libavutil/avutil.h deleted file mode 100644 index 6f66fbb07..000000000 --- a/src/libffmpeg/libavutil/avutil.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef AVUTIL_H -#define AVUTIL_H - -/** - * @file avutil.h - * external api header. - */ - - -#ifdef __cplusplus -extern "C" { -#endif - -#define AV_STRINGIFY(s) AV_TOSTRING(s) -#define AV_TOSTRING(s) #s - -#define LIBAVUTIL_VERSION_INT ((49<<16)+(0<<8)+0) -#define LIBAVUTIL_VERSION 49.0.0 -#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT - -#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) - - -#include "common.h" -#include "mathematics.h" -#include "rational.h" -#include "integer.h" -#include "intfloat_readwrite.h" -#include "log.h" - -/** - * Pixel format. Notes: - * - * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA - * color is put together as: - * (A << 24) | (R << 16) | (G << 8) | B - * This is stored as BGRA on little endian CPU architectures and ARGB on - * big endian CPUs. - * - * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized - * image data is stored in AVFrame.data[0]. The palette is transported in - * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is - * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is - * also endian-specific). Note also that the individual RGB palette - * components stored in AVFrame.data[1] should be in the range 0..255. - * This is important as many custom PAL8 video codecs that were designed - * to run on the IBM VGA graphics adapter use 6-bit palette components. - */ -enum PixelFormat { - PIX_FMT_NONE= -1, - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUV422, ///< Packed pixel, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB... - PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< always stored in cpu endianness - PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1 - PIX_FMT_GRAY8, - PIX_FMT_MONOWHITE, ///< 0 is white - PIX_FMT_MONOBLACK, ///< 0 is black - PIX_FMT_PAL8, ///< 8 bit with RGBA palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) - PIX_FMT_XVMC_MPEG2_IDCT, - PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1 - PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_NB, -}; - -#ifdef __cplusplus -} -#endif - -#endif /* AVUTIL_H */ diff --git a/src/libffmpeg/libavutil/bswap.h b/src/libffmpeg/libavutil/bswap.h deleted file mode 100644 index 25d418c69..000000000 --- a/src/libffmpeg/libavutil/bswap.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * @file bswap.h - * byte swap. - */ - -#ifndef __BSWAP_H__ -#define __BSWAP_H__ - -#ifdef HAVE_BYTESWAP_H -#include <byteswap.h> -#else - -#ifdef ARCH_X86_64 -# define LEGACY_REGS "=Q" -#else -# define LEGACY_REGS "=q" -#endif - -#if defined(ARCH_X86) || defined(ARCH_X86_64) -static always_inline uint16_t bswap_16(uint16_t x) -{ - __asm("rorw $8, %0" : - LEGACY_REGS (x) : - "0" (x)); - return x; -} - -static always_inline uint32_t bswap_32(uint32_t x) -{ -#if __CPU__ != 386 - __asm("bswap %0": - "=r" (x) : -#else - __asm("xchgb %b0,%h0\n" - " rorl $16,%0\n" - " xchgb %b0,%h0": - LEGACY_REGS (x) : -#endif - "0" (x)); - return x; -} - -static inline uint64_t bswap_64(uint64_t x) -{ -#ifdef ARCH_X86_64 - __asm("bswap %0": - "=r" (x) : - "0" (x)); - return x; -#else - union { - uint64_t ll; - struct { - uint32_t l,h; - } l; - } r; - r.l.l = bswap_32 (x); - r.l.h = bswap_32 (x>>32); - return r.ll; -#endif -} - -#elif defined(ARCH_SH4) - -static 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) { - __asm__( - "swap.b %0,%0\n" - "swap.w %0,%0\n" - "swap.b %0,%0\n" - :"=r"(x):"0"(x)); - return x; -} - -static inline uint64_t bswap_64(uint64_t x) -{ - union { - uint64_t ll; - struct { - uint32_t l,h; - } l; - } r; - r.l.l = bswap_32 (x); - r.l.h = bswap_32 (x>>32); - return r.ll; -} -#else - -static 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){ - uint32_t t; - __asm__ ( - "eor %1, %0, %0, ror #16 \n\t" - "bic %1, %1, #0xFF0000 \n\t" - "mov %0, %0, ror #8 \n\t" - "eor %0, %0, %1, lsr #8 \n\t" - : "+r"(x), "+r"(t)); - return x; -} -#else -static always_inline uint32_t bswap_32(uint32_t x){ - x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); - return (x>>16) | (x<<16); -} -#endif - -static inline uint64_t bswap_64(uint64_t x) -{ -#if 0 - x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); - x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); - return (x>>32) | (x<<32); -#else - union { - uint64_t ll; - uint32_t l[2]; - } w, r; - w.ll = x; - r.l[0] = bswap_32 (w.l[1]); - r.l[1] = bswap_32 (w.l[0]); - return r.ll; -#endif -} -#endif /* !ARCH_X86 */ - -#endif /* !HAVE_BYTESWAP_H */ - -// be2me ... BigEndian to MachineEndian -// le2me ... LittleEndian to MachineEndian - -#ifdef WORDS_BIGENDIAN -#define be2me_16(x) (x) -#define be2me_32(x) (x) -#define be2me_64(x) (x) -#define le2me_16(x) bswap_16(x) -#define le2me_32(x) bswap_32(x) -#define le2me_64(x) bswap_64(x) -#else -#define be2me_16(x) bswap_16(x) -#define be2me_32(x) bswap_32(x) -#define be2me_64(x) bswap_64(x) -#define le2me_16(x) (x) -#define le2me_32(x) (x) -#define le2me_64(x) (x) -#endif - -#endif /* __BSWAP_H__ */ diff --git a/src/libffmpeg/libavutil/common.h b/src/libffmpeg/libavutil/common.h deleted file mode 100644 index b26c821f8..000000000 --- a/src/libffmpeg/libavutil/common.h +++ /dev/null @@ -1,373 +0,0 @@ -/** - * @file common.h - * common internal and external api header. - */ - -#ifndef COMMON_H -#define COMMON_H - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#ifdef HAVE_AV_CONFIG_H -/* only include the following when compiling package */ -# include "config.h" - -# include <stdlib.h> -# include <stdio.h> -# include <string.h> -# include <ctype.h> -# include <limits.h> -# ifndef __BEOS__ -# include <errno.h> -# else -# include "berrno.h" -# endif -# 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 -#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__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define attribute_unused __attribute__((unused)) -#else -# define attribute_unused -#endif -#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; - typedef signed long long int64_t; - typedef unsigned long long uint64_t; -#endif /* EMULATE_INTTYPES */ - -#ifndef PRId64 -#define PRId64 "lld" -#endif - -#ifndef PRIu64 -#define PRIu64 "llu" -#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 - -#ifdef EMULATE_FAST_INT -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; -typedef uint64_t uint_fast64_t; -#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" -#endif - -//rounded divison & shift -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) -/* assume b>0 */ -#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -#define ABS(a) ((a) >= 0 ? (a) : (-(a))) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) - -/* misc math functions */ -extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256]; - -static inline int av_log2(unsigned int v) -{ - int n; - - n = 0; - if (v & 0xffff0000) { - v >>= 16; - n += 16; - } - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -static inline int av_log2_16bit(unsigned int v) -{ - int n; - - n = 0; - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} - -/* median of 3 */ -static inline int mid_pred(int a, int b, int c) -{ -#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 -} - -/** - * clip a signed integer value into the amin-amax range - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return cliped value - */ -static inline int clip(int a, int amin, int amax) -{ - if (a < amin) return amin; - else if (a > amax) return amax; - else return a; -} - -/** - * clip a signed integer value into the 0-255 range - * @param a value to clip - * @return cliped value - */ -static inline uint8_t clip_uint8(int a) -{ - if (a&(~255)) return (-a)>>31; - else return a; -} - -/* math */ -int64_t ff_gcd(int64_t a, int64_t b); - -/** - * converts fourcc string to int - */ -static inline int ff_get_fourcc(const char *s){ -#ifdef HAVE_AV_CONFIG_H - assert( strlen(s)==4 ); -#endif - - return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); -} - -#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) -#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) - - -#define GET_UTF8(val, GET_BYTE, ERROR)\ - val= GET_BYTE;\ - {\ - int ones= 7 - av_log2(val ^ 255);\ - if(ones==1)\ - ERROR\ - val&= 127>>ones;\ - while(--ones > 0){\ - int tmp= GET_BYTE - 128;\ - if(tmp>>6)\ - ERROR\ - val= (val<<6) + tmp;\ - }\ - } - -#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_POWERPC) -#if defined(ARCH_X86_64) -static inline uint64_t read_time(void) -{ - uint64_t a, d; - asm volatile( "rdtsc\n\t" - : "=a" (a), "=d" (d) - ); - return (d << 32) | (a & 0xffffffff); -} -#elif defined(ARCH_X86) -static inline long long read_time(void) -{ - long long l; - asm volatile( "rdtsc\n\t" - : "=A" (l) - ); - return l; -} -#else //FIXME check ppc64 -static inline uint64_t read_time(void) -{ - uint32_t tbu, tbl, temp; - - /* from section 2.2.1 of the 32-bit PowerPC PEM */ - __asm__ __volatile__( - "1:\n" - "mftbu %2\n" - "mftb %0\n" - "mftbu %1\n" - "cmpw %2,%1\n" - "bne 1b\n" - : "=r"(tbl), "=r"(tbu), "=r"(temp) - : - : "cc"); - - return (((uint64_t)tbu)<<32) | (uint64_t)tbl; -} -#endif - -#define START_TIMER \ -uint64_t tend;\ -uint64_t tstart= read_time();\ - -#define STOP_TIMER(id) \ -tend= read_time();\ -{\ - static uint64_t tsum=0;\ - static int tcount=0;\ - static int tskip_count=0;\ - if(tcount<2 || tend - tstart < 8*tsum/tcount){\ - tsum+= tend - tstart;\ - tcount++;\ - }else\ - tskip_count++;\ - if(256*256*256*64%(tcount+tskip_count)==0){\ - av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\ - }\ -} -#else -#define START_TIMER -#define STOP_TIMER(id) {} -#endif - -/* memory */ -void *av_malloc(unsigned int size); -void *av_realloc(void *ptr, unsigned int size); -void av_free(void *ptr); - -/* xine: inline causes trouble for debug compiling */ -#ifdef DISABLE_INLINE -# ifdef inline -# undef inline -# endif -# ifdef always_inline -# undef always_inline -# endif -# define inline -# define always_inline -#endif - -#endif /* COMMON_H */ diff --git a/src/libffmpeg/libavutil/crc.c b/src/libffmpeg/libavutil/crc.c deleted file mode 100644 index 13be2020d..000000000 --- a/src/libffmpeg/libavutil/crc.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "common.h" -#include "crc.h" - -AVCRC *av_crcEDB88320; -AVCRC *av_crc04C11DB7; -AVCRC *av_crc8005 ; -AVCRC *av_crc07 ; - -/** - * Inits a crc table. - * @param ctx must be an array of sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 - * @param cts_size size of ctx in bytes - * @return <0 on failure - */ -int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ - int i, j; - uint32_t c; - - if (bits < 8 || bits > 32 || poly >= (1LL<<bits)) - return -1; - if (ctx_size != sizeof(AVCRC)*257 && ctx_size != sizeof(AVCRC)*1024) - return -1; - - for (i = 0; i < 256; i++) { - if (le) { - for (c = i, j = 0; j < 8; j++) - c = (c>>1)^(poly & (-(c&1))); - ctx[i] = c; - } else { - for (c = i << 24, j = 0; j < 8; j++) - c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) ); - ctx[i] = bswap_32(c); - } - } - ctx[256]=1; -#ifndef CONFIG_SMALL - if(ctx_size >= sizeof(AVCRC)*1024) - for (i = 0; i < 256; i++) - for(j=0; j<3; j++) - ctx[256*(j+1) + i]= (ctx[256*j + i]>>8) ^ ctx[ ctx[256*j + i]&0xFF ]; -#endif - - return 0; -} - -uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){ - const uint8_t *end= buffer+length; - -#ifndef CONFIG_SMALL - if(!ctx[256]) - while(buffer<end-3){ - crc ^= le2me_32(*(uint32_t*)buffer); buffer+=4; - crc = ctx[3*256 + ( crc &0xFF)] - ^ctx[2*256 + ((crc>>8 )&0xFF)] - ^ctx[1*256 + ((crc>>16)&0xFF)] - ^ctx[0*256 + ((crc>>24) )]; - } -#endif - while(buffer<end) - crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8); - - return crc; -} - -#ifdef TEST -#undef printf -main(){ - uint8_t buf[1999]; - int i; - int p[4][4]={{1, 32, 0xedb88320L, 0x3D5CDD04}, - {0, 32, 0x04c11db7L, 0xC0F5BAE0}, - {0, 16, 0x8005 , 0x1FBB }, - {0, 8, 0x07 , 0xE3 },}; - AVCRC ctx[1 ? 1024:257]; - - for(i=0; i<sizeof(buf); i++) - buf[i]= i+i*i; - - for(i=0; i<4; i++){ - av_crc_init(ctx, p[i][0], p[i][1], p[i][2], sizeof(ctx)); - printf("crc %08X =%X\n", p[i][2], av_crc(ctx, 0, buf, sizeof(buf))); - } -} -#endif diff --git a/src/libffmpeg/libavutil/crc.h b/src/libffmpeg/libavutil/crc.h deleted file mode 100644 index c5b217017..000000000 --- a/src/libffmpeg/libavutil/crc.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef CRC_H -#define CRC_H - -typedef uint32_t AVCRC; - -extern AVCRC *av_crcEDB88320; -extern AVCRC *av_crc04C11DB7; -extern AVCRC *av_crc8005 ; -extern AVCRC *av_crc07 ; - -int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); -uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length); - -#endif /* CRC_H */ - diff --git a/src/libffmpeg/libavutil/integer.c b/src/libffmpeg/libavutil/integer.c deleted file mode 100644 index 1820dbf59..000000000 --- a/src/libffmpeg/libavutil/integer.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file integer.c - * arbitrary precision integers. - * @author Michael Niedermayer <michaelni@gmx.at> - */ - -#include "common.h" -#include "integer.h" - -AVInteger av_add_i(AVInteger a, AVInteger b){ - int i, carry=0; - - for(i=0; i<AV_INTEGER_SIZE; i++){ - carry= (carry>>16) + a.v[i] + b.v[i]; - a.v[i]= carry; - } - return a; -} - -AVInteger av_sub_i(AVInteger a, AVInteger b){ - int i, carry=0; - - for(i=0; i<AV_INTEGER_SIZE; i++){ - carry= (carry>>16) + a.v[i] - b.v[i]; - a.v[i]= carry; - } - return a; -} - -/** - * returns the rounded down value of the logarithm of base 2 of the given AVInteger. - * this is simply the index of the most significant bit which is 1. Or 0 of all bits are 0 - */ -int av_log2_i(AVInteger a){ - int i; - - for(i=AV_INTEGER_SIZE-1; i>=0; i--){ - if(a.v[i]) - return av_log2_16bit(a.v[i]) + 16*i; - } - return -1; -} - -AVInteger av_mul_i(AVInteger a, AVInteger b){ - AVInteger out; - int i, j; - int na= (av_log2_i(a)+16) >> 4; - int nb= (av_log2_i(b)+16) >> 4; - - memset(&out, 0, sizeof(out)); - - for(i=0; i<na; i++){ - unsigned int carry=0; - - if(a.v[i]) - for(j=i; j<AV_INTEGER_SIZE && j-i<=nb; j++){ - carry= (carry>>16) + out.v[j] + a.v[i]*b.v[j-i]; - out.v[j]= carry; - } - } - - return out; -} - -/** - * returns 0 if a==b, 1 if a>b and -1 if a<b. - */ -int av_cmp_i(AVInteger a, AVInteger b){ - int i; - int v= (int16_t)a.v[AV_INTEGER_SIZE-1] - (int16_t)b.v[AV_INTEGER_SIZE-1]; - if(v) return (v>>16)|1; - - for(i=AV_INTEGER_SIZE-2; i>=0; i--){ - int v= a.v[i] - b.v[i]; - if(v) return (v>>16)|1; - } - return 0; -} - -/** - * bitwise shift. - * @param s the number of bits by which the value should be shifted right, may be negative for shifting left - */ -AVInteger av_shr_i(AVInteger a, int s){ - AVInteger out; - int i; - - for(i=0; i<AV_INTEGER_SIZE; i++){ - int index= i + (s>>4); - unsigned int v=0; - if(index+1<AV_INTEGER_SIZE && index+1>=0) v = a.v[index+1]<<16; - if(index <AV_INTEGER_SIZE && index >=0) v+= a.v[index ]; - out.v[i]= v >> (s&15); - } - return out; -} - -/** - * returns a % b. - * @param quot a/b will be stored here - */ -AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){ - int i= av_log2_i(a) - av_log2_i(b); - AVInteger quot_temp; - if(!quot) quot = "_temp; - - assert((int16_t)a.v[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b.v[AV_INTEGER_SIZE-1] >= 0); - assert(av_log2_i(b)>=0); - - if(i > 0) - b= av_shr_i(b, -i); - - memset(quot, 0, sizeof(AVInteger)); - - while(i-- >= 0){ - *quot= av_shr_i(*quot, -1); - if(av_cmp_i(a, b) >= 0){ - a= av_sub_i(a, b); - quot->v[0] += 1; - } - b= av_shr_i(b, 1); - } - return a; -} - -/** - * returns a/b. - */ -AVInteger av_div_i(AVInteger a, AVInteger b){ - AVInteger quot; - av_mod_i(", a, b); - return quot; -} - -/** - * converts the given int64_t to an AVInteger. - */ -AVInteger av_int2i(int64_t a){ - AVInteger out; - int i; - - for(i=0; i<AV_INTEGER_SIZE; i++){ - out.v[i]= a; - a>>=16; - } - return out; -} - -/** - * converts the given AVInteger to an int64_t. - * if the AVInteger is too large to fit into an int64_t, - * then only the least significant 64bit will be used - */ -int64_t av_i2int(AVInteger a){ - int i; - int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1]; - - for(i= AV_INTEGER_SIZE-2; i>=0; i--){ - out = (out<<16) + a.v[i]; - } - return out; -} - -#if 0 -#undef NDEBUG -#include <assert.h> - -const uint8_t ff_log2_tab[256]={ - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -main(){ - int64_t a,b; - - for(a=7; a<256*256*256; a+=13215){ - for(b=3; b<256*256*256; b+=27118){ - AVInteger ai= av_int2i(a); - AVInteger bi= av_int2i(b); - - assert(av_i2int(ai) == a); - assert(av_i2int(bi) == b); - assert(av_i2int(av_add_i(ai,bi)) == a+b); - assert(av_i2int(av_sub_i(ai,bi)) == a-b); - assert(av_i2int(av_mul_i(ai,bi)) == a*b); - assert(av_i2int(av_shr_i(ai, 9)) == a>>9); - assert(av_i2int(av_shr_i(ai,-9)) == a<<9); - assert(av_i2int(av_shr_i(ai, 17)) == a>>17); - assert(av_i2int(av_shr_i(ai,-17)) == a<<17); - assert(av_log2_i(ai) == av_log2(a)); - assert(av_i2int(av_div_i(ai,bi)) == a/b); - } - } -} -#endif diff --git a/src/libffmpeg/libavutil/integer.h b/src/libffmpeg/libavutil/integer.h deleted file mode 100644 index 523752912..000000000 --- a/src/libffmpeg/libavutil/integer.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file integer.h - * arbitrary precision integers - * @author Michael Niedermayer <michaelni@gmx.at> - */ - -#ifndef INTEGER_H -#define INTEGER_H - -#define AV_INTEGER_SIZE 8 - -typedef struct AVInteger{ - uint16_t v[AV_INTEGER_SIZE]; -} AVInteger; - -AVInteger av_add_i(AVInteger a, AVInteger b); -AVInteger av_sub_i(AVInteger a, AVInteger b); -int av_log2_i(AVInteger a); -AVInteger av_mul_i(AVInteger a, AVInteger b); -int av_cmp_i(AVInteger a, AVInteger b); -AVInteger av_shr_i(AVInteger a, int s); -AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b); -AVInteger av_div_i(AVInteger a, AVInteger b); -AVInteger av_int2i(int64_t a); -int64_t av_i2int(AVInteger a); - -#endif // INTEGER_H diff --git a/src/libffmpeg/libavutil/internal.h b/src/libffmpeg/libavutil/internal.h deleted file mode 100644 index 266976c94..000000000 --- a/src/libffmpeg/libavutil/internal.h +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @file internal.h - * common internal api header. - */ - -#ifndef INTERNAL_H -#define INTERNAL_H - -#if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC) -# define PIC -#endif - -# ifndef ENODATA -# define ENODATA 61 -# endif - -#include "bswap.h" - -#include <stddef.h> -#ifndef offsetof -# define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F)) -#endif - -#define AVOPTION_CODEC_BOOL(name, help, field) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_BOOL } -#define AVOPTION_CODEC_DOUBLE(name, help, field, minv, maxv, defval) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_DOUBLE, minv, maxv, defval } -#define AVOPTION_CODEC_FLAG(name, help, field, flag, defval) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_FLAG, flag, 0, defval } -#define AVOPTION_CODEC_INT(name, help, field, minv, maxv, defval) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_INT, minv, maxv, defval } -#define AVOPTION_CODEC_STRING(name, help, field, str, val) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_STRING, .defval = val, .defstr = str } -#define AVOPTION_CODEC_RCOVERRIDE(name, help, field) \ - { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_RCOVERRIDE, .defval = 0, .defstr = NULL } -#define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } -#define AVOPTION_END() AVOPTION_SUB(NULL) - -#ifdef __MINGW32__ -# ifdef _DEBUG -# define DEBUG -# endif - -# define snprintf _snprintf -# define vsnprintf _vsnprintf - -# ifdef CONFIG_WINCE -# define perror(a) -# endif - -/* __MINGW32__ end */ -#elif defined (CONFIG_OS2) -/* OS/2 EMX */ - -#include <float.h> - -#endif /* !__MINGW32__ && CONFIG_OS2 */ - -# ifdef USE_FASTMEMCPY -# include "fastmemcpy.h" -# endif - -// Use rip-relative addressing if compiling PIC code on x86-64. -# if defined(__MINGW32__) || defined(__CYGWIN__) || \ - defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) -# if defined(ARCH_X86_64) && defined(PIC) -# define MANGLE(a) "_" #a"(%%rip)" -# else -# define MANGLE(a) "_" #a -# endif -# else -# if defined(ARCH_X86_64) && defined(PIC) -# define MANGLE(a) #a"(%%rip)" -# elif defined(CONFIG_DARWIN) -# define MANGLE(a) "_" #a -# else -# define MANGLE(a) #a -# endif -# endif - -/* debug stuff */ - -# if !defined(DEBUG) && !defined(NDEBUG) -# define NDEBUG -# endif -# include <assert.h> - -/* dprintf macros */ -# ifdef DEBUG -# ifdef __GNUC__ -# define dprintf(fmt,args...) av_log(NULL, AV_LOG_DEBUG, fmt, ##args) -# else -# define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) -# endif -# else -# define dprintf(fmt,...) -# endif - -# ifdef CONFIG_WINCE -# define abort() -# endif - -# define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) - -extern const uint32_t inverse[256]; - -#if defined(ARCH_X86) || defined(ARCH_X86_64) -# define FASTDIV(a,b) \ - ({\ - int ret,dmy;\ - asm volatile(\ - "mull %3"\ - :"=d"(ret),"=a"(dmy)\ - :"1"(a),"g"(inverse[b])\ - );\ - ret;\ - }) -#elif defined(CONFIG_FASTDIV) -# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*inverse[b])>>32)) -#else -# define FASTDIV(a,b) ((a)/(b)) -#endif - -/* math */ -extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128]; - -static inline int ff_sqrt(int a) -{ - int ret=0; - int s; - int ret_sq=0; - - if(a<128) return ff_sqrt_tab[a]; - - for(s=15; s>=0; s--){ - int b= ret_sq + (1<<(s*2)) + (ret<<s)*2; - if(b<=a){ - ret_sq=b; - ret+= 1<<s; - } - } - return ret; -} - -#if defined(ARCH_X86) || defined(ARCH_X86_64) -#define MASK_ABS(mask, level)\ - asm volatile(\ - "cdq \n\t"\ - "xorl %1, %0 \n\t"\ - "subl %1, %0 \n\t"\ - : "+a" (level), "=&d" (mask)\ - ); -#else -#define MASK_ABS(mask, level)\ - mask= level>>31;\ - level= (level^mask)-mask; -#endif - -#if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT) -#define COPY3_IF_LT(x,y,a,b,c,d)\ -asm volatile (\ - "cmpl %0, %3 \n\t"\ - "cmovl %3, %0 \n\t"\ - "cmovl %4, %1 \n\t"\ - "cmovl %5, %2 \n\t"\ - : "+r" (x), "+r" (a), "+r" (c)\ - : "r" (y), "r" (b), "r" (d)\ -); -#else -#define COPY3_IF_LT(x,y,a,b,c,d)\ -if((y)<(x)){\ - (x)=(y);\ - (a)=(b);\ - (c)=(d);\ -} -#endif - -/* avoid usage of various functions */ -#define malloc please_use_av_malloc -#define free please_use_av_free -#define realloc please_use_av_realloc -#define time time_is_forbidden_due_to_security_issues -#define rand rand_is_forbidden_due_to_state_trashing -#define srand srand_is_forbidden_due_to_state_trashing -#define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf -#define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat -#if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H)) -#define printf please_use_av_log -#define fprintf please_use_av_log -#endif - -#define CHECKED_ALLOCZ(p, size)\ -{\ - p= av_mallocz(size);\ - if(p==NULL && (size)!=0){\ - perror("malloc");\ - goto fail;\ - }\ -} - -#ifndef HAVE_LRINTF -/* 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) -{ -#ifdef __MINGW32__ -# ifdef ARCH_X86 - int32_t i; - asm volatile( - "fistpl %0\n\t" - : "=m" (i) : "t" (x) : "st" - ); - return i; -# else - /* XXX: incorrect, but make it compile */ - return (int)(x + (x < 0 ? -0.5 : 0.5)); -# endif /* ARCH_X86 */ -#else - return (int)(rint(x)); -#endif /* __MINGW32__ */ -} -#endif /* HAVE_LRINTF */ - -#endif /* INTERNAL_H */ diff --git a/src/libffmpeg/libavutil/intfloat_readwrite.h b/src/libffmpeg/libavutil/intfloat_readwrite.h deleted file mode 100644 index 33e4c636c..000000000 --- a/src/libffmpeg/libavutil/intfloat_readwrite.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef INTFLOAT_READWRITE_H -#define INTFLOAT_READWRITE_H - -#include "common.h" - -/* IEEE 80 bits extended float */ -typedef struct AVExtFloat { - uint8_t exponent[2]; - uint8_t mantissa[8]; -} AVExtFloat; - -double av_int2dbl(int64_t v); -float av_int2flt(int32_t v); -double av_ext2dbl(const AVExtFloat ext); -int64_t av_dbl2int(double d); -int32_t av_flt2int(float d); -AVExtFloat av_dbl2ext(double d); - -#endif /* INTFLOAT_READWRITE_H */ diff --git a/src/libffmpeg/libavutil/lls.c b/src/libffmpeg/libavutil/lls.c deleted file mode 100644 index 6bf4d9278..000000000 --- a/src/libffmpeg/libavutil/lls.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file lls.c - * linear least squares model - */ - -#include <math.h> -#include <string.h> - -#include "lls.h" - -#ifdef TEST -#define av_log(a,b,...) printf(__VA_ARGS__) -#endif - -void av_init_lls(LLSModel *m, int indep_count){ - memset(m, 0, sizeof(LLSModel)); - - m->indep_count= indep_count; -} - -void av_update_lls(LLSModel *m, double *var, double decay){ - int i,j; - - for(i=0; i<=m->indep_count; i++){ - for(j=i; j<=m->indep_count; j++){ - m->covariance[i][j] *= decay; - m->covariance[i][j] += var[i]*var[j]; - } - } -} - -void av_solve_lls(LLSModel *m, double threshold, int min_order){ - int i,j,k; - double (*factor)[MAX_VARS+1]= &m->covariance[1][0]; - double (*covar )[MAX_VARS+1]= &m->covariance[1][1]; - double *covar_y = m->covariance[0]; - int count= m->indep_count; - - for(i=0; i<count; i++){ - for(j=i; j<count; j++){ - double sum= covar[i][j]; - - for(k=i-1; k>=0; k--) - sum -= factor[i][k]*factor[j][k]; - - if(i==j){ - if(sum < threshold) - sum= 1.0; - factor[i][i]= sqrt(sum); - }else - factor[j][i]= sum / factor[i][i]; - } - } - for(i=0; i<count; i++){ - double sum= covar_y[i+1]; - for(k=i-1; k>=0; k--) - sum -= factor[i][k]*m->coeff[0][k]; - m->coeff[0][i]= sum / factor[i][i]; - } - - for(j=count-1; j>=min_order; j--){ - for(i=j; i>=0; i--){ - double sum= m->coeff[0][i]; - for(k=i+1; k<=j; k++) - sum -= factor[k][i]*m->coeff[j][k]; - m->coeff[j][i]= sum / factor[i][i]; - } - - m->variance[j]= covar_y[0]; - for(i=0; i<=j; i++){ - double sum= m->coeff[j][i]*covar[i][i] - 2*covar_y[i+1]; - for(k=0; k<i; k++) - sum += 2*m->coeff[j][k]*covar[k][i]; - m->variance[j] += m->coeff[j][i]*sum; - } - } -} - -double av_evaluate_lls(LLSModel *m, double *param, int order){ - int i; - double out= 0; - - for(i=0; i<=order; i++) - out+= param[i]*m->coeff[order][i]; - - return out; -} - -#ifdef TEST - -#include <stdlib.h> -#include <stdio.h> - -int main(){ - LLSModel m; - int i, order; - - av_init_lls(&m, 3); - - for(i=0; i<100; i++){ - double var[4]; - double eval, variance; -#if 0 - var[1] = rand() / (double)RAND_MAX; - var[2] = rand() / (double)RAND_MAX; - var[3] = rand() / (double)RAND_MAX; - - var[2]= var[1] + var[3]/2; - - var[0] = var[1] + var[2] + var[3] + var[1]*var[2]/100; -#else - var[0] = (rand() / (double)RAND_MAX - 0.5)*2; - var[1] = var[0] + rand() / (double)RAND_MAX - 0.5; - var[2] = var[1] + rand() / (double)RAND_MAX - 0.5; - var[3] = var[2] + rand() / (double)RAND_MAX - 0.5; -#endif - av_update_lls(&m, var, 0.99); - av_solve_lls(&m, 0.001, 0); - for(order=0; order<3; order++){ - eval= av_evaluate_lls(&m, var+1, order); - av_log(NULL, AV_LOG_DEBUG, "real:%f order:%d pred:%f var:%f coeffs:%f %f %f\n", - var[0], order, eval, sqrt(m.variance[order] / (i+1)), - m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]); - } - } - return 0; -} - -#endif diff --git a/src/libffmpeg/libavutil/lls.h b/src/libffmpeg/libavutil/lls.h deleted file mode 100644 index 944fba75d..000000000 --- a/src/libffmpeg/libavutil/lls.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LLS_H -#define LLS_H - -#define MAX_VARS 32 - -//FIXME avoid direct access to LLSModel from outside - -/** - * Linear least squares model. - */ -typedef struct LLSModel{ - double covariance[MAX_VARS+1][MAX_VARS+1]; - double coeff[MAX_VARS][MAX_VARS]; - double variance[MAX_VARS]; - int indep_count; -}LLSModel; - -void av_init_lls(LLSModel *m, int indep_count); -void av_update_lls(LLSModel *m, double *param, double decay); -void av_solve_lls(LLSModel *m, double threshold, int min_order); -double av_evaluate_lls(LLSModel *m, double *param, int order); - -#endif diff --git a/src/libffmpeg/libavutil/log.c b/src/libffmpeg/libavutil/log.c deleted file mode 100644 index f43593ad9..000000000 --- a/src/libffmpeg/libavutil/log.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * log functions - * Copyright (c) 2003 Michel Bardiaux - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file log.c - * log. - */ - -#include "avutil.h" - -int av_log_level = AV_LOG_INFO; - -static void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) -{ - static int print_prefix=1; - AVClass* avc= ptr ? *(AVClass**)ptr : NULL; - if(level>av_log_level) - return; -#undef fprintf - if(print_prefix && avc) { - fprintf(stderr, "[%s @ %p]", avc->item_name(ptr), avc); - } -#define fprintf please_use_av_log - - print_prefix= strstr(fmt, "\n") != NULL; - - vfprintf(stderr, fmt, vl); -} - -#if LIBAVUTIL_VERSION_INT < (50<<16) -static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback; -#else -void (*av_vlog)(void*, int, const char*, va_list) = av_log_default_callback; -#endif - -void av_log(void* avcl, int level, const char *fmt, ...) -{ - va_list vl; - va_start(vl, fmt); - av_vlog(avcl, level, fmt, vl); - va_end(vl); -} - -#if LIBAVUTIL_VERSION_INT < (50<<16) -void av_vlog(void* avcl, int level, const char *fmt, va_list vl) -{ - av_log_callback(avcl, level, fmt, vl); -} - -int av_log_get_level(void) -{ - return av_log_level; -} - -void av_log_set_level(int level) -{ - av_log_level = level; -} - -void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) -{ - av_log_callback = callback; -} -#endif diff --git a/src/libffmpeg/libavutil/log.h b/src/libffmpeg/libavutil/log.h deleted file mode 100644 index 13366064e..000000000 --- a/src/libffmpeg/libavutil/log.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef LOG_H -#define LOG_H - -#include <stdarg.h> - -/** - * Used by av_log - */ -typedef struct AVCLASS AVClass; -struct AVCLASS { - const char* class_name; - const char* (*item_name)(void*); /* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat */ - struct AVOption *option; -}; - -/* av_log API */ - -#define AV_LOG_QUIET -1 -#define AV_LOG_ERROR 0 -#define AV_LOG_INFO 1 -#define AV_LOG_DEBUG 2 -extern int av_log_level; - -#ifdef __GNUC__ -extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); -#else -extern void av_log(void*, int level, const char *fmt, ...); -#endif - -#if LIBAVUTIL_VERSION_INT < (50<<16) -extern void av_vlog(void*, int level, const char *fmt, va_list); -extern int av_log_get_level(void); -extern void av_log_set_level(int); -extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); -#else -extern void (*av_vlog)(void*, int, const char*, va_list); -#endif - -#endif /* LOG_H */ diff --git a/src/libffmpeg/libavutil/mathematics.c b/src/libffmpeg/libavutil/mathematics.c deleted file mode 100644 index 951324e99..000000000 --- a/src/libffmpeg/libavutil/mathematics.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file mathematics.c - * Miscellaneous math routines and tables. - */ - -#include "common.h" -#include "mathematics.h" - -const uint8_t ff_sqrt_tab[128]={ - 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11 -}; - -const uint8_t ff_log2_tab[256]={ - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -int64_t ff_gcd(int64_t a, int64_t b){ - if(b) return ff_gcd(b, a%b); - else return a; -} - -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ - int64_t r=0; - assert(c > 0); - assert(b >=0); - assert(rnd >=0 && rnd<=5 && rnd!=4); - - if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1)); - - if(rnd==AV_ROUND_NEAR_INF) r= c/2; - else if(rnd&1) r= c-1; - - if(b<=INT_MAX && c<=INT_MAX){ - if(a<=INT_MAX) - return (a * b + r)/c; - else - return a/c*b + (a%c*b + r)/c; - }else{ -#if 1 - uint64_t a0= a&0xFFFFFFFF; - uint64_t a1= a>>32; - uint64_t b0= b&0xFFFFFFFF; - uint64_t b1= b>>32; - uint64_t t1= a0*b1 + a1*b0; - uint64_t t1a= t1<<32; - int i; - - a0 = a0*b0 + t1a; - a1 = a1*b1 + (t1>>32) + (a0<t1a); - a0 += r; - a1 += a0<r; - - for(i=63; i>=0; i--){ -// int o= a1 & 0x8000000000000000ULL; - a1+= a1 + ((a0>>i)&1); - t1+=t1; - if(/*o || */c <= a1){ - a1 -= c; - t1++; - } - } - return t1; - } -#else - AVInteger ai; - ai= av_mul_i(av_int2i(a), av_int2i(b)); - ai= av_add_i(ai, av_int2i(r)); - - return av_i2int(av_div_i(ai, av_int2i(c))); - } -#endif -} - -int64_t av_rescale(int64_t a, int64_t b, int64_t c){ - return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); -} - -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ - int64_t b= bq.num * (int64_t)cq.den; - int64_t c= cq.num * (int64_t)bq.den; - return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); -} -#if 0 -#include "integer.h" -#undef printf -main(){ - int64_t a,b,c,d,e; - - for(a=7; a<(1LL<<62); a+=a/3+1){ - for(b=3; b<(1LL<<62); b+=b/4+1){ - for(c=9; c<(1LL<<62); c+=(c*2)/5+3){ - int64_t r= c/2; - AVInteger ai; - ai= av_mul_i(av_int2i(a), av_int2i(b)); - ai= av_add_i(ai, av_int2i(r)); - - d= av_i2int(av_div_i(ai, av_int2i(c))); - - e= av_rescale(a,b,c); - - if((double)a * (double)b / (double)c > (1LL<<63)) - continue; - - if(d!=e) printf("%Ld*%Ld/%Ld= %Ld=%Ld\n", a, b, c, d, e); - } - } - } -} -#endif diff --git a/src/libffmpeg/libavutil/mathematics.h b/src/libffmpeg/libavutil/mathematics.h deleted file mode 100644 index 0cf726cbe..000000000 --- a/src/libffmpeg/libavutil/mathematics.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef MATHEMATICS_H -#define MATHEMATICS_H - -#include "rational.h" - -enum AVRounding { - AV_ROUND_ZERO = 0, ///< round toward zero - AV_ROUND_INF = 1, ///< round away from zero - AV_ROUND_DOWN = 2, ///< round toward -infinity - AV_ROUND_UP = 3, ///< round toward +infinity - AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero -}; - -/** - * rescale a 64bit integer with rounding to nearest. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale(int64_t a, int64_t b, int64_t c); - -/** - * rescale a 64bit integer with specified rounding. - * a simple a*b/c isn't possible as it can overflow - */ -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding); - -/** - * rescale a 64bit integer by 2 rational numbers. - */ -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq); - -#endif /* MATHEMATICS_H */ diff --git a/src/libffmpeg/libavutil/md5.c b/src/libffmpeg/libavutil/md5.c deleted file mode 100644 index 32eca3a8e..000000000 --- a/src/libffmpeg/libavutil/md5.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2006 Michael Niedermayer (michaelni@gmx.at) - * Copyright (C) 2003-2005 by Christopher R. Hertel (crh@ubiqx.mn.org) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * References: - * IETF RFC 1321: The MD5 Message-Digest Algorithm - * Ron Rivest. IETF, April, 1992 - * - * based on http://ubiqx.org/libcifs/source/Auth/MD5.c - * from Christopher R. Hertel (crh@ubiqx.mn.org) - * simplified, cleaned and IMO redundant comments removed by michael - * - * if you use gcc, then version 4.1 or later and -fomit-frame-pointer is - * strongly recommended - */ - -#include "common.h" -#include <string.h> -#include "md5.h" - -typedef struct AVMD5{ - uint8_t block[64]; - uint32_t ABCD[4]; - uint64_t len; - int b_used; -} AVMD5; - -const int av_md5_size= sizeof(AVMD5); - -static const uint8_t S[4][4] = { - { 7, 12, 17, 22 }, /* Round 1 */ - { 5, 9, 14, 20 }, /* Round 2 */ - { 4, 11, 16, 23 }, /* Round 3 */ - { 6, 10, 15, 21 } /* Round 4 */ -}; - -static const uint32_t T[64] = { - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* Round 1 */ - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, /* Round 2 */ - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, /* Round 3 */ - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, /* Round 4 */ - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, -}; - -#define CORE(i, a, b, c, d) \ - t = S[i>>4][i&3];\ - a += T[i];\ -\ - switch(i>>4){\ - case 0: a += (d ^ (b&(c^d))) + X[ i &15 ]; break;\ - case 1: a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ]; break;\ - case 2: a += (b^c^d) + X[ (5+3*i)&15 ]; break;\ - case 3: a += (c^(b|~d)) + X[ ( 7*i)&15 ]; break;\ - }\ - a = b + (( a << t ) | ( a >> (32 - t) )); - -static void body(uint32_t ABCD[4], uint32_t X[16]){ - - int t; - int i attribute_unused; - unsigned int a= ABCD[3]; - unsigned int b= ABCD[2]; - unsigned int c= ABCD[1]; - unsigned int d= ABCD[0]; - -#ifdef WORDS_BIGENDIAN - for(i=0; i<16; i++) - X[i]= bswap_32(X[i]); -#endif - -#ifdef CONFIG_SMALL - for( i = 0; i < 64; i++ ){ - CORE(i,a,b,c,d) - t=d; d=c; c=b; b=a; a=t; - } -#else -#define CORE2(i) CORE(i,a,b,c,d) CORE((i+1),d,a,b,c) CORE((i+2),c,d,a,b) CORE((i+3),b,c,d,a) -#define CORE4(i) CORE2(i) CORE2((i+4)) CORE2((i+8)) CORE2((i+12)) -CORE4(0) CORE4(16) CORE4(32) CORE4(48) -#endif - - ABCD[0] += d; - ABCD[1] += c; - ABCD[2] += b; - ABCD[3] += a; -} - -void av_md5_init(AVMD5 *ctx){ - ctx->len = 0; - ctx->b_used = 0; - - ctx->ABCD[0] = 0x10325476; - ctx->ABCD[1] = 0x98badcfe; - ctx->ABCD[2] = 0xefcdab89; - ctx->ABCD[3] = 0x67452301; -} - -void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){ - int i; - - ctx->len += len; - - for( i = 0; i < len; i++ ){ - ctx->block[ ctx->b_used++ ] = src[i]; - if( 64 == ctx->b_used ){ - body(ctx->ABCD, (uint32_t*) ctx->block); - ctx->b_used = 0; - } - } -} - -void av_md5_final(AVMD5 *ctx, uint8_t *dst){ - int i; - - ctx->block[ctx->b_used++] = 0x80; - - memset(&ctx->block[ctx->b_used], 0, 64 - ctx->b_used); - - if( 56 < ctx->b_used ){ - body( ctx->ABCD, (uint32_t*) ctx->block ); - memset(ctx->block, 0, 64); - } - - for(i=0; i<8; i++) - ctx->block[56+i] = (ctx->len << 3) >> (i<<3); - - body(ctx->ABCD, (uint32_t*) ctx->block); - - for(i=0; i<4; i++) - ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]); -} - -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){ - AVMD5 ctx[1]; - - av_md5_init(ctx); - av_md5_update(ctx, src, len); - av_md5_final(ctx, dst); -} - -#ifdef TEST -#include <stdio.h> -main(){ - uint64_t md5val; - int i; - uint8_t in[1000]; - - for(i=0; i<1000; i++) in[i]= i*i; - av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%lld\n", md5val); - for(i=0; i<1000; i++) in[i]= i % 127; - av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%lld\n", md5val); -} -#endif diff --git a/src/libffmpeg/libavutil/md5.h b/src/libffmpeg/libavutil/md5.h deleted file mode 100644 index c8144b4cc..000000000 --- a/src/libffmpeg/libavutil/md5.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MD5_H -#define MD5_H - -extern const int av_md5_size; - -struct AVMD5; - -void av_md5_init(struct AVMD5 *ctx); -void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); -void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); - -#endif /* MD5_H */ - diff --git a/src/libffmpeg/libavutil/rational.c b/src/libffmpeg/libavutil/rational.c deleted file mode 100644 index 4a7b0edf7..000000000 --- a/src/libffmpeg/libavutil/rational.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file rational.c - * Rational numbers - * @author Michael Niedermayer <michaelni@gmx.at> - */ - -//#include <math.h> -#include <limits.h> - -#include "common.h" -#include "mathematics.h" -#include "rational.h" - -int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max){ - AVRational a0={0,1}, a1={1,0}; - int sign= (nom<0) ^ (den<0); - int64_t gcd= ff_gcd(ABS(nom), ABS(den)); - - nom = ABS(nom)/gcd; - den = ABS(den)/gcd; - if(nom<=max && den<=max){ - a1= (AVRational){nom, den}; - den=0; - } - - while(den){ - int64_t x = nom / den; - int64_t next_den= nom - den*x; - int64_t a2n= x*a1.num + a0.num; - int64_t a2d= x*a1.den + a0.den; - - if(a2n > max || a2d > max) break; - - a0= a1; - a1= (AVRational){a2n, a2d}; - nom= den; - den= next_den; - } - assert(ff_gcd(a1.num, a1.den) == 1); - - *dst_nom = sign ? -a1.num : a1.num; - *dst_den = a1.den; - - return den==0; -} - -/** - * returns b*c. - */ -AVRational av_mul_q(AVRational b, AVRational c){ - av_reduce(&b.num, &b.den, b.num * (int64_t)c.num, b.den * (int64_t)c.den, INT_MAX); - return b; -} - -/** - * returns b/c. - */ -AVRational av_div_q(AVRational b, AVRational c){ - return av_mul_q(b, (AVRational){c.den, c.num}); -} - -/** - * returns b+c. - */ -AVRational av_add_q(AVRational b, AVRational c){ - av_reduce(&b.num, &b.den, b.num * (int64_t)c.den + c.num * (int64_t)b.den, b.den * (int64_t)c.den, INT_MAX); - return b; -} - -/** - * returns b-c. - */ -AVRational av_sub_q(AVRational b, AVRational c){ - return av_add_q(b, (AVRational){-c.num, c.den}); -} - -/** - * Converts a double precission floating point number to a AVRational. - * @param max the maximum allowed numerator and denominator - */ -AVRational av_d2q(double d, int max){ - AVRational a; -#define LOG2 0.69314718055994530941723212145817656807550013436025 - int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); - int64_t den= 1LL << (61 - exponent); - av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max); - - return a; -} diff --git a/src/libffmpeg/libavutil/rational.h b/src/libffmpeg/libavutil/rational.h deleted file mode 100644 index 0fbe0d29d..000000000 --- a/src/libffmpeg/libavutil/rational.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/** - * @file rational.h - * Rational numbers. - * @author Michael Niedermayer <michaelni@gmx.at> - */ - -#ifndef RATIONAL_H -#define RATIONAL_H - -/** - * Rational number num/den. - */ -typedef struct AVRational{ - int num; ///< numerator - int den; ///< denominator -} AVRational; - -/** - * returns 0 if a==b, 1 if a>b and -1 if a<b. - */ -static inline int av_cmp_q(AVRational a, AVRational b){ - const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; - - if(tmp) return (tmp>>63)|1; - else return 0; -} - -/** - * converts the given AVRational to a double. - */ -static inline double av_q2d(AVRational a){ - return a.num / (double) a.den; -} - -/** - * reduce a fraction. - * this is usefull for framerate calculations - * @param max the maximum allowed for dst_nom & dst_den - * @return 1 if exact, 0 otherwise - */ -int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max); - -AVRational av_mul_q(AVRational b, AVRational c); -AVRational av_div_q(AVRational b, AVRational c); -AVRational av_add_q(AVRational b, AVRational c); -AVRational av_sub_q(AVRational b, AVRational c); -AVRational av_d2q(double d, int max); - -#endif // RATIONAL_H diff --git a/src/libffmpeg/libavutil/x86_cpu.h b/src/libffmpeg/libavutil/x86_cpu.h deleted file mode 100644 index 8fd5f8600..000000000 --- a/src/libffmpeg/libavutil/x86_cpu.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef AVUTIL_X86CPU_H -#define AVUTIL_X86CPU_H - -#ifdef ARCH_X86_64 -# define REG_a "rax" -# define REG_b "rbx" -# define REG_c "rcx" -# define REG_d "rdx" -# define REG_D "rdi" -# define REG_S "rsi" -# define PTR_SIZE "8" - -# define REG_SP "rsp" -# define REG_BP "rbp" -# define REGBP rbp -# define REGa rax -# define REGb rbx -# define REGSP rsp - -#else - -# define REG_a "eax" -# define REG_b "ebx" -# define REG_c "ecx" -# define REG_d "edx" -# define REG_D "edi" -# define REG_S "esi" -# define PTR_SIZE "4" - -# define REG_SP "esp" -# define REG_BP "ebp" -# define REGBP ebp -# define REGa eax -# define REGb ebx -# define REGSP esp -#endif - -#endif /* AVUTIL_X86CPU_H */ |