diff options
Diffstat (limited to 'src/libffmpeg/libavutil')
25 files changed, 0 insertions, 2867 deletions
diff --git a/src/libffmpeg/libavutil/Makefile.am b/src/libffmpeg/libavutil/Makefile.am deleted file mode 100644 index 6010a8134..000000000 --- a/src/libffmpeg/libavutil/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CPPFLAGS = $(LIBFFMPEG_CPPFLAGS) -I$(top_srcdir)/src/libffmpeg \ - -I$(top_builddir)/src/libffmpeg -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 \ - mem.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 \ - intreadwrite.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 50d57470b..000000000 --- a/src/libffmpeg/libavutil/adler32.c +++ /dev/null @@ -1,71 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * This is a modified version based on adler32.c from the zlib library. - * - * Copyright (C) 1995 Mark Adler - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - * - */ - -#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 f56d416fb..000000000 --- a/src/libffmpeg/libavutil/adler32.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * copyright (c) 2006 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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 d5a4570dc..000000000 --- a/src/libffmpeg/libavutil/avutil.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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)+(2<<8)+0) -#define LIBAVUTIL_VERSION 49.2.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_RGB32 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_RGB32 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, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) - PIX_FMT_YUYV422, ///< Packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr - PIX_FMT_RGB24, ///< Packed RGB 8:8:8, 24bpp, RGBRGB... - PIX_FMT_BGR24, ///< Packed RGB 8:8:8, 24bpp, BGRBGR... - PIX_FMT_YUV422P, ///< Planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) - PIX_FMT_YUV444P, ///< Planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) - PIX_FMT_RGB32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in cpu endianness - PIX_FMT_YUV410P, ///< Planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) - PIX_FMT_YUV411P, ///< Planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) - PIX_FMT_RGB565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in cpu endianness - PIX_FMT_RGB555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in cpu endianness most significant bit to 0 - PIX_FMT_GRAY8, ///< Y , 8bpp - PIX_FMT_MONOWHITE, ///< Y , 1bpp, 1 is white - PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black - PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette - PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0, 12bpp, full scale (jpeg) - PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2, 16bpp, full scale (jpeg) - PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4, 24bpp, 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 YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 - PIX_FMT_UYYVYY411, ///< Packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 - PIX_FMT_BGR32, ///< Packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in cpu endianness - PIX_FMT_BGR565, ///< Packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in cpu endianness - PIX_FMT_BGR555, ///< Packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in cpu endianness most significant bit to 1 - PIX_FMT_BGR8, ///< Packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) - PIX_FMT_BGR4, ///< Packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_BGR4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) - PIX_FMT_RGB8, ///< Packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4, ///< Packed RGB 1:2:1, 4bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_RGB4_BYTE, ///< Packed RGB 1:2:1, 8bpp, (msb)2R 3G 3B(lsb) - PIX_FMT_NV12, ///< Planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV - PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - - PIX_FMT_RGB32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in cpu endianness - PIX_FMT_BGR32_1, ///< Packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in cpu endianness - - PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian - PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian - PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions -}; - -#ifdef WORDS_BIGENDIAN -#define PIX_FMT_RGBA PIX_FMT_RGB32_1 -#define PIX_FMT_BGRA PIX_FMT_BGR32_1 -#define PIX_FMT_ARGB PIX_FMT_RGB32 -#define PIX_FMT_ABGR PIX_FMT_BGR32 -#define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE -#else -#define PIX_FMT_RGBA PIX_FMT_BGR32 -#define PIX_FMT_BGRA PIX_FMT_RGB32 -#define PIX_FMT_ARGB PIX_FMT_BGR32_1 -#define PIX_FMT_ABGR PIX_FMT_RGB32_1 -#define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE -#endif - -#if LIBAVUTIL_VERSION_INT < (50<<16) -#define PIX_FMT_UYVY411 PIX_FMT_UYYVYY411 -#define PIX_FMT_RGBA32 PIX_FMT_RGB32 -#define PIX_FMT_YUV422 PIX_FMT_YUYV422 -#endif - -#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 03d613db2..000000000 --- a/src/libffmpeg/libavutil/bswap.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @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) -static av_always_inline uint16_t bswap_16(uint16_t x) -{ - __asm("rorw $8, %0" : - LEGACY_REGS (x) : - "0" (x)); - return x; -} - -static av_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 av_always_inline uint16_t bswap_16(uint16_t x) { - __asm__("swap.b %0,%0":"=r"(x):"0"(x)); - return x; -} - -static av_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 av_always_inline uint16_t bswap_16(uint16_t x){ - return (x>>8) | (x<<8); -} - -#ifdef ARCH_ARM -static av_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 av_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 /* defined(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 0d4346048..000000000 --- a/src/libffmpeg/libavutil/common.h +++ /dev/null @@ -1,364 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file common.h - * common internal and external api header. - */ - -#ifndef COMMON_H -#define COMMON_H - -#include <inttypes.h> - -#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 */ - -#ifndef av_always_inline -#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) -# define av_always_inline __attribute__((always_inline)) inline -#else -# define av_always_inline inline -#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) -# define attribute_deprecated __attribute__((deprecated)) -#else -# define attribute_deprecated -#endif -#endif - -#ifndef INT64_C -#define INT64_C(c) (c ## LL) -#define UINT64_C(c) (c ## ULL) -#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 FFABS(a) ((a) >= 0 ? (a) : (-(a))) -#define FFSIGN(a) ((a) > 0 ? 1 : -1) - -#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) - -#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) - -/* misc math functions */ -extern 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) -{ -#ifdef HAVE_CMOV - int i=b; - asm volatile( - "cmp %2, %1 \n\t" - "cmovg %1, %0 \n\t" - "cmovg %2, %1 \n\t" - "cmp %3, %1 \n\t" - "cmovl %3, %1 \n\t" - "cmp %1, %0 \n\t" - "cmovg %1, %0 \n\t" - :"+&r"(i), "+&r"(a) - :"r"(b), "r"(c) - ); - return i; -#elif 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 clipped 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 clipped 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)) - -/*! - * \def GET_UTF8(val, GET_BYTE, ERROR) - * converts a utf-8 character (up to 4 bytes long) to its 32-bit ucs-4 encoded form - * \param val is the output and should be of type uint32_t. It holds the converted - * ucs-4 character and should be a left value. - * \param GET_BYTE gets utf-8 encoded bytes from any proper source. It can be - * a function or a statement whose return value or evaluated value is of type - * uint8_t. It will be executed up to 4 times for values in the valid utf-8 range, - * and up to 7 times in the general case. - * \param ERROR action that should be taken when an invalid utf-8 byte is returned - * from GET_BYTE. It should be a statement that jumps out of the macro, - * like exit(), goto, return, break, or continue. - */ -#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;\ - }\ - } - -/*! - * \def PUT_UTF8(val, tmp, PUT_BYTE) - * converts a 32-bit unicode character to its utf-8 encoded form (up to 4 bytes long). - * \param val is an input only argument and should be of type uint32_t. It holds - * a ucs4 encoded unicode character that is to be converted to utf-8. If - * val is given as a function it's executed only once. - * \param tmp is a temporary variable and should be of type uint8_t. It - * represents an intermediate value during conversion that is to be - * outputted by PUT_BYTE. - * \param PUT_BYTE writes the converted utf-8 bytes to any proper destination. - * It could be a function or a statement, and uses tmp as the input byte. - * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be - * executed up to 4 times for values in the valid utf-8 range and up to - * 7 times in the general case, depending on the length of the converted - * unicode character. - */ -#define PUT_UTF8(val, tmp, PUT_BYTE)\ - {\ - int bytes, shift;\ - uint32_t in = val;\ - if (in < 0x80) {\ - tmp = in;\ - PUT_BYTE\ - } else {\ - bytes = (av_log2(in) + 4) / 5;\ - shift = (bytes - 1) * 6;\ - tmp = (256 - (256 >> bytes)) | (in >> shift);\ - PUT_BYTE\ - while (shift >= 6) {\ - shift -= 6;\ - tmp = 0x80 | ((in >> shift) & 0x3f);\ - PUT_BYTE\ - }\ - }\ - } - -#if defined(ARCH_X86) || 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_32) -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(((tcount+tskip_count)&(tcount+tskip_count-1))==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 */ - -#ifdef __GNUC__ - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) -#else - #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v -#endif - -/* memory */ -void *av_malloc(unsigned int size); -void *av_realloc(void *ptr, unsigned int size); -void av_free(void *ptr); - -void *av_mallocz(unsigned int size); -char *av_strdup(const char *s); -void av_freep(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 - -/* xine: another config.h with codecs to use */ -#include "ffmpeg_config.h" - -#endif /* COMMON_H */ - diff --git a/src/libffmpeg/libavutil/crc.c b/src/libffmpeg/libavutil/crc.c deleted file mode 100644 index baa605d32..000000000 --- a/src/libffmpeg/libavutil/crc.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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 e739c309b..000000000 --- a/src/libffmpeg/libavutil/crc.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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 5c7b71530..000000000 --- a/src/libffmpeg/libavutil/integer.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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 a50ad9bae..000000000 --- a/src/libffmpeg/libavutil/integer.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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 0c4b44170..000000000 --- a/src/libffmpeg/libavutil/internal.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file internal.h - * common internal api header. - */ - -#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 - -#ifndef ENODATA -# define ENODATA 61 -#endif - -#include "intreadwrite.h" -#include "bswap.h" - -#include <stddef.h> -#ifndef offsetof -# define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F)) -#endif - -#ifdef __MINGW32__ -# ifdef _DEBUG -# define DEBUG -# endif - -# define snprintf _snprintf -# define vsnprintf _vsnprintf - -# ifdef CONFIG_WINCE -# define perror(a) -# define abort() -# endif - -/* __MINGW32__ end */ -#elif defined (CONFIG_OS2) -/* OS/2 EMX */ - -# include <float.h> - -#endif /* !__MINGW32__ && CONFIG_OS2 */ - -#ifdef USE_FASTMEMCPY -# include "libvo/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 - -#define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) - -/* math */ - -extern const uint32_t ff_inverse[256]; - -#if defined(ARCH_X86) -# define FASTDIV(a,b) \ - ({\ - int ret,dmy;\ - asm volatile(\ - "mull %3"\ - :"=d"(ret),"=a"(dmy)\ - :"1"(a),"g"(ff_inverse[b])\ - );\ - ret;\ - }) -#elif defined(ARCH_ARMV4L) -# define FASTDIV(a,b) \ - ({\ - int ret,dmy;\ - asm volatile(\ - "umull %1, %0, %2, %3"\ - :"=&r"(ret),"=&r"(dmy)\ - :"r"(a),"r"(ff_inverse[b])\ - );\ - ret;\ - }) -#elif defined(CONFIG_FASTDIV) -# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*ff_inverse[b])>>32)) -#else -# define FASTDIV(a,b) ((a)/(b)) -#endif - -extern 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) -#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 - -#ifdef HAVE_CMOV -#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 av_always_inline long int lrintf(float x) -{ -#ifdef __MINGW32__ -# ifdef ARCH_X86_32 - 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_32 */ -#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 c535b64c8..000000000 --- a/src/libffmpeg/libavutil/intfloat_readwrite.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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/intreadwrite.h b/src/libffmpeg/libavutil/intreadwrite.h deleted file mode 100644 index e6db5ce6f..000000000 --- a/src/libffmpeg/libavutil/intreadwrite.h +++ /dev/null @@ -1,65 +0,0 @@ -#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 */ -#define AV_RB8(x) (((uint8_t*)(x))[0]) -#define AV_WB8(p, i, d) { ((uint8_t*)(p))[(i)] = (d); } - -#define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define AV_WB16(p, i, d) { \ - ((uint8_t*)(p))[(i)+1] = (d); \ - ((uint8_t*)(p))[(i)] = (d)>>8; } - -#define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) -#define AV_WB32(p, i, d) { \ - ((uint8_t*)(p))[(i)+3] = (d); \ - ((uint8_t*)(p))[(i)+2] = (d)>>8; \ - ((uint8_t*)(p))[(i)+1] = (d)>>16; \ - ((uint8_t*)(p))[(i)] = (d)>>24; } - -#define AV_RL8(x) AV_RB8(x) -#define AV_WL8(p, i, d) AV_WB8(p, i, d) - -#define AV_RL16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define AV_WL16(p, i, d) { \ - ((uint8_t*)(p))[(i)] = (d); \ - ((uint8_t*)(p))[(i)+1] = (d)>>8; } - -#define AV_RL32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) -#define AV_WL32(p, i, d) { \ - ((uint8_t*)(p))[(i)] = (d); \ - ((uint8_t*)(p))[(i)+1] = (d)>>8; \ - ((uint8_t*)(p))[(i)+2] = (d)>>16; \ - ((uint8_t*)(p))[(i)+3] = (d)>>24; } - -#endif /* INTREADWRITE_H */ diff --git a/src/libffmpeg/libavutil/lls.c b/src/libffmpeg/libavutil/lls.c deleted file mode 100644 index aa9467dce..000000000 --- a/src/libffmpeg/libavutil/lls.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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 59ad2e958..000000000 --- a/src/libffmpeg/libavutil/lls.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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 4fd503d0d..000000000 --- a/src/libffmpeg/libavutil/log.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * log functions - * Copyright (c) 2003 Michel Bardiaux - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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; - -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 56ca01289..000000000 --- a/src/libffmpeg/libavutil/log.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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 */ - const struct AVOption *option; -}; - -/* av_log API */ - -#if LIBAVUTIL_VERSION_INT < (50<<16) -#define AV_LOG_QUIET -1 -#define AV_LOG_FATAL 0 -#define AV_LOG_ERROR 0 -#define AV_LOG_WARNING 1 -#define AV_LOG_INFO 1 -#define AV_LOG_VERBOSE 1 -#define AV_LOG_DEBUG 2 -#else -#define AV_LOG_QUIET -8 - -/** - * something went really wrong and we will crash now - */ -#define AV_LOG_PANIC 0 - -/** - * something went wrong and recovery is not possible - * like no header in a format which depends on it or a combination - * of parameters which are not allowed - */ -#define AV_LOG_FATAL 8 - -/** - * something went wrong and cannot losslessly be recovered - * but not all future data is affected - */ -#define AV_LOG_ERROR 16 - -/** - * something somehow does not look correct / something which may or may not - * lead to some problems like use of -vstrict -2 - */ -#define AV_LOG_WARNING 24 - -#define AV_LOG_INFO 32 -#define AV_LOG_VERBOSE 40 - -/** - * stuff which is only useful for libav* developers - */ -#define AV_LOG_DEBUG 48 -#endif -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)); -extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); -#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 4be027d9d..000000000 --- a/src/libffmpeg/libavutil/mathematics.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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("%"PRId64"*%"PRId64"/%"PRId64"= %"PRId64"=%"PRId64"\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 0b74b254b..000000000 --- a/src/libffmpeg/libavutil/mathematics.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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 d33ad1483..000000000 --- a/src/libffmpeg/libavutil/md5.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2006 Michael Niedermayer (michaelni@gmx.at) - * Copyright (C) 2003-2005 by Christopher R. Hertel (crh@ubiqx.mn.org) - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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("%"PRId64"\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%"PRId64"\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%"PRId64"\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%"PRId64"\n", md5val); - for(i=0; i<1000; i++) in[i]= i % 127; - av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%"PRId64"\n", md5val); -} -#endif diff --git a/src/libffmpeg/libavutil/md5.h b/src/libffmpeg/libavutil/md5.h deleted file mode 100644 index 8d1b4b5fe..000000000 --- a/src/libffmpeg/libavutil/md5.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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/mem.c b/src/libffmpeg/libavutil/mem.c deleted file mode 100644 index f43fb5420..000000000 --- a/src/libffmpeg/libavutil/mem.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * default memory allocator for libavutil - * Copyright (c) 2002 Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file mem.c - * default memory allocator for libavutil. - */ - -#include "common.h" - -/* here we can use OS dependant allocation functions */ -#undef malloc -#undef free -#undef realloc - -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - -/* you can redefine av_malloc and av_free in your project to use your - memory allocator. You do not need to suppress this file because the - linker will do it automatically */ - -/** - * Memory allocation of size byte with alignment suitable for all - * memory accesses (including vectors if available on the - * CPU). av_malloc(0) must return a non NULL pointer. - */ -void *av_malloc(unsigned int size) -{ - void *ptr; -#ifdef CONFIG_MEMALIGN_HACK - long diff; -#endif - - /* let's disallow possible ambiguous cases */ - if(size > (INT_MAX-16) ) - return NULL; - -#ifdef CONFIG_MEMALIGN_HACK - ptr = malloc(size+16); - if(!ptr) - return ptr; - diff= ((-(long)ptr - 1)&15) + 1; - ptr += diff; - ((char*)ptr)[-1]= diff; -#elif defined (HAVE_MEMALIGN) - ptr = memalign(16,size); - /* Why 64? - Indeed, we should align it: - on 4 for 386 - on 16 for 486 - on 32 for 586, PPro - k6-III - on 64 for K7 (maybe for P3 too). - Because L1 and L2 caches are aligned on those values. - But I don't want to code such logic here! - */ - /* Why 16? - because some cpus need alignment, for example SSE2 on P4, & most RISC cpus - it will just trigger an exception and the unaligned load will be done in the - exception handler or it will just segfault (SSE2 on P4) - Why not larger? because i didnt see a difference in benchmarks ... - */ - /* benchmarks with p3 - memalign(64)+1 3071,3051,3032 - memalign(64)+2 3051,3032,3041 - memalign(64)+4 2911,2896,2915 - memalign(64)+8 2545,2554,2550 - memalign(64)+16 2543,2572,2563 - memalign(64)+32 2546,2545,2571 - memalign(64)+64 2570,2533,2558 - - btw, malloc seems to do 8 byte alignment by default here - */ -#else - ptr = malloc(size); -#endif - return ptr; -} - -/** - * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, - * identical to malloc(size). If size is zero, it is identical to - * free(ptr) and NULL is returned. - */ -void *av_realloc(void *ptr, unsigned int size) -{ -#ifdef CONFIG_MEMALIGN_HACK - int diff; -#endif - - /* let's disallow possible ambiguous cases */ - if(size > (INT_MAX-16) ) - return NULL; - -#ifdef CONFIG_MEMALIGN_HACK - //FIXME this isn't aligned correctly, though it probably isn't needed - if(!ptr) return av_malloc(size); - diff= ((char*)ptr)[-1]; - return realloc(ptr - diff, size + diff) + diff; -#else - return realloc(ptr, size); -#endif -} - -/** - * Free memory which has been allocated with av_malloc(z)() or av_realloc(). - * NOTE: ptr = NULL is explicetly allowed - * Note2: it is recommended that you use av_freep() instead - */ -void av_free(void *ptr) -{ - /* XXX: this test should not be needed on most libcs */ - if (ptr) -#ifdef CONFIG_MEMALIGN_HACK - free(ptr - ((char*)ptr)[-1]); -#else - free(ptr); -#endif -} - -/** - * Frees memory and sets the pointer to NULL. - * @param arg pointer to the pointer which should be freed - */ -void av_freep(void *arg) -{ - void **ptr= (void**)arg; - av_free(*ptr); - *ptr = NULL; -} - -void *av_mallocz(unsigned int size) -{ - void *ptr; - - ptr = av_malloc(size); - if (ptr) - memset(ptr, 0, size); - return ptr; -} - -char *av_strdup(const char *s) -{ - char *ptr; - int len; - len = strlen(s) + 1; - ptr = av_malloc(len); - if (ptr) - memcpy(ptr, s, len); - return ptr; -} - diff --git a/src/libffmpeg/libavutil/rational.c b/src/libffmpeg/libavutil/rational.c deleted file mode 100644 index 0480aa882..000000000 --- a/src/libffmpeg/libavutil/rational.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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(FFABS(nom), FFABS(den)); - - if(gcd){ - nom = FFABS(nom)/gcd; - den = FFABS(den)/gcd; - } - if(nom<=max && den<=max){ - a1= (AVRational){nom, den}; - den=0; - } - - while(den){ - uint64_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){ - if(a1.num) x= (max - a0.num) / a1.num; - if(a1.den) x= FFMIN(x, (max - a0.den) / a1.den); - - if (den*(2*x*a1.den + a0.den) > nom*a1.den) - a1 = (AVRational){x*a1.num + a0.num, x*a1.den + a0.den}; - break; - } - - a0= a1; - a1= (AVRational){a2n, a2d}; - nom= den; - den= next_den; - } - assert(ff_gcd(a1.num, a1.den) <= 1U); - - *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 43fc22114..000000000 --- a/src/libffmpeg/libavutil/rational.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Rational numbers - * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; 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 3d54b2a60..000000000 --- a/src/libffmpeg/libavutil/x86_cpu.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg 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.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#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 REGc rcx -# 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 REGc ecx -# define REGSP esp -#endif - -#endif /* AVUTIL_X86CPU_H */ |