summaryrefslogtreecommitdiffstats
path: root/libmpeg2
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-02-01 20:10:27 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-02-01 20:10:27 +0200
commit7cd7416c7316ce28cfa663b1f1d578b9c768a6ba (patch)
tree9ac07232011a1488a0f502835f6aba41631a71c2 /libmpeg2
parent156ba34ac7b6099f867a66295fbfe650db63e598 (diff)
downloadmpv-7cd7416c7316ce28cfa663b1f1d578b9c768a6ba.tar.bz2
mpv-7cd7416c7316ce28cfa663b1f1d578b9c768a6ba.tar.xz
libmpeg2: drop libmpeg2 support
libavcodec mpeg2 decoder has been the default for a while and seems to work fine.
Diffstat (limited to 'libmpeg2')
-rw-r--r--libmpeg2/alloc.c70
-rw-r--r--libmpeg2/alpha_asm.h181
-rw-r--r--libmpeg2/attributes.h42
-rw-r--r--libmpeg2/cpu_accel.c283
-rw-r--r--libmpeg2/cpu_state.c129
-rw-r--r--libmpeg2/decode.c452
-rw-r--r--libmpeg2/header.c972
-rw-r--r--libmpeg2/idct.c299
-rw-r--r--libmpeg2/idct_alpha.c377
-rw-r--r--libmpeg2/idct_altivec.c286
-rw-r--r--libmpeg2/idct_mmx.c1305
-rw-r--r--libmpeg2/libmpeg2_changes.diff439
-rw-r--r--libmpeg2/mmx.h292
-rw-r--r--libmpeg2/motion_comp.c145
-rw-r--r--libmpeg2/motion_comp_alpha.c253
-rw-r--r--libmpeg2/motion_comp_altivec.c1010
-rw-r--r--libmpeg2/motion_comp_arm.c185
-rw-r--r--libmpeg2/motion_comp_arm_s.S323
-rw-r--r--libmpeg2/motion_comp_mmx.c1013
-rw-r--r--libmpeg2/motion_comp_vis.c2061
-rw-r--r--libmpeg2/mpeg2.h208
-rw-r--r--libmpeg2/mpeg2_internal.h329
-rw-r--r--libmpeg2/slice.c2101
-rw-r--r--libmpeg2/vis.h333
-rw-r--r--libmpeg2/vlc.h434
25 files changed, 0 insertions, 13522 deletions
diff --git a/libmpeg2/alloc.c b/libmpeg2/alloc.c
deleted file mode 100644
index 71bc18b692..0000000000
--- a/libmpeg2/alloc.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * alloc.c
- * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
- * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "mpeg2.h"
-
-static void * (* malloc_hook) (unsigned size, mpeg2_alloc_t reason) = NULL;
-static int (* free_hook) (void * buf) = NULL;
-
-void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason)
-{
- char * buf;
-
- if (malloc_hook) {
- buf = (char *) malloc_hook (size, reason);
- if (buf)
- return buf;
- }
-
- if (size) {
- buf = (char *) malloc (size + 63 + sizeof (void **));
- if (buf) {
- char * align_buf;
-
- align_buf = buf + 63 + sizeof (void **);
- align_buf -= (long)align_buf & 63;
- *(((void **)align_buf) - 1) = buf;
- return align_buf;
- }
- }
- return NULL;
-}
-
-void mpeg2_free (void * buf)
-{
- if (free_hook && free_hook (buf))
- return;
-
- if (buf)
- free (*(((void **)buf) - 1));
-}
-
-void mpeg2_malloc_hooks (void * alloc_func (unsigned, mpeg2_alloc_t),
- int free_func (void *))
-{
- malloc_hook = alloc_func;
- free_hook = free_func;
-}
diff --git a/libmpeg2/alpha_asm.h b/libmpeg2/alpha_asm.h
deleted file mode 100644
index 8cebbcb817..0000000000
--- a/libmpeg2/alpha_asm.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Alpha assembly macros
- * Copyright (c) 2002-2003 Falk Hueffner <falk@debian.org>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef LIBMPEG2_ALPHA_ASM_H
-#define LIBMPEG2_ALPHA_ASM_H
-
-#include <inttypes.h>
-
-#if defined __GNUC__
-# define GNUC_PREREQ(maj, min) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-# define GNUC_PREREQ(maj, min) 0
-#endif
-
-#define AMASK_BWX (1 << 0)
-#define AMASK_FIX (1 << 1)
-#define AMASK_CIX (1 << 2)
-#define AMASK_MVI (1 << 8)
-
-#ifdef __alpha_bwx__
-# define HAVE_BWX() 1
-#else
-# define HAVE_BWX() (amask(AMASK_BWX) == 0)
-#endif
-#ifdef __alpha_fix__
-# define HAVE_FIX() 1
-#else
-# define HAVE_FIX() (amask(AMASK_FIX) == 0)
-#endif
-#ifdef __alpha_max__
-# define HAVE_MVI() 1
-#else
-# define HAVE_MVI() (amask(AMASK_MVI) == 0)
-#endif
-#ifdef __alpha_cix__
-# define HAVE_CIX() 1
-#else
-# define HAVE_CIX() (amask(AMASK_CIX) == 0)
-#endif
-
-inline static uint64_t BYTE_VEC(uint64_t x)
-{
- x |= x << 8;
- x |= x << 16;
- x |= x << 32;
- return x;
-}
-inline static uint64_t WORD_VEC(uint64_t x)
-{
- x |= x << 16;
- x |= x << 32;
- return x;
-}
-
-#define ldq(p) (*(const uint64_t *) (p))
-#define ldl(p) (*(const int32_t *) (p))
-#define stl(l, p) do { *(uint32_t *) (p) = (l); } while (0)
-#define stq(l, p) do { *(uint64_t *) (p) = (l); } while (0)
-#define sextw(x) ((int16_t) (x))
-
-#ifdef __GNUC__
-struct unaligned_long { uint64_t l; } __attribute__((packed));
-#define ldq_u(p) (*(const uint64_t *) (((uint64_t) (p)) & ~7ul))
-#define uldq(a) (((const struct unaligned_long *) (a))->l)
-
-#if GNUC_PREREQ(3,3)
-#define prefetch(p) __builtin_prefetch((p), 0, 1)
-#define prefetch_en(p) __builtin_prefetch((p), 0, 0)
-#define prefetch_m(p) __builtin_prefetch((p), 1, 1)
-#define prefetch_men(p) __builtin_prefetch((p), 1, 0)
-#define cmpbge __builtin_alpha_cmpbge
-/* Avoid warnings. */
-#define extql(a, b) __builtin_alpha_extql(a, (uint64_t) (b))
-#define extwl(a, b) __builtin_alpha_extwl(a, (uint64_t) (b))
-#define extqh(a, b) __builtin_alpha_extqh(a, (uint64_t) (b))
-#define zap __builtin_alpha_zap
-#define zapnot __builtin_alpha_zapnot
-#define amask __builtin_alpha_amask
-#define implver __builtin_alpha_implver
-#define rpcc __builtin_alpha_rpcc
-#else
-#define prefetch(p) asm volatile("ldl $31,%0" : : "m"(*(const char *) (p)) : "memory")
-#define prefetch_en(p) asm volatile("ldq $31,%0" : : "m"(*(const char *) (p)) : "memory")
-#define prefetch_m(p) asm volatile("lds $f31,%0" : : "m"(*(const char *) (p)) : "memory")
-#define prefetch_men(p) asm volatile("ldt $f31,%0" : : "m"(*(const char *) (p)) : "memory")
-#define cmpbge(a, b) ({ uint64_t __r; asm ("cmpbge %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
-#define extql(a, b) ({ uint64_t __r; asm ("extql %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
-#define extwl(a, b) ({ uint64_t __r; asm ("extwl %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
-#define extqh(a, b) ({ uint64_t __r; asm ("extqh %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
-#define zap(a, b) ({ uint64_t __r; asm ("zap %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
-#define zapnot(a, b) ({ uint64_t __r; asm ("zapnot %r1,%2,%0" : "=r" (__r) : "rJ" (a), "rI" (b)); __r; })
-#define amask(a) ({ uint64_t __r; asm ("amask %1,%0" : "=r" (__r) : "rI" (a)); __r; })
-#define implver() ({ uint64_t __r; asm ("implver %0" : "=r" (__r)); __r; })
-#define rpcc() ({ uint64_t __r; asm volatile ("rpcc %0" : "=r" (__r)); __r; })
-#endif
-#define wh64(p) asm volatile("wh64 (%0)" : : "r"(p) : "memory")
-
-#if GNUC_PREREQ(3,3) && defined(__alpha_max__)
-#define minub8 __builtin_alpha_minub8
-#define minsb8 __builtin_alpha_minsb8
-#define minuw4 __builtin_alpha_minuw4
-#define minsw4 __builtin_alpha_minsw4
-#define maxub8 __builtin_alpha_maxub8
-#define maxsb8 __builtin_alpha_maxsb8
-#define maxuw4 __builtin_alpha_maxuw4
-#define maxsw4 __builtin_alpha_maxsw4
-#define perr __builtin_alpha_perr
-#define pklb __builtin_alpha_pklb
-#define pkwb __builtin_alpha_pkwb
-#define unpkbl __builtin_alpha_unpkbl
-#define unpkbw __builtin_alpha_unpkbw
-#else
-#define minub8(a, b) ({ uint64_t __r; asm (".arch ev6; minub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define minsb8(a, b) ({ uint64_t __r; asm (".arch ev6; minsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define minuw4(a, b) ({ uint64_t __r; asm (".arch ev6; minuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define minsw4(a, b) ({ uint64_t __r; asm (".arch ev6; minsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxub8(a, b) ({ uint64_t __r; asm (".arch ev6; maxub8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxsb8(a, b) ({ uint64_t __r; asm (".arch ev6; maxsb8 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxuw4(a, b) ({ uint64_t __r; asm (".arch ev6; maxuw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxsw4(a, b) ({ uint64_t __r; asm (".arch ev6; maxsw4 %r1,%2,%0" : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define perr(a, b) ({ uint64_t __r; asm (".arch ev6; perr %r1,%r2,%0" : "=r" (__r) : "%rJ" (a), "rJ" (b)); __r; })
-#define pklb(a) ({ uint64_t __r; asm (".arch ev6; pklb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
-#define pkwb(a) ({ uint64_t __r; asm (".arch ev6; pkwb %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
-#define unpkbl(a) ({ uint64_t __r; asm (".arch ev6; unpkbl %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
-#define unpkbw(a) ({ uint64_t __r; asm (".arch ev6; unpkbw %r1,%0" : "=r" (__r) : "rJ" (a)); __r; })
-#endif
-
-#elif defined(__DECC) /* Digital/Compaq/hp "ccc" compiler */
-
-#include <c_asm.h>
-#define ldq_u(a) asm ("ldq_u %v0,0(%a0)", a)
-#define uldq(a) (*(const __unaligned uint64_t *) (a))
-#define cmpbge(a, b) asm ("cmpbge %a0,%a1,%v0", a, b)
-#define extql(a, b) asm ("extql %a0,%a1,%v0", a, b)
-#define extwl(a, b) asm ("extwl %a0,%a1,%v0", a, b)
-#define extqh(a, b) asm ("extqh %a0,%a1,%v0", a, b)
-#define zap(a, b) asm ("zap %a0,%a1,%v0", a, b)
-#define zapnot(a, b) asm ("zapnot %a0,%a1,%v0", a, b)
-#define amask(a) asm ("amask %a0,%v0", a)
-#define implver() asm ("implver %v0")
-#define rpcc() asm ("rpcc %v0")
-#define minub8(a, b) asm ("minub8 %a0,%a1,%v0", a, b)
-#define minsb8(a, b) asm ("minsb8 %a0,%a1,%v0", a, b)
-#define minuw4(a, b) asm ("minuw4 %a0,%a1,%v0", a, b)
-#define minsw4(a, b) asm ("minsw4 %a0,%a1,%v0", a, b)
-#define maxub8(a, b) asm ("maxub8 %a0,%a1,%v0", a, b)
-#define maxsb8(a, b) asm ("maxsb8 %a0,%a1,%v0", a, b)
-#define maxuw4(a, b) asm ("maxuw4 %a0,%a1,%v0", a, b)
-#define maxsw4(a, b) asm ("maxsw4 %a0,%a1,%v0", a, b)
-#define perr(a, b) asm ("perr %a0,%a1,%v0", a, b)
-#define pklb(a) asm ("pklb %a0,%v0", a)
-#define pkwb(a) asm ("pkwb %a0,%v0", a)
-#define unpkbl(a) asm ("unpkbl %a0,%v0", a)
-#define unpkbw(a) asm ("unpkbw %a0,%v0", a)
-#define wh64(a) asm ("wh64 %a0", a)
-
-#else
-#error "Unknown compiler!"
-#endif
-
-#endif /* LIBMPEG2_ALPHA_ASM_H */
diff --git a/libmpeg2/attributes.h b/libmpeg2/attributes.h
deleted file mode 100644
index e005eef1c3..0000000000
--- a/libmpeg2/attributes.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * attributes.h
- * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
- * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef LIBMPEG2_ATTRIBUTES_H
-#define LIBMPEG2_ATTRIBUTES_H
-
-/* use gcc attribs to align critical data structures */
-#ifdef ATTRIBUTE_ALIGNED_MAX
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
-#else
-#define ATTR_ALIGN(align)
-#endif
-
-#ifdef HAVE_BUILTIN_EXPECT
-#define likely(x) __builtin_expect ((x) != 0, 1)
-#define unlikely(x) __builtin_expect ((x) != 0, 0)
-#else
-#define likely(x) (x)
-#define unlikely(x) (x)
-#endif
-
-#endif /* LIBMPEG2_ATTRIBUTES_H */
diff --git a/libmpeg2/cpu_accel.c b/libmpeg2/cpu_accel.c
deleted file mode 100644
index f2e99f754a..0000000000
--- a/libmpeg2/cpu_accel.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * cpu_accel.c
- * Copyright (C) 2000-2004 Michel Lespinasse <walken@zoy.org>
- * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
- * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-#include "config.h"
-
-#include <inttypes.h>
-
-#include "mpeg2.h"
-#include "attributes.h"
-#include "mpeg2_internal.h"
-
-#include "cpudetect.h"
-
-#if ARCH_X86 || ARCH_X86_64
-static inline uint32_t arch_accel (uint32_t accel)
-{
-/* Use MPlayer CPU detection instead of libmpeg2 variant. */
-#if 0
- if (accel & (MPEG2_ACCEL_X86_3DNOW | MPEG2_ACCEL_X86_MMXEXT))
- accel |= MPEG2_ACCEL_X86_MMX;
-
- if (accel & (MPEG2_ACCEL_X86_SSE2 | MPEG2_ACCEL_X86_SSE3))
- accel |= MPEG2_ACCEL_X86_MMXEXT;
-
- if (accel & (MPEG2_ACCEL_X86_SSE3))
- accel |= MPEG2_ACCEL_X86_SSE2;
-
-#ifdef ACCEL_DETECT
- if (accel & MPEG2_ACCEL_DETECT) {
- uint32_t eax, ebx, ecx, edx;
- int AMD;
-
-#if defined(__x86_64__) || (!defined(PIC) && !defined(__PIC__))
-#define cpuid(op,eax,ebx,ecx,edx) \
- __asm__ ("cpuid" \
- : "=a" (eax), \
- "=b" (ebx), \
- "=c" (ecx), \
- "=d" (edx) \
- : "a" (op) \
- : "cc")
-#else /* PIC version : save ebx (not needed on x86_64) */
-#define cpuid(op,eax,ebx,ecx,edx) \
- __asm__ ("pushl %%ebx\n\t" \
- "cpuid\n\t" \
- "movl %%ebx,%1\n\t" \
- "popl %%ebx" \
- : "=a" (eax), \
- "=r" (ebx), \
- "=c" (ecx), \
- "=d" (edx) \
- : "a" (op) \
- : "cc")
-#endif
-
-#ifndef __x86_64__ /* x86_64 supports the cpuid op */
- __asm__ ("pushf\n\t"
- "pushf\n\t"
- "pop %0\n\t"
- "movl %0,%1\n\t"
- "xorl $0x200000,%0\n\t"
- "push %0\n\t"
- "popf\n\t"
- "pushf\n\t"
- "pop %0\n\t"
- "popf"
- : "=r" (eax),
- "=r" (ebx)
- :
- : "cc");
-
- if (eax == ebx) /* no cpuid */
- return accel;
-#endif
-
- cpuid (0x00000000, eax, ebx, ecx, edx);
- if (!eax) /* vendor string only */
- return accel;
-
- AMD = (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65);
-
- cpuid (0x00000001, eax, ebx, ecx, edx);
- if (! (edx & 0x00800000)) /* no MMX */
- return accel;
-
- accel |= MPEG2_ACCEL_X86_MMX;
- if (edx & 0x02000000) /* SSE - identical to AMD MMX ext. */
- accel |= MPEG2_ACCEL_X86_MMXEXT;
-
- if (edx & 0x04000000) /* SSE2 */
- accel |= MPEG2_ACCEL_X86_SSE2;
-
- if (ecx & 0x00000001) /* SSE3 */
- accel |= MPEG2_ACCEL_X86_SSE3;
-
- cpuid (0x80000000, eax, ebx, ecx, edx);
- if (eax < 0x80000001) /* no extended capabilities */
- return accel;
-
- cpuid (0x80000001, eax, ebx, ecx, edx);
-
- if (edx & 0x80000000)
- accel |= MPEG2_ACCEL_X86_3DNOW;
-
- if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
- accel |= MPEG2_ACCEL_X86_MMXEXT;
- }
-#endif /* ACCEL_DETECT */
-
- return accel;
-
-#else /* 0 */
- accel = 0;
- if (gCpuCaps.hasMMX)
- accel |= MPEG2_ACCEL_X86_MMX;
- if (gCpuCaps.hasSSE2)
- accel |= MPEG2_ACCEL_X86_SSE2;
- if (gCpuCaps.hasMMX2)
- accel |= MPEG2_ACCEL_X86_MMXEXT;
- if (gCpuCaps.has3DNow)
- accel |= MPEG2_ACCEL_X86_3DNOW;
-
- return accel;
-
-#endif /* 0 */
-}
-#endif /* ARCH_X86 || ARCH_X86_64 */
-
-#if defined(ACCEL_DETECT) && (ARCH_PPC || ARCH_SPARC)
-#include <signal.h>
-#include <setjmp.h>
-
-static sigjmp_buf jmpbuf;
-static volatile sig_atomic_t canjump = 0;
-
-static RETSIGTYPE sigill_handler (int sig)
-{
- if (!canjump) {
- signal (sig, SIG_DFL);
- raise (sig);
- }
-
- canjump = 0;
- siglongjmp (jmpbuf, 1);
-}
-#endif /* ACCEL_DETECT && (ARCH_PPC || ARCH_SPARC) */
-
-#if ARCH_PPC
-static uint32_t arch_accel (uint32_t accel)
-{
-#ifdef ACCEL_DETECT
- if ((accel & (MPEG2_ACCEL_PPC_ALTIVEC | MPEG2_ACCEL_DETECT)) ==
- MPEG2_ACCEL_DETECT) {
- static RETSIGTYPE (* oldsig) (int);
-
- oldsig = signal (SIGILL, sigill_handler);
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, oldsig);
- return accel;
- }
-
- canjump = 1;
-
-#if defined(__APPLE_CC__) /* apple */
-#define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t"
-#else /* gnu */
-#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t"
-#endif
- asm volatile ("mtspr 256, %0\n\t"
- VAND (0, 0, 0)
- :
- : "r" (-1));
-
- canjump = 0;
- accel |= MPEG2_ACCEL_PPC_ALTIVEC;
-
- signal (SIGILL, oldsig);
- }
-#endif /* ACCEL_DETECT */
-
- return accel;
-}
-#endif /* ARCH_PPC */
-
-#if ARCH_SPARC
-static uint32_t arch_accel (uint32_t accel)
-{
- if (accel & MPEG2_ACCEL_SPARC_VIS2)
- accel |= MPEG2_ACCEL_SPARC_VIS;
-
-#ifdef ACCEL_DETECT
- if ((accel & (MPEG2_ACCEL_SPARC_VIS2 | MPEG2_ACCEL_DETECT)) ==
- MPEG2_ACCEL_DETECT) {
- static RETSIGTYPE (* oldsig) (int);
-
- oldsig = signal (SIGILL, sigill_handler);
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, oldsig);
- return accel;
- }
-
- canjump = 1;
-
- /* pdist %f0, %f0, %f0 */
- __asm__ __volatile__(".word\t0x81b007c0");
-
- canjump = 0;
- accel |= MPEG2_ACCEL_SPARC_VIS;
-
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, oldsig);
- return accel;
- }
-
- canjump = 1;
-
- /* edge8n %g0, %g0, %g0 */
- __asm__ __volatile__(".word\t0x81b00020");
-
- canjump = 0;
- accel |= MPEG2_ACCEL_SPARC_VIS2;
-
- signal (SIGILL, oldsig);
- }
-#endif /* ACCEL_DETECT */
-
- return accel;
-}
-#endif /* ARCH_SPARC */
-
-#if ARCH_ALPHA
-static inline uint32_t arch_accel (uint32_t accel)
-{
- if (accel & MPEG2_ACCEL_ALPHA_MVI)
- accel |= MPEG2_ACCEL_ALPHA;
-
-#ifdef ACCEL_DETECT
- if (accel & MPEG2_ACCEL_DETECT) {
- uint64_t no_mvi;
-
- asm volatile ("amask %1, %0"
- : "=r" (no_mvi)
- : "rI" (256)); /* AMASK_MVI */
- accel |= no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
- MPEG2_ACCEL_ALPHA_MVI);
- }
-#endif /* ACCEL_DETECT */
-
- return accel;
-}
-#endif /* ARCH_ALPHA */
-
-uint32_t mpeg2_detect_accel (uint32_t accel)
-{
-#if ARCH_X86 || ARCH_X86_64 || ARCH_PPC || ARCH_ALPHA || ARCH_SPARC
- accel = arch_accel (accel);
-#endif
- return accel;
-}
diff --git a/libmpeg2/cpu_state.c b/libmpeg2/cpu_state.c
deleted file mode 100644
index d82b6738a7..0000000000
--- a/libmpeg2/cpu_state.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * cpu_state.c
- * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
- * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "mpeg2.h"
-#include "attributes.h"
-#include "mpeg2_internal.h"
-#if ARCH_X86 || ARCH_X86_64
-#include "mmx.h"
-#endif
-
-void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL;
-void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL;
-
-#if ARCH_X86 || ARCH_X86_64
-static void state_restore_mmx (cpu_state_t * state)
-{
- emms ();
-}
-#endif
-
-#if ARCH_PPC
-#if defined(__APPLE_CC__) /* apple */
-#define LI(a,b) "li r" #a "," #b "\n\t"
-#define STVX0(a,b,c) "stvx v" #a ",0,r" #c "\n\t"
-#define STVX(a,b,c) "stvx v" #a ",r" #b ",r" #c "\n\t"
-#define LVX0(a,b,c) "lvx v" #a ",0,r" #c "\n\t"
-#define LVX(a,b,c) "lvx v" #a ",r" #b ",r" #c "\n\t"
-#else /* gnu */
-#define LI(a,b) "li " #a "," #b "\n\t"
-#define STVX0(a,b,c) "stvx " #a ",0," #c "\n\t"
-#define STVX(a,b,c) "stvx " #a "," #b "," #c "\n\t"
-#define LVX0(a,b,c) "lvx " #a ",0," #c "\n\t"
-#define LVX(a,b,c) "lvx " #a "," #b "," #c "\n\t"
-#endif
-
-static void state_save_altivec (cpu_state_t * state)
-{
- asm (LI (9, 16)
- STVX0 (20, 0, 3)
- LI (11, 32)
- STVX (21, 9, 3)
- LI (9, 48)
- STVX (22, 11, 3)
- LI (11, 64)
- STVX (23, 9, 3)
- LI (9, 80)
- STVX (24, 11, 3)
- LI (11, 96)
- STVX (25, 9, 3)
- LI (9, 112)
- STVX (26, 11, 3)
- LI (11, 128)
- STVX (27, 9, 3)
- LI (9, 144)
- STVX (28, 11, 3)
- LI (11, 160)
- STVX (29, 9, 3)
- LI (9, 176)
- STVX (30, 11, 3)
- STVX (31, 9, 3));
-}
-
-static void state_restore_altivec (cpu_state_t * state)
-{
- asm (LI (9, 16)
- LVX0 (20, 0, 3)
- LI (11, 32)
- LVX (21, 9, 3)
- LI (9, 48)
- LVX (22, 11, 3)
- LI (11, 64)
- LVX (23, 9, 3)
- LI (9, 80)
- LVX (24, 11, 3)
- LI (11, 96)
- LVX (25, 9, 3)
- LI (9, 112)
- LVX (26, 11, 3)
- LI (11, 128)
- LVX (27, 9, 3)
- LI (9, 144)
- LVX (28, 11, 3)
- LI (11, 160)
- LVX (29, 9, 3)
- LI (9, 176)
- LVX (30, 11, 3)
- LVX (31, 9, 3));
-}
-#endif
-
-void mpeg2_cpu_state_init (uint32_t accel)
-{
-#if ARCH_X86 || ARCH_X86_64
- if (accel & MPEG2_ACCEL_X86_MMX) {
- mpeg2_cpu_state_restore = state_restore_mmx;
- }
-#endif
-#if ARCH_PPC
- if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
- mpeg2_cpu_state_save = state_save_altivec;
- mpeg2_cpu_state_restore = state_restore_altivec;
- }
-#endif
-}
diff --git a/libmpeg2/decode.c b/libmpeg2/decode.c
deleted file mode 100644
index f30b86b740..0000000000
--- a/libmpeg2/decode.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * decode.c
- * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
- * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Modified for use with MPlayer, see libmpeg2_changes.diff for the exact changes.
- * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- */
-
-#include "config.h"
-
-#include <string.h> /* memcmp/memset, try to remove */
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "mpeg2.h"
-#include "attributes.h"
-#include "mpeg2_internal.h"
-
-static int mpeg2_accels = 0;
-
-#define BUFFER_SIZE (1194 * 1024)
-
-const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec)
-{
- return &(mpeg2dec->info);
-}
-
-static inline int skip_chunk (mpeg2dec_t * mpeg2dec, int bytes)
-{
- uint8_t * current;
- uint32_t shift;
- uint8_t * limit;
- uint8_t byte;
-
- if (!bytes)
- return 0;
-
- current = mpeg2dec->buf_start;
- shift = mpeg2dec->shift;
- limit = current + bytes;
-
- do {
- byte = *current++;
- if (shift == 0x00000100) {
- int skipped;
-
- mpeg2dec->shift = 0xffffff00;
- skipped = current - mpeg2dec->buf_start;
- mpeg2dec->buf_start = current;
- return skipped;
- }
- shift = (shift | byte) << 8;
- } while (current < limit);
-
- mpeg2dec->shift = shift;
- mpeg2dec->buf_start = current;
- return 0;
-}
-
-static inline int copy_chunk (mpeg2dec_t * mpeg2dec, int bytes)
-{
- uint8_t * current;
- uint32_t shift;
- uint8_t * chunk_ptr;
- uint8_t * limit;
- uint8_t byte;
-
- if (!bytes)
- return 0;
-
- current = mpeg2dec->buf_start;
- shift = mpeg2dec->shift;
- chunk_ptr = mpeg2dec->chunk_ptr;
- limit = current + bytes;
-
- do {
- byte = *current++;
- if (shift == 0x00000100) {
- int copied;
-
- mpeg2dec->shift = 0xffffff00;
- mpeg2dec->chunk_ptr = chunk_ptr + 1;
- copied = current - mpeg2dec->buf_start;
- mpeg2dec->buf_start = current;
- return copied;
- }
- shift = (shift | byte) << 8;
- *chunk_ptr++ = byte;
- } while (current < limit);
-
- mpeg2dec->shift = shift;
- mpeg2dec->buf_start = current;
- return 0;
-}
-
-void mpeg2_buffer (mpeg2dec_t * mpeg2dec, uint8_t * start, uint8_t * end)
-{
- mpeg2dec->buf_start = start;
- mpeg2dec->buf_end = end;
-}
-
-int mpeg2_getpos (mpeg2dec_t * mpeg2dec)
-{
- return mpeg2dec->buf_end - mpeg2dec->buf_start;
-}
-
-static inline mpeg2_state_t seek_chunk (mpeg2dec_t * mpeg2dec)
-{
- int size, skipped;
-
- size = mpeg2dec->buf_end - mpeg2dec->buf_start;
- skipped = skip_chunk (mpeg2dec, size);
- if (!skipped) {
- mpeg2dec->bytes_since_tag += size;
- return STATE_BUFFER;
- }
- mpeg2dec->bytes_since_tag += skipped;
- mpeg2dec->code = mpeg2dec->buf_start[-1];
- return STATE_INTERNAL_NORETURN;
-}
-
-mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec)
-{
- while (!(mpeg2dec->code == 0xb3 ||
- ((mpeg2dec->code == 0xb7 || mpeg2dec->code == 0xb8 ||
- !mpeg2dec->code) && mpeg2dec->sequence.width != (unsigned)-1)))
- if (seek_chunk (mpeg2dec) == STATE_BUFFER)
- return STATE_BUFFER;
- mpeg2dec->chunk_start = mpeg2dec->chunk_ptr = mpeg2dec->chunk_buffer;
- mpeg2dec->user_data_len = 0;
- return ((mpeg2dec->code == 0xb7) ?
- mpeg2_header_end (mpeg2dec) : mpeg2_parse_header (mpeg2dec));
-}
-
-#define RECEIVED(code,state) (((state) << 8) + (code))
-
-mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec)
-{
- int size_buffer, size_chunk, copied;