Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg')
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h76
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h83
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/char_t.h340
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/config.h15
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h549
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h389
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c6
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.h1
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c6
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h1
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h29
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c1
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c4
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c75
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h22
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c18
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c7
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h8
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c1
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c8
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c16
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8.c173
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/config.asm3
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c2
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h38
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_chromamc.asm6
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred.asm1720
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred_init.c78
-rw-r--r--src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h17
31 files changed, 3050 insertions, 647 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h b/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h
index 5e116d904..007084e96 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/PODtypes.h
@@ -1,32 +1,70 @@
#ifndef _PODTYPES_H_
#define _PODTYPES_H_
-template<class T> struct isPOD {enum {is=false};};
-template<> struct isPOD<bool> {enum {is=true};};
+template<class T> struct isPOD {
+ enum {is=false};
+};
+template<> struct isPOD<bool> {
+ enum {is=true};
+};
-template<> struct isPOD<char> {enum {is=true};};
+template<> struct isPOD<char> {
+ enum {is=true};
+};
-template<> struct isPOD<signed char> {enum {is=true};};
-template<> struct isPOD<short int> {enum {is=true};};
-template<> struct isPOD<int> {enum {is=true};};
-template<> struct isPOD<long int> {enum {is=true};};
-template<> struct isPOD<__int64> {enum {is=true};};
+template<> struct isPOD<signed char> {
+ enum {is=true};
+};
+template<> struct isPOD<short int> {
+ enum {is=true};
+};
+template<> struct isPOD<int> {
+ enum {is=true};
+};
+template<> struct isPOD<long int> {
+ enum {is=true};
+};
+template<> struct isPOD<__int64> {
+ enum {is=true};
+};
-template<> struct isPOD<unsigned char> {enum {is=true};};
-template<> struct isPOD<unsigned short int> {enum {is=true};};
-template<> struct isPOD<unsigned int> {enum {is=true};};
-template<> struct isPOD<unsigned long int> {enum {is=true};};
-template<> struct isPOD<unsigned __int64> {enum {is=true};};
+template<> struct isPOD<unsigned char> {
+ enum {is=true};
+};
+template<> struct isPOD<unsigned short int> {
+ enum {is=true};
+};
+template<> struct isPOD<unsigned int> {
+ enum {is=true};
+};
+template<> struct isPOD<unsigned long int> {
+ enum {is=true};
+};
+template<> struct isPOD<unsigned __int64> {
+ enum {is=true};
+};
-template<> struct isPOD<float> {enum {is=true};};
-template<> struct isPOD<double> {enum {is=true};};
-template<> struct isPOD<long double> {enum {is=true};};
+template<> struct isPOD<float> {
+ enum {is=true};
+};
+template<> struct isPOD<double> {
+ enum {is=true};
+};
+template<> struct isPOD<long double> {
+ enum {is=true};
+};
#if defined(__INTEL_COMPILER) || defined(__GNUC__) || (_MSC_VER>=1300)
-template<> struct isPOD<wchar_t> {enum {is=true};};
-template<class Tp> struct isPOD<Tp*> {enum {is=true};};
+template<> struct isPOD<wchar_t> {
+ enum {is=true};
+};
+template<class Tp> struct isPOD<Tp*> {
+ enum {is=true};
+};
#endif
-template<class A> struct allocator_traits {enum {is_static=false};};
+template<class A> struct allocator_traits {
+ enum {is_static=false};
+};
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h b/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h
index a22137d23..dd57c2294 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/array_allocator.h
@@ -4,47 +4,60 @@
template <class T,size_t size> class array_allocator
{
private:
- T array[size];
+ T* p;
public:
- typedef T value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- typedef T* pointer;
- typedef const T* const_pointer;
-
- typedef T& reference;
- typedef const T& const_reference;
-
- pointer address(reference r) const { return &r; }
- const_pointer address(const_reference r) const { return &r; }
-
- array_allocator() throw(){}
- template <class U,size_t sz> array_allocator(const array_allocator<U,sz>& ) throw() {}
- ~array_allocator() throw(){}
-
- pointer allocate(size_type n, const void* = 0)
- {
- return array;
- }
- void deallocate(pointer p, size_type)
- {
- }
-
- //Use placement new to engage the constructor
- void construct(pointer p, const T& val) { new((void*)p) T(val); }
- void destroy(pointer p){ ((T*)p)->~T(); }
-
- size_type max_size() const throw() {return size;}
- template<class U> struct rebind { typedef array_allocator<U,size> other; };
+ typedef T value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ typedef T* pointer;
+ typedef const T* const_pointer;
+
+ typedef T& reference;
+ typedef const T& const_reference;
+
+ pointer address(reference r) const {
+ return &r;
+ }
+ const_pointer address(const_reference r) const {
+ return &r;
+ }
+
+ array_allocator() throw() {}
+ template <class U,size_t sz> array_allocator(const array_allocator<U,sz>& ) throw() {}
+ ~array_allocator() throw() {}
+
+ pointer allocate(size_type n, const void* = 0) {
+ p = ((T *)::operator new(size * sizeof (T)));
+ return p;
+ }
+ void deallocate(pointer p, size_type) {
+ delete p;
+ }
+
+ //Use placement new to engage the constructor
+ void construct(pointer p, const T& val) {
+ new((void*)p) T(val);
+ }
+ void destroy(pointer p) {
+ ((T*)p)->~T();
+ }
+
+ size_type max_size() const throw() {
+ return size;
+ }
+ template<class U> struct rebind {
+ typedef array_allocator<U,size> other;
+ };
};
-template<class T,size_t size> struct array_vector : std::vector<T, array_allocator<T,size> >
-{
+template<class T,size_t size> struct array_vector : std::vector<T, array_allocator<T,size> > {
};
#if defined(__INTEL_COMPILER) || defined(__GNUC__) || (_MSC_VER>=1300)
- template<class T,size_t a> struct allocator_traits<array_allocator<T,a> > {enum {is_static=true};};
+template<class T,size_t a> struct allocator_traits<array_allocator<T,a> > {
+ enum {is_static=true};
+};
#endif
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h b/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h
index e25cb5dc5..4eacf8114 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/char_t.h
@@ -7,152 +7,274 @@
#undef _l
#ifdef UNICODE
- typedef wchar_t char_t;
- #define tsprintf swprintf
- #define tsnprintf _snwprintf
- #define tfprintf fwprintf
- #define tsscanf swscanf
- #define __l(x) L ## x
- #define _l(x) __l(x)
+typedef wchar_t char_t;
+#define tsprintf swprintf
+#define tsnprintf_s _snwprintf_s
+#define tfprintf fwprintf
+#define tsscanf swscanf
+#define __l(x) L ## x
+#define _l(x) __l(x)
#else
- typedef char char_t;
- #define tsprintf sprintf
- #define tsnprintf _snprintf
- #define tfprintf fprintf
- #define tsscanf sscanf
- #define _l(x) x
+typedef char char_t;
+#define tsprintf sprintf
+#define tsnprintf_s _snprintf_s
+#define tfprintf fprintf
+#define tsscanf sscanf
+#define _l(x) x
#endif
#ifdef __cplusplus
#ifdef __GNUC__
- #ifndef __forceinline
- #define __forceinline __attribute__((__always_inline__)) inline
- #endif
+#ifndef __forceinline
+#define __forceinline __attribute__((__always_inline__)) inline
#endif
+#endif
+
+static __forceinline errno_t strncat_s(wchar_t *a, size_t b, const wchar_t *c, size_t d)
+{
+ return wcsncat_s(a,b,c,d);
+}
+static __forceinline int vsnprintf_s(wchar_t *a, size_t b, size_t c, const wchar_t *d, va_list e)
+{
+ return _vsnwprintf_s(a,b,c,d,e);
+}
+static __forceinline errno_t _splitpath_s(const wchar_t * a,
+ wchar_t * b, size_t c, wchar_t * d, size_t e,
+ wchar_t * f, size_t g, wchar_t * h, size_t i)
+{
+ return _wsplitpath_s(a,b,c,d,e,f,g,h,i);
+};
+static __forceinline errno_t _makepath_s(wchar_t *a, size_t b,
+ const wchar_t *c, const wchar_t *d,
+ const wchar_t *e, const wchar_t *f)
+{
+ return _wmakepath_s(a,b,c,d,e,f);
+};
+static __forceinline wchar_t* ff_strncpy(wchar_t *dst, const wchar_t *src, size_t count)
+{
+ wcsncpy_s(dst, count, src, _TRUNCATE);
+ return dst;
+}
+static __forceinline char* ff_strncpy(char *dst, const char *src, size_t count)
+{
+ strncpy_s(dst, count, src, _TRUNCATE);
+ return dst;
+}
+
+static __forceinline wchar_t* strcat(wchar_t *a, const wchar_t *b)
+{
+ return wcscat(a,b);
+}
+static __forceinline int strcmp(const wchar_t *a, const wchar_t *b)
+{
+ return wcscmp(a,b);
+}
+static __forceinline int strncmp(const wchar_t *a, const wchar_t *b, size_t c)
+{
+ return wcsncmp(a,b,c);
+}
+static __forceinline int strnicmp(const wchar_t *a, const wchar_t *b,size_t c)
+{
+ return _wcsnicmp(a,b,c);
+}
+
+static __forceinline long strtol(const wchar_t *a, wchar_t **b, int c)
+{
+ return wcstol(a,b,c);
+}
+static __forceinline wchar_t* strchr(const wchar_t *a, wchar_t b)
+{
+ return (wchar_t*)wcschr(a,b);
+}
+static __forceinline int _strnicmp(const wchar_t *a, const wchar_t *b, size_t c)
+{
+ return _wcsnicmp(a,b,c);
+}
+static __forceinline wchar_t* strstr(const wchar_t *a, const wchar_t *b)
+{
+ return (wchar_t*)wcsstr(a,b);
+}
+static __forceinline size_t strlen(const wchar_t *a)
+{
+ return wcslen(a);
+}
+static __forceinline wchar_t* strcpy(wchar_t *a, const wchar_t *b)
+{
+ return wcscpy(a,b);
+}
+static __forceinline int atoi(const wchar_t *a)
+{
+ return _wtoi(a);
+}
+static __forceinline wchar_t* _itoa(int a, wchar_t *b, int c)
+{
+ return _itow(a,b,c);
+}
+static __forceinline int stricmp(const wchar_t *a, const wchar_t *b)
+{
+ return _wcsicmp(a,b);
+}
+static __forceinline unsigned long strtoul(const wchar_t *a,wchar_t **b,int c)
+{
+ return wcstoul(a,b,c);
+}
+static __forceinline double strtod(const wchar_t *a, wchar_t **b)
+{
+ return wcstod(a,b);
+}
+static __forceinline int vsprintf(wchar_t *a, const wchar_t *b, va_list c)
+{
+ return vswprintf(a,b,c);
+}
+static __forceinline int _vsnprintf(wchar_t *a, size_t b, const wchar_t *c, va_list d)
+{
+ return _vsnwprintf(a,b,c,d);
+}
-static __forceinline wchar_t* strcat(wchar_t *a, const wchar_t *b) {return wcscat(a,b);}
-static __forceinline wchar_t* strncat(wchar_t *a, const wchar_t *b,size_t c) {return wcsncat(a,b,c);}
-static __forceinline int strcmp(const wchar_t *a, const wchar_t *b) {return wcscmp(a,b);}
-static __forceinline int strncmp(const wchar_t *a, const wchar_t *b, size_t c) {return wcsncmp(a,b,c);}
-static __forceinline int strnicmp(const wchar_t *a, const wchar_t *b,size_t c) {return _wcsnicmp(a,b,c);}
-static __forceinline wchar_t* strncpy(wchar_t *a, const wchar_t *b, size_t c) {return wcsncpy(a,b,c);}
-static __forceinline long strtol(const wchar_t *a, wchar_t **b, int c) {return wcstol(a,b,c);}
-static __forceinline wchar_t* strchr(const wchar_t *a, wchar_t b) {return (wchar_t*)wcschr(a,b);}
-static __forceinline int _strnicmp(const wchar_t *a, const wchar_t *b, size_t c) {return _wcsnicmp(a,b,c);}
-static __forceinline wchar_t* strstr(const wchar_t *a, const wchar_t *b) {return (wchar_t*)wcsstr(a,b);}
-static __forceinline size_t strlen(const wchar_t *a) {return wcslen(a);}
-static __forceinline wchar_t* strcpy(wchar_t *a, const wchar_t *b) {return wcscpy(a,b);}
-static __forceinline int atoi(const wchar_t *a) {return _wtoi(a);}
-static __forceinline wchar_t* _itoa(int a, wchar_t *b, int c) {return _itow(a,b,c);}
-static __forceinline int stricmp(const wchar_t *a, const wchar_t *b) {return _wcsicmp(a,b);}
-static __forceinline unsigned long strtoul(const wchar_t *a,wchar_t **b,int c) {return wcstoul(a,b,c);}
-static __forceinline double strtod(const wchar_t *a, wchar_t **b) {return wcstod(a,b);}
-static __forceinline int vsprintf(wchar_t *a, const wchar_t *b, va_list c) {return vswprintf(a,b,c);}
-static __forceinline int _vsnprintf(wchar_t *a, size_t b, const wchar_t *c, va_list d) {return _vsnwprintf(a,b,c,d);}
-static __forceinline void _splitpath(const wchar_t *a, wchar_t *b, wchar_t *c, wchar_t *d, wchar_t *e) {_wsplitpath(a,b,c,d,e);}
-static __forceinline void _makepath(wchar_t *a, const wchar_t *b, const wchar_t *c, const wchar_t *d,const wchar_t *e) {_wmakepath(a,b,c,d,e);}
-static __forceinline FILE* fopen(const wchar_t *a, const wchar_t *b) {return _wfopen(a,b);}
-static __forceinline int fputs(const wchar_t *a, FILE *b) {return fputws(a,b);}
-static __forceinline int _stricoll(const wchar_t *a, const wchar_t *b) {return _wcsicoll(a,b);}
-static __forceinline wchar_t* strrchr(const wchar_t *a, wchar_t b) {return (wchar_t*)wcsrchr(a,b);}
-static __forceinline wchar_t* strupr(wchar_t *a) {return _wcsupr(a);}
-static __forceinline wchar_t* strlwr(wchar_t *a) {return _wcslwr(a);}
-static __forceinline wchar_t* _strtime(wchar_t *a) {return _wstrtime(a);}
-static __forceinline wchar_t* memchr(wchar_t *a,wchar_t b,size_t c) {return wmemchr(a,b,c);}
-static __forceinline const wchar_t* memchr(const wchar_t *a,wchar_t b,size_t c) {return wmemchr(a,b,c);}
-static __forceinline wchar_t* strpbrk(const wchar_t *a, const wchar_t *b) {return (wchar_t*)wcspbrk(a,b);}
+static __forceinline FILE* fopen(const wchar_t *a, const wchar_t *b)
+{
+ return _wfopen(a,b);
+}
+static __forceinline int fputs(const wchar_t *a, FILE *b)
+{
+ return fputws(a,b);
+}
+static __forceinline int _stricoll(const wchar_t *a, const wchar_t *b)
+{
+ return _wcsicoll(a,b);
+}
+static __forceinline wchar_t* strrchr(const wchar_t *a, wchar_t b)
+{
+ return (wchar_t*)wcsrchr(a,b);
+}
+static __forceinline wchar_t* strupr(wchar_t *a)
+{
+ return _wcsupr(a);
+}
+static __forceinline wchar_t* strlwr(wchar_t *a)
+{
+ return _wcslwr(a);
+}
+static __forceinline wchar_t* _strtime(wchar_t *a)
+{
+ return _wstrtime(a);
+}
+static __forceinline wchar_t* memchr(wchar_t *a,wchar_t b,size_t c)
+{
+ return wmemchr(a,b,c);
+}
+static __forceinline const wchar_t* memchr(const wchar_t *a,wchar_t b,size_t c)
+{
+ return wmemchr(a,b,c);
+}
+static __forceinline wchar_t* strpbrk(const wchar_t *a, const wchar_t *b)
+{
+ return (wchar_t*)wcspbrk(a,b);
+}
template<class Tout> struct text
-// ANSI <--> UNICODE conversion.
-// in : input string in char* or wchar_t*.
-// inlen : count of characters, not byte size!! -1 for null terminated string.
-// out : output string in char* or wchar_t*.
-// outlen : count of characters, not byte size!!
+ // ANSI <--> UNICODE conversion.
+ // in : input string in char* or wchar_t*.
+ // inlen : count of characters, not byte size!! -1 for null terminated string.
+ // out : output string in char* or wchar_t*.
+ // outlen : count of characters, not byte size!!
{
private:
- Tout *buf;
- bool own;
+ Tout *buf;
+ bool own;
public:
- template<class Tin> inline text(const Tin *in);
- template<class Tin> inline text(const Tin *in,Tout *Ibuf);
- template<class Tin> inline text(const Tin *in,int inlen,Tout *Ibuf,size_t outlen);
- ~text() {if (own) delete []buf;}
- operator const Tout*() const {return buf;}
+ template<class Tin> inline text(const Tin *in,int code_page = CP_ACP);
+ template<class Tin> inline text(const Tin *in,Tout *Ibuf,int code_page = CP_ACP);
+ template<class Tin> inline text(const Tin *in,int inlen,Tout *Ibuf,size_t outlen,int code_page = CP_ACP);
+ ~text() {
+ if (own) {
+ delete []buf;
+ }
+ }
+ operator const Tout*() const {
+ return buf;
+ }
};
-template<> template<> inline text<char>::text(const char *in):buf(const_cast<char*>(in)),own(false) {}
-template<> template<> inline text<char>::text(const char *in,char *Ibuf):buf(strcpy(Ibuf,in)),own(false) {}
-template<> template<> inline text<char>::text(const char *in,int inlen,char *Ibuf,size_t outlen):own(false)
+template<> template<> inline text<char>::text(const char *in,int code_page):buf(const_cast<char*>(in)),own(false) {}
+template<> template<> inline text<char>::text(const char *in,char *Ibuf,int code_page):buf(strcpy(Ibuf,in)),own(false) {}
+template<> template<> inline text<char>::text(const char *in,int inlen,char *Ibuf,size_t outlen,int code_page):own(false)
{
- if (inlen!=-1)
- buf=strncpy(Ibuf,in,((size_t)inlen < outlen ? inlen : outlen));
- else
- {
- size_t inlen1=strlen(in)+1;
- buf=strncpy(Ibuf,in,inlen1 < outlen ? inlen1 : outlen);
- }
+ if (inlen!=-1) {
+ buf=Ibuf;
+ if ((size_t)inlen < outlen) {
+ ff_strncpy(Ibuf, in, inlen + 1);
+ } else {
+ ff_strncpy(Ibuf, in, outlen);
+ }
+ } else {
+ buf=Ibuf;
+ ff_strncpy(Ibuf, in, outlen);
+ }
}
-template<> template<> inline text<wchar_t>::text(const wchar_t *in):buf(const_cast<wchar_t*>(in)),own(false) {}
-template<> template<> inline text<wchar_t>::text(const wchar_t *in,wchar_t *Ibuf):buf(strcpy(Ibuf,in)),own(false) {}
-template<> template<> inline text<wchar_t>::text(const wchar_t *in,int inlen,wchar_t *Ibuf,size_t outlen):own(false)
+template<> template<> inline text<wchar_t>::text(const wchar_t *in,int code_page):buf(const_cast<wchar_t*>(in)),own(false) {}
+template<> template<> inline text<wchar_t>::text(const wchar_t *in,wchar_t *Ibuf,int code_page):buf(strcpy(Ibuf,in)),own(false) {}
+template<> template<> inline text<wchar_t>::text(const wchar_t *in,int inlen,wchar_t *Ibuf,size_t outlen,int code_page):own(false)
{
- if (inlen!=-1)
- buf=strncpy(Ibuf,in,((size_t)inlen < outlen ? inlen : outlen));
- else
- {
- size_t inlen1=strlen(in)+1;
- buf=strncpy(Ibuf,in,inlen1 < outlen ? inlen1 : outlen);
- }
+ if (inlen!=-1) {
+ buf=Ibuf;
+ if ((size_t)inlen < outlen) {
+ ff_strncpy(Ibuf, in, inlen + 1);
+ } else {
+ ff_strncpy(Ibuf, in, outlen);
+ }
+ } else {
+ buf=Ibuf;
+ ff_strncpy(Ibuf, in, outlen);
+ }
}
-template<> template<> inline text<wchar_t>::text(const char *in):own(in?true:false)
+template<> template<> inline text<wchar_t>::text(const char *in,int code_page):own(in?true:false)
{
- if (in)
- {
- size_t l=strlen(in);
- buf=new wchar_t[l+1];
- MultiByteToWideChar(CP_ACP,0,in,int(l+1),buf,int(l+1));
- }
- else
- buf=NULL;
+ if (in) {
+ size_t l=strlen(in);
+ buf=new wchar_t[l+1];
+ MultiByteToWideChar(code_page,0,in,int(l+1),buf,int(l+1));
+ } else {
+ buf=NULL;
+ }
}
-template<> template<> inline text<wchar_t>::text(const char *in,wchar_t *Ibuf):own(false),buf(Ibuf)
+template<> template<> inline text<wchar_t>::text(const char *in,wchar_t *Ibuf,int code_page):own(false),buf(Ibuf)
{
- size_t l=strlen(in);
- MultiByteToWideChar(CP_ACP,0,in,int(l+1),buf,int(l+1));
+ size_t l=strlen(in);
+ MultiByteToWideChar(code_page,0,in,int(l+1),buf,int(l+1));
}
-template<> template<> inline text<wchar_t>::text(const char *in,int inlen,wchar_t *Ibuf,size_t outlen):own(false),buf(Ibuf)
+template<> template<> inline text<wchar_t>::text(const char *in,int inlen,wchar_t *Ibuf,size_t outlen,int code_page):own(false),buf(Ibuf)
{
- MultiByteToWideChar(CP_ACP,0,in,int(inlen),buf,int(outlen));
+ MultiByteToWideChar(code_page,0,in,int(inlen),buf,int(outlen));
}
-template<> template<> inline text<char>::text(const wchar_t *in):own(in?true:false)
+template<> template<> inline text<char>::text(const wchar_t *in,int code_page):own(in?true:false)
{
- if (in)
- {
- size_t l=strlen(in);
- int length=WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,0,NULL,NULL);
- buf=new char[length+1];
- WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,int(length+1),NULL,NULL);
- }
- else
- buf=NULL;
+ if (in) {
+ size_t l=strlen(in);
+ int length=WideCharToMultiByte(code_page,0,in,int(l+1),buf,0,NULL,NULL);
+ buf=new char[length+1];
+ WideCharToMultiByte(code_page,0,in,int(l+1),buf,int(length+1),NULL,NULL);
+ } else {
+ buf=NULL;
+ }
}
-template<> template<> inline text<char>::text(const wchar_t *in,char *Ibuf):own(false),buf(Ibuf)
+template<> template<> inline text<char>::text(const wchar_t *in,char *Ibuf,int code_page):own(false),buf(Ibuf)
{
- size_t l=strlen(in);
- int length= WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,0,NULL,NULL);
- WideCharToMultiByte(CP_ACP,0,in,int(l+1),buf,length,NULL,NULL);
+ size_t l=strlen(in);
+ int length= WideCharToMultiByte(code_page,0,in,int(l+1),buf,0,NULL,NULL);
+ WideCharToMultiByte(code_page,0,in,int(l+1),buf,length,NULL,NULL);
}
-template<> template<> inline text<char>::text(const wchar_t *in,int inlen,char *Ibuf,size_t outlen):own(false),buf(Ibuf)
+template<> template<> inline text<char>::text(const wchar_t *in,int inlen,char *Ibuf,size_t outlen,int code_page):own(false),buf(Ibuf)
{
- WideCharToMultiByte(CP_ACP,0,in,int(inlen),buf,int(outlen),NULL,NULL);
+ WideCharToMultiByte(code_page,0,in,int(inlen),buf,int(outlen),NULL,NULL);
}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/config.h b/src/filters/transform/MPCVideoDec/ffmpeg/config.h
index fcc29c930..01b00ea0c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/config.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/config.h
@@ -79,7 +79,6 @@
#define ARCH_SPARC64 0
#define ARCH_TOMI 0
-#define HAVE_ALIGNED_STACK 0
#define HAVE_ALTIVEC 0
#define HAVE_ARMV5TE 0
#define HAVE_ARMV6 0
@@ -91,6 +90,7 @@
#define HAVE_PPC4XX 0
#define HAVE_VIS 0
+#define HAVE_ALIGNED_STACK 0
#define HAVE_ALTIVEC_H 0
#define HAVE_BIGENDIAN 0
#define HAVE_BSWAP 1
@@ -143,31 +143,31 @@
#define cbrtf(x) pow((float)x, (float)1.0/3)
#endif
+#define CONFIG_AC3ENC_FLOAT 0
#define CONFIG_DCT 0
#define CONFIG_DWT 0
-
#define CONFIG_GPL 1
#define CONFIG_GRAY 1
#define CONFIG_H264DSP 1
#define CONFIG_H264PRED 1
#define CONFIG_HARDCODED_TABLES 0
-#define CONFIG_HUFFMAN 0
+#define CONFIG_HUFFMAN 1
#define CONFIG_LIBAMR_NB 1
#define CONFIG_LIBXVID 0
#define CONFIG_LPC 0
#define CONFIG_MDCT 1
#define CONFIG_MPEGAUDIO_HP 1
+#define CONFIG_RUNTIME_CPUDETECT 1
#define CONFIG_SMALL 0
#define CONFIG_ZLIB 1
#define CONFIG_DECODERS 1
#define CONFIG_ENCODERS 0
-#define CONFIG_POSTPROC 0
-#define CONFIG_RUNTIME_CPUDETECT 1
#define CONFIG_SWSCALE 1
#define CONFIG_SWSCALE_ALPHA 1
+#define CONFIG_POSTPROC 0
-/*
+/*
Note: when adding a new codec, you have to:
1) Add a
#define CONFIG_<codec suffix>_<ENCODER|DECODER|PARSER>
@@ -201,6 +201,7 @@ Note: when adding a new codec, you have to:
#define CONFIG_HUFFYUV_DECODER 0
#define CONFIG_INDEO2_DECODER 0
#define CONFIG_INDEO3_DECODER 0
+#define CONFIG_INDEO5_DECODER 0
#define CONFIG_JPEGLS_DECODER 0
#define CONFIG_LOCO_DECODER 0
#define CONFIG_MJPEG_DECODER 0
@@ -325,7 +326,9 @@ Note: when adding a new codec, you have to:
#define CONFIG_SNOW_ENCODER 0
#define CONFIG_WMV1_ENCODER 0
#define CONFIG_WMV2_ENCODER 0
+
#define CONFIG_AC3_ENCODER 0
+#define CONFIG_AC3_FIXED_ENCODER 0
#define CONFIG_AAC_PARSER 0
#define CONFIG_AC3_PARSER 1
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h b/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h
index cc5d526ba..efd5e1161 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/ffImgfmt.h
@@ -14,36 +14,35 @@
// destination byte order for the file.
// (e.g. PNG images uses RGB order, so select BGR order
// BMP image uses BGR order, so select RGB order)
-enum
-{
- FF_CSP_NULL = 0,
-
- FF_CSP_420P =1U<< 0,
- FF_CSP_422P =1U<< 1,
- FF_CSP_444P =1U<< 2,
- FF_CSP_411P =1U<< 3,
- FF_CSP_410P =1U<< 4,
-
- FF_CSP_YUY2 =1U<< 5,
- FF_CSP_UYVY =1U<< 6,
- FF_CSP_YVYU =1U<< 7,
- FF_CSP_VYUY =1U<< 8,
-
- FF_CSP_ABGR =1U<< 9, // [a|b|g|r]
- FF_CSP_RGBA =1U<<10, // [r|g|b|a]
- FF_CSP_BGR32 =1U<<11,
- FF_CSP_BGR24 =1U<<12,
- FF_CSP_BGR15 =1U<<13,
- FF_CSP_BGR16 =1U<<14,
- FF_CSP_RGB32 =1U<<15,
- FF_CSP_RGB24 =1U<<16,
- FF_CSP_RGB15 =1U<<17,
- FF_CSP_RGB16 =1U<<18,
-
- FF_CSP_PAL8 =1U<<19,
- FF_CSP_CLJR =1U<<20,
- FF_CSP_Y800 =1U<<21,
- FF_CSP_NV12 =1U<<22
+enum {
+ FF_CSP_NULL = 0,
+
+ FF_CSP_420P =1U<< 0,
+ FF_CSP_422P =1U<< 1,
+ FF_CSP_444P =1U<< 2,
+ FF_CSP_411P =1U<< 3,
+ FF_CSP_410P =1U<< 4,
+
+ FF_CSP_YUY2 =1U<< 5,
+ FF_CSP_UYVY =1U<< 6,
+ FF_CSP_YVYU =1U<< 7,
+ FF_CSP_VYUY =1U<< 8,
+
+ FF_CSP_ABGR =1U<< 9, // [a|b|g|r]
+ FF_CSP_RGBA =1U<<10, // [r|g|b|a]
+ FF_CSP_BGR32 =1U<<11,
+ FF_CSP_BGR24 =1U<<12,
+ FF_CSP_BGR15 =1U<<13,
+ FF_CSP_BGR16 =1U<<14,
+ FF_CSP_RGB32 =1U<<15,
+ FF_CSP_RGB24 =1U<<16,
+ FF_CSP_RGB15 =1U<<17,
+ FF_CSP_RGB16 =1U<<18,
+
+ FF_CSP_PAL8 =1U<<19,
+ FF_CSP_CLJR =1U<<20,
+ FF_CSP_Y800 =1U<<21,
+ FF_CSP_NV12 =1U<<22
};
#define FF_CSPS_NUM 24
@@ -84,71 +83,121 @@ typedef ptrdiff_t stride_t;
static __inline int csp_xvid4_2ffdshow(int csp)
{
- switch (csp)
- {
- case XVID4_CSP_BGR :return FF_CSP_RGB24;
- case XVID4_CSP_YV12 :return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ;
- case XVID4_CSP_YUY2 :return FF_CSP_YUY2;
- case XVID4_CSP_UYVY :return FF_CSP_UYVY;
- case XVID4_CSP_I420 :return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ|FF_CSP_FLAGS_YUV_ORDER;
- case XVID4_CSP_RGB555:return FF_CSP_RGB15;
- case XVID4_CSP_RGB565:return FF_CSP_RGB16;
- case XVID4_CSP_PLANAR:return FF_CSP_420P;
- case XVID4_CSP_YVYU :return FF_CSP_YVYU;
- case XVID4_CSP_BGRA :return FF_CSP_RGB32;
- case XVID4_CSP_ABGR :return FF_CSP_ABGR;
- case XVID4_CSP_RGBA :return FF_CSP_RGBA;
- default :return FF_CSP_NULL;
- }
+ switch (csp) {
+ case XVID4_CSP_BGR :
+ return FF_CSP_RGB24;
+ case XVID4_CSP_YV12 :
+ return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ;
+ case XVID4_CSP_YUY2 :
+ return FF_CSP_YUY2;
+ case XVID4_CSP_UYVY :
+ return FF_CSP_UYVY;
+ case XVID4_CSP_I420 :
+ return FF_CSP_420P|FF_CSP_FLAGS_YUV_ADJ|FF_CSP_FLAGS_YUV_ORDER;
+ case XVID4_CSP_RGB555:
+ return FF_CSP_RGB15;
+ case XVID4_CSP_RGB565:
+ return FF_CSP_RGB16;
+ case XVID4_CSP_PLANAR:
+ return FF_CSP_420P;
+ case XVID4_CSP_YVYU :
+ return FF_CSP_YVYU;
+ case XVID4_CSP_BGRA :
+ return FF_CSP_RGB32;
+ case XVID4_CSP_ABGR :
+ return FF_CSP_ABGR;
+ case XVID4_CSP_RGBA :
+ return FF_CSP_RGBA;
+ default :
+ return FF_CSP_NULL;
+ }
}
//================================= ffmpeg ===================================
static __inline int csp_lavc2ffdshow(enum PixelFormat pix_fmt)
{
- switch (pix_fmt)
- {
- case PIX_FMT_YUV420P :return FF_CSP_420P;
- case PIX_FMT_YUVJ420P:return FF_CSP_420P|FF_CSP_FLAGS_YUV_JPEG;
- case PIX_FMT_YUV422P :return FF_CSP_422P;
- case PIX_FMT_YUVJ422P:return FF_CSP_422P|FF_CSP_FLAGS_YUV_JPEG;
- case PIX_FMT_YUV444P :return FF_CSP_444P;
- case PIX_FMT_YUVJ444P:return FF_CSP_444P|FF_CSP_FLAGS_YUV_JPEG;
- case PIX_FMT_YUV411P :return FF_CSP_411P;
- case PIX_FMT_YUV410P :return FF_CSP_410P;
- case PIX_FMT_YUYV422 :return FF_CSP_YUY2;
- case PIX_FMT_UYVY422 :return FF_CSP_UYVY;
- case PIX_FMT_RGB24 :return FF_CSP_RGB24;
- case PIX_FMT_BGR24 :return FF_CSP_BGR24;
- case PIX_FMT_RGB32 :return FF_CSP_RGB32;
- case PIX_FMT_RGB555 :return FF_CSP_RGB15;
- case PIX_FMT_RGB565 :return FF_CSP_RGB16;
- case PIX_FMT_PAL8 :return FF_CSP_PAL8;
- case PIX_FMT_GRAY8 :return FF_CSP_Y800;
- case PIX_FMT_NV12 :return FF_CSP_NV12;
- default :return FF_CSP_NULL;
- }
+ switch (pix_fmt) {
+ case PIX_FMT_YUV420P :
+ return FF_CSP_420P;
+ case PIX_FMT_YUVJ420P:
+ return FF_CSP_420P|FF_CSP_FLAGS_YUV_JPEG;
+ case PIX_FMT_YUV422P :
+ return FF_CSP_422P;
+ case PIX_FMT_YUVJ422P:
+ return FF_CSP_422P|FF_CSP_FLAGS_YUV_JPEG;
+ case PIX_FMT_YUV444P :
+ return FF_CSP_444P;
+ case PIX_FMT_YUVJ444P:
+ return FF_CSP_444P|FF_CSP_FLAGS_YUV_JPEG;
+ case PIX_FMT_YUV411P :
+ return FF_CSP_411P;
+ case PIX_FMT_YUV410P :
+ return FF_CSP_410P;
+ case PIX_FMT_YUYV422 :
+ return FF_CSP_YUY2;
+ case PIX_FMT_UYVY422 :
+ return FF_CSP_UYVY;
+ case PIX_FMT_RGB24 :
+ return FF_CSP_RGB24;
+ case PIX_FMT_BGR24 :
+ return FF_CSP_BGR24;
+ case PIX_FMT_RGB32 :
+ case PIX_FMT_ARGB:
+ return FF_CSP_RGB32;
+ case PIX_FMT_RGB555 :
+ return FF_CSP_RGB15;
+ case PIX_FMT_RGB565 :
+ return FF_CSP_RGB16;
+ case PIX_FMT_PAL8 :
+ return FF_CSP_PAL8;
+ case PIX_FMT_GRAY8 :
+ return FF_CSP_Y800;
+ case PIX_FMT_NV12 :
+ return FF_CSP_NV12;
+ default :
+ return FF_CSP_NULL;
+ }
}
static __inline enum PixelFormat csp_ffdshow2lavc(int pix_fmt)
{
- switch (pix_fmt&FF_CSPS_MASK)
- {
- case FF_CSP_420P:return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ420P:PIX_FMT_YUV420P;
- case FF_CSP_422P:return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ422P:PIX_FMT_YUV422P;
- case FF_CSP_444P:return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ444P:PIX_FMT_YUV444P;
- case FF_CSP_411P:return PIX_FMT_YUV411P;
- case FF_CSP_410P:return PIX_FMT_YUV410P;
- case FF_CSP_YUY2:return PIX_FMT_YUYV422;
- case FF_CSP_UYVY:return PIX_FMT_UYVY422;
- case FF_CSP_RGB24:return PIX_FMT_RGB24;
- case FF_CSP_BGR24:return PIX_FMT_BGR24;
- case FF_CSP_RGB32:return PIX_FMT_RGB32;
- case FF_CSP_RGB15:return PIX_FMT_RGB555;
- case FF_CSP_RGB16:return PIX_FMT_RGB565;
- case FF_CSP_PAL8:return PIX_FMT_PAL8;
- case FF_CSP_Y800:return PIX_FMT_GRAY8;
- case FF_CSP_NV12:return PIX_FMT_NV12;
- default :return PIX_FMT_NB;
- }
+ switch (pix_fmt&FF_CSPS_MASK) {
+ case FF_CSP_420P:
+ return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ420P:PIX_FMT_YUV420P;
+ case FF_CSP_422P:
+ return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ422P:PIX_FMT_YUV422P;
+ case FF_CSP_444P:
+ return pix_fmt&FF_CSP_FLAGS_YUV_JPEG?PIX_FMT_YUVJ444P:PIX_FMT_YUV444P;
+ case FF_CSP_411P:
+ return PIX_FMT_YUV411P;
+ case FF_CSP_410P:
+ return PIX_FMT_YUV410P;
+ case FF_CSP_YUY2:
+ return PIX_FMT_YUYV422;
+ case FF_CSP_UYVY:
+ return PIX_FMT_UYVY422;
+ case FF_CSP_RGB24:
+ return PIX_FMT_RGB24;
+ case FF_CSP_BGR24:
+ return PIX_FMT_BGR24;
+ case FF_CSP_RGB32:
+ return PIX_FMT_RGB32;
+ case FF_CSP_RGB15:
+ return PIX_FMT_RGB555;
+ case FF_CSP_RGB16:
+ return PIX_FMT_RGB565;
+ case FF_CSP_PAL8:
+ return PIX_FMT_PAL8;
+ case FF_CSP_Y800:
+ return PIX_FMT_GRAY8;
+ case FF_CSP_NV12:
+ return PIX_FMT_NV12;
+ case FF_CSP_ABGR:
+ return PIX_FMT_ABGR;
+ case FF_CSP_RGBA:
+ return PIX_FMT_RGBA;
+ default :
+ return PIX_FMT_NB;
+ }
}
//=================================== mplayer ===================================
@@ -227,78 +276,119 @@ static __inline enum PixelFormat csp_ffdshow2lavc(int pix_fmt)
static __inline int csp_mplayercsp2Bpp(int mplayercsp)
{
- // return byte per pixel for the first plane.
- // IMGFMT_NV21,IMGFMT_NV12 are troublesome, because bpp is different in first plane and second plane.
- switch (mplayercsp)
- {
- case IMGFMT_YV12 :return 1;
- case IMGFMT_422P :return 1;
- case IMGFMT_444P :return 1;
- case IMGFMT_411P :return 1;
- case IMGFMT_YVU9 :return 1;
-
- case IMGFMT_YUY2 :return 2;
- case IMGFMT_UYVY :return 2;
- case IMGFMT_YVYU :return 2;
- case IMGFMT_VYUY :return 2;
-
- case IMGFMT_RGB32 :return 4;
-
- case IMGFMT_BGR15:return 2;
- case IMGFMT_BGR16:return 2;
- case IMGFMT_BGR24:return 3;
- case IMGFMT_BGR32:return 4;
-
- case IMGFMT_RGB15:return 2;
- case IMGFMT_RGB16:return 2;
- case IMGFMT_RGB24:return 3;
-
- case IMGFMT_Y800 :return 1;
- case IMGFMT_NV12 :return 1;
- case IMGFMT_NV21 :return 1;
- default :return 1;
- }
+ // return byte per pixel for the first plane.
+ // IMGFMT_NV21,IMGFMT_NV12 are troublesome, because bpp is different in first plane and second plane.
+ switch (mplayercsp) {
+ case IMGFMT_YV12 :
+ return 1;
+ case IMGFMT_422P :
+ return 1;
+ case IMGFMT_444P :
+ return 1;
+ case IMGFMT_411P :
+ return 1;
+ case IMGFMT_YVU9 :
+ return 1;
+
+ case IMGFMT_YUY2 :
+ return 2;
+ case IMGFMT_UYVY :
+ return 2;
+ case IMGFMT_YVYU :
+ return 2;
+ case IMGFMT_VYUY :
+ return 2;
+
+ case IMGFMT_RGB32 :
+ return 4;
+
+ case IMGFMT_BGR15:
+ return 2;
+ case IMGFMT_BGR16:
+ return 2;
+ case IMGFMT_BGR24:
+ return 3;
+ case IMGFMT_BGR32:
+ return 4;
+
+ case IMGFMT_RGB15:
+ return 2;
+ case IMGFMT_RGB16:
+ return 2;
+ case IMGFMT_RGB24:
+ return 3;
+
+ case IMGFMT_Y800 :
+ return 1;
+ case IMGFMT_NV12 :
+ return 1;
+ case IMGFMT_NV21 :
+ return 1;
+ default :
+ return 1;
+ }
}
-// libmplayer refers to the write order, FF_CSP_ enum refers to the "memory byte order",
+// libmplayer refers to the write order, FF_CSP_ enum refers to the "memory byte order",
// which under x86 is reversed, see the comment above the FF_CSP_ enum definition.
static __inline int csp_ffdshow2mplayer(int csp)
{
- switch (csp&FF_CSPS_MASK)
- {
- case FF_CSP_420P :return IMGFMT_YV12;
- case FF_CSP_422P :return IMGFMT_422P;
- case FF_CSP_444P :return IMGFMT_444P;
- case FF_CSP_411P :return IMGFMT_411P;
- case FF_CSP_410P :return IMGFMT_YVU9;
-/*
- case FF_CSP_YUY2 :return IMGFMT_YVYU;
- case FF_CSP_UYVY :return IMGFMT_VYUY;
- case FF_CSP_YVYU :return IMGFMT_YUY2;
- case FF_CSP_VYUY :return IMGFMT_UYVY;
-*/
- case FF_CSP_YUY2 :return IMGFMT_YUY2;
- case FF_CSP_UYVY :return IMGFMT_UYVY;
- case FF_CSP_YVYU :return IMGFMT_YVYU;
- case FF_CSP_VYUY :return IMGFMT_VYUY;
-
- case FF_CSP_ABGR :return IMGFMT_RGB32;
- case FF_CSP_RGBA :return IMGFMT_RGB32;
-
- case FF_CSP_RGB15:return IMGFMT_BGR15; // see the comment above
- case FF_CSP_RGB16:return IMGFMT_BGR16; // see the comment above
- case FF_CSP_RGB24:return IMGFMT_BGR24; // see the comment above
- case FF_CSP_RGB32:return IMGFMT_BGR32; // see the comment above
-
- case FF_CSP_BGR15:return IMGFMT_RGB15; // see the comment above
- case FF_CSP_BGR16:return IMGFMT_RGB16; // see the comment above
- case FF_CSP_BGR24:return IMGFMT_RGB24; // see the comment above
- case FF_CSP_BGR32:return IMGFMT_RGB32; // see the comment above
-
- case FF_CSP_Y800 :return IMGFMT_Y800;
- case FF_CSP_NV12 :return csp&FF_CSP_FLAGS_YUV_ORDER?IMGFMT_NV12:IMGFMT_NV21;
- default :return 0;
- }
+ switch (csp&FF_CSPS_MASK) {
+ case FF_CSP_420P :
+ return IMGFMT_YV12;
+ case FF_CSP_422P :
+ return IMGFMT_422P;
+ case FF_CSP_444P :
+ return IMGFMT_444P;
+ case FF_CSP_411P :
+ return IMGFMT_411P;
+ case FF_CSP_410P :
+ return IMGFMT_YVU9;
+ /*
+ case FF_CSP_YUY2 :return IMGFMT_YVYU;
+ case FF_CSP_UYVY :return IMGFMT_VYUY;
+ case FF_CSP_YVYU :return IMGFMT_YUY2;
+ case FF_CSP_VYUY :return IMGFMT_UYVY;
+ */
+ case FF_CSP_YUY2 :
+ return IMGFMT_YUY2;
+ case FF_CSP_UYVY :
+ return IMGFMT_UYVY;
+ case FF_CSP_YVYU :
+ return IMGFMT_YVYU;
+ case FF_CSP_VYUY :
+ return IMGFMT_VYUY;
+
+ case FF_CSP_ABGR :
+ return IMGFMT_RGB32;
+ case FF_CSP_RGBA :
+ return IMGFMT_RGB32;
+
+ case FF_CSP_RGB15:
+ return IMGFMT_BGR15; // see the comment above
+ case FF_CSP_RGB16:
+ return IMGFMT_BGR16; // see the comment above
+ case FF_CSP_RGB24:
+ return IMGFMT_BGR24; // see the comment above
+ case FF_CSP_RGB32:
+ return IMGFMT_BGR32; // see the comment above
+
+ case FF_CSP_BGR15:
+ return IMGFMT_RGB15; // see the comment above
+ case FF_CSP_BGR16:
+ return IMGFMT_RGB16; // see the comment above
+ case FF_CSP_BGR24:
+ return IMGFMT_RGB24; // see the comment above
+ case FF_CSP_BGR32:
+ return IMGFMT_RGB32; // see the comment above
+
+ case FF_CSP_Y800 :
+ return IMGFMT_Y800;
+ case FF_CSP_NV12 :
+ return csp&FF_CSP_FLAGS_YUV_ORDER?IMGFMT_NV12:IMGFMT_NV21;
+ default :
+ return 0;
+ }
}
#define SWS_IN_CSPS \
@@ -348,11 +438,11 @@ static __inline int csp_ffdshow2mplayer(int csp)
static __inline int csp_supSWSin(int x)
{
- return (x&FF_CSPS_MASK)&SWS_IN_CSPS;
+ return (x&FF_CSPS_MASK)&SWS_IN_CSPS;
}
static __inline int csp_supSWSout(int x)
{
- return (x&FF_CSPS_MASK)&SWS_OUT_CSPS;
+ return (x&FF_CSPS_MASK)&SWS_OUT_CSPS;
}
#endif
@@ -365,96 +455,95 @@ static __inline int csp_supSWSout(int x)
#include "array_allocator.h"
#include "char_t.h"
-struct TcspInfo
-{
- int id;
- const char_t *name;
- int Bpp,bpp;
- unsigned int numPlanes;
- unsigned int shiftX[4],shiftY[4];
- unsigned int black[4];
- FOURCC fcc,fcccsp;const GUID *subtype;
- int packedLumaOffset,packedChromaOffset;
+struct TcspInfo {
+ int id;
+ const char_t *name;
+ int Bpp,bpp;
+ unsigned int numPlanes;
+ unsigned int shiftX[4],shiftY[4];
+ unsigned int black[4];
+ FOURCC fcc,fcccsp;
+ const GUID *subtype;
+ int packedLumaOffset,packedChromaOffset;
};
extern const TcspInfo cspInfos[];
-struct TcspInfos :std::vector<const TcspInfo*,array_allocator<const TcspInfo*,FF_CSPS_NUM*2> >
-{
+struct TcspInfos :std::vector<const TcspInfo*,array_allocator<const TcspInfo*,FF_CSPS_NUM*2> > {
private:
- struct TsortFc
- {
- private:
- int csp;
- public:
- TsortFc(int Icsp):csp(Icsp) {}
- bool operator ()(const TcspInfo* &csp1,const TcspInfo* &csp2);
- };
+ struct TsortFc {
+ private:
+ int csp;
+ public:
+ TsortFc(int Icsp):csp(Icsp) {}
+ bool operator ()(const TcspInfo* &csp1,const TcspInfo* &csp2);
+ };
public:
- void sort(int csp);
+ void sort(int csp);
};
static __inline const TcspInfo* csp_getInfo(int csp)
{
- switch (csp&(FF_CSPS_MASK|FF_CSP_FLAGS_YUV_ORDER))
- {
- case FF_CSP_420P|FF_CSP_FLAGS_YUV_ORDER:
- {
- extern TcspInfo cspInfoIYUV;
- return &cspInfoIYUV;
- }
- case FF_CSP_NV12|FF_CSP_FLAGS_YUV_ORDER:
- {
- extern TcspInfo cspInfoNV21;
- return &cspInfoNV21;
+ switch (csp&(FF_CSPS_MASK|FF_CSP_FLAGS_YUV_ORDER)) {
+ case FF_CSP_420P|FF_CSP_FLAGS_YUV_ORDER: {
+ extern TcspInfo cspInfoIYUV;
+ return &cspInfoIYUV;
+ }
+ case FF_CSP_NV12|FF_CSP_FLAGS_YUV_ORDER: {
+ extern TcspInfo cspInfoNV21;
+ return &cspInfoNV21;
+ }
+ default:
+ csp&=FF_CSPS_MASK;
+ if (csp==0) {
+ return NULL;
+ }
+ int i=0;
+ while (csp>>=1) {
+ i++;
+ }
+ if (i<=FF_CSPS_NUM) {
+ return &cspInfos[i];
+ } else {
+ return NULL;
+ }
}
- default:
- csp&=FF_CSPS_MASK;
- if (csp==0) return NULL;
- int i=0;
- while (csp>>=1)
- i++;
- if (i<=FF_CSPS_NUM)
- return &cspInfos[i];
- else
- return NULL;
- }
}
const TcspInfo* csp_getInfoFcc(FOURCC fcc);
static __inline int csp_isYUVplanar(int x)
{
- return x&FF_CSPS_MASK&FF_CSPS_MASK_YUV_PLANAR;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_YUV_PLANAR;
}
static __inline int csp_isYUVpacked(int x)
{
- return x&FF_CSPS_MASK&FF_CSPS_MASK_YUV_PACKED;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_YUV_PACKED;
}
static __inline int csp_isYUV(int x)
{
- return csp_isYUVpacked(x)|csp_isYUVplanar(x);
+ return csp_isYUVpacked(x)|csp_isYUVplanar(x);
}
static __inline int csp_isYUV_NV(int x)
{
- return csp_isYUVpacked(x)|csp_isYUVplanar(x)|(x & FF_CSP_NV12);
+ return csp_isYUVpacked(x)|csp_isYUVplanar(x)|(x & FF_CSP_NV12);
}
static __inline int csp_isRGB_RGB(int x)
{
- return x&FF_CSPS_MASK&FF_CSPS_MASK_RGB;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_RGB;
}
static __inline int csp_isRGB_BGR(int x)
{
- return x&FF_CSPS_MASK&FF_CSPS_MASK_BGR;
+ return x&FF_CSPS_MASK&FF_CSPS_MASK_BGR;
}
static __inline int csp_isRGB(int x)
{
- return csp_isRGB_RGB(x)|csp_isRGB_BGR(x);
+ return csp_isRGB_RGB(x)|csp_isRGB_BGR(x);
}
static __inline int csp_isPAL(int x)
{
- return x&FF_CSPS_MASK&FF_CSP_PAL8;
+ return x&FF_CSPS_MASK&FF_CSP_PAL8;
}
static __inline int csp_supXvid(int x)
{
- return (x&FF_CSPS_MASK)&(FF_CSP_RGB24|FF_CSP_420P|FF_CSP_YUY2|FF_CSP_UYVY|FF_CSP_YVYU|FF_CSP_VYUY|FF_CSP_RGB15|FF_CSP_RGB16|FF_CSP_RGB32|FF_CSP_ABGR|FF_CSP_RGBA|FF_CSP_BGR24);
+ return (x&FF_CSPS_MASK)&(FF_CSP_RGB24|FF_CSP_420P|FF_CSP_YUY2|FF_CSP_UYVY|FF_CSP_YVYU|FF_CSP_VYUY|FF_CSP_RGB15|FF_CSP_RGB16|FF_CSP_RGB32|FF_CSP_ABGR|FF_CSP_RGBA|FF_CSP_BGR24);
}
bool csp_inFOURCCmask(int x,FOURCC fcc);
@@ -467,44 +556,44 @@ static __inline void csp_yuv_adj_to_plane(int &csp,const TcspInfo *cspInfo,unsig
{
if (csp_isYUVplanar(csp) && (csp & FF_CSP_FLAGS_YUV_ADJ)) {
csp&=~FF_CSP_FLAGS_YUV_ADJ;
- data[2]=data[0]+stride[0]*(dy>>cspInfo->shiftY[0]);stride[1]=stride[0]>>cspInfo->shiftX[1];
- data[1]=data[2]+stride[1]*(dy>>cspInfo->shiftY[1]);stride[2]=stride[0]>>cspInfo->shiftX[2];
+ data[2]=data[0]+stride[0]*(dy>>cspInfo->shiftY[0]);
+ stride[1]=stride[0]>>cspInfo->shiftX[1];
+ data[1]=data[2]+stride[1]*(dy>>cspInfo->shiftY[1]);
+ stride[2]=stride[0]>>cspInfo->shiftX[2];
} else if ((csp & FF_CSP_NV12) && (csp & FF_CSP_FLAGS_YUV_ADJ)) {
csp&=~FF_CSP_FLAGS_YUV_ADJ;
data[1] = data[0] + stride[0] *dy;
stride[1] = stride[0];
}
-
+
}
static __inline void csp_yuv_order(int &csp,unsigned char *data[4],stride_t stride[4])
{
- if (csp_isYUVplanar(csp) && (csp&FF_CSP_FLAGS_YUV_ORDER))
- {
- csp&=~FF_CSP_FLAGS_YUV_ORDER;
- std::swap(data[1],data[2]);
- std::swap(stride[1],stride[2]);
- }
+ if (csp_isYUVplanar(csp) && (csp&FF_CSP_FLAGS_YUV_ORDER)) {
+ csp&=~FF_CSP_FLAGS_YUV_ORDER;
+ std::swap(data[1],data[2]);
+ std::swap(stride[1],stride[2]);
+ }
}
static __inline void csp_vflip(int &csp,const TcspInfo *cspInfo,unsigned char *data[],stride_t stride[],unsigned int dy)
{
- if (csp&FF_CSP_FLAGS_VFLIP)
- {
- csp&=~FF_CSP_FLAGS_VFLIP;
- for (unsigned int i=0;i<cspInfo->numPlanes;i++)
- {
- data[i]+=stride[i]*((dy>>cspInfo->shiftY[i])-1);
- stride[i]*=-1;
+ if (csp&FF_CSP_FLAGS_VFLIP) {
+ csp&=~FF_CSP_FLAGS_VFLIP;
+ for (unsigned int i=0; i<cspInfo->numPlanes; i++) {
+ data[i]+=stride[i]*((dy>>cspInfo->shiftY[i])-1);
+ stride[i]*=-1;
+ }
}
- }
}
int getBMPcolorspace(const BITMAPINFOHEADER *hdr,const TcspInfos &forcedCsps);
-struct TcspFcc
-{
- const char_t *name;
- FOURCC fcc;int csp;bool flip;
- bool supEnc;
+struct TcspFcc {
+ const char_t *name;
+ FOURCC fcc;
+ int csp;
+ bool flip;
+ bool supEnc;
};
extern const TcspFcc cspFccs[];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h b/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h
index ea7197265..22b6a4130 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/ffcodecs.h
@@ -79,16 +79,17 @@
CODEC_OP(CODEC_ID_RV30 ,69,"rv30") \
CODEC_OP(CODEC_ID_RV40 ,70,"rv40") \
CODEC_OP(CODEC_ID_AMV ,71,"amv") \
+ CODEC_OP(CODEC_ID_VP8 ,72,"vp8") \
\
/* Well-known audio codecs */ \
- CODEC_OP(CODEC_ID_MP2 ,100,"") \
- CODEC_OP(CODEC_ID_MP3 ,101,"") \
+ CODEC_OP(CODEC_ID_MP2 ,100,"mp2") \
+ CODEC_OP(CODEC_ID_MP3 ,101,"mp3") \
CODEC_OP(CODEC_ID_VORBIS ,102,"vorbis") \
- CODEC_OP(CODEC_ID_AC3 ,103,"") \
+ CODEC_OP(CODEC_ID_AC3 ,103,"ac3") \
CODEC_OP(CODEC_ID_WMAV1 ,104,"wmav1") \
CODEC_OP(CODEC_ID_WMAV2 ,105,"wmav2") \
- CODEC_OP(CODEC_ID_AAC ,106,"") \
- CODEC_OP(CODEC_ID_DTS ,107,"") \
+ CODEC_OP(CODEC_ID_AAC ,106,"aac") \
+ CODEC_OP(CODEC_ID_DTS ,107,"dts") \
CODEC_OP(CODEC_ID_IMC ,108,"imc") \
CODEC_OP(CODEC_ID_PCM_U16LE ,109,"") \
CODEC_OP(CODEC_ID_PCM_U16BE ,110,"") \
@@ -114,28 +115,27 @@
CODEC_OP(CODEC_ID_ADPCM_SBPRO_3 ,130,"") \
CODEC_OP(CODEC_ID_ADPCM_SBPRO_4 ,131,"") \
CODEC_OP(CODEC_ID_ADPCM_IMA_AMV ,132,"adpcm ima amv") \
- CODEC_OP(CODEC_ID_XAN_DPCM ,133,"adpcm ima xan") \
- CODEC_OP(CODEC_ID_FLAC ,134,"flac") \
- CODEC_OP(CODEC_ID_AMR_NB ,135,"amr nb") \
- CODEC_OP(CODEC_ID_GSM_MS ,136,"gsm ms") \
- CODEC_OP(CODEC_ID_TTA ,137,"tta") \
- CODEC_OP(CODEC_ID_MACE3 ,138,"mace3") \
- CODEC_OP(CODEC_ID_MACE6 ,139,"mace6") \
- CODEC_OP(CODEC_ID_QDM2 ,140,"qdm2") \
- CODEC_OP(CODEC_ID_COOK ,141,"cook") \
- CODEC_OP(CODEC_ID_TRUESPEECH ,142,"truespeech") \
- CODEC_OP(CODEC_ID_RA_144 ,143,"14_4") \
- CODEC_OP(CODEC_ID_RA_288 ,144,"28_8") \
- CODEC_OP(CODEC_ID_ATRAC3 ,145,"atrac 3") \
- CODEC_OP(CODEC_ID_NELLYMOSER ,146,"nellymoser") \
- CODEC_OP(CODEC_ID_ADPCM_ADX ,147,"adpcm adx") \
- CODEC_OP(CODEC_ID_MLP ,148,"MLP") \
- CODEC_OP(CODEC_ID_EAC3 ,149,"EAC3") \
- CODEC_OP(CODEC_ID_WAVPACK ,150,"Wavpack") \
- CODEC_OP(CODEC_ID_PCM_ZORK ,151,"PCM Zork") \
- CODEC_OP(CODEC_ID_SHORTEN ,152,"Shorten") \
+ CODEC_OP(CODEC_ID_FLAC ,133,"flac") \
+ CODEC_OP(CODEC_ID_AMR_NB ,134,"amr nb") \
+ CODEC_OP(CODEC_ID_GSM_MS ,135,"gsm ms") \
+ CODEC_OP(CODEC_ID_TTA ,136,"tta") \
+ CODEC_OP(CODEC_ID_MACE3 ,137,"mace3") \
+ CODEC_OP(CODEC_ID_MACE6 ,138,"mace6") \
+ CODEC_OP(CODEC_ID_QDM2 ,139,"qdm2") \
+ CODEC_OP(CODEC_ID_COOK ,140,"cook") \
+ CODEC_OP(CODEC_ID_TRUESPEECH ,141,"truespeech") \
+ CODEC_OP(CODEC_ID_RA_144 ,142,"14_4") \
+ CODEC_OP(CODEC_ID_RA_288 ,143,"28_8") \
+ CODEC_OP(CODEC_ID_ATRAC3 ,144,"atrac 3") \
+ CODEC_OP(CODEC_ID_NELLYMOSER ,145,"nellymoser") \
+ CODEC_OP(CODEC_ID_EAC3 ,146,"eac3") \
+ CODEC_OP(CODEC_ID_MP3ADU ,147,"mp3adu") \
+ CODEC_OP(CODEC_ID_MLP ,148,"mlp") \
+ CODEC_OP(CODEC_ID_MP1 ,149,"mp1") \
+ CODEC_OP(CODEC_ID_TRUEHD ,150,"truehd") \
+ CODEC_OP(CODEC_ID_WAVPACK ,151,"wavpack") \
+ CODEC_OP(CODEC_ID_GSM ,152,"gsm") \
CODEC_OP(CODEC_ID_AMR_WB ,153,"amrwb") \
- CODEC_OP(CODEC_ID_TRUEHD ,154,"truehd") \
\
/* Raw formats */ \
CODEC_OP(CODEC_ID_RAW ,300,"raw") \
@@ -164,30 +164,26 @@
CODEC_OP(CODEC_ID_PAL1 ,323,"raw") \
CODEC_OP(CODEC_ID_PAL4 ,324,"raw") \
CODEC_OP(CODEC_ID_PAL8 ,325,"raw") \
- CODEC_OP(CODEC_ID_LPCM ,398,"raw") \
- CODEC_OP(CODEC_ID_PCM ,399,"raw") \
- CODEC_OP(CODEC_ID_RAWVIDEO ,400,"raw") \
+ CODEC_OP(CODEC_ID_YV16 ,326,"raw") \
+ CODEC_OP(CODEC_ID_LPCM ,398,"raw LPCM") \
+ CODEC_OP(CODEC_ID_PCM ,399,"raw PCM") \
\
- CODEC_OP(CODEC_ID_PCM_S32LE ,200,"raw") \
- CODEC_OP(CODEC_ID_PCM_S32BE ,201,"raw") \
- CODEC_OP(CODEC_ID_PCM_U32LE ,202,"raw") \
- CODEC_OP(CODEC_ID_PCM_U32BE ,203,"raw") \
- CODEC_OP(CODEC_ID_PCM_S24LE ,204,"raw") \
- CODEC_OP(CODEC_ID_PCM_S24BE ,205,"raw") \
- CODEC_OP(CODEC_ID_PCM_U24LE ,206,"raw") \
- CODEC_OP(CODEC_ID_PCM_U24BE ,207,"raw") \
- CODEC_OP(CODEC_ID_PCM_S16LE ,208,"raw") \
- CODEC_OP(CODEC_ID_PCM_S16BE ,209,"raw") \
- CODEC_OP(CODEC_ID_PCM_S24DAUD ,210,"raw") \
+ CODEC_OP(CODEC_ID_PCM_S32LE ,200,"raw PCM 32") \
+ CODEC_OP(CODEC_ID_PCM_S32BE ,201,"raw PCM 32") \
+ CODEC_OP(CODEC_ID_PCM_U32LE ,202,"raw PCM 32") \
+ CODEC_OP(CODEC_ID_PCM_U32BE ,203,"raw PCM 32") \
+ CODEC_OP(CODEC_ID_PCM_S24LE ,204,"raw PCM 24") \
+ CODEC_OP(CODEC_ID_PCM_S24BE ,205,"raw PCM 24") \
+ CODEC_OP(CODEC_ID_PCM_U24LE ,206,"raw PCM 24") \
+ CODEC_OP(CODEC_ID_PCM_U24BE ,207,"raw PCM 24") \
+ CODEC_OP(CODEC_ID_PCM_S16LE ,208,"raw PCM 16") \
+ CODEC_OP(CODEC_ID_PCM_S16BE ,209,"raw PCM 16") \
+ CODEC_OP(CODEC_ID_PCM_S24DAUD ,210,"raw PCM 24") \
\
CODEC_OP(CODEC_ID_XVID4 ,400,"xvid") \
\
CODEC_OP(CODEC_ID_LIBMPEG2 ,500,"libmpeg2") \
\
- CODEC_OP(CODEC_ID_THEORA_LIB ,600,"libtheora") \
- \
- CODEC_OP(CODEC_ID_MP3LIB ,700,"mp3lib") \
- \
CODEC_OP(CODEC_ID_LIBMAD ,800,"libmad") \
\
CODEC_OP(CODEC_ID_LIBFAAD ,900,"faad2") \
@@ -196,104 +192,251 @@
\
CODEC_OP(CODEC_ID_AVISYNTH ,1100,"avisynth") \
\
- CODEC_OP(CODEC_ID_SKAL ,1200,"skal's") \
- \
CODEC_OP(CODEC_ID_LIBA52 ,1300,"liba52") \
\
- CODEC_OP(CODEC_ID_SPDIF_AC3 ,1400,"s/pdif") \
- CODEC_OP(CODEC_ID_SPDIF_DTS ,1401,"s/pdif") \
+ CODEC_OP(CODEC_ID_SPDIF_AC3 ,1400,"AC3 s/pdif") \
+ CODEC_OP(CODEC_ID_SPDIF_DTS ,1401,"DTS s/pdif") \
+ CODEC_OP(CODEC_ID_BITSTREAM_TRUEHD ,1402,"bitstream Dolby True HD") \
+ CODEC_OP(CODEC_ID_BITSTREAM_DTSHD ,1403,"bitstream DTS-HD") \
+ CODEC_OP(CODEC_ID_BITSTREAM_EAC3 ,1404,"bitstream EAC3") \
\
CODEC_OP(CODEC_ID_LIBDTS ,1500,"libdts") \
\
- CODEC_OP(CODEC_ID_TREMOR ,1600,"tremor") \
- \
- CODEC_OP(CODEC_ID_REALAAC ,1700,"realaac") \
+ CODEC_OP(CODEC_ID_H264_MT ,2000,"h264 multithreaded") \
+ CODEC_OP(CODEC_ID_VP3_MT ,2001,"vp3 multithreaded") \
+ CODEC_OP(CODEC_ID_THEORA_MT ,2002,"theora multithreaded") \
\
- CODEC_OP(CODEC_ID_AUDX ,1800,"Aud-X") \
+ CODEC_OP(CODEC_ID_H264_DXVA ,2100,"h264 DXVA") \
\
- CODEC_OP(CODEC_ID_X264 ,1900,"x264") \
- CODEC_OP(CODEC_ID_X264_LOSSLESS ,1901,"x264 lossless") \
+ CODEC_OP(CODEC_ID_VC1_DXVA ,2101,"vc1 DXVA") \
\
- CODEC_OP(CODEC_ID_VP8 ,1902,"VP8") \
- \
- /* Subtitles formats */ \
- CODEC_OP(CODEC_ID_DVD_SUBTITLE ,2000,"DVD Subs") \
- CODEC_OP(CODEC_ID_DVB_SUBTITLE ,2001,"DVB Subs") \
- CODEC_OP(CODEC_ID_SSA ,2002,"SSA") \
- CODEC_OP(CODEC_ID_TEXT ,2003,"Text") \
- CODEC_OP(CODEC_ID_XSUB ,2004,"XSUB") \
- /* Other formats */ \
- CODEC_OP(CODEC_ID_GSM ,2101,"GSM") \
- CODEC_OP(CODEC_ID_GIF ,2102,"Gif") \
- CODEC_OP(CODEC_ID_TIFF ,2103,"Tiff") \
- CODEC_OP(CODEC_ID_TTF ,2104,"TTF")
-enum CodecID
-{
- #define CODEC_OP(codecEnum,codecId,codecName) codecEnum=codecId,
- FFDSHOW_CODECS
- #undef CODEC_OP
+ CODEC_OP(CODEC_ID_HDMV_PGS_SUBTITLE, 2200, "PGS subtitles")
+
+
+
+
+enum CodecID {
+#define CODEC_OP(codecEnum,codecId,codecName) codecEnum=codecId,
+ FFDSHOW_CODECS
+#undef CODEC_OP
};
#ifdef __cplusplus
-template<> struct isPOD<CodecID> {enum {is=true};};
+template<> struct isPOD<CodecID> {
+ enum {is=true};
+};
const FOURCC* getCodecFOURCCs(CodecID codecId);
//const char_t* getCodecName(CodecID codecId);
-static __inline bool lavc_codec(int x) {return x>0 && x<200;}
-static __inline bool raw_codec(int x) {return x>=300 && x<400;}
-static __inline bool xvid_codec(int x) {return x==CODEC_ID_XVID4;}
-static __inline bool theora_codec(int x) {return x==CODEC_ID_THEORA_LIB;}
-static __inline bool mplayer_codec(int x) {return x==CODEC_ID_MP3LIB;}
-static __inline bool wmv9_codec(int x) {return x>=1000 && x<1100;}
-static __inline bool mpeg12_codec(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_LIBMPEG2;}
-static __inline bool mpeg1_codec(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_LIBMPEG2;}
-static __inline bool mpeg2_codec(int x) {return x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_LIBMPEG2;}
-static __inline bool mpeg4_codec(int x) {return x==CODEC_ID_MPEG4 || xvid_codec(x) || x==CODEC_ID_SKAL;}
-static __inline bool spdif_codec(int x) {return x==CODEC_ID_SPDIF_AC3 || x==CODEC_ID_SPDIF_DTS;}
-static __inline bool huffyuv_codec(int x) {return x==CODEC_ID_HUFFYUV || x==CODEC_ID_FFVHUFF;}
-static __inline bool x264_codec(int x) {return x==CODEC_ID_X264 || x==CODEC_ID_X264_LOSSLESS;}
-static __inline bool lossless_codec(int x) {return huffyuv_codec(x) || x==CODEC_ID_LJPEG || x==CODEC_ID_FFV1 || x==CODEC_ID_DVVIDEO || x==CODEC_ID_X264_LOSSLESS;}
+static __inline bool lavc_codec(int x)
+{
+ return x>0 && x<200;
+}
+static __inline bool raw_codec(int x)
+{
+ return x>=300 && x<400;
+}
+static __inline bool xvid_codec(int x)
+{
+ return x==CODEC_ID_XVID4;
+}
+static __inline bool wmv9_codec(int x)
+{
+ return x>=1000 && x<1100;
+}
+static __inline bool mpeg12_codec(int x)
+{
+ return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_LIBMPEG2;
+}
+static __inline bool mpeg1_codec(int x)
+{
+ return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_LIBMPEG2;
+}
+static __inline bool mpeg2_codec(int x)
+{
+ return x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_LIBMPEG2;
+}
+static __inline bool mpeg4_codec(int x)
+{
+ return x==CODEC_ID_MPEG4 || xvid_codec(x);
+}
+static __inline bool spdif_codec(int x)
+{
+ return x==CODEC_ID_SPDIF_AC3 || x==CODEC_ID_SPDIF_DTS;
+}
+static __inline bool bitstream_codec(int x)
+{
+ return x==CODEC_ID_BITSTREAM_TRUEHD || x==CODEC_ID_BITSTREAM_DTSHD || x==CODEC_ID_BITSTREAM_EAC3;
+}
+static __inline bool huffyuv_codec(int x)
+{
+ return x==CODEC_ID_HUFFYUV || x==CODEC_ID_FFVHUFF;
+}
+static __inline bool lossless_codec(int x)
+{
+ return huffyuv_codec(x) || x==CODEC_ID_LJPEG || x==CODEC_ID_FFV1 || x==CODEC_ID_DVVIDEO;
+}
+static __inline bool h264_codec(int x)
+{
+ return x == CODEC_ID_H264 || x == CODEC_ID_H264_MT;
+}
+static __inline bool vc1_codec(int x)
+{
+ return x == CODEC_ID_VC1 || x == CODEC_ID_WMV9_LIB;
+}
+static __inline bool dxva_codec(int x)
+{
+ return x == CODEC_ID_H264_DXVA || x == CODEC_ID_VC1_DXVA;
+}
//I'm not sure of all these
-static __inline bool sup_CBR(int x) {return !lossless_codec(x) && !raw_codec(x);}
-static __inline bool sup_VBR_QUAL(int x) {return !lossless_codec(x) && !raw_codec(x) && x!=CODEC_ID_SKAL;}
-static __inline bool sup_VBR_QUANT(int x) {return (lavc_codec(x) || xvid_codec(x) || theora_codec(x) || x==CODEC_ID_SKAL || x==CODEC_ID_X264) && !lossless_codec(x) && x!=CODEC_ID_SNOW;}
-static __inline bool sup_XVID2PASS(int x) {return sup_VBR_QUANT(x) && x!=CODEC_ID_X264 && x!=CODEC_ID_SNOW;}
-static __inline bool sup_LAVC2PASS(int x) {return (lavc_codec(x) && !lossless_codec(x) && x!=CODEC_ID_MJPEG && !raw_codec(x)) || x==CODEC_ID_X264;}
+static __inline bool sup_CBR(int x)
+{
+ return !lossless_codec(x) && !raw_codec(x);
+}
+static __inline bool sup_VBR_QUAL(int x)
+{
+ return !lossless_codec(x) && !raw_codec(x);
+}
+static __inline bool sup_VBR_QUANT(int x)
+{
+ return (lavc_codec(x) || xvid_codec(x)) && !lossless_codec(x) && x!=CODEC_ID_SNOW;
+}
+static __inline bool sup_XVID2PASS(int x)
+{
+ return sup_VBR_QUANT(x) && x!=CODEC_ID_SNOW;
+}
+static __inline bool sup_LAVC2PASS(int x)
+{
+ return (lavc_codec(x) && !lossless_codec(x) && x!=CODEC_ID_MJPEG && !raw_codec(x));
+}
-static __inline bool sup_interlace(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x==CODEC_ID_SKAL;}
-static __inline bool sup_gray(int x) {return x!=CODEC_ID_LJPEG && x!=CODEC_ID_FFV1 && x!=CODEC_ID_SNOW && !theora_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_SKAL && x!=CODEC_ID_DVVIDEO && !x264_codec(x);}
-static __inline bool sup_globalheader(int x) {return x==CODEC_ID_MPEG4;}
-static __inline bool sup_part(int x) {return x==CODEC_ID_MPEG4;}
-static __inline bool sup_packedBitstream(int x) {return xvid_codec(x);}
-static __inline bool sup_minKeySet(int x) {return x!=CODEC_ID_MJPEG && x!=CODEC_ID_SNOW && (!lossless_codec(x) || x==CODEC_ID_X264_LOSSLESS) && !wmv9_codec(x) && !raw_codec(x);}
-static __inline bool sup_maxKeySet(int x) {return x!=CODEC_ID_MJPEG && (!lossless_codec(x) || x==CODEC_ID_X264_LOSSLESS) && !raw_codec(x);}
-static __inline bool sup_bframes(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x264_codec(x);}
-static __inline bool sup_adaptiveBframes(int x) {return lavc_codec(x) || x==CODEC_ID_X264;}
-static __inline bool sup_closedGop(int x) {return sup_bframes(x) && !x264_codec(x);}
-static __inline bool sup_lavcme(int x) {return lavc_codec(x) && x!=CODEC_ID_MJPEG && !lossless_codec(x);}
-static __inline bool sup_quantProps(int x) {return !lossless_codec(x) && !theora_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_SNOW;}
-static __inline bool sup_trellisQuant(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_SKAL || x==CODEC_ID_X264;}
-static __inline bool sup_masking(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x==CODEC_ID_SKAL || x==CODEC_ID_X264;}
-static __inline bool sup_lavcOnePass(int x) {return (lavc_codec(x) && !lossless_codec(x)) || x==CODEC_ID_X264;}
-static __inline bool sup_perFrameQuant(int x) {return !lossless_codec(x) && !wmv9_codec(x) && !raw_codec(x) && !x264_codec(x) && x!=CODEC_ID_SNOW;}
-static __inline bool sup_4mv(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_SNOW || x==CODEC_ID_SKAL;}
-static __inline bool sup_aspect(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4 || x==CODEC_ID_THEORA_LIB || x264_codec(x);}
-static __inline bool sup_PSNR(int x) {return (lavc_codec(x) && !lossless_codec(x)) || xvid_codec(x) || x==CODEC_ID_SKAL || x264_codec(x);}
-static __inline bool sup_quantBias(int x) {return lavc_codec(x) && !lossless_codec(x);}
-static __inline bool sup_MPEGquant(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_MSMPEG4V3 || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x) || x==CODEC_ID_SKAL;}
-static __inline bool sup_lavcQuant(int x) {return lavc_codec(x) && sup_quantProps(x);}
-static __inline bool sup_customQuantTables(int x) {return x==CODEC_ID_MPEG4 || xvid_codec(x) || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_SKAL || x==CODEC_ID_X264;}
-static __inline bool sup_qpel(int x) {return x==CODEC_ID_MPEG4 || x==CODEC_ID_SNOW || xvid_codec(x) || x==CODEC_ID_SKAL;}
-static __inline bool sup_gmc(int x) {return xvid_codec(x) || x==CODEC_ID_SKAL;}
-static __inline bool sup_me_mv0(int x) {return sup_lavcme(x) && x!=CODEC_ID_SNOW;}
-static __inline bool sup_cbp_rd(int x) {return x==CODEC_ID_MPEG4;}
-static __inline bool sup_qns(int x) {return lavc_codec(x) && sup_quantProps(x) && x!=CODEC_ID_MSMPEG4V3 && x!=CODEC_ID_MSMPEG4V2 && x!=CODEC_ID_MSMPEG4V1 && x!=CODEC_ID_WMV1 && x!=CODEC_ID_WMV2 && x!=CODEC_ID_MJPEG && x!=CODEC_ID_SNOW;}
-static __inline bool sup_threads(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_MPEG4 || x==CODEC_ID_XVID4 || x264_codec(x);}
-static __inline bool sup_threads_dec(int x) {return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_H264;}
-static __inline bool sup_palette(int x) {return x==CODEC_ID_MSVIDEO1 || x==CODEC_ID_8BPS || x==CODEC_ID_QTRLE || x==CODEC_ID_TSCC || x==CODEC_ID_QPEG || x==CODEC_ID_PNG;}
+static __inline bool sup_interlace(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x);
+}
+static __inline bool sup_gray(int x)
+{
+ return x!=CODEC_ID_LJPEG && x!=CODEC_ID_FFV1 && x!=CODEC_ID_SNOW && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_DVVIDEO;
+}
+static __inline bool sup_globalheader(int x)
+{
+ return x==CODEC_ID_MPEG4;
+}
+static __inline bool sup_part(int x)
+{
+ return x==CODEC_ID_MPEG4;
+}
+static __inline bool sup_packedBitstream(int x)
+{
+ return xvid_codec(x);
+}
+static __inline bool sup_minKeySet(int x)
+{
+ return x!=CODEC_ID_MJPEG && x!=CODEC_ID_SNOW && !lossless_codec(x) && !wmv9_codec(x) && !raw_codec(x);
+}
+static __inline bool sup_maxKeySet(int x)
+{
+ return x!=CODEC_ID_MJPEG && !lossless_codec(x) && !raw_codec(x);
+}
+static __inline bool sup_bframes(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x);
+}
+static __inline bool sup_adaptiveBframes(int x)
+{
+ return lavc_codec(x);
+}
+static __inline bool sup_closedGop(int x)
+{
+ return sup_bframes(x);
+}
+static __inline bool sup_lavcme(int x)
+{
+ return lavc_codec(x) && x!=CODEC_ID_MJPEG && !lossless_codec(x);
+}
+static __inline bool sup_quantProps(int x)
+{
+ return !lossless_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_SNOW;
+}
+static __inline bool sup_trellisQuant(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P;
+}
+static __inline bool sup_masking(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x);
+}
+static __inline bool sup_lavcOnePass(int x)
+{
+ return (lavc_codec(x) && !lossless_codec(x));
+}
+static __inline bool sup_perFrameQuant(int x)
+{
+ return !lossless_codec(x) && !wmv9_codec(x) && !raw_codec(x) && x!=CODEC_ID_SNOW;
+}
+static __inline bool sup_4mv(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_H263 || x==CODEC_ID_H263P || x==CODEC_ID_SNOW;
+}
+static __inline bool sup_aspect(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4;
+}
+static __inline bool sup_PSNR(int x)
+{
+ return (lavc_codec(x) && !lossless_codec(x)) || xvid_codec(x);
+}
+static __inline bool sup_quantBias(int x)
+{
+ return lavc_codec(x) && !lossless_codec(x);
+}
+static __inline bool sup_MPEGquant(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_MSMPEG4V3 || x==CODEC_ID_MPEG2VIDEO || xvid_codec(x);
+}
+static __inline bool sup_lavcQuant(int x)
+{
+ return lavc_codec(x) && sup_quantProps(x);
+}
+static __inline bool sup_customQuantTables(int x)
+{
+ return x==CODEC_ID_MPEG4 || xvid_codec(x) || x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO;
+}
+static __inline bool sup_qpel(int x)
+{
+ return x==CODEC_ID_MPEG4 || x==CODEC_ID_SNOW || xvid_codec(x);
+}
+static __inline bool sup_gmc(int x)
+{
+ return xvid_codec(x);
+}
+static __inline bool sup_me_mv0(int x)
+{
+ return sup_lavcme(x) && x!=CODEC_ID_SNOW;
+}
+static __inline bool sup_cbp_rd(int x)
+{
+ return x==CODEC_ID_MPEG4;
+}
+static __inline bool sup_qns(int x)
+{
+ return lavc_codec(x) && sup_quantProps(x) && x!=CODEC_ID_MSMPEG4V3 && x!=CODEC_ID_MSMPEG4V2 && x!=CODEC_ID_MSMPEG4V1 && x!=CODEC_ID_WMV1 && x!=CODEC_ID_WMV2 && x!=CODEC_ID_MJPEG && x!=CODEC_ID_SNOW;
+}
+static __inline bool sup_threads(int x)
+{
+ return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO || x==CODEC_ID_XVID4;
+}
+static __inline bool sup_threads_dec(int x)
+{
+ return x==CODEC_ID_MPEG1VIDEO || x==CODEC_ID_MPEG2VIDEO;
+}
+static __inline bool sup_palette(int x)
+{
+ return x==CODEC_ID_MSVIDEO1 || x==CODEC_ID_8BPS || x==CODEC_ID_QTRLE || x==CODEC_ID_TSCC || x==CODEC_ID_QPEG || x==CODEC_ID_PNG;
+}
#endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c
index ea13d3de5..c40390245 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.c
@@ -43,12 +43,6 @@ const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] = {
{ 3, 0, 1 }, { 3, 0, 2 }, { 3, 1, 0 }, { 3, 1, 1 }
};
-/**
- * Table of bin locations for rematrixing bands
- * reference: Section 7.5.2 Rematrixing : Frequency Band Definitions
- */
-const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 };
-
const uint8_t ff_eac3_hebap_tab[64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8,
8, 8, 9, 9, 9, 10, 10, 10, 10, 11,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.h
index 9ed7c7318..e2ab7ddbe 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3dec_data.h
@@ -25,7 +25,6 @@
#include <stdint.h>
extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3];
-extern const uint8_t ff_ac3_rematrix_band_tab[5];
extern const uint8_t ff_eac3_hebap_tab[64];
extern const uint8_t ff_eac3_default_cpl_band_struct[18];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c
index c8e6b068f..0837e95b4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.c
@@ -132,6 +132,12 @@ const uint16_t ff_ac3_bitrate_tab[19] = {
160, 192, 224, 256, 320, 384, 448, 512, 576, 640
};
+/**
+ * Table of bin locations for rematrixing bands
+ * reference: Section 7.5.2 Rematrixing : Frequency Band Definitions
+ */
+const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 };
+
/* AC-3 MDCT window */
/* MDCT window */
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h
index 8f86370ab..8d70f6dc0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/ac3tab.h
@@ -32,6 +32,7 @@ extern const uint8_t ff_ac3_enc_channel_map[8][2][6];
extern const uint8_t ff_ac3_dec_channel_map[8][2][6];
extern const uint16_t ff_ac3_sample_rate_tab[3];
extern const uint16_t ff_ac3_bitrate_tab[19];
+extern const uint8_t ff_ac3_rematrix_band_tab[5];
extern const int16_t ff_ac3_window[AC3_WINDOW_SIZE/2];
extern const uint8_t ff_ac3_log_add_tab[260];
extern const uint16_t ff_ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3];
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c
index cce50bef4..c760fdcb5 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/allcodecs.c
@@ -70,6 +70,7 @@ void avcodec_register_all(void)
//REGISTER_ENCDEC (HUFFYUV, huffyuv);
//REGISTER_DECODER (INDEO2, indeo2);
//REGISTER_DECODER (INDEO3, indeo3);
+ //REGISTER_DECODER (INDEO5, indeo5);
//REGISTER_DECODER (JPEGLS, jpegls);
//REGISTER_ENCODER (LJPEG, ljpeg);
//REGISTER_DECODER (LOCO, loco);
@@ -148,6 +149,8 @@ void avcodec_register_all(void)
//REGISTER_DECODER (WMAV1, wmav1);
//REGISTER_DECODER (WMAV2, wmav2);
//REGISTER_DECODER (WAVPACK, wavpack);
+ //REGISTER_ENCODER (AC3, ac3);
+ //REGISTER_ENCODER (AC3_FIXED, ac3_fixed);
/* PCM codecs */
//REGISTER_DECODER (PCM_ALAW, pcm_alaw);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h
index a6358a7fb..43f308393 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/avcodec.h
@@ -46,7 +46,7 @@
#include "libavutil/cpu.h"
#define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 99
+#define LIBAVCODEC_VERSION_MINOR 103
#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -712,11 +712,11 @@ typedef struct AVPanScan{
int8_t *ref_index[2];\
\
/**\
- * reordered opaque 64bit (generally a integer or double preccission float \
+ * reordered opaque 64bit (generally an integer or a double precision float\
* PTS but can be anything). \
* The user sets AVCodecContext.reordered_opaque to represent the input at\
- * that time ,\
- * the decoder reorderes values as needed and sets AVFrame.reordered_opaque\
+ * that time,\
+ * the decoder reorders values as needed and sets AVFrame.reordered_opaque\
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque \
* - encoding: unused\
* - decoding: Read by user.\
@@ -1995,6 +1995,12 @@ typedef struct AVCodecContext {
#define FF_PROFILE_AAC_SSR 2
#define FF_PROFILE_AAC_LTP 3
+#define FF_PROFILE_DTS 20
+#define FF_PROFILE_DTS_ES 30
+#define FF_PROFILE_DTS_96_24 40
+#define FF_PROFILE_DTS_HD_HRA 50
+#define FF_PROFILE_DTS_HD_MA 60
+
#define FF_PROFILE_H264_BASELINE 66
#define FF_PROFILE_H264_MAIN 77
#define FF_PROFILE_H264_EXTENDED 88
@@ -2559,8 +2565,7 @@ typedef struct AVCodecContext {
int qmin_b,qmax_b;
float postgain;
- int ac3mode,ac3lfe;
- int ac3channels[6];
+ uint8_t ac3channels[6];
int nal_length_size;
int vorbis_header_size[3];
int64_t granulepos;
@@ -3370,18 +3375,6 @@ void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_s
*/
void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size);
-/* for static data only */
-
-/**
- * Frees all static arrays and resets their pointers to 0.
- * Call this function to release all statically allocated tables.
- *
- * @deprecated. Code which uses av_free_static is broken/misdesigned
- * and should correctly use static arrays
- *
- */
-attribute_deprecated void av_free_static(void);
-
#if LIBAVCODEC_VERSION_MAJOR < 53
/**
* @deprecated Deprecated in favor of av_image_copy().
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c
index 60da0d11e..358fb565d 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/dsputil.c
@@ -40,7 +40,6 @@
#include "ac3dec.h"
#include "vorbis.h"
#include "png.h"
-#include "vp8dsp.h"
uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
uint32_t ff_squareTbl[512] = {0, };
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c
index 25b2c7b14..d6f9a63f4 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264.c
@@ -1741,7 +1741,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if (s->context_initialized
&& ( s->width != s->avctx->width || s->height != s->avctx->height
- || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
+ || (s->avctx->sample_aspect_ratio.num && av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio)))) { //workaround to avoid crash with linked Matroska files, see fixme in line 1801
if(h != h0)
return -1; // width / height changed during parallelized decoding
free_tables(h);
@@ -1798,7 +1798,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
return -1;
}
- h->frame_num= get_bits(&s->gb, h->sps.log2_max_frame_num);
+ h->frame_num= get_bits(&s->gb, h->sps.log2_max_frame_num); // fixme: a crash occurs here with certain linked Matroska files if context is reset above
h->mb_mbaff = 0;
h->mb_aff_frame = 0;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c
index aad472b7d..c71291b22 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.c
@@ -80,6 +80,20 @@ static void pred4x4_128_dc_c(uint8_t *src, const uint8_t *topright, int stride){
((uint32_t*)(src+3*stride))[0]= 128U*0x01010101U;
}
+static void pred4x4_127_dc_c(uint8_t *src, const uint8_t *topright, int stride){
+ ((uint32_t*)(src+0*stride))[0]=
+ ((uint32_t*)(src+1*stride))[0]=
+ ((uint32_t*)(src+2*stride))[0]=
+ ((uint32_t*)(src+3*stride))[0]= 127U*0x01010101U;
+}
+
+static void pred4x4_129_dc_c(uint8_t *src, const uint8_t *topright, int stride){
+ ((uint32_t*)(src+0*stride))[0]=
+ ((uint32_t*)(src+1*stride))[0]=
+ ((uint32_t*)(src+2*stride))[0]=
+ ((uint32_t*)(src+3*stride))[0]= 129U*0x01010101U;
+}
+
#define LOAD_TOP_RIGHT_EDGE\
const int av_unused t4= topright[0];\
@@ -547,6 +561,28 @@ static void pred16x16_128_dc_c(uint8_t *src, int stride){
}
}
+static void pred16x16_127_dc_c(uint8_t *src, int stride){
+ int i;
+
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= 0x01010101U*127U;
+ }
+}
+
+static void pred16x16_129_dc_c(uint8_t *src, int stride){
+ int i;
+
+ for(i=0; i<16; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]=
+ ((uint32_t*)(src+i*stride))[2]=
+ ((uint32_t*)(src+i*stride))[3]= 0x01010101U*129U;
+ }
+}
+
static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int svq3, const int rv40){
int i, j, k;
int a;
@@ -658,6 +694,23 @@ static void pred8x8_128_dc_c(uint8_t *src, int stride){
}
}
+static void pred8x8_127_dc_c(uint8_t *src, int stride){
+ int i;
+
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= 0x01010101U*127U;
+ }
+}
+static void pred8x8_129_dc_c(uint8_t *src, int stride){
+ int i;
+
+ for(i=0; i<8; i++){
+ ((uint32_t*)(src+i*stride))[0]=
+ ((uint32_t*)(src+i*stride))[1]= 0x01010101U*129U;
+ }
+}
+
static void pred8x8_left_dc_c(uint8_t *src, int stride){
int i;
int dc0, dc2;
@@ -1210,11 +1263,17 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id){
} else
h->pred4x4[VERT_LEFT_PRED ]= pred4x4_vertical_left_c;
h->pred4x4[HOR_UP_PRED ]= pred4x4_horizontal_up_c;
- h->pred4x4[LEFT_DC_PRED ]= pred4x4_left_dc_c;
- h->pred4x4[TOP_DC_PRED ]= pred4x4_top_dc_c;
- h->pred4x4[DC_128_PRED ]= pred4x4_128_dc_c;
- if(codec_id == CODEC_ID_VP8)
+ if(codec_id != CODEC_ID_VP8) {
+ h->pred4x4[LEFT_DC_PRED ]= pred4x4_left_dc_c;
+ h->pred4x4[TOP_DC_PRED ]= pred4x4_top_dc_c;
+ h->pred4x4[DC_128_PRED ]= pred4x4_128_dc_c;
+ } else {
h->pred4x4[TM_VP8_PRED ]= pred4x4_tm_vp8_c;
+ h->pred4x4[DC_127_PRED ]= pred4x4_127_dc_c;
+ h->pred4x4[DC_129_PRED ]= pred4x4_129_dc_c;
+ h->pred4x4[VERT_VP8_PRED ]= pred4x4_vertical_c;
+ h->pred4x4[HOR_VP8_PRED ]= pred4x4_horizontal_c;
+ }
}else{
h->pred4x4[VERT_PRED ]= pred4x4_vertical_c;
h->pred4x4[HOR_PRED ]= pred4x4_horizontal_c;
@@ -1264,13 +1323,16 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id){
h->pred8x8[DC_PRED8x8 ]= pred8x8_dc_rv40_c;
h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_rv40_c;
h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_rv40_c;
+ if (codec_id == CODEC_ID_VP8) {
+ h->pred8x8[DC_127_PRED8x8]= pred8x8_127_dc_c;
+ h->pred8x8[DC_129_PRED8x8]= pred8x8_129_dc_c;
+ }
}
h->pred8x8[DC_128_PRED8x8 ]= pred8x8_128_dc_c;
h->pred16x16[DC_PRED8x8 ]= pred16x16_dc_c;
h->pred16x16[VERT_PRED8x8 ]= pred16x16_vertical_c;
h->pred16x16[HOR_PRED8x8 ]= pred16x16_horizontal_c;
- h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c;
switch(codec_id){
case CODEC_ID_SVQ3:
h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_svq3_c;
@@ -1280,9 +1342,12 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id){
break;
case CODEC_ID_VP8:
h->pred16x16[PLANE_PRED8x8 ]= pred16x16_tm_vp8_c;
+ h->pred16x16[DC_127_PRED8x8]= pred16x16_127_dc_c;
+ h->pred16x16[DC_129_PRED8x8]= pred16x16_129_dc_c;
break;
default:
h->pred16x16[PLANE_PRED8x8 ]= pred16x16_plane_c;
+ break;
}
h->pred16x16[LEFT_DC_PRED8x8]= pred16x16_left_dc_c;
h->pred16x16[TOP_DC_PRED8x8 ]= pred16x16_top_dc_c;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h
index 9ac1fec8b..5a3199798 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/h264pred.h
@@ -45,29 +45,45 @@
#define VERT_LEFT_PRED 7
#define HOR_UP_PRED 8
+// DC edge (not for VP8)
#define LEFT_DC_PRED 9
#define TOP_DC_PRED 10
#define DC_128_PRED 11
-#define TM_VP8_PRED 9 ///< "True Motion", used instead of plane
-
+// RV40 specific
#define DIAG_DOWN_LEFT_PRED_RV40_NODOWN 12
#define HOR_UP_PRED_RV40_NODOWN 13
#define VERT_LEFT_PRED_RV40_NODOWN 14
+// VP8 specific
+#define TM_VP8_PRED 9 ///< "True Motion", used instead of plane
+#define VERT_VP8_PRED 10 ///< for VP8, #VERT_PRED is the average of
+ ///< (left col+cur col x2+right col) / 4;
+ ///< this is the "unaveraged" one
+#define HOR_VP8_PRED 11 ///< unaveraged version of #HOR_PRED, see
+ ///< #VERT_VP8_PRED for details
+#define DC_127_PRED 12
+#define DC_129_PRED 13
+
#define DC_PRED8x8 0
#define HOR_PRED8x8 1
#define VERT_PRED8x8 2
#define PLANE_PRED8x8 3
+// DC edge
#define LEFT_DC_PRED8x8 4
#define TOP_DC_PRED8x8 5
#define DC_128_PRED8x8 6
+// H264/SVQ3 (8x8) specific
#define ALZHEIMER_DC_L0T_PRED8x8 7
#define ALZHEIMER_DC_0LT_PRED8x8 8
#define ALZHEIMER_DC_L00_PRED8x8 9
#define ALZHEIMER_DC_0L0_PRED8x8 10
+
+// VP8 specific
+#define DC_127_PRED8x8 7
+#define DC_129_PRED8x8 8
//@}
/**
@@ -77,7 +93,7 @@ typedef struct H264PredContext{
void (*pred4x4 [9+3+3])(uint8_t *src, const uint8_t *topright, int stride);//FIXME move to dsp?
void (*pred8x8l [9+3])(uint8_t *src, int topleft, int topright, int stride);
void (*pred8x8 [4+3+4])(uint8_t *src, int stride);
- void (*pred16x16[4+3])(uint8_t *src, int stride);
+ void (*pred16x16[4+3+2])(uint8_t *src, int stride);
void (*pred4x4_add [2])(uint8_t *pix/*align 4*/, const DCTELEM *block/*align 16*/, int stride);
void (*pred8x8l_add [2])(uint8_t *pix/*align 8*/, const DCTELEM *block/*align 16*/, int stride);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c
index 4f95fc1f1..b865b94b7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/intelh263dec.c
@@ -46,7 +46,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
skip_bits1(&s->gb); /* freeze picture release off */
format = get_bits(&s->gb, 3);
- if (format != 7) {
+ if (format == 0 || format == 6) {
av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n");
return -1;
}
@@ -64,7 +64,12 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
s->obmc= get_bits1(&s->gb);
s->pb_frame = get_bits1(&s->gb);
- if(format == 7){
+ if (format < 6) {
+ s->width = h263_format[format][0];
+ s->height = h263_format[format][1];
+ s->avctx->sample_aspect_ratio.num=12;s->avctx->sample_aspect_ratio.den=11;
+ }
+ else {
format = get_bits(&s->gb, 3);
if(format == 0 || format == 7){
av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n");
@@ -88,9 +93,14 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
skip_bits1(&s->gb);
skip_bits(&s->gb, 9); // display height
if(ar == 15){
- skip_bits(&s->gb, 8); // aspect ratio - width
- skip_bits(&s->gb, 8); // aspect ratio - height
+ s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 8); // aspect ratio - width
+ s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 8); // aspect ratio - height
+ }
+ else {
+ s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[ar];
}
+ if(s->avctx->sample_aspect_ratio.num == 0)
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid aspect ratio\n");
}
s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c
index 6aab625c8..a5b68515a 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.c
@@ -135,6 +135,9 @@ void ff_mpeg1_clean_buffers(MpegEncContext *s){
/******************************************/
/* decoding */
+VLC ff_dc_lum_vlc;
+VLC ff_dc_chroma_vlc;
+
static VLC mv_vlc;
static VLC mbincr_vlc;
static VLC mb_ptype_vlc;
@@ -148,10 +151,10 @@ av_cold void ff_mpeg12_init_vlcs(void)
if (!done) {
done = 1;
- INIT_VLC_STATIC(&dc_lum_vlc, DC_VLC_BITS, 12,
+ INIT_VLC_STATIC(&ff_dc_lum_vlc, DC_VLC_BITS, 12,
ff_mpeg12_vlc_dc_lum_bits, 1, 1,
ff_mpeg12_vlc_dc_lum_code, 2, 2, 512);
- INIT_VLC_STATIC(&dc_chroma_vlc, DC_VLC_BITS, 12,
+ INIT_VLC_STATIC(&ff_dc_chroma_vlc, DC_VLC_BITS, 12,
ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514);
INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 17,
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h
index 30bb675d3..541b66bd9 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg12.h
@@ -27,8 +27,8 @@
#define DC_VLC_BITS 9
#define TEX_VLC_BITS 9
-static VLC dc_lum_vlc;
-static VLC dc_chroma_vlc;
+extern VLC ff_dc_lum_vlc;
+extern VLC ff_dc_chroma_vlc;
extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
@@ -40,9 +40,9 @@ static inline int decode_dc(GetBitContext *gb, int component)
int code, diff;
if (component == 0) {
- code = get_vlc2(gb, dc_lum_vlc.table, DC_VLC_BITS, 2);
+ code = get_vlc2(gb, ff_dc_lum_vlc.table, DC_VLC_BITS, 2);
} else {
- code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2);
+ code = get_vlc2(gb, ff_dc_chroma_vlc.table, DC_VLC_BITS, 2);
}
if (code < 0){
av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c
index 539d3a451..1263ef141 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpeg4videodec.c
@@ -1575,6 +1575,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
s->avctx->time_base.den = get_bits(gb, 16);
if(!s->avctx->time_base.den){
av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n");
+ s->avctx->time_base.num = 0;
return -1;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c
index 65b8f9c9d..110e5c739 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/mpegvideo.c
@@ -950,13 +950,11 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
s->current_picture_ptr= pic;
//FIXME use only the vars from current_pic
+ s->current_picture_ptr->top_field_first= s->top_field_first;
if(s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) {
- if(s->picture_structure == PICT_FRAME)
- s->current_picture_ptr->top_field_first= s->top_field_first;
- else
+ if(s->picture_structure != PICT_FRAME)
s->current_picture_ptr->top_field_first= (s->picture_structure == PICT_TOP_FIELD) == s->first_field;
- } else
- s->current_picture_ptr->top_field_first= s->top_field_first;
+ }
s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c
index 588b81aac..06ffd6b8c 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/utils.c
@@ -74,19 +74,6 @@ void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_siz
*size= min_size;
}
-/* ffdshow custom code (begin) */
-static unsigned int last_static = 0;
-static void** array_static = NULL;
-
-void av_free_static(void)
-{
- while(last_static){
- av_freep(&array_static[--last_static]);
- }
- av_freep(&array_static);
-}
-/* ffdshow custom code (end) */
-
/* encoder management */
static AVCodec *first_avcodec = NULL;
@@ -182,8 +169,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int l
*width = FFALIGN(*width , w_align);
*height= FFALIGN(*height, h_align);
- if(s->codec_id == CODEC_ID_H264)
+ if(s->codec_id == CODEC_ID_H264 || s->lowres)
*height+=2; // some of the optimized chroma MC reads one line too much
+ // which is also done in mpeg decoders with lowres > 0
linesize_align[0] =
linesize_align[1] =
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8.c
index de97489a8..1abf500c7 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8.c
@@ -983,14 +983,91 @@ void xchg_mb_border(uint8_t *top_border, uint8_t *src_y, uint8_t *src_cb, uint8_
}
static av_always_inline
-int check_intra_pred_mode(int mode, int mb_x, int mb_y)
+int check_dc_pred8x8_mode(int mode, int mb_x, int mb_y)
+{
+ if (!mb_x) {
+ return mb_y ? TOP_DC_PRED8x8 : DC_128_PRED8x8;
+ } else {
+ return mb_y ? mode : LEFT_DC_PRED8x8;
+ }
+}
+
+static av_always_inline
+int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y)
+{
+ if (!mb_x) {
+ return mb_y ? VERT_PRED8x8 : DC_129_PRED8x8;
+ } else {
+ return mb_y ? mode : HOR_PRED8x8;
+ }
+}
+
+static av_always_inline
+int check_intra_pred8x8_mode(int mode, int mb_x, int mb_y)
{
if (mode == DC_PRED8x8) {
- if (!mb_x) {
- mode = mb_y ? TOP_DC_PRED8x8 : DC_128_PRED8x8;
- } else if (!mb_y) {
- mode = LEFT_DC_PRED8x8;
+ return check_dc_pred8x8_mode(mode, mb_x, mb_y);
+ } else {
+ return mode;
+ }
+}
+
+static av_always_inline
+int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y)
+{
+ switch (mode) {
+ case DC_PRED8x8:
+ return check_dc_pred8x8_mode(mode, mb_x, mb_y);
+ case VERT_PRED8x8:
+ return !mb_y ? DC_127_PRED8x8 : mode;
+ case HOR_PRED8x8:
+ return !mb_x ? DC_129_PRED8x8 : mode;
+ case PLANE_PRED8x8 /*TM*/:
+ return check_tm_pred8x8_mode(mode, mb_x, mb_y);
+ }
+ return mode;
+}
+
+static av_always_inline
+int check_tm_pred4x4_mode(int mode, int mb_x, int mb_y)
+{
+ if (!mb_x) {
+ return mb_y ? VERT_VP8_PRED : DC_129_PRED;
+ } else {
+ return mb_y ? mode : HOR_VP8_PRED;
+ }
+}
+
+static av_always_inline
+int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf)
+{
+ switch (mode) {
+ case VERT_PRED:
+ if (!mb_x && mb_y) {
+ *copy_buf = 1;
+ return mode;
+ }
+ /* fall-through */
+ case DIAG_DOWN_LEFT_PRED:
+ case VERT_LEFT_PRED:
+ return !mb_y ? DC_127_PRED : mode;
+ case HOR_PRED:
+ if (!mb_y) {
+ *copy_buf = 1;
+ return mode;
}
+ /* fall-through */
+ case HOR_UP_PRED:
+ return !mb_x ? DC_129_PRED : mode;
+ case TM_VP8_PRED:
+ return check_tm_pred4x4_mode(mode, mb_x, mb_y);
+ case DC_PRED: // 4x4 DC doesn't use the same "H.264-style" exceptions as 16x16/8x8 DC
+ case DIAG_DOWN_RIGHT_PRED:
+ case VERT_RIGHT_PRED:
+ case HOR_DOWN_PRED:
+ if (!mb_y || !mb_x)
+ *copy_buf = 1;
+ return mode;
}
return mode;
}
@@ -999,21 +1076,27 @@ static av_always_inline
void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
int mb_x, int mb_y)
{
+ AVCodecContext *avctx = s->avctx;
int x, y, mode, nnz, tr;
// for the first row, we need to run xchg_mb_border to init the top edge to 127
// otherwise, skip it if we aren't going to deblock
- if (s->deblock_filter || !mb_y)
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y))
xchg_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2],
s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,
s->filter.simple, 1);
if (mb->mode < MODE_I4x4) {
- mode = check_intra_pred_mode(mb->mode, mb_x, mb_y);
+ if (avctx->flags & CODEC_FLAG_EMU_EDGE) { // tested
+ mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y);
+ } else {
+ mode = check_intra_pred8x8_mode(mb->mode, mb_x, mb_y);
+ }
s->hpc.pred16x16[mode](dst[0], s->linesize);
} else {
uint8_t *ptr = dst[0];
uint8_t *intra4x4 = s->intra4x4_pred_mode_mb;
+ uint8_t tr_top[4] = { 127, 127, 127, 127 };
// all blocks on the right edge of the macroblock use bottom edge
// the top macroblock for their topright edge
@@ -1021,7 +1104,8 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
// if we're on the right edge of the frame, said edge is extended
// from the top macroblock
- if (mb_x == s->mb_width-1) {
+ if (!(!mb_y && avctx->flags & CODEC_FLAG_EMU_EDGE) &&
+ mb_x == s->mb_width-1) {
tr = tr_right[-1]*0x01010101;
tr_right = (uint8_t *)&tr;
}
@@ -1032,10 +1116,53 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
for (y = 0; y < 4; y++) {
uint8_t *topright = ptr + 4 - s->linesize;
for (x = 0; x < 4; x++) {
- if (x == 3)
+ int copy = 0, linesize = s->linesize;
+ uint8_t *dst = ptr+4*x;
+ DECLARE_ALIGNED(4, uint8_t, copy_dst)[5*8];
+
+ if ((y == 0 || x == 3) && mb_y == 0 && avctx->flags & CODEC_FLAG_EMU_EDGE) {
+ topright = tr_top;
+ } else if (x == 3)
topright = tr_right;
- s->hpc.pred4x4[intra4x4[x]](ptr+4*x, topright, s->linesize);
+ if (avctx->flags & CODEC_FLAG_EMU_EDGE) { // mb_x+x or mb_y+y is a hack but works
+ mode = check_intra_pred4x4_mode_emuedge(intra4x4[x], mb_x + x, mb_y + y, &copy);
+ if (copy) {
+ dst = copy_dst + 12;
+ linesize = 8;
+ if (!(mb_y + y)) {
+ copy_dst[3] = 127U;
+ * (uint32_t *) (copy_dst + 4) = 127U * 0x01010101U;
+ } else {
+ * (uint32_t *) (copy_dst + 4) = * (uint32_t *) (ptr+4*x-s->linesize);
+ if (!(mb_x + x)) {
+ copy_dst[3] = 129U;
+ } else {
+ copy_dst[3] = ptr[4*x-s->linesize-1];
+ }
+ }
+ if (!(mb_x + x)) {
+ copy_dst[11] =
+ copy_dst[19] =
+ copy_dst[27] =
+ copy_dst[35] = 129U;
+ } else {
+ copy_dst[11] = ptr[4*x -1];
+ copy_dst[19] = ptr[4*x+s->linesize -1];
+ copy_dst[27] = ptr[4*x+s->linesize*2-1];
+ copy_dst[35] = ptr[4*x+s->linesize*3-1];
+ }
+ }
+ } else {
+ mode = intra4x4[x];
+ }
+ s->hpc.pred4x4[mode](dst, topright, linesize);
+ if (copy) {
+ * (uint32_t *) (ptr+4*x) = * (uint32_t *) (copy_dst + 12);
+ * (uint32_t *) (ptr+4*x+s->linesize) = * (uint32_t *) (copy_dst + 20);
+ * (uint32_t *) (ptr+4*x+s->linesize*2) = * (uint32_t *) (copy_dst + 28);
+ * (uint32_t *) (ptr+4*x+s->linesize*3) = * (uint32_t *) (copy_dst + 36);
+ }
nnz = s->non_zero_count_cache[y][x];
if (nnz) {
@@ -1052,11 +1179,15 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
}
}
- mode = check_intra_pred_mode(s->chroma_pred_mode, mb_x, mb_y);
+ if (avctx->flags & CODEC_FLAG_EMU_EDGE) {
+ mode = check_intra_pred8x8_mode_emuedge(s->chroma_pred_mode, mb_x, mb_y);
+ } else {
+ mode = check_intra_pred8x8_mode(s->chroma_pred_mode, mb_x, mb_y);
+ }
s->hpc.pred8x8[mode](dst[1], s->uvlinesize);
s->hpc.pred8x8[mode](dst[2], s->uvlinesize);
- if (s->deblock_filter || !mb_y)
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE && !mb_y) && (s->deblock_filter || !mb_y))
xchg_mb_border(s->top_border[mb_x+1], dst[0], dst[1], dst[2],
s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,
s->filter.simple, 0);
@@ -1533,7 +1664,10 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks));
// top edge of 127 for intra prediction
- memset(s->top_border, 127, (s->mb_width+1)*sizeof(*s->top_border));
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
+ s->top_border[0][15] = s->top_border[0][23] = 127;
+ memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1);
+ }
memset(s->ref_count, 0, sizeof(s->ref_count));
if (s->keyframe)
memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4);
@@ -1553,12 +1687,13 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101);
// left edge of 129 for intra prediction
- if (!(avctx->flags & CODEC_FLAG_EMU_EDGE))
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
for (i = 0; i < 3; i++)
for (y = 0; y < 16>>!!i; y++)
dst[i][y*curframe->linesize[i]-1] = 129;
- if (mb_y)
- memset(s->top_border, 129, sizeof(*s->top_border));
+ if (mb_y == 1) // top left edge is also 129
+ s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129;
+ }
for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
/* Prefetch the current frame, 4 MBs ahead */
@@ -1658,12 +1793,6 @@ static av_cold int vp8_decode_init(AVCodecContext *avctx)
ff_h264_pred_init(&s->hpc, CODEC_ID_VP8);
ff_vp8dsp_init(&s->vp8dsp);
- // intra pred needs edge emulation among other things
- if (avctx->flags&CODEC_FLAG_EMU_EDGE) {
- av_log(avctx, AV_LOG_ERROR, "Edge emulation not supported\n");
- return AVERROR_PATCHWELCOME;
- }
-
return 0;
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c
index 407b9355b..75592f5ef 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/wmv2dec.c
@@ -87,7 +87,7 @@ static int decode_ext_header(Wmv2Context *w){
if(s->avctx->extradata_size<4) return -1;
- init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);
+ init_get_bits(&gb, s->avctx->extradata, 32);
fps = get_bits(&gb, 5);
s->bit_rate = get_bits(&gb, 11)*1024;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/config.asm b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/config.asm
index 8efc2c533..8a9faa117 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/config.asm
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/config.asm
@@ -1 +1,2 @@
-%define ARCH_X86
+%define ARCH_X86 1
+%define CONFIG_GPL 1
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c
index 8c19b170d..1a6675f0b 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.c
@@ -41,7 +41,7 @@ DECLARE_ALIGNED(8, const uint64_t, ff_wtwo) = 0x0002000200020002ULL;
DECLARE_ALIGNED(16, const uint64_t, ff_pdw_80000000)[2] =
{0x8000000080000000ULL, 0x8000000080000000ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_3 ) = 0x0003000300030003ULL;
+DECLARE_ALIGNED(8, const xmm_reg, ff_pw_3 ) = {0x0003000300030003ULL, 0x0003000300030003ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_4 ) = {0x0004000400040004ULL, 0x0004000400040004ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5 ) = {0x0005000500050005ULL, 0x0005000500050005ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8 ) = {0x0008000800080008ULL, 0x0008000800080008ULL};
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h
index 58256fd40..3259bb4c0 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/dsputil_mmx.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "libavcodec/dsputil.h"
+#include "libavutil/x86_cpu.h"
typedef struct { uint64_t a, b; } xmm_reg;
@@ -32,7 +33,7 @@ extern const uint64_t ff_wtwo;
extern const uint64_t ff_pdw_80000000[2];
-extern const uint64_t ff_pw_3;
+extern const xmm_reg ff_pw_3;
extern const xmm_reg ff_pw_4;
extern const xmm_reg ff_pw_5;
extern const xmm_reg ff_pw_8;
@@ -94,32 +95,31 @@ extern const double ff_pd_2[2];
SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
-static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){
+static inline void transpose4x4(uint8_t *dst, uint8_t *src, x86_reg dst_stride, x86_reg src_stride){
__asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ...
- "movd %4, %%mm0 \n\t"
- "movd %5, %%mm1 \n\t"
- "movd %6, %%mm2 \n\t"
- "movd %7, %%mm3 \n\t"
+ "movd (%1), %%mm0 \n\t"
+ "add %3, %1 \n\t"
+ "movd (%1), %%mm1 \n\t"
+ "movd (%1,%3,1), %%mm2 \n\t"
+ "movd (%1,%3,2), %%mm3 \n\t"
"punpcklbw %%mm1, %%mm0 \n\t"
"punpcklbw %%mm3, %%mm2 \n\t"
"movq %%mm0, %%mm1 \n\t"
"punpcklwd %%mm2, %%mm0 \n\t"
"punpckhwd %%mm2, %%mm1 \n\t"
- "movd %%mm0, %0 \n\t"
+ "movd %%mm0, (%0) \n\t"
+ "add %2, %0 \n\t"
"punpckhdq %%mm0, %%mm0 \n\t"
- "movd %%mm0, %1 \n\t"
- "movd %%mm1, %2 \n\t"
+ "movd %%mm0, (%0) \n\t"
+ "movd %%mm1, (%0,%2,1) \n\t"
"punpckhdq %%mm1, %%mm1 \n\t"
- "movd %%mm1, %3 \n\t"
-
- : "=m" (*(uint32_t*)(dst + 0*dst_stride)),
- "=m" (*(uint32_t*)(dst + 1*dst_stride)),
- "=m" (*(uint32_t*)(dst + 2*dst_stride)),
- "=m" (*(uint32_t*)(dst + 3*dst_stride))
- : "m" (*(uint32_t*)(src + 0*src_stride)),
- "m" (*(uint32_t*)(src + 1*src_stride)),
- "m" (*(uint32_t*)(src + 2*src_stride)),
- "m" (*(uint32_t*)(src + 3*src_stride))
+ "movd %%mm1, (%0,%2,2) \n\t"
+
+ : "+&r" (dst),
+ "+&r" (src)
+ : "r" (dst_stride),
+ "r" (src_stride)
+ : "memory"
);
}
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_chromamc.asm b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_chromamc.asm
index 6df82cc52..3bb5ed485 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_chromamc.asm
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_chromamc.asm
@@ -530,9 +530,8 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
add r4, 8
sub r4, r5 ; 255*x+8 = x<<8 | (8-x)
movd m7, r4d
- movq m6, [rnd_1d_%2]
+ movdqa m6, [rnd_1d_%2]
pshuflw m7, m7, 0
- movlhps m6, m6
movlhps m7, m7
.next2xrows
@@ -568,9 +567,8 @@ cglobal %1_%2_chroma_mc8_%3, 6, 7, 8
add r5, 8
sub r5, r4 ; 255*y+8 = y<<8 | (8-y)
movd m7, r5d
- movq m6, [rnd_1d_%2]
+ movdqa m6, [rnd_1d_%2]
pshuflw m7, m7, 0
- movlhps m6, m6
movlhps m7, m7
.next2yrows
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred.asm b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred.asm
index 7d3ef9555..52e691df8 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred.asm
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred.asm
@@ -1,6 +1,9 @@
;******************************************************************************
;* H.264 intra prediction asm optimizations
;* Copyright (c) 2010 Jason Garrett-Glaser
+;* Copyright (c) 2010 Holger Lubitz
+;* Copyright (c) 2010 Loren Merritt
+;* Copyright (c) 2010 Ronald S. Bultje
;*
;* This file is part of FFmpeg.
;*
@@ -20,10 +23,12 @@
;******************************************************************************
%include "x86inc.asm"
+%include "x86util.asm"
SECTION_RODATA
tm_shuf: times 8 db 0x03, 0x80
+pw_ff00: times 8 dw 0xff00
plane_shuf: db -8, -7, -6, -5, -4, -3, -2, -1
db 1, 2, 3, 4, 5, 6, 7, 8
plane8_shuf: db -4, -3, -2, -1, 0, 0, 0, 0
@@ -37,7 +42,9 @@ SECTION .text
cextern pb_1
cextern pb_3
+cextern pw_4
cextern pw_5
+cextern pw_8
cextern pw_16
cextern pw_17
cextern pw_32
@@ -828,6 +835,102 @@ PRED8x8_H mmxext
PRED8x8_H ssse3
;-----------------------------------------------------------------------------
+; void pred8x8_top_dc_mmxext(uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%ifdef CONFIG_GPL
+cglobal pred8x8_top_dc_mmxext, 2,5
+ sub r0, r1
+ movq mm0, [r0]
+ pxor mm1, mm1
+ pxor mm2, mm2
+ lea r2, [r0+r1*2]
+ punpckhbw mm1, mm0
+ punpcklbw mm0, mm2
+ psadbw mm1, mm2 ; s1
+ lea r3, [r2+r1*2]
+ psadbw mm0, mm2 ; s0
+ psrlw mm1, 1
+ psrlw mm0, 1
+ pavgw mm1, mm2
+ lea r4, [r3+r1*2]
+ pavgw mm0, mm2
+ pshufw mm1, mm1, 0
+ pshufw mm0, mm0, 0 ; dc0 (w)
+ packuswb mm0, mm1 ; dc0,dc1 (b)
+ movq [r0+r1*1], mm0
+ movq [r0+r1*2], mm0
+ lea r0, [r3+r1*2]
+ movq [r2+r1*1], mm0
+ movq [r2+r1*2], mm0
+ movq [r3+r1*1], mm0
+ movq [r3+r1*2], mm0
+ movq [r0+r1*1], mm0
+ movq [r0+r1*2], mm0
+ RET
+
+;-----------------------------------------------------------------------------
+; void pred8x8_dc_mmxext(uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+cglobal pred8x8_dc_mmxext, 2,5
+ sub r0, r1
+ pxor m7, m7
+ movd m0, [r0+0]
+ movd m1, [r0+4]
+ psadbw m0, m7 ; s0
+ mov r4, r0
+ psadbw m1, m7 ; s1
+
+ movzx r2d, byte [r0+r1*1-1]
+ movzx r3d, byte [r0+r1*2-1]
+ lea r0, [r0+r1*2]
+ add r2d, r3d
+ movzx r3d, byte [r0+r1*1-1]
+ add r2d, r3d
+ movzx r3d, byte [r0+r1*2-1]
+ add r2d, r3d
+ lea r0, [r0+r1*2]
+ movd m2, r2d ; s2
+ movzx r2d, byte [r0+r1*1-1]
+ movzx r3d, byte [r0+r1*2-1]
+ lea r0, [r0+r1*2]
+ add r2d, r3d
+ movzx r3d, byte [r0+r1*1-1]
+ add r2d, r3d
+ movzx r3d, byte [r0+r1*2-1]
+ add r2d, r3d
+ movd m3, r2d ; s3
+
+ punpcklwd m0, m1
+ mov r0, r4
+ punpcklwd m2, m3
+ punpckldq m0, m2 ; s0, s1, s2, s3
+ pshufw m3, m0, 11110110b ; s2, s1, s3, s3
+ lea r2, [r0+r1*2]
+ pshufw m0, m0, 01110100b ; s0, s1, s3, s1
+ paddw m0, m3
+ lea r3, [r2+r1*2]
+ psrlw m0, 2
+ pavgw m0, m7 ; s0+s2, s1, s3, s1+s3
+ lea r4, [r3+r1*2]
+ packuswb m0, m0
+ punpcklbw m0, m0
+ movq m1, m0
+ punpcklbw m0, m0
+ punpckhbw m1, m1
+ movq [r0+r1*1], m0
+ movq [r0+r1*2], m0
+ movq [r2+r1*1], m0
+ movq [r2+r1*2], m0
+ movq [r3+r1*1], m1
+ movq [r3+r1*2], m1
+ movq [r4+r1*1], m1
+ movq [r4+r1*2], m1
+ RET
+%endif
+
+;-----------------------------------------------------------------------------
; void pred8x8_dc_rv40(uint8_t *src, int stride)
;-----------------------------------------------------------------------------
@@ -966,6 +1069,1428 @@ cglobal pred8x8_tm_vp8_ssse3, 2,3,6
jg .loop
REP_RET
+; dest, left, right, src, tmp
+; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
+%macro PRED4x4_LOWPASS 5
+ mova %5, %2
+ pavgb %2, %3
+ pxor %3, %5
+ mova %1, %4
+ pand %3, [pb_1]
+ psubusb %2, %3
+ pavgb %1, %2
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_top_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%ifdef CONFIG_GPL
+%macro PRED8x8L_TOP_DC 1
+cglobal pred8x8l_top_dc_%1, 4,4
+ sub r0, r3
+ pxor mm7, mm7
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+ jmp .body
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2 ; top_right
+ jnz .body
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+.body
+ PRED4x4_LOWPASS mm0, mm2, mm1, mm3, mm5
+ psadbw mm7, mm0
+ paddw mm7, [pw_4]
+ psrlw mm7, 3
+ pshufw mm7, mm7, 0
+ packuswb mm7, mm7
+%rep 3
+ movq [r0+r3*1], mm7
+ movq [r0+r3*2], mm7
+ lea r0, [r0+r3*2]
+%endrep
+ movq [r0+r3*1], mm7
+ movq [r0+r3*2], mm7
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_TOP_DC mmxext
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_TOP_DC ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_dc(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+%macro PRED8x8L_DC 1
+cglobal pred8x8l_dc_%1, 4,5
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jnz .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .body
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .body
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm4, mm0
+ movq mm7, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ psllq mm1, 56
+ PALIGNR mm7, mm1, 7, mm3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.body
+ lea r1, [r0+r3*2]
+ PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
+ pxor mm0, mm0
+ pxor mm1, mm1
+ lea r2, [r1+r3*2]
+ psadbw mm0, mm7
+ psadbw mm1, mm6
+ paddw mm0, [pw_8]
+ paddw mm0, mm1
+ lea r4, [r2+r3*2]
+ psrlw mm0, 4
+ pshufw mm0, mm0, 0
+ packuswb mm0, mm0
+ movq [r0+r3*1], mm0
+ movq [r0+r3*2], mm0
+ movq [r1+r3*1], mm0
+ movq [r1+r3*2], mm0
+ movq [r2+r3*1], mm0
+ movq [r2+r3*2], mm0
+ movq [r4+r3*1], mm0
+ movq [r4+r3*2], mm0
+ RET
+%endmacro
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_DC mmxext
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_DC ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_horizontal(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+%macro PRED8x8L_HORIZONTAL 1
+cglobal pred8x8l_horizontal_%1, 4,4
+ sub r0, r3
+ lea r2, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r2+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r2, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r2]
+ mov r0, r2
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1 ; top_left
+ jnz .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm4, mm0
+ movq mm7, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ psllq mm1, 56
+ PALIGNR mm7, mm1, 7, mm3
+ movq mm3, mm7
+ lea r1, [r0+r3*2]
+ movq mm7, mm3
+ punpckhbw mm3, mm3
+ punpcklbw mm7, mm7
+ pshufw mm0, mm3, 0xff
+ pshufw mm1, mm3, 0xaa
+ lea r2, [r1+r3*2]
+ pshufw mm2, mm3, 0x55
+ pshufw mm3, mm3, 0x00
+ pshufw mm4, mm7, 0xff
+ pshufw mm5, mm7, 0xaa
+ pshufw mm6, mm7, 0x55
+ pshufw mm7, mm7, 0x00
+ movq [r0+r3*1], mm0
+ movq [r0+r3*2], mm1
+ movq [r1+r3*1], mm2
+ movq [r1+r3*2], mm3
+ movq [r2+r3*1], mm4
+ movq [r2+r3*2], mm5
+ lea r0, [r2+r3*2]
+ movq [r0+r3*1], mm6
+ movq [r0+r3*2], mm7
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_HORIZONTAL mmxext
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_HORIZONTAL ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_vertical(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+%macro PRED8x8L_VERTICAL 1
+cglobal pred8x8l_vertical_%1, 4,4
+ sub r0, r3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+ jmp .body
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2 ; top_right
+ jnz .body
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+.body
+ PRED4x4_LOWPASS mm0, mm2, mm1, mm3, mm5
+%rep 3
+ movq [r0+r3*1], mm0
+ movq [r0+r3*2], mm0
+ lea r0, [r0+r3*2]
+%endrep
+ movq [r0+r3*1], mm0
+ movq [r0+r3*2], mm0
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_VERTICAL mmxext
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_VERTICAL ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_down_left(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred8x8l_down_left_mmxext, 4,5
+ sub r0, r3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+ jmp .do_top
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.fix_tr_2:
+ punpckhbw mm3, mm3
+ pshufw mm1, mm3, 0xFF
+ jmp .do_topright
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq mm7, mm4
+ test r2, r2
+ jz .fix_tr_2
+ movq mm0, [r0+8]
+ movq mm5, mm0
+ movq mm2, mm0
+ movq mm4, mm0
+ psrlq mm5, 56
+ PALIGNR mm2, mm3, 7, mm3
+ PALIGNR mm5, mm4, 1, mm4
+ PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
+.do_topright:
+ lea r1, [r0+r3*2]
+ movq mm6, mm1
+ psrlq mm1, 56
+ movq mm4, mm1
+ lea r2, [r1+r3*2]
+ movq mm2, mm6
+ PALIGNR mm2, mm7, 1, mm0
+ movq mm3, mm6
+ PALIGNR mm3, mm7, 7, mm0
+ PALIGNR mm4, mm6, 1, mm0
+ movq mm5, mm7
+ movq mm1, mm7
+ movq mm7, mm6
+ lea r4, [r2+r3*2]
+ psllq mm1, 8
+ PRED4x4_LOWPASS mm0, mm1, mm2, mm5, mm6
+ PRED4x4_LOWPASS mm1, mm3, mm4, mm7, mm6
+ movq [r4+r3*2], mm1
+ movq mm2, mm0
+ psllq mm1, 8
+ psrlq mm2, 56
+ psllq mm0, 8
+ por mm1, mm2
+ movq [r4+r3*1], mm1
+ movq mm2, mm0
+ psllq mm1, 8
+ psrlq mm2, 56
+ psllq mm0, 8
+ por mm1, mm2
+ movq [r2+r3*2], mm1
+ movq mm2, mm0
+ psllq mm1, 8
+ psrlq mm2, 56
+ psllq mm0, 8
+ por mm1, mm2
+ movq [r2+r3*1], mm1
+ movq mm2, mm0
+ psllq mm1, 8
+ psrlq mm2, 56
+ psllq mm0, 8
+ por mm1, mm2
+ movq [r1+r3*2], mm1
+ movq mm2, mm0
+ psllq mm1, 8
+ psrlq mm2, 56
+ psllq mm0, 8
+ por mm1, mm2
+ movq [r1+r3*1], mm1
+ movq mm2, mm0
+ psllq mm1, 8
+ psrlq mm2, 56
+ psllq mm0, 8
+ por mm1, mm2
+ movq [r0+r3*2], mm1
+ psllq mm1, 8
+ psrlq mm0, 56
+ por mm1, mm0
+ movq [r0+r3*1], mm1
+ RET
+
+%macro PRED8x8L_DOWN_LEFT 1
+cglobal pred8x8l_down_left_%1, 4,4
+ sub r0, r3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+ jmp .do_top
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2 ; top_right
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.fix_tr_2:
+ punpckhbw mm3, mm3
+ pshufw mm1, mm3, 0xFF
+ jmp .do_topright
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq2dq xmm3, mm4
+ test r2, r2 ; top_right
+ jz .fix_tr_2
+ movq mm0, [r0+8]
+ movq mm5, mm0
+ movq mm2, mm0
+ movq mm4, mm0
+ psrlq mm5, 56
+ PALIGNR mm2, mm3, 7, mm3
+ PALIGNR mm5, mm4, 1, mm4
+ PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
+.do_topright:
+ movq2dq xmm4, mm1
+ psrlq mm1, 56
+ movq2dq xmm5, mm1
+ lea r1, [r0+r3*2]
+ pslldq xmm4, 8
+ por xmm3, xmm4
+ movdqa xmm2, xmm3
+ psrldq xmm2, 1
+ pslldq xmm5, 15
+ por xmm2, xmm5
+ lea r2, [r1+r3*2]
+ movdqa xmm1, xmm3
+ pslldq xmm1, 1
+INIT_XMM
+ PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm4
+ psrldq xmm0, 1
+ movq [r0+r3*1], xmm0
+ psrldq xmm0, 1
+ movq [r0+r3*2], xmm0
+ psrldq xmm0, 1
+ lea r0, [r2+r3*2]
+ movq [r1+r3*1], xmm0
+ psrldq xmm0, 1
+ movq [r1+r3*2], xmm0
+ psrldq xmm0, 1
+ movq [r2+r3*1], xmm0
+ psrldq xmm0, 1
+ movq [r2+r3*2], xmm0
+ psrldq xmm0, 1
+ movq [r0+r3*1], xmm0
+ psrldq xmm0, 1
+ movq [r0+r3*2], xmm0
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_DOWN_LEFT sse2
+INIT_MMX
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_DOWN_LEFT ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_down_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred8x8l_down_right_mmxext, 4,5
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1 ; top_left
+ jz .fix_lt_1
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm4, mm0
+ movq mm7, mm2
+ movq mm6, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ psllq mm1, 56
+ PALIGNR mm7, mm1, 7, mm3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq mm5, mm4
+ jmp .body
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2 ; top_right
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.body
+ lea r1, [r0+r3*2]
+ movq mm1, mm7
+ movq mm7, mm5
+ movq mm5, mm6
+ movq mm2, mm7
+ lea r2, [r1+r3*2]
+ PALIGNR mm2, mm6, 1, mm0
+ movq mm3, mm7
+ PALIGNR mm3, mm6, 7, mm0
+ movq mm4, mm7
+ lea r4, [r2+r3*2]
+ psrlq mm4, 8
+ PRED4x4_LOWPASS mm0, mm1, mm2, mm5, mm6
+ PRED4x4_LOWPASS mm1, mm3, mm4, mm7, mm6
+ movq [r4+r3*2], mm0
+ movq mm2, mm1
+ psrlq mm0, 8
+ psllq mm2, 56
+ psrlq mm1, 8
+ por mm0, mm2
+ movq [r4+r3*1], mm0
+ movq mm2, mm1
+ psrlq mm0, 8
+ psllq mm2, 56
+ psrlq mm1, 8
+ por mm0, mm2
+ movq [r2+r3*2], mm0
+ movq mm2, mm1
+ psrlq mm0, 8
+ psllq mm2, 56
+ psrlq mm1, 8
+ por mm0, mm2
+ movq [r2+r3*1], mm0
+ movq mm2, mm1
+ psrlq mm0, 8
+ psllq mm2, 56
+ psrlq mm1, 8
+ por mm0, mm2
+ movq [r1+r3*2], mm0
+ movq mm2, mm1
+ psrlq mm0, 8
+ psllq mm2, 56
+ psrlq mm1, 8
+ por mm0, mm2
+ movq [r1+r3*1], mm0
+ movq mm2, mm1
+ psrlq mm0, 8
+ psllq mm2, 56
+ psrlq mm1, 8
+ por mm0, mm2
+ movq [r0+r3*2], mm0
+ psrlq mm0, 8
+ psllq mm1, 56
+ por mm0, mm1
+ movq [r0+r3*1], mm0
+ RET
+
+%macro PRED8x8L_DOWN_RIGHT 1
+cglobal pred8x8l_down_right_%1, 4,5
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jz .fix_lt_1
+ jmp .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm4, mm0
+ movq mm7, mm2
+ movq2dq xmm3, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ psllq mm1, 56
+ PALIGNR mm7, mm1, 7, mm3
+ movq2dq xmm1, mm7
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq2dq xmm4, mm4
+ lea r1, [r0+r3*2]
+ movdqa xmm0, xmm3
+ pslldq xmm4, 8
+ por xmm3, xmm4
+ lea r2, [r1+r3*2]
+ pslldq xmm4, 1
+ por xmm1, xmm4
+ psrldq xmm0, 7
+ pslldq xmm0, 15
+ psrldq xmm0, 7
+ por xmm1, xmm0
+ lea r0, [r2+r3*2]
+ movdqa xmm2, xmm3
+ psrldq xmm2, 1
+INIT_XMM
+ PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm4
+ movdqa xmm1, xmm0
+ psrldq xmm1, 1
+ movq [r0+r3*2], xmm0
+ movq [r0+r3*1], xmm1
+ psrldq xmm0, 2
+ psrldq xmm1, 2
+ movq [r2+r3*2], xmm0
+ movq [r2+r3*1], xmm1
+ psrldq xmm0, 2
+ psrldq xmm1, 2
+ movq [r1+r3*2], xmm0
+ movq [r1+r3*1], xmm1
+ psrldq xmm0, 2
+ psrldq xmm1, 2
+ movq [r4+r3*2], xmm0
+ movq [r4+r3*1], xmm1
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_DOWN_RIGHT sse2
+INIT_MMX
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_DOWN_RIGHT ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_vertical_right(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred8x8l_vertical_right_mmxext, 4,5
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jz .fix_lt_1
+ jmp .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm7, mm2
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.do_top
+ PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
+ lea r1, [r0+r3*2]
+ movq mm2, mm6
+ movq mm3, mm6
+ PALIGNR mm3, mm7, 7, mm0
+ PALIGNR mm6, mm7, 6, mm1
+ movq mm4, mm3
+ pavgb mm3, mm2
+ lea r2, [r1+r3*2]
+ PRED4x4_LOWPASS mm0, mm6, mm2, mm4, mm5
+ movq [r0+r3*1], mm3
+ movq [r0+r3*2], mm0
+ movq mm5, mm0
+ movq mm6, mm3
+ movq mm1, mm7
+ movq mm2, mm1
+ psllq mm2, 8
+ movq mm3, mm1
+ psllq mm3, 16
+ lea r4, [r2+r3*2]
+ PRED4x4_LOWPASS mm0, mm1, mm3, mm2, mm4
+ PALIGNR mm6, mm0, 7, mm2
+ movq [r1+r3*1], mm6
+ psllq mm0, 8
+ PALIGNR mm5, mm0, 7, mm1
+ movq [r1+r3*2], mm5
+ psllq mm0, 8
+ PALIGNR mm6, mm0, 7, mm2
+ movq [r2+r3*1], mm6
+ psllq mm0, 8
+ PALIGNR mm5, mm0, 7, mm1
+ movq [r2+r3*2], mm5
+ psllq mm0, 8
+ PALIGNR mm6, mm0, 7, mm2
+ movq [r4+r3*1], mm6
+ psllq mm0, 8
+ PALIGNR mm5, mm0, 7, mm1
+ movq [r4+r3*2], mm5
+ RET
+
+%macro PRED8x8L_VERTICAL_RIGHT 1
+cglobal pred8x8l_vertical_right_%1, 4,5,7
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jnz .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq2dq xmm0, mm2
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.do_top
+ PRED4x4_LOWPASS mm6, mm2, mm1, mm3, mm5
+ lea r1, [r0+r3*2]
+ movq2dq xmm4, mm6
+ pslldq xmm4, 8
+ por xmm0, xmm4
+ movdqa xmm6, [pw_ff00]
+ movdqa xmm1, xmm0
+ lea r2, [r1+r3*2]
+ movdqa xmm2, xmm0
+ movdqa xmm3, xmm0
+ pslldq xmm0, 1
+ pslldq xmm1, 2
+ pavgb xmm2, xmm0
+INIT_XMM
+ PRED4x4_LOWPASS xmm4, xmm3, xmm1, xmm0, xmm5
+ pandn xmm6, xmm4
+ movdqa xmm5, xmm4
+ psrlw xmm4, 8
+ packuswb xmm6, xmm4
+ movhlps xmm4, xmm6
+ movhps [r0+r3*2], xmm5
+ movhps [r0+r3*1], xmm2
+ psrldq xmm5, 4
+ movss xmm5, xmm6
+ psrldq xmm2, 4
+ movss xmm2, xmm4
+ lea r0, [r2+r3*2]
+ psrldq xmm5, 1
+ psrldq xmm2, 1
+ movq [r0+r3*2], xmm5
+ movq [r0+r3*1], xmm2
+ psrldq xmm5, 1
+ psrldq xmm2, 1
+ movq [r2+r3*2], xmm5
+ movq [r2+r3*1], xmm2
+ psrldq xmm5, 1
+ psrldq xmm2, 1
+ movq [r1+r3*2], xmm5
+ movq [r1+r3*1], xmm2
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_VERTICAL_RIGHT sse2
+INIT_MMX
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_VERTICAL_RIGHT ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_vertical_left(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+%macro PRED8x8L_VERTICAL_LEFT 1
+cglobal pred8x8l_vertical_left_%1, 4,4
+ sub r0, r3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+ jmp .do_top
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.fix_tr_2:
+ punpckhbw mm3, mm3
+ pshufw mm1, mm3, 0xFF
+ jmp .do_topright
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq2dq xmm4, mm4
+ test r2, r2
+ jz .fix_tr_2
+ movq mm0, [r0+8]
+ movq mm5, mm0
+ movq mm2, mm0
+ movq mm4, mm0
+ psrlq mm5, 56
+ PALIGNR mm2, mm3, 7, mm3
+ PALIGNR mm5, mm4, 1, mm4
+ PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
+.do_topright:
+ movq2dq xmm3, mm1
+ lea r1, [r0+r3*2]
+ pslldq xmm3, 8
+ por xmm4, xmm3
+ movdqa xmm2, xmm4
+ movdqa xmm1, xmm4
+ movdqa xmm3, xmm4
+ psrldq xmm2, 1
+ pslldq xmm1, 1
+ pavgb xmm3, xmm2
+ lea r2, [r1+r3*2]
+INIT_XMM
+ PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm4, xmm5
+ psrldq xmm0, 1
+ movq [r0+r3*1], xmm3
+ movq [r0+r3*2], xmm0
+ lea r0, [r2+r3*2]
+ psrldq xmm3, 1
+ psrldq xmm0, 1
+ movq [r1+r3*1], xmm3
+ movq [r1+r3*2], xmm0
+ psrldq xmm3, 1
+ psrldq xmm0, 1
+ movq [r2+r3*1], xmm3
+ movq [r2+r3*2], xmm0
+ psrldq xmm3, 1
+ psrldq xmm0, 1
+ movq [r0+r3*1], xmm3
+ movq [r0+r3*2], xmm0
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_VERTICAL_LEFT sse2
+%define PALIGNR PALIGNR_SSSE3
+INIT_MMX
+PRED8x8L_VERTICAL_LEFT ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_horizontal_up(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+%macro PRED8x8L_HORIZONTAL_UP 1
+cglobal pred8x8l_horizontal_up_%1, 4,4
+ sub r0, r3
+ lea r2, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r2+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r2, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r2]
+ mov r0, r2
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jnz .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm4, mm0
+ movq mm7, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ psllq mm1, 56
+ PALIGNR mm7, mm1, 7, mm3
+ lea r1, [r0+r3*2]
+ pshufw mm0, mm7, 00011011b ; l6 l7 l4 l5 l2 l3 l0 l1
+ psllq mm7, 56 ; l7 .. .. .. .. .. .. ..
+ movq mm2, mm0
+ psllw mm0, 8
+ psrlw mm2, 8
+ por mm2, mm0 ; l7 l6 l5 l4 l3 l2 l1 l0
+ movq mm3, mm2
+ movq mm4, mm2
+ movq mm5, mm2
+ psrlq mm2, 8
+ psrlq mm3, 16
+ lea r2, [r1+r3*2]
+ por mm2, mm7 ; l7 l7 l6 l5 l4 l3 l2 l1
+ punpckhbw mm7, mm7
+ por mm3, mm7 ; l7 l7 l7 l6 l5 l4 l3 l2
+ pavgb mm4, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm5, mm2, mm6
+ movq mm5, mm4
+ punpcklbw mm4, mm1 ; p4 p3 p2 p1
+ punpckhbw mm5, mm1 ; p8 p7 p6 p5
+ movq mm6, mm5
+ movq mm7, mm5
+ movq mm0, mm5
+ PALIGNR mm5, mm4, 2, mm1
+ pshufw mm1, mm6, 11111001b
+ PALIGNR mm6, mm4, 4, mm2
+ pshufw mm2, mm7, 11111110b
+ PALIGNR mm7, mm4, 6, mm3
+ pshufw mm3, mm0, 11111111b
+ movq [r0+r3*1], mm4
+ movq [r0+r3*2], mm5
+ lea r0, [r2+r3*2]
+ movq [r1+r3*1], mm6
+ movq [r1+r3*2], mm7
+ movq [r2+r3*1], mm0
+ movq [r2+r3*2], mm1
+ movq [r0+r3*1], mm2
+ movq [r0+r3*2], mm3
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_HORIZONTAL_UP mmxext
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_HORIZONTAL_UP ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_horizontal_down(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred8x8l_horizontal_down_mmxext, 4,5
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jnz .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq mm4, mm0
+ movq mm7, mm2
+ movq mm6, mm2
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ psllq mm1, 56
+ PALIGNR mm7, mm1, 7, mm3
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq mm5, mm4
+ lea r1, [r0+r3*2]
+ psllq mm7, 56
+ movq mm2, mm5
+ movq mm3, mm6
+ movq mm4, mm2
+ PALIGNR mm2, mm6, 7, mm5
+ PALIGNR mm6, mm7, 7, mm0
+ lea r2, [r1+r3*2]
+ PALIGNR mm4, mm3, 1, mm7
+ movq mm5, mm3
+ pavgb mm3, mm6
+ PRED4x4_LOWPASS mm0, mm4, mm6, mm5, mm7
+ movq mm4, mm2
+ movq mm1, mm2
+ lea r4, [r2+r3*2]
+ psrlq mm4, 16
+ psrlq mm1, 8
+ PRED4x4_LOWPASS mm6, mm4, mm2, mm1, mm5
+ movq mm7, mm3
+ punpcklbw mm3, mm0
+ punpckhbw mm7, mm0
+ movq mm1, mm7
+ movq mm0, mm7
+ movq mm4, mm7
+ movq [r4+r3*2], mm3
+ PALIGNR mm7, mm3, 2, mm5
+ movq [r4+r3*1], mm7
+ PALIGNR mm1, mm3, 4, mm5
+ movq [r2+r3*2], mm1
+ PALIGNR mm0, mm3, 6, mm3
+ movq [r2+r3*1], mm0
+ movq mm2, mm6
+ movq mm3, mm6
+ movq [r1+r3*2], mm4
+ PALIGNR mm6, mm4, 2, mm5
+ movq [r1+r3*1], mm6
+ PALIGNR mm2, mm4, 4, mm5
+ movq [r0+r3*2], mm2
+ PALIGNR mm3, mm4, 6, mm4
+ movq [r0+r3*1], mm3
+ RET
+
+%macro PRED8x8L_HORIZONTAL_DOWN 1
+cglobal pred8x8l_horizontal_down_%1, 4,5
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ movq mm0, [r0+r3*1-8]
+ punpckhbw mm0, [r0+r3*0-8]
+ movq mm1, [r4+r3*1-8]
+ punpckhbw mm1, [r0+r3*2-8]
+ mov r4, r0
+ punpckhwd mm1, mm0
+ lea r0, [r0+r3*4]
+ movq mm2, [r0+r3*1-8]
+ punpckhbw mm2, [r0+r3*0-8]
+ lea r0, [r0+r3*2]
+ movq mm3, [r0+r3*1-8]
+ punpckhbw mm3, [r0+r3*0-8]
+ punpckhwd mm3, mm2
+ punpckhdq mm3, mm1
+ lea r0, [r0+r3*2]
+ movq mm0, [r0+r3*0-8]
+ movq mm1, [r4]
+ mov r0, r4
+ movq mm4, mm3
+ movq mm2, mm3
+ PALIGNR mm4, mm0, 7, mm0
+ PALIGNR mm1, mm2, 1, mm2
+ test r1, r1
+ jnz .do_left
+.fix_lt_1:
+ movq mm5, mm3
+ pxor mm5, mm4
+ psrlq mm5, 56
+ psllq mm5, 48
+ pxor mm1, mm5
+ jmp .do_left
+.fix_lt_2:
+ movq mm5, mm3
+ pxor mm5, mm2
+ psllq mm5, 56
+ psrlq mm5, 56
+ pxor mm2, mm5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ movq mm5, mm3
+ pxor mm5, mm1
+ psrlq mm5, 56
+ psllq mm5, 56
+ pxor mm1, mm5
+ jmp .do_top
+.fix_tr_2:
+ punpckhbw mm3, mm3
+ pshufw mm1, mm3, 0xFF
+ jmp .do_topright
+.do_left:
+ movq mm0, mm4
+ PRED4x4_LOWPASS mm2, mm1, mm4, mm3, mm5
+ movq2dq xmm0, mm2
+ pslldq xmm0, 8
+ movq mm4, mm0
+ PRED4x4_LOWPASS mm1, mm3, mm0, mm4, mm5
+ movq2dq xmm2, mm1
+ pslldq xmm2, 15
+ psrldq xmm2, 8
+ por xmm0, xmm2
+ movq mm0, [r0-8]
+ movq mm3, [r0]
+ movq mm1, [r0+8]
+ movq mm2, mm3
+ movq mm4, mm3
+ PALIGNR mm2, mm0, 7, mm0
+ PALIGNR mm1, mm4, 1, mm4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.do_top:
+ PRED4x4_LOWPASS mm4, mm2, mm1, mm3, mm5
+ movq2dq xmm1, mm4
+ test r2, r2
+ jz .fix_tr_2
+ movq mm0, [r0+8]
+ movq mm5, mm0
+ movq mm2, mm0
+ movq mm4, mm0
+ psrlq mm5, 56
+ PALIGNR mm2, mm3, 7, mm3
+ PALIGNR mm5, mm4, 1, mm4
+ PRED4x4_LOWPASS mm1, mm2, mm5, mm0, mm4
+.do_topright:
+ movq2dq xmm5, mm1
+ pslldq xmm5, 8
+ por xmm1, xmm5
+INIT_XMM
+ lea r2, [r4+r3*2]
+ movdqa xmm2, xmm1
+ movdqa xmm3, xmm1
+ PALIGNR xmm1, xmm0, 7, xmm4
+ PALIGNR xmm2, xmm0, 9, xmm5
+ lea r1, [r2+r3*2]
+ PALIGNR xmm3, xmm0, 8, xmm0
+ movdqa xmm4, xmm1
+ pavgb xmm4, xmm3
+ lea r0, [r1+r3*2]
+ PRED4x4_LOWPASS xmm0, xmm1, xmm2, xmm3, xmm5
+ punpcklbw xmm4, xmm0
+ movhlps xmm0, xmm4
+ movq [r0+r3*2], xmm4
+ movq [r2+r3*2], xmm0
+ psrldq xmm4, 2
+ psrldq xmm0, 2
+ movq [r0+r3*1], xmm4
+ movq [r2+r3*1], xmm0
+ psrldq xmm4, 2
+ psrldq xmm0, 2
+ movq [r1+r3*2], xmm4
+ movq [r4+r3*2], xmm0
+ psrldq xmm4, 2
+ psrldq xmm0, 2
+ movq [r1+r3*1], xmm4
+ movq [r4+r3*1], xmm0
+ RET
+%endmacro
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_HORIZONTAL_DOWN sse2
+INIT_MMX
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_HORIZONTAL_DOWN ssse3
+%endif
+
;-----------------------------------------------------------------------------
; void pred4x4_dc_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
@@ -1073,18 +2598,6 @@ cglobal pred4x4_tm_vp8_ssse3, 3,3
movd [r1+r2*2], mm5
RET
-; dest, left, right, src, tmp
-; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
-%macro PRED4x4_LOWPASS 5
- mova %5, %2
- pavgb %2, %3
- pxor %3, %5
- mova %1, %4
- pand %3, [pb_1]
- psubusb %2, %3
- pavgb %1, %2
-%endmacro
-
;-----------------------------------------------------------------------------
; void pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
;-----------------------------------------------------------------------------
@@ -1104,3 +2617,186 @@ cglobal pred4x4_vertical_vp8_mmxext, 3,3
movd [r1+r2*1], m3
movd [r1+r2*2], m3
RET
+
+;-----------------------------------------------------------------------------
+; void pred4x4_down_left_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+;-----------------------------------------------------------------------------
+%ifdef CONFIG_GPL
+INIT_MMX
+cglobal pred4x4_down_left_mmxext, 3,3
+ sub r0, r2
+ movq m1, [r0]
+ punpckldq m1, [r1]
+ movq m2, m1
+ movq m3, m1
+ movq m4, m1
+ psllq m1, 8
+ pxor m2, m1
+ psrlq m2, 8
+ pxor m3, m2
+ PRED4x4_LOWPASS m0, m1, m3, m4, m5
+ lea r1, [r0+r2*2]
+ psrlq m0, 8
+ movd [r0+r2*1], m0
+ psrlq m0, 8
+ movd [r0+r2*2], m0
+ psrlq m0, 8
+ movd [r1+r2*1], m0
+ psrlq m0, 8
+ movd [r1+r2*2], m0
+ RET
+
+;-----------------------------------------------------------------------------
+; void pred4x4_vertical_left_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+cglobal pred4x4_vertical_left_mmxext, 3,3
+ sub r0, r2
+ movq m1, [r0]
+ punpckldq m1, [r1]
+ movq m3, m1
+ movq m2, m1
+ psrlq m3, 8
+ psrlq m2, 16
+ movq m4, m3
+ pavgb m4, m1
+ PRED4x4_LOWPASS m0, m1, m2, m3, m5
+ lea r1, [r0+r2*2]
+ movh [r0+r2*1], m4
+ movh [r0+r2*2], m0
+ psrlq m4, 8
+ psrlq m0, 8
+ movh [r1+r2*1], m4
+ movh [r1+r2*2], m0
+ RET
+
+;-----------------------------------------------------------------------------
+; void pred4x4_horizontal_up_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+cglobal pred4x4_horizontal_up_mmxext, 3,3
+ sub r0, r2
+ lea r1, [r0+r2*2]
+ movd m0, [r0+r2*1-4]
+ punpcklbw m0, [r0+r2*2-4]
+ movd m1, [r1+r2*1-4]
+ punpcklbw m1, [r1+r2*2-4]
+ punpckhwd m0, m1
+ movq m1, m0
+ punpckhbw m1, m1
+ pshufw m1, m1, 0xFF
+ punpckhdq m0, m1
+ movq m2, m0
+ movq m3, m0
+ movq m7, m0
+ psrlq m2, 16
+ psrlq m3, 8
+ pavgb m7, m3
+ PRED4x4_LOWPASS m4, m0, m2, m3, m5
+ punpcklbw m7, m4
+ movd [r0+r2*1], m7
+ psrlq m7, 16
+ movd [r0+r2*2], m7
+ psrlq m7, 16
+ movd [r1+r2*1], m7
+ movd [r1+r2*2], m1
+ RET
+
+;-----------------------------------------------------------------------------
+; void pred4x4_horizontal_down_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred4x4_horizontal_down_mmxext, 3,3
+ sub r0, r2
+ lea r1, [r0+r2*2]
+ movh m0, [r0-4] ; lt ..
+ punpckldq m0, [r0] ; t3 t2 t1 t0 lt .. .. ..
+ psllq m0, 8 ; t2 t1 t0 lt .. .. .. ..
+ movd m1, [r1+r2*2-4] ; l3
+ punpcklbw m1, [r1+r2*1-4] ; l2 l3
+ movd m2, [r0+r2*2-4] ; l1
+ punpcklbw m2, [r0+r2*1-4] ; l0 l1
+ punpckhwd m1, m2 ; l0 l1 l2 l3
+ punpckhdq m1, m0 ; t2 t1 t0 lt l0 l1 l2 l3
+ movq m0, m1
+ movq m2, m1
+ movq m5, m1
+ psrlq m0, 16 ; .. .. t2 t1 t0 lt l0 l1
+ psrlq m2, 8 ; .. t2 t1 t0 lt l0 l1 l2
+ pavgb m5, m2
+ PRED4x4_LOWPASS m3, m1, m0, m2, m4
+ punpcklbw m5, m3
+ psrlq m3, 32
+ PALIGNR m3, m5, 6, m4
+ movh [r1+r2*2], m5
+ psrlq m5, 16
+ movh [r1+r2*1], m5
+ psrlq m5, 16
+ movh [r0+r2*2], m5
+ movh [r0+r2*1], m3
+ RET
+
+;-----------------------------------------------------------------------------
+; void pred4x4_vertical_right_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred4x4_vertical_right_mmxext, 3,3
+ sub r0, r2
+ lea r1, [r0+r2*2]
+ movh m0, [r0] ; ........t3t2t1t0
+ movq m5, m0
+ PALIGNR m0, [r0-8], 7, m1 ; ......t3t2t1t0lt
+ pavgb m5, m0
+ PALIGNR m0, [r0+r2*1-8], 7, m1 ; ....t3t2t1t0ltl0
+ movq m1, m0
+ PALIGNR m0, [r0+r2*2-8], 7, m2 ; ..t3t2t1t0ltl0l1
+ movq m2, m0
+ PALIGNR m0, [r1+r2*1-8], 7, m3 ; t3t2t1t0ltl0l1l2
+ PRED4x4_LOWPASS m3, m1, m0, m2, m4
+ movq m1, m3
+ psrlq m3, 16
+ psllq m1, 48
+ movh [r0+r2*1], m5
+ movh [r0+r2*2], m3
+ PALIGNR m5, m1, 7, m2
+ psllq m1, 8
+ movh [r1+r2*1], m5
+ PALIGNR m3, m1, 7, m1
+ movh [r1+r2*2], m3
+ RET
+
+;-----------------------------------------------------------------------------
+; void pred4x4_down_right_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+;-----------------------------------------------------------------------------
+
+INIT_MMX
+%define PALIGNR PALIGNR_MMX
+cglobal pred4x4_down_right_mmxext, 3,3
+ sub r0, r2
+ lea r1, [r0+r2*2]
+ movq m1, [r1-8]
+ movq m2, [r0+r2*1-8]
+ punpckhbw m2, [r0-8]
+ movh m3, [r0]
+ punpckhwd m1, m2
+ PALIGNR m3, m1, 5, m1
+ movq m1, m3
+ PALIGNR m3, [r1+r2*1-8], 7, m4
+ movq m2, m3
+ PALIGNR m3, [r1+r2*2-8], 7, m4
+ PRED4x4_LOWPASS m0, m3, m1, m2, m4
+ movh [r1+r2*2], m0
+ psrlq m0, 8
+ movh [r1+r2*1], m0
+ psrlq m0, 8
+ movh [r0+r2*2], m0
+ psrlq m0, 8
+ movh [r0+r2*1], m0
+ RET
+%endif
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred_init.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred_init.c
index a3ce40b9f..ee893a336 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred_init.c
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/x86/h264_intrapred_init.c
@@ -44,7 +44,9 @@ void ff_pred16x16_plane_svq3_ssse3 (uint8_t *src, int stride);
void ff_pred16x16_tm_vp8_mmx (uint8_t *src, int stride);
void ff_pred16x16_tm_vp8_mmxext (uint8_t *src, int stride);
void ff_pred16x16_tm_vp8_sse2 (uint8_t *src, int stride);
+void ff_pred8x8_top_dc_mmxext (uint8_t *src, int stride);
void ff_pred8x8_dc_rv40_mmxext (uint8_t *src, int stride);
+void ff_pred8x8_dc_mmxext (uint8_t *src, int stride);
void ff_pred8x8_vertical_mmx (uint8_t *src, int stride);
void ff_pred8x8_horizontal_mmx (uint8_t *src, int stride);
void ff_pred8x8_horizontal_mmxext (uint8_t *src, int stride);
@@ -57,7 +59,37 @@ void ff_pred8x8_tm_vp8_mmx (uint8_t *src, int stride);
void ff_pred8x8_tm_vp8_mmxext (uint8_t *src, int stride);
void ff_pred8x8_tm_vp8_sse2 (uint8_t *src, int stride);
void ff_pred8x8_tm_vp8_ssse3 (uint8_t *src, int stride);
+void ff_pred8x8l_top_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_top_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_down_left_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_down_left_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_down_left_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_down_right_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_down_right_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_down_right_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_right_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_right_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_right_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_left_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_vertical_left_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_up_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_up_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_down_mmxext(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_down_sse2(uint8_t *src, int has_topleft, int has_topright, int stride);
+void ff_pred8x8l_horizontal_down_ssse3(uint8_t *src, int has_topleft, int has_topright, int stride);
void ff_pred4x4_dc_mmxext (uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_down_left_mmxext (uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_down_right_mmxext (uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_vertical_left_mmxext(uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_vertical_right_mmxext(uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_horizontal_up_mmxext(uint8_t *src, const uint8_t *topright, int stride);
+void ff_pred4x4_horizontal_down_mmxext(uint8_t *src, const uint8_t *topright, int stride);
void ff_pred4x4_tm_vp8_mmx (uint8_t *src, const uint8_t *topright, int stride);
void ff_pred4x4_tm_vp8_mmxext (uint8_t *src, const uint8_t *topright, int stride);
void ff_pred4x4_tm_vp8_ssse3 (uint8_t *src, const uint8_t *topright, int stride);
@@ -93,7 +125,34 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext;
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
+#if CONFIG_GPL
+ h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext;
+ h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext;
+ h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext;
+ h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext;
+ h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_mmxext;
+ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_mmxext;
+ h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_mmxext;
+ h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_mmxext;
+ h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_mmxext;
+ h->pred4x4 [DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_mmxext;
+ h->pred4x4 [VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_mmxext;
+ h->pred4x4 [HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_mmxext;
+#endif
h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext;
+#if CONFIG_GPL
+ if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
+ h->pred4x4 [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
+ if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264)
+ h->pred4x4 [VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_mmxext;
+ if (codec_id != CODEC_ID_RV40) {
+ h->pred4x4 [HOR_UP_PRED ] = ff_pred4x4_horizontal_up_mmxext;
+ }
+ if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) {
+ h->pred8x8 [TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext;
+ h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_mmxext;
+ }
+#endif
if (codec_id == CODEC_ID_VP8) {
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext;
h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext;
@@ -118,6 +177,13 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
if (mm_flags & AV_CPU_FLAG_SSE2) {
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2;
+#if CONFIG_GPL
+ h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_sse2;
+ h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_sse2;
+ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_sse2;
+ h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_sse2;
+ h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_sse2;
+#endif
if (codec_id == CODEC_ID_VP8) {
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
@@ -137,6 +203,18 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3;
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3;
+#if CONFIG_GPL
+ h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3;
+ h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3;
+ h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3;
+ h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3;
+ h->pred8x8l [DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_ssse3;
+ h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_ssse3;
+ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_ssse3;
+ h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_ssse3;
+ h->pred8x8l [HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_ssse3;
+ h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_ssse3;
+#endif
if (codec_id == CODEC_ID_VP8) {
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3;
h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3;
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h
index 5d5e0f2c4..670d3b934 100644
--- a/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h
+++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavutil/common.h
@@ -198,6 +198,20 @@ static inline av_const int av_ceil_log2_c(int x)
return av_log2((x - 1) << 1);
}
+/**
+ * Count number of bits set to one in x
+ * @param x value to count bits of
+ * @return the number of bits set to one in x
+ */
+static inline av_const int av_popcount_c(uint32_t x)
+{
+ x -= (x >> 1) & 0x55555555;
+ x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+ x = (x + (x >> 4)) & 0x0F0F0F0F;
+ x += x >> 8;
+ return (x + (x >> 16)) & 0x3F;
+}
+
#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))
@@ -360,5 +374,8 @@ static inline av_const int av_ceil_log2_c(int x)
#ifndef av_clipf
# define av_clipf av_clipf_c
#endif
+#ifndef av_popcount
+# define av_popcount av_popcount_c
+#endif
#endif /* HAVE_AV_CONFIG_H */