summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-14 16:35:44 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-14 16:35:44 +0000
commitf4b5a723b06b25babe201b0a97bdeebc716f5bba (patch)
tree10a759a0438df774a7b1eab6af0e3995f85ae4d3 /apps
parent32bd59d4f75f135b26a537f438e0d6b893f1cdfb (diff)
downloadrockbox-f4b5a723b06b25babe201b0a97bdeebc716f5bba.tar.gz
rockbox-f4b5a723b06b25babe201b0a97bdeebc716f5bba.zip
mpeg2dec in mpegplayer: Do a little code slashing and organizing. Much more to come I think.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13159 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/mpegplayer/SOURCES11
-rw-r--r--apps/plugins/mpegplayer/cpu_accel.c220
-rw-r--r--apps/plugins/mpegplayer/cpu_state.c129
-rw-r--r--apps/plugins/mpegplayer/decode.c23
-rw-r--r--apps/plugins/mpegplayer/header.c4
-rw-r--r--apps/plugins/mpegplayer/idct.c86
-rw-r--r--apps/plugins/mpegplayer/motion_comp.c133
-rw-r--r--apps/plugins/mpegplayer/motion_comp.h84
-rw-r--r--apps/plugins/mpegplayer/motion_comp_arm.c183
-rw-r--r--apps/plugins/mpegplayer/motion_comp_arm_c.c37
-rw-r--r--apps/plugins/mpegplayer/motion_comp_arm_s.S104
-rw-r--r--apps/plugins/mpegplayer/mpeg2.h14
-rw-r--r--apps/plugins/mpegplayer/mpeg2_internal.h46
-rw-r--r--apps/plugins/mpegplayer/slice.c67
14 files changed, 274 insertions, 867 deletions
diff --git a/apps/plugins/mpegplayer/SOURCES b/apps/plugins/mpegplayer/SOURCES
index fc23a2ab11..e9a01b73d0 100644
--- a/apps/plugins/mpegplayer/SOURCES
+++ b/apps/plugins/mpegplayer/SOURCES
@@ -1,14 +1,17 @@
alloc.c
-cpu_accel.c
-cpu_state.c
decode.c
header.c
idct.c
+
motion_comp.c
+
#ifdef CPU_ARM
-motion_comp_arm.c
+motion_comp_arm_c.c
motion_comp_arm_s.S
-#endif
+#else /* other CPU or SIM */
+motion_comp_c.c
+#endif /* CPU_* */
+
slice.c
video_out_rockbox.c
mpeg_settings.c
diff --git a/apps/plugins/mpegplayer/cpu_accel.c b/apps/plugins/mpegplayer/cpu_accel.c
deleted file mode 100644
index 2616e04cd0..0000000000
--- a/apps/plugins/mpegplayer/cpu_accel.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * cpu_accel.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 "plugin.h"
-
-#include "mpeg2dec_config.h"
-
-#include "mpeg2.h"
-#include "attributes.h"
-#include "mpeg2_internal.h"
-
-#ifdef ACCEL_DETECT
-#ifdef ARCH_X86
-static inline uint32_t arch_accel (void)
-{
- uint32_t eax, ebx, ecx, edx;
- int AMD;
- uint32_t caps;
-
-#if !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 */
-#define cpuid(op,eax,ebx,ecx,edx) \
- __asm__ ("push %%ebx\n\t" \
- "cpuid\n\t" \
- "movl %%ebx,%1\n\t" \
- "pop %%ebx" \
- : "=a" (eax), \
- "=r" (ebx), \
- "=c" (ecx), \
- "=d" (edx) \
- : "a" (op) \
- : "cc")
-#endif
-
- __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 0;
-
- cpuid (0x00000000, eax, ebx, ecx, edx);
- if (!eax) /* vendor string only */
- return 0;
-
- AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
-
- cpuid (0x00000001, eax, ebx, ecx, edx);
- if (! (edx & 0x00800000)) /* no MMX */
- return 0;
-
- caps = MPEG2_ACCEL_X86_MMX;
- if (edx & 0x02000000) /* SSE - identical to AMD MMX extensions */
- caps = MPEG2_ACCEL_X86_MMX | MPEG2_ACCEL_X86_MMXEXT;
-
- cpuid (0x80000000, eax, ebx, ecx, edx);
- if (eax < 0x80000001) /* no extended capabilities */
- return caps;
-
- cpuid (0x80000001, eax, ebx, ecx, edx);
-
- if (edx & 0x80000000)
- caps |= MPEG2_ACCEL_X86_3DNOW;
-
- if (AMD && (edx & 0x00400000)) /* AMD MMX extensions */
- caps |= MPEG2_ACCEL_X86_MMXEXT;
-
- return caps;
-}
-#endif /* ARCH_X86 */
-
-#if defined(ARCH_PPC) || defined(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);
-}
-
-#ifdef ARCH_PPC
-static inline uint32_t arch_accel (void)
-{
- static RETSIGTYPE (* oldsig) (int);
-
- oldsig = signal (SIGILL, sigill_handler);
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, oldsig);
- return 0;
- }
-
- canjump = 1;
-
-#ifdef HAVE_ALTIVEC_H /* gnu */
-#define VAND(a,b,c) "vand " #a "," #b "," #c "\n\t"
-#else /* apple */
-#define VAND(a,b,c) "vand v" #a ",v" #b ",v" #c "\n\t"
-#endif
- asm volatile ("mtspr 256, %0\n\t"
- VAND (0, 0, 0)
- :
- : "r" (-1));
-
- canjump = 0;
-
- signal (SIGILL, oldsig);
- return MPEG2_ACCEL_PPC_ALTIVEC;
-}
-#endif /* ARCH_PPC */
-
-#ifdef ARCH_SPARC
-static inline uint32_t arch_accel (void)
-{
- static RETSIGTYPE (* oldsig) (int);
-
- oldsig = signal (SIGILL, sigill_handler);
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, oldsig);
- return 0;
- }
-
- canjump = 1;
-
- /* pdist %f0, %f0, %f0 */
- __asm__ __volatile__(".word\t0x81b007c0");
-
- canjump = 0;
-
- if (sigsetjmp (jmpbuf, 1)) {
- signal (SIGILL, oldsig);
- return MPEG2_ACCEL_SPARC_VIS;
- }
-
- canjump = 1;
-
- /* edge8n %g0, %g0, %g0 */
- __asm__ __volatile__(".word\t0x81b00020");
-
- canjump = 0;
-
- signal (SIGILL, oldsig);
- return MPEG2_ACCEL_SPARC_VIS | MPEG2_ACCEL_SPARC_VIS2;
-}
-#endif /* ARCH_SPARC */
-#endif /* ARCH_PPC || ARCH_SPARC */
-
-#ifdef ARCH_ALPHA
-static inline uint32_t arch_accel (void)
-{
- uint64_t no_mvi;
-
- asm volatile ("amask %1, %0"
- : "=r" (no_mvi)
- : "rI" (256)); /* AMASK_MVI */
- return no_mvi ? MPEG2_ACCEL_ALPHA : (MPEG2_ACCEL_ALPHA |
- MPEG2_ACCEL_ALPHA_MVI);
-}
-#endif /* ARCH_ALPHA */
-#endif /* ACCEL_DETECT */
-
-uint32_t mpeg2_detect_accel (void)
-{
- uint32_t accel;
-
- accel = 0;
-#ifdef ACCEL_DETECT
-#if defined (ARCH_X86) || defined (ARCH_PPC) || defined (ARCH_ALPHA) || defined (ARCH_SPARC)
- accel = arch_accel ();
-#endif
-#endif
- return accel;
-}
diff --git a/apps/plugins/mpegplayer/cpu_state.c b/apps/plugins/mpegplayer/cpu_state.c
deleted file mode 100644
index 4406853626..0000000000
--- a/apps/plugins/mpegplayer/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 "plugin.h"
-
-#include "mpeg2dec_config.h"
-
-#include "mpeg2.h"
-#include "attributes.h"
-#include "mpeg2_internal.h"
-#ifdef ARCH_X86
-#include "mmx.h"
-#endif
-
-void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL;
-void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL;
-
-#ifdef ARCH_X86
-static void state_restore_mmx (cpu_state_t * state)
-{
- emms ();
-}
-#endif
-
-#ifdef ARCH_PPC
-#ifdef HAVE_ALTIVEC_H /* 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"
-#else /* 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"
-#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)
-{
- (void)accel;
-#ifdef ARCH_X86
- if (accel & MPEG2_ACCEL_X86_MMX) {
- mpeg2_cpu_state_restore = state_restore_mmx;
- }
-#endif
-#ifdef 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/apps/plugins/mpegplayer/decode.c b/apps/plugins/mpegplayer/decode.c
index 613292699d..299abc9663 100644
--- a/apps/plugins/mpegplayer/decode.c
+++ b/apps/plugins/mpegplayer/decode.c
@@ -31,8 +31,6 @@ extern struct plugin_api* rb;
#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)
@@ -270,7 +268,7 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
break;
case RECEIVED (0x01, STATE_PICTURE):
case RECEIVED (0x01, STATE_PICTURE_2ND):
- mpeg2_header_picture_finalize (mpeg2dec, mpeg2_accels);
+ mpeg2_header_picture_finalize (mpeg2dec);
mpeg2dec->action = mpeg2_header_slice_start;
break;
@@ -302,7 +300,7 @@ int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg)
int error;
error = convert (MPEG2_CONVERT_SET, NULL, &(mpeg2dec->sequence), 0,
- mpeg2_accels, arg, &convert_init);
+ arg, &convert_init);
if (!error) {
mpeg2dec->convert = convert;
mpeg2dec->convert_arg = arg;
@@ -323,7 +321,7 @@ int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride)
stride = mpeg2dec->convert (MPEG2_CONVERT_STRIDE, NULL,
&(mpeg2dec->sequence), stride,
- mpeg2_accels, mpeg2dec->convert_arg,
+ mpeg2dec->convert_arg,
&convert_init);
mpeg2dec->convert_id_size = convert_init.id_size;
mpeg2dec->convert_stride = stride;
@@ -382,19 +380,6 @@ void mpeg2_tag_picture (mpeg2dec_t * mpeg2dec, uint32_t tag, uint32_t tag2)
mpeg2dec->bytes_since_tag = 0;
}
-uint32_t mpeg2_accel (uint32_t accel)
-{
- if (!mpeg2_accels) {
- if (accel & MPEG2_ACCEL_DETECT)
- accel |= mpeg2_detect_accel ();
- mpeg2_accels = accel |= MPEG2_ACCEL_DETECT;
- mpeg2_cpu_state_init (accel);
- mpeg2_idct_init (accel);
- mpeg2_mc_init (accel);
- }
- return mpeg2_accels & ~MPEG2_ACCEL_DETECT;
-}
-
void mpeg2_reset (mpeg2dec_t * mpeg2dec, int full_reset)
{
mpeg2dec->buf_start = mpeg2dec->buf_end = NULL;
@@ -420,7 +405,7 @@ mpeg2dec_t * mpeg2_init (void)
{
mpeg2dec_t * mpeg2dec;
- mpeg2_accel (MPEG2_ACCEL_DETECT);
+ mpeg2_idct_init ();
mpeg2dec = (mpeg2dec_t *) mpeg2_malloc (sizeof (mpeg2dec_t),
MPEG2_ALLOC_MPEG2DEC);
diff --git a/apps/plugins/mpegplayer/header.c b/apps/plugins/mpegplayer/header.c
index 6e8cfc213a..7f94705f52 100644
--- a/apps/plugins/mpegplayer/header.c
+++ b/apps/plugins/mpegplayer/header.c
@@ -603,7 +603,7 @@ static int picture_display_ext (mpeg2dec_t * mpeg2dec)
return 0;
}
-void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels)
+void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec)
{
mpeg2_decoder_t * decoder = &(mpeg2dec->decoder);
int old_type_b = (decoder->coding_type == B_TYPE);
@@ -661,7 +661,7 @@ void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels)
mpeg2dec->convert (MPEG2_CONVERT_START,
mpeg2dec->decoder.convert_id,
&(mpeg2dec->sequence),
- mpeg2dec->convert_stride, accels,
+ mpeg2dec->convert_stride,
mpeg2dec->convert_arg, &convert_init);
mpeg2dec->convert_start = convert_init.start;
mpeg2dec->decoder.convert = convert_init.copy;
diff --git a/apps/plugins/mpegplayer/idct.c b/apps/plugins/mpegplayer/idct.c
index 7ad78bfcd9..ee02e72a6f 100644
--- a/apps/plugins/mpegplayer/idct.c
+++ b/apps/plugins/mpegplayer/idct.c
@@ -77,18 +77,18 @@ uint8_t mpeg2_clip[3840 * 2 + 256] IBSS_ATTR;
#endif
#if 0
-#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
-do { \
- t0 = W0 * d0 + W1 * d1; \
- t1 = W0 * d1 - W1 * d0; \
-} while (0)
+#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
+ do { \
+ t0 = W0 * d0 + W1 * d1; \
+ t1 = W0 * d1 - W1 * d0; \
+ } while (0)
#else
-#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
-do { \
- int tmp = W0 * (d0 + d1); \
- t0 = tmp + (W1 - W0) * d1; \
- t1 = tmp - (W1 + W0) * d0; \
-} while (0)
+#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
+ do { \
+ int tmp = W0 * (d0 + d1); \
+ t0 = tmp + (W1 - W0) * d1; \
+ t1 = tmp - (W1 + W0) * d0; \
+ } while (0)
#endif
static inline void idct_row (int16_t * const block)
@@ -258,58 +258,26 @@ static void mpeg2_idct_add_c (const int last, int16_t * block,
}
}
-void mpeg2_idct_init (uint32_t accel)
+void mpeg2_idct_init (void)
{
- (void)accel;
-#ifdef ARCH_X86
- if (accel & MPEG2_ACCEL_X86_MMXEXT) {
- mpeg2_idct_copy = mpeg2_idct_copy_mmxext;
- mpeg2_idct_add = mpeg2_idct_add_mmxext;
- mpeg2_idct_mmx_init ();
- } else if (accel & MPEG2_ACCEL_X86_MMX) {
- mpeg2_idct_copy = mpeg2_idct_copy_mmx;
- mpeg2_idct_add = mpeg2_idct_add_mmx;
- mpeg2_idct_mmx_init ();
- } else
-#endif
-#ifdef ARCH_PPC
- if (accel & MPEG2_ACCEL_PPC_ALTIVEC) {
- mpeg2_idct_copy = mpeg2_idct_copy_altivec;
- mpeg2_idct_add = mpeg2_idct_add_altivec;
- mpeg2_idct_altivec_init ();
- } else
-#endif
-#ifdef ARCH_ALPHA
- if (accel & MPEG2_ACCEL_ALPHA_MVI) {
- mpeg2_idct_copy = mpeg2_idct_copy_mvi;
- mpeg2_idct_add = mpeg2_idct_add_mvi;
- mpeg2_idct_alpha_init ();
- } else if (accel & MPEG2_ACCEL_ALPHA) {
- int i;
+ extern uint8_t mpeg2_scan_norm[64];
+ extern uint8_t mpeg2_scan_alt[64];
+ int i, j;
- mpeg2_idct_copy = mpeg2_idct_copy_alpha;
- mpeg2_idct_add = mpeg2_idct_add_alpha;
- mpeg2_idct_alpha_init ();
- for (i = -3840; i < 3840 + 256; i++)
- CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
- } else
-#endif
- {
- extern uint8_t mpeg2_scan_norm[64];
- extern uint8_t mpeg2_scan_alt[64];
- int i, j;
+ mpeg2_idct_copy = mpeg2_idct_copy_c;
+ mpeg2_idct_add = mpeg2_idct_add_c;
- mpeg2_idct_copy = mpeg2_idct_copy_c;
- mpeg2_idct_add = mpeg2_idct_add_c;
#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM)
- for (i = -3840; i < 3840 + 256; i++)
- CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
+ for (i = -3840; i < 3840 + 256; i++)
+ CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
#endif
- for (i = 0; i < 64; i++) {
- j = mpeg2_scan_norm[i];
- mpeg2_scan_norm[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);
- j = mpeg2_scan_alt[i];
- mpeg2_scan_alt[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);
- }
+
+ for (i = 0; i < 64; i++)
+ {
+ j = mpeg2_scan_norm[i];
+ mpeg2_scan_norm[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);
+
+ j = mpeg2_scan_alt[i];
+ mpeg2_scan_alt[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);
}
}
diff --git a/apps/plugins/mpegplayer/motion_comp.c b/apps/plugins/mpegplayer/motion_comp.c
index b2f30c01ff..beb5c00228 100644
--- a/apps/plugins/mpegplayer/motion_comp.c
+++ b/apps/plugins/mpegplayer/motion_comp.c
@@ -29,108 +29,33 @@
#include "attributes.h"
#include "mpeg2_internal.h"
-mpeg2_mc_t mpeg2_mc;
-
-void mpeg2_mc_init (uint32_t accel)
+/* These are defined in their respective target files - motion_comp_X.c */
+extern mpeg2_mc_fct MC_put_o_16;
+extern mpeg2_mc_fct MC_put_o_8;
+extern mpeg2_mc_fct MC_put_x_16;
+extern mpeg2_mc_fct MC_put_x_8;
+extern mpeg2_mc_fct MC_put_y_16;
+extern mpeg2_mc_fct MC_put_y_8;
+extern mpeg2_mc_fct MC_put_xy_16;
+extern mpeg2_mc_fct MC_put_xy_8;
+
+extern mpeg2_mc_fct MC_avg_o_16;
+extern mpeg2_mc_fct MC_avg_o_8;
+extern mpeg2_mc_fct MC_avg_x_16;
+extern mpeg2_mc_fct MC_avg_x_8;
+extern mpeg2_mc_fct MC_avg_y_16;
+extern mpeg2_mc_fct MC_avg_y_8;
+extern mpeg2_mc_fct MC_avg_xy_16;
+extern mpeg2_mc_fct MC_avg_xy_8;
+
+mpeg2_mc_t mpeg2_mc =
{
- (void)accel;
-#ifdef ARCH_X86
- if (accel & MPEG2_ACCEL_X86_MMXEXT)
- mpeg2_mc = mpeg2_mc_mmxext;
- else if (accel & MPEG2_ACCEL_X86_3DNOW)
- mpeg2_mc = mpeg2_mc_3dnow;
- else if (accel & MPEG2_ACCEL_X86_MMX)
- mpeg2_mc = mpeg2_mc_mmx;
- else
-#endif
-#ifdef ARCH_PPC
- if (accel & MPEG2_ACCEL_PPC_ALTIVEC)
- mpeg2_mc = mpeg2_mc_altivec;
- else
-#endif
-#ifdef ARCH_ALPHA
- if (accel & MPEG2_ACCEL_ALPHA)
- mpeg2_mc = mpeg2_mc_alpha;
- else
-#endif
-#ifdef ARCH_SPARC
- if (accel & MPEG2_ACCEL_SPARC_VIS)
- mpeg2_mc = mpeg2_mc_vis;
- else
-#endif
-
-#ifdef CPU_ARM
- mpeg2_mc = mpeg2_mc_arm;
-#else
- mpeg2_mc = mpeg2_mc_c;
-#endif
-}
-
-#define avg2(a,b) ((a+b+1)>>1)
-#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
-
-#define predict_o(i) (ref[i])
-#define predict_x(i) (avg2 (ref[i], ref[i+1]))
-#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
-#define predict_xy(i) (avg4 (ref[i], ref[i+1], \
- (ref+stride)[i], (ref+stride)[i+1]))
-
-#define put(predictor,i) dest[i] = predictor (i)
-#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])
-
-/* mc function template */
-
-#define MC_FUNC(op,xy) \
-static void MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \
- const int stride, int height) \
-{ \
- do { \
- op (predict_##xy, 0); \
- op (predict_##xy, 1); \
- op (predict_##xy, 2); \
- op (predict_##xy, 3); \
- op (predict_##xy, 4); \
- op (predict_##xy, 5); \
- op (predict_##xy, 6); \
- op (predict_##xy, 7); \
- op (predict_##xy, 8); \
- op (predict_##xy, 9); \
- op (predict_##xy, 10); \
- op (predict_##xy, 11); \
- op (predict_##xy, 12); \
- op (predict_##xy, 13); \
- op (predict_##xy, 14); \
- op (predict_##xy, 15); \
- ref += stride; \
- dest += stride; \
- } while (--height); \
-} \
-static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \
- const int stride, int height) \
-{ \
- do { \
- op (predict_##xy, 0); \
- op (predict_##xy, 1); \
- op (predict_##xy, 2); \
- op (predict_##xy, 3); \
- op (predict_##xy, 4); \
- op (predict_##xy, 5); \
- op (predict_##xy, 6); \
- op (predict_##xy, 7); \
- ref += stride; \
- dest += stride; \
- } while (--height); \
-}
-
-/* definitions of the actual mc functions */
-
-MC_FUNC (put,o)
-MC_FUNC (avg,o)
-MC_FUNC (put,x)
-MC_FUNC (avg,x)
-MC_FUNC (put,y)
-MC_FUNC (avg,y)
-MC_FUNC (put,xy)
-MC_FUNC (avg,xy)
-
-MPEG2_MC_EXTERN (c)
+ {
+ MC_put_o_16, MC_put_x_16, MC_put_y_16, MC_put_xy_16,
+ MC_put_o_8, MC_put_x_8, MC_put_y_8, MC_put_xy_8
+ },
+ {
+ MC_avg_o_16, MC_avg_x_16, MC_avg_y_16, MC_avg_xy_16,
+ MC_avg_o_8, MC_avg_x_8, MC_avg_y_8, MC_avg_xy_8
+ }
+};
diff --git a/apps/plugins/mpegplayer/motion_comp.h b/apps/plugins/mpegplayer/motion_comp.h
new file mode 100644
index 0000000000..2823cc6da1
--- /dev/null
+++ b/apps/plugins/mpegplayer/motion_comp.h
@@ -0,0 +1,84 @@
+/*
+ * motion_comp.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
+ */
+
+
+#define avg2(a,b) ((a+b+1)>>1)
+#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
+
+#define predict_o(i) (ref[i])
+#define predict_x(i) (avg2 (ref[i], ref[i+1]))
+#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
+#define predict_xy(i) (avg4 (ref[i], ref[i+1], \
+ (ref+stride)[i], (ref+stride)[i+1]))
+
+#define put(predictor,i) dest[i] = predictor (i)
+#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])
+
+/* mc function template */
+#define MC_FUNC(op, xy) \
+ MC_FUNC_16(op, xy) \
+ MC_FUNC_8(op, xy)
+
+#define MC_FUNC_16(op, xy) \
+ void MC_##op##_##xy##_16 (uint8_t * dest, const uint8_t * ref, \
+ const int stride, int height) \
+ { \
+ do { \
+ op (predict_##xy, 0); \
+ op (predict_##xy, 1); \
+ op (predict_##xy, 2); \
+ op (predict_##xy, 3); \
+ op (predict_##xy, 4); \
+ op (predict_##xy, 5); \
+ op (predict_##xy, 6); \
+ op (predict_##xy, 7); \
+ op (predict_##xy, 8); \
+ op (predict_##xy, 9); \
+ op (predict_##xy, 10); \
+ op (predict_##xy, 11); \
+ op (predict_##xy, 12); \
+ op (predict_##xy, 13); \
+ op (predict_##xy, 14); \
+ op (predict_##xy, 15); \
+ ref += stride; \
+ dest += stride; \
+ } while (--height); \
+ }
+
+#define MC_FUNC_8(op, xy) \
+ void MC_##op##_##xy##_8 (uint8_t * dest, const uint8_t * ref, \
+ const int stride, int height) \
+ { \
+ do { \
+ op (predict_##xy, 0); \
+ op (predict_##xy, 1); \
+ op (predict_##xy, 2); \
+ op (predict_##xy, 3); \
+ op (predict_##xy, 4); \
+ op (predict_##xy, 5); \
+ op (predict_##xy, 6); \
+ op (predict_##xy, 7); \
+ ref += stride; \
+ dest += stride; \
+ } while (--height); \
+ }
diff --git a/apps/plugins/mpegplayer/motion_comp_arm.c b/apps/plugins/mpegplayer/motion_comp_arm.c
deleted file mode 100644
index ec9eddab72..0000000000
--- a/apps/plugins/mpegplayer/motion_comp_arm.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * motion_comp_arm.c
- * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
- *
- * 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 "mpeg2dec_config.h"
-
-#include <inttypes.h>
-
-#include "mpeg2.h"
-#include "attributes.h"
-#include "mpeg2_internal.h"
-
-#define avg2(a,b) ((a+b+1)>>1)
-#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
-
-#define predict_o(i) (ref[i])
-#define predict_x(i) (avg2 (ref[i], ref[i+1]))
-#define predict_y(i) (avg2 (ref[i], (ref+stride)[i]))
-#define predict_xy(i) (avg4 (ref[i], ref[i+1], \
- (ref+stride)[i], (ref+stride)[i+1]))
-
-#define put(predictor,i) dest[i] = predictor (i)
-#define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])
-
-/* mc function template */
-
-#define MC_FUNC(op,xy) \
-inline static void MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \
- const int stride, int height) \
-{ \
- do { \
- op (predict_##xy, 0); \
- op (predict_##xy, 1); \
- op (predict_##xy, 2); \
- op (predict_##xy, 3); \
- op (predict_##xy, 4); \
- op (predict_##xy, 5); \
- op (predict_##xy, 6); \
- op (predict_##xy, 7); \
- op (predict_##xy, 8); \
- op (predict_##xy, 9); \
- op (predict_##xy, 10); \
- op (predict_##xy, 11); \
- op (predict_##xy, 12); \
- op (predict_##xy, 13); \
- op (predict_##xy, 14); \
- op (predict_##xy, 15); \
- ref += stride; \
- dest += stride; \
- } while (--height); \
-} \
-static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \
- const int stride, int height) \
-{ \
- do { \
- op (predict_##xy, 0); \
- op (predict_##xy, 1); \
- op (predict_##xy, 2); \
- op (predict_##xy, 3); \
- op (predict_##xy, 4); \
- op (predict_##xy, 5); \
- op (predict_##xy, 6); \
- op (predict_##xy, 7); \
- ref += stride; \
- dest += stride; \
- } while (--height); \
-} \
-/* definitions of the actual mc functions */
-
-/* MC_FUNC (put,o) */
-MC_FUNC (avg,o)
-/* MC_FUNC (put,x) */
-MC_FUNC (avg,x)
-MC_FUNC (put,y)
-MC_FUNC (avg,y)
-MC_FUNC (put,xy)
-MC_FUNC (avg,xy)
-
-
-extern void MC_put_o_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height);
-
-extern void MC_put_x_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height);
-
-
-static void MC_put_y_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_put_y_16_c(dest, ref, stride, height);
-}
-
-static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_put_xy_16_c(dest, ref, stride, height);
-}
-
-extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height);
-
-extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height);
-
-static void MC_put_y_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_put_y_8_c(dest, ref, stride, height);
-}
-
-static void MC_put_xy_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_put_xy_8_c(dest, ref, stride, height);
-}
-
-static void MC_avg_o_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_o_16_c(dest, ref, stride, height);
-}
-
-static void MC_avg_x_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_x_16_c(dest, ref, stride, height);
-}
-
-static void MC_avg_y_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_y_16_c(dest, ref, stride, height);
-}
-
-static void MC_avg_xy_16_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_xy_16_c(dest, ref, stride, height);
-}
-
-static void MC_avg_o_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_o_8_c(dest, ref, stride, height);
-}
-
-static void MC_avg_x_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_x_8_c(dest, ref, stride, height);
-}
-
-static void MC_avg_y_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_y_8_c(dest, ref, stride, height);
-}
-
-static void MC_avg_xy_8_arm (uint8_t * dest, const uint8_t * ref,
- int stride, int height)
-{
- MC_avg_xy_8_c(dest, ref, stride, height);
-}
-
-MPEG2_MC_EXTERN (arm)
diff --git a/apps/plugins/mpegplayer/motion_comp_arm_c.c b/apps/plugins/mpegplayer/motion_comp_arm_c.c
new file mode 100644
index 0000000000..1d0f9d22fc
--- /dev/null
+++ b/apps/plugins/mpegplayer/motion_comp_arm_c.c
@@ -0,0 +1,37 @@
+/*
+ * motion_comp_arm.c
+ * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
+ *
+ * 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 <inttypes.h>
+#include "mpeg2.h"
+#include "attributes.h"
+#include "mpeg2_internal.h"
+#include "motion_comp.h"
+
+/* definitions of the actual mc functions */
+
+/* MC_FUNC (put, o) <= ASM */
+MC_FUNC (avg, o)
+/* MC_FUNC (put, x) <= ASM */
+MC_FUNC (avg, x)
+MC_FUNC (put, y)
+MC_FUNC (avg, y)
+MC_FUNC (put, xy)
+MC_FUNC (avg, xy)
diff --git a/apps/plugins/mpegplayer/motion_comp_arm_s.S b/apps/plugins/mpegplayer/motion_comp_arm_s.S
index 82be8e6a8e..e515f8b516 100644
--- a/apps/plugins/mpegplayer/motion_comp_arm_s.S
+++ b/apps/plugins/mpegplayer/motion_comp_arm_s.S
@@ -22,24 +22,24 @@
@ ----------------------------------------------------------------
.align
- .global MC_put_o_16_arm
-MC_put_o_16_arm:
+ .global MC_put_o_16
+MC_put_o_16:
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
@@ pld [r1]
stmfd sp!, {r4-r11, lr} @ R14 is also called LR
and r4, r1, #3
- adr r5, MC_put_o_16_arm_align_jt
+ adr r5, MC_put_o_16_align_jt
add r5, r5, r4, lsl #2
ldr pc, [r5]
-MC_put_o_16_arm_align0:
+MC_put_o_16_align0:
ldmia r1, {r4-r7}
add r1, r1, r2
@@ pld [r1]
stmia r0, {r4-r7}
subs r3, r3, #1
add r0, r0, r2
- bne MC_put_o_16_arm_align0
+ bne MC_put_o_16_align0
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
.macro PROC shift
@@ -59,46 +59,46 @@ MC_put_o_16_arm_align0:
add r0, r0, r2
.endm
-MC_put_o_16_arm_align1:
+MC_put_o_16_align1:
and r1, r1, #0xFFFFFFFC
1: PROC(8)
bne 1b
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
-MC_put_o_16_arm_align2:
+MC_put_o_16_align2:
and r1, r1, #0xFFFFFFFC
1: PROC(16)
bne 1b
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
-MC_put_o_16_arm_align3:
+MC_put_o_16_align3:
and r1, r1, #0xFFFFFFFC
1: PROC(24)
bne 1b
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
-MC_put_o_16_arm_align_jt:
- .word MC_put_o_16_arm_align0
- .word MC_put_o_16_arm_align1
- .word MC_put_o_16_arm_align2
- .word MC_put_o_16_arm_align3
+MC_put_o_16_align_jt:
+ .word MC_put_o_16_align0
+ .word MC_put_o_16_align1
+ .word MC_put_o_16_align2
+ .word MC_put_o_16_align3
@ ----------------------------------------------------------------
.align
- .global MC_put_o_8_arm
-MC_put_o_8_arm:
+ .global MC_put_o_8
+MC_put_o_8:
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
@@ pld [r1]
stmfd sp!, {r4-r10, lr} @ R14 is also called LR
and r4, r1, #3
- adr r5, MC_put_o_8_arm_align_jt
+ adr r5, MC_put_o_8_align_jt
add r5, r5, r4, lsl #2
ldr pc, [r5]
-MC_put_o_8_arm_align0:
+MC_put_o_8_align0:
ldmia r1, {r4-r5}
add r1, r1, r2
@@ pld [r1]
stmia r0, {r4-r5}
add r0, r0, r2
subs r3, r3, #1
- bne MC_put_o_8_arm_align0
+ bne MC_put_o_8_align0
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
.macro PROC8 shift
@@ -114,29 +114,29 @@ MC_put_o_8_arm_align0:
add r0, r0, r2
.endm
-MC_put_o_8_arm_align1:
+MC_put_o_8_align1:
and r1, r1, #0xFFFFFFFC
1: PROC8(8)
bne 1b
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
-MC_put_o_8_arm_align2:
+MC_put_o_8_align2:
and r1, r1, #0xFFFFFFFC
1: PROC8(16)
bne 1b
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
-MC_put_o_8_arm_align3:
+MC_put_o_8_align3:
and r1, r1, #0xFFFFFFFC
1: PROC8(24)
bne 1b
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
-MC_put_o_8_arm_align_jt:
- .word MC_put_o_8_arm_align0
- .word MC_put_o_8_arm_align1
- .word MC_put_o_8_arm_align2
- .word MC_put_o_8_arm_align3
+MC_put_o_8_align_jt:
+ .word MC_put_o_8_align0
+ .word MC_put_o_8_align1
+ .word MC_put_o_8_align2
+ .word MC_put_o_8_align3
@ ----------------------------------------------------------------
.macro AVG_PW rW1, rW2
@@ -151,13 +151,13 @@ MC_put_o_8_arm_align_jt:
.endm
.align
- .global MC_put_x_16_arm
-MC_put_x_16_arm:
+ .global MC_put_x_16
+MC_put_x_16:
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
@@ pld [r1]
stmfd sp!, {r4-r11,lr} @ R14 is also called LR
and r4, r1, #3
- adr r5, MC_put_x_16_arm_align_jt
+ adr r5, MC_put_x_16_align_jt
ldr r11, [r5]
mvn r12, r11
add r5, r5, r4, lsl #2
@@ -176,7 +176,7 @@ MC_put_x_16_arm:
@ and \R4, \R4, #0xFF
.endm
-MC_put_x_16_arm_align0:
+MC_put_x_16_align0:
ldmia r1, {r4-r8}
add r1, r1, r2
@@ pld [r1]
@@ -187,9 +187,9 @@ MC_put_x_16_arm_align0:
stmia r0, {r5-r8}
subs r3, r3, #1
add r0, r0, r2
- bne MC_put_x_16_arm_align0
+ bne MC_put_x_16_align0
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_16_arm_align1:
+MC_put_x_16_align1:
and r1, r1, #0xFFFFFFFC
1: ldmia r1, {r4-r8}
add r1, r1, r2
@@ -204,7 +204,7 @@ MC_put_x_16_arm_align1:
add r0, r0, r2
bne 1b
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_16_arm_align2:
+MC_put_x_16_align2:
and r1, r1, #0xFFFFFFFC
1: ldmia r1, {r4-r8}
add r1, r1, r2
@@ -219,7 +219,7 @@ MC_put_x_16_arm_align2:
add r0, r0, r2
bne 1b
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_16_arm_align3:
+MC_put_x_16_align3:
and r1, r1, #0xFFFFFFFC
1: ldmia r1, {r4-r8}
add r1, r1, r2
@@ -234,22 +234,22 @@ MC_put_x_16_arm_align3:
add r0, r0, r2
bne 1b
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_16_arm_align_jt:
+MC_put_x_16_align_jt:
.word 0x01010101
- .word MC_put_x_16_arm_align0
- .word MC_put_x_16_arm_align1
- .word MC_put_x_16_arm_align2
- .word MC_put_x_16_arm_align3
+ .word MC_put_x_16_align0
+ .word MC_put_x_16_align1
+ .word MC_put_x_16_align2
+ .word MC_put_x_16_align3
@ ----------------------------------------------------------------
.align
- .global MC_put_x_8_arm
-MC_put_x_8_arm:
+ .global MC_put_x_8
+MC_put_x_8:
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
@@ pld [r1]
stmfd sp!, {r4-r11,lr} @ R14 is also called LR
and r4, r1, #3
- adr r5, MC_put_x_8_arm_align_jt
+ adr r5, MC_put_x_8_align_jt
ldr r11, [r5]
mvn r12, r11
add r5, r5, r4, lsl #2
@@ -264,7 +264,7 @@ MC_put_x_8_arm:
@ and \R4, \R4, #0xFF
.endm
-MC_put_x_8_arm_align0:
+MC_put_x_8_align0:
ldmia r1, {r4-r6}
add r1, r1, r2
@@ pld [r1]
@@ -273,9 +273,9 @@ MC_put_x_8_arm_align0:
stmia r0, {r5-r6}
subs r3, r3, #1
add r0, r0, r2
- bne MC_put_x_8_arm_align0
+ bne MC_put_x_8_align0
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_8_arm_align1:
+MC_put_x_8_align1:
and r1, r1, #0xFFFFFFFC
1: ldmia r1, {r4-r6}
add r1, r1, r2
@@ -288,7 +288,7 @@ MC_put_x_8_arm_align1:
add r0, r0, r2
bne 1b
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_8_arm_align2:
+MC_put_x_8_align2:
and r1, r1, #0xFFFFFFFC
1: ldmia r1, {r4-r6}
add r1, r1, r2
@@ -301,7 +301,7 @@ MC_put_x_8_arm_align2:
add r0, r0, r2
bne 1b
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_8_arm_align3:
+MC_put_x_8_align3:
and r1, r1, #0xFFFFFFFC
1: ldmia r1, {r4-r6}
add r1, r1, r2
@@ -314,9 +314,9 @@ MC_put_x_8_arm_align3:
add r0, r0, r2
bne 1b
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
-MC_put_x_8_arm_align_jt:
+MC_put_x_8_align_jt:
.word 0x01010101
- .word MC_put_x_8_arm_align0
- .word MC_put_x_8_arm_align1
- .word MC_put_x_8_arm_align2
- .word MC_put_x_8_arm_align3
+ .word MC_put_x_8_align0
+ .word MC_put_x_8_align1
+ .word MC_put_x_8_align2
+ .word MC_put_x_8_align3
diff --git a/apps/plugins/mpegplayer/mpeg2.h b/apps/plugins/mpegplayer/mpeg2.h
index 6062f93010..01b3de49eb 100644
--- a/apps/plugins/mpegplayer/mpeg2.h
+++ b/apps/plugins/mpegplayer/mpeg2.h
@@ -144,24 +144,12 @@ typedef enum {
} mpeg2_convert_stage_t;
typedef int mpeg2_convert_t (int stage, void * id,
const mpeg2_sequence_t * sequence, int stride,
- uint32_t accel, void * arg,
- mpeg2_convert_init_t * result);
+ void * arg, mpeg2_convert_init_t * result);
int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg);
int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride);
void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id);
void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf);
-#define MPEG2_ACCEL_X86_MMX 1
-#define MPEG2_ACCEL_X86_3DNOW 2
-#define MPEG2_ACCEL_X86_MMXEXT 4
-#define MPEG2_ACCEL_PPC_ALTIVEC 1
-#define MPEG2_ACCEL_ALPHA 1
-#define MPEG2_ACCEL_ALPHA_MVI 2
-#define MPEG2_ACCEL_SPARC_VIS 1
-#define MPEG2_ACCEL_SPARC_VIS2 2
-#define MPEG2_ACCEL_DETECT 0x80000000
-
-uint32_t mpeg2_accel (uint32_t accel);
mpeg2dec_t * mpeg2_init (void);
const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec);
void mpeg2_close (mpeg2dec_t * mpeg2dec);
diff --git a/apps/plugins/mpegplayer/mpeg2_internal.h b/apps/plugins/mpegplayer/mpeg2_internal.h
index 443b6d6114..0c552b766f 100644
--- a/apps/plugins/mpegplayer/mpeg2_internal.h
+++ b/apps/plugins/mpegplayer/mpeg2_internal.h
@@ -244,58 +244,18 @@ int mpeg2_header_extension (mpeg2dec_t * mpeg2dec);
int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);
void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec);
void mpeg2_header_gop_finalize (mpeg2dec_t * mpeg2dec);
-void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels);
+void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec);
mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec);
mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec);
void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type);
/* idct.c */
-void mpeg2_idct_init (uint32_t accel);
-
-/* idct_mmx.c */
-void mpeg2_idct_copy_mmxext (int16_t * block, uint8_t * dest, int stride);
-void mpeg2_idct_add_mmxext (int last, int16_t * block,
- uint8_t * dest, int stride);
-void mpeg2_idct_copy_mmx (int16_t * block, uint8_t * dest, int stride);
-void mpeg2_idct_add_mmx (int last, int16_t * block,
- uint8_t * dest, int stride);
-void mpeg2_idct_mmx_init (void);
-
-/* idct_altivec.c */
-void mpeg2_idct_copy_altivec (int16_t * block, uint8_t * dest, int stride);
-void mpeg2_idct_add_altivec (int last, int16_t * block,
- uint8_t * dest, int stride);
-void mpeg2_idct_altivec_init (void);
-
-/* idct_alpha.c */
-void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, int stride);
-void mpeg2_idct_add_mvi (int last, int16_t * block,
- uint8_t * dest, int stride);
-void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, int stride);
-void mpeg2_idct_add_alpha (int last, int16_t * block,
- uint8_t * dest, int stride);
-void mpeg2_idct_alpha_init (void);
+void mpeg2_idct_init (void);
/* motion_comp.c */
-void mpeg2_mc_init (uint32_t accel);
+void mpeg2_mc_init (void);
typedef struct {
mpeg2_mc_fct * put [8];
mpeg2_mc_fct * avg [8];
} mpeg2_mc_t;
-
-#define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \
- {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \
- MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \
- {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \
- MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \
-};
-
-extern mpeg2_mc_t mpeg2_mc_c;
-extern mpeg2_mc_t mpeg2_mc_mmx;
-extern mpeg2_mc_t mpeg2_mc_mmxext;
-extern mpeg2_mc_t mpeg2_mc_3dnow;
-extern mpeg2_mc_t mpeg2_mc_altivec;
-extern mpeg2_mc_t mpeg2_mc_alpha;
-extern mpeg2_mc_t mpeg2_mc_vis;
-extern mpeg2_mc_t mpeg2_mc_arm;
diff --git a/apps/plugins/mpegplayer/slice.c b/apps/plugins/mpegplayer/slice.c
index 8ee341739d..7c1c07bf37 100644
--- a/apps/plugins/mpegplayer/slice.c
+++ b/apps/plugins/mpegplayer/slice.c
@@ -34,8 +34,6 @@ extern mpeg2_mc_t mpeg2_mc;
extern void (* mpeg2_idct_copy) (int16_t * block, uint8_t * dest, int stride);
extern void (* mpeg2_idct_add) (int last, int16_t * block,
uint8_t * dest, int stride);
-extern void (* mpeg2_cpu_state_save) (cpu_state_t * state);
-extern void (* mpeg2_cpu_state_restore) (cpu_state_t * state);
#include "vlc.h"
@@ -1554,39 +1552,36 @@ static void motion_fi_conceal (mpeg2_decoder_t * const decoder)
#undef bits
#undef bit_ptr
-#define MOTION_CALL(routine,direction) \
-do { \
- if ((direction) & MACROBLOCK_MOTION_FORWARD) \
- routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
- if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
- routine (decoder, &(decoder->b_motion), \
- ((direction) & MACROBLOCK_MOTION_FORWARD ? \
- mpeg2_mc.avg : mpeg2_mc.put)); \
+#define MOTION_CALL(routine,direction) \
+do { \
+ if ((direction) & MACROBLOCK_MOTION_FORWARD) \
+ routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
+ if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
+ routine (decoder, &(decoder->b_motion), \
+ ((direction) & MACROBLOCK_MOTION_FORWARD ? \
+ mpeg2_mc.avg : mpeg2_mc.put)); \
} while (0)
-#define NEXT_MACROBLOCK \
-do { \
- decoder->offset += 16; \
- if (decoder->offset == decoder->width) { \
- do { /* just so we can use the break statement */ \
- if (decoder->convert) { \
- decoder->convert (decoder->convert_id, decoder->dest, \
- decoder->v_offset); \
- if (decoder->coding_type == B_TYPE) \
- break; \
- } \
- decoder->dest[0] += decoder->slice_stride; \
- decoder->dest[1] += decoder->slice_uv_stride; \
- decoder->dest[2] += decoder->slice_uv_stride; \
- } while (0); \
- decoder->v_offset += 16; \
- if (decoder->v_offset > decoder->limit_y) { \
- if (mpeg2_cpu_state_restore) \
- mpeg2_cpu_state_restore (&cpu_state); \
- return; \
- } \
- decoder->offset = 0; \
- } \
+#define NEXT_MACROBLOCK \
+do { \
+ decoder->offset += 16; \
+ if (decoder->offset == decoder->width) { \
+ do { /* just so we can use the break statement */ \
+ if (decoder->convert) { \
+ decoder->convert (decoder->convert_id, decoder->dest, \
+ decoder->v_offset); \
+ if (decoder->coding_type == B_TYPE) \
+ break; \
+ } \
+ decoder->dest[0] += decoder->slice_stride; \
+ decoder->dest[1] += decoder->slice_uv_stride; \
+ decoder->dest[2] += decoder->slice_uv_stride; \
+ } while (0); \
+ decoder->v_offset += 16; \
+ if (decoder->v_offset > decoder->limit_y) \
+ return; \
+ decoder->offset = 0; \
+ } \
} while (0)
void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
@@ -1780,16 +1775,12 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code,
#define bit_buf (decoder->bitstream_buf)
#define bits (decoder->bitstream_bits)
#define bit_ptr (decoder->bitstream_ptr)
- cpu_state_t cpu_state;
bitstream_init (decoder, buffer);
if (slice_init (decoder, code))
return;
- if (mpeg2_cpu_state_save)
- mpeg2_cpu_state_save (&cpu_state);
-
while (1) {
int macroblock_modes;
int mba_inc;
@@ -2028,8 +2019,6 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code,
NEEDBITS (bit_buf, bits, bit_ptr);
continue;
default: /* end of slice, or error */
- if (mpeg2_cpu_state_restore)
- mpeg2_cpu_state_restore (&cpu_state);
return;
}
}