forked from len0rd/rockbox
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
This commit is contained in:
parent
32bd59d4f7
commit
f4b5a723b0
14 changed files with 273 additions and 866 deletions
|
@ -1,14 +1,17 @@
|
||||||
alloc.c
|
alloc.c
|
||||||
cpu_accel.c
|
|
||||||
cpu_state.c
|
|
||||||
decode.c
|
decode.c
|
||||||
header.c
|
header.c
|
||||||
idct.c
|
idct.c
|
||||||
|
|
||||||
motion_comp.c
|
motion_comp.c
|
||||||
|
|
||||||
#ifdef CPU_ARM
|
#ifdef CPU_ARM
|
||||||
motion_comp_arm.c
|
motion_comp_arm_c.c
|
||||||
motion_comp_arm_s.S
|
motion_comp_arm_s.S
|
||||||
#endif
|
#else /* other CPU or SIM */
|
||||||
|
motion_comp_c.c
|
||||||
|
#endif /* CPU_* */
|
||||||
|
|
||||||
slice.c
|
slice.c
|
||||||
video_out_rockbox.c
|
video_out_rockbox.c
|
||||||
mpeg_settings.c
|
mpeg_settings.c
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
}
|
|
|
@ -31,8 +31,6 @@ extern struct plugin_api* rb;
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
#include "mpeg2_internal.h"
|
#include "mpeg2_internal.h"
|
||||||
|
|
||||||
static int mpeg2_accels = 0;
|
|
||||||
|
|
||||||
#define BUFFER_SIZE (1194 * 1024)
|
#define BUFFER_SIZE (1194 * 1024)
|
||||||
|
|
||||||
const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec)
|
const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec)
|
||||||
|
@ -270,7 +268,7 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec)
|
||||||
break;
|
break;
|
||||||
case RECEIVED (0x01, STATE_PICTURE):
|
case RECEIVED (0x01, STATE_PICTURE):
|
||||||
case RECEIVED (0x01, STATE_PICTURE_2ND):
|
case RECEIVED (0x01, STATE_PICTURE_2ND):
|
||||||
mpeg2_header_picture_finalize (mpeg2dec, mpeg2_accels);
|
mpeg2_header_picture_finalize (mpeg2dec);
|
||||||
mpeg2dec->action = mpeg2_header_slice_start;
|
mpeg2dec->action = mpeg2_header_slice_start;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -302,7 +300,7 @@ int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg)
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = convert (MPEG2_CONVERT_SET, NULL, &(mpeg2dec->sequence), 0,
|
error = convert (MPEG2_CONVERT_SET, NULL, &(mpeg2dec->sequence), 0,
|
||||||
mpeg2_accels, arg, &convert_init);
|
arg, &convert_init);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
mpeg2dec->convert = convert;
|
mpeg2dec->convert = convert;
|
||||||
mpeg2dec->convert_arg = arg;
|
mpeg2dec->convert_arg = arg;
|
||||||
|
@ -323,7 +321,7 @@ int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride)
|
||||||
|
|
||||||
stride = mpeg2dec->convert (MPEG2_CONVERT_STRIDE, NULL,
|
stride = mpeg2dec->convert (MPEG2_CONVERT_STRIDE, NULL,
|
||||||
&(mpeg2dec->sequence), stride,
|
&(mpeg2dec->sequence), stride,
|
||||||
mpeg2_accels, mpeg2dec->convert_arg,
|
mpeg2dec->convert_arg,
|
||||||
&convert_init);
|
&convert_init);
|
||||||
mpeg2dec->convert_id_size = convert_init.id_size;
|
mpeg2dec->convert_id_size = convert_init.id_size;
|
||||||
mpeg2dec->convert_stride = stride;
|
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;
|
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)
|
void mpeg2_reset (mpeg2dec_t * mpeg2dec, int full_reset)
|
||||||
{
|
{
|
||||||
mpeg2dec->buf_start = mpeg2dec->buf_end = NULL;
|
mpeg2dec->buf_start = mpeg2dec->buf_end = NULL;
|
||||||
|
@ -420,7 +405,7 @@ mpeg2dec_t * mpeg2_init (void)
|
||||||
{
|
{
|
||||||
mpeg2dec_t * mpeg2dec;
|
mpeg2dec_t * mpeg2dec;
|
||||||
|
|
||||||
mpeg2_accel (MPEG2_ACCEL_DETECT);
|
mpeg2_idct_init ();
|
||||||
|
|
||||||
mpeg2dec = (mpeg2dec_t *) mpeg2_malloc (sizeof (mpeg2dec_t),
|
mpeg2dec = (mpeg2dec_t *) mpeg2_malloc (sizeof (mpeg2dec_t),
|
||||||
MPEG2_ALLOC_MPEG2DEC);
|
MPEG2_ALLOC_MPEG2DEC);
|
||||||
|
|
|
@ -603,7 +603,7 @@ static int picture_display_ext (mpeg2dec_t * mpeg2dec)
|
||||||
return 0;
|
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);
|
mpeg2_decoder_t * decoder = &(mpeg2dec->decoder);
|
||||||
int old_type_b = (decoder->coding_type == B_TYPE);
|
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->convert (MPEG2_CONVERT_START,
|
||||||
mpeg2dec->decoder.convert_id,
|
mpeg2dec->decoder.convert_id,
|
||||||
&(mpeg2dec->sequence),
|
&(mpeg2dec->sequence),
|
||||||
mpeg2dec->convert_stride, accels,
|
mpeg2dec->convert_stride,
|
||||||
mpeg2dec->convert_arg, &convert_init);
|
mpeg2dec->convert_arg, &convert_init);
|
||||||
mpeg2dec->convert_start = convert_init.start;
|
mpeg2dec->convert_start = convert_init.start;
|
||||||
mpeg2dec->decoder.convert = convert_init.copy;
|
mpeg2dec->decoder.convert = convert_init.copy;
|
||||||
|
|
|
@ -77,18 +77,18 @@ uint8_t mpeg2_clip[3840 * 2 + 256] IBSS_ATTR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
|
#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
|
||||||
do { \
|
do { \
|
||||||
t0 = W0 * d0 + W1 * d1; \
|
t0 = W0 * d0 + W1 * d1; \
|
||||||
t1 = W0 * d1 - W1 * d0; \
|
t1 = W0 * d1 - W1 * d0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
|
#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
|
||||||
do { \
|
do { \
|
||||||
int tmp = W0 * (d0 + d1); \
|
int tmp = W0 * (d0 + d1); \
|
||||||
t0 = tmp + (W1 - W0) * d1; \
|
t0 = tmp + (W1 - W0) * d1; \
|
||||||
t1 = tmp - (W1 + W0) * d0; \
|
t1 = tmp - (W1 + W0) * d0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void idct_row (int16_t * const block)
|
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;
|
extern uint8_t mpeg2_scan_norm[64];
|
||||||
#ifdef ARCH_X86
|
extern uint8_t mpeg2_scan_alt[64];
|
||||||
if (accel & MPEG2_ACCEL_X86_MMXEXT) {
|
int i, j;
|
||||||
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;
|
|
||||||
|
|
||||||
mpeg2_idct_copy = mpeg2_idct_copy_alpha;
|
mpeg2_idct_copy = mpeg2_idct_copy_c;
|
||||||
mpeg2_idct_add = mpeg2_idct_add_alpha;
|
mpeg2_idct_add = mpeg2_idct_add_c;
|
||||||
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;
|
|
||||||
#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM)
|
#if !defined(CPU_COLDFIRE) && !defined(CPU_ARM)
|
||||||
for (i = -3840; i < 3840 + 256; i++)
|
for (i = -3840; i < 3840 + 256; i++)
|
||||||
CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
|
CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < 64; i++) {
|
|
||||||
j = mpeg2_scan_norm[i];
|
for (i = 0; i < 64; i++)
|
||||||
mpeg2_scan_norm[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);
|
{
|
||||||
j = mpeg2_scan_alt[i];
|
j = mpeg2_scan_norm[i];
|
||||||
mpeg2_scan_alt[i] = ((j & 0x36) >> 1) | ((j & 0x09) << 2);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,108 +29,33 @@
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
#include "mpeg2_internal.h"
|
#include "mpeg2_internal.h"
|
||||||
|
|
||||||
mpeg2_mc_t mpeg2_mc;
|
/* 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;
|
||||||
|
|
||||||
void mpeg2_mc_init (uint32_t accel)
|
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
|
MC_put_o_16, MC_put_x_16, MC_put_y_16, MC_put_xy_16,
|
||||||
if (accel & MPEG2_ACCEL_X86_MMXEXT)
|
MC_put_o_8, MC_put_x_8, MC_put_y_8, MC_put_xy_8
|
||||||
mpeg2_mc = mpeg2_mc_mmxext;
|
},
|
||||||
else if (accel & MPEG2_ACCEL_X86_3DNOW)
|
{
|
||||||
mpeg2_mc = mpeg2_mc_3dnow;
|
MC_avg_o_16, MC_avg_x_16, MC_avg_y_16, MC_avg_xy_16,
|
||||||
else if (accel & MPEG2_ACCEL_X86_MMX)
|
MC_avg_o_8, MC_avg_x_8, MC_avg_y_8, MC_avg_xy_8
|
||||||
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)
|
|
||||||
|
|
84
apps/plugins/mpegplayer/motion_comp.h
Normal file
84
apps/plugins/mpegplayer/motion_comp.h
Normal file
|
@ -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); \
|
||||||
|
}
|
|
@ -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)
|
|
37
apps/plugins/mpegplayer/motion_comp_arm_c.c
Normal file
37
apps/plugins/mpegplayer/motion_comp_arm_c.c
Normal file
|
@ -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)
|
|
@ -22,24 +22,24 @@
|
||||||
|
|
||||||
@ ----------------------------------------------------------------
|
@ ----------------------------------------------------------------
|
||||||
.align
|
.align
|
||||||
.global MC_put_o_16_arm
|
.global MC_put_o_16
|
||||||
MC_put_o_16_arm:
|
MC_put_o_16:
|
||||||
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
stmfd sp!, {r4-r11, lr} @ R14 is also called LR
|
stmfd sp!, {r4-r11, lr} @ R14 is also called LR
|
||||||
and r4, r1, #3
|
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
|
add r5, r5, r4, lsl #2
|
||||||
ldr pc, [r5]
|
ldr pc, [r5]
|
||||||
|
|
||||||
MC_put_o_16_arm_align0:
|
MC_put_o_16_align0:
|
||||||
ldmia r1, {r4-r7}
|
ldmia r1, {r4-r7}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
stmia r0, {r4-r7}
|
stmia r0, {r4-r7}
|
||||||
subs r3, r3, #1
|
subs r3, r3, #1
|
||||||
add r0, r0, r2
|
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.
|
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
|
||||||
|
|
||||||
.macro PROC shift
|
.macro PROC shift
|
||||||
|
@ -59,46 +59,46 @@ MC_put_o_16_arm_align0:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
MC_put_o_16_arm_align1:
|
MC_put_o_16_align1:
|
||||||
and r1, r1, #0xFFFFFFFC
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: PROC(8)
|
1: PROC(8)
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: PROC(16)
|
1: PROC(16)
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: PROC(24)
|
1: PROC(24)
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
|
ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
|
||||||
MC_put_o_16_arm_align_jt:
|
MC_put_o_16_align_jt:
|
||||||
.word MC_put_o_16_arm_align0
|
.word MC_put_o_16_align0
|
||||||
.word MC_put_o_16_arm_align1
|
.word MC_put_o_16_align1
|
||||||
.word MC_put_o_16_arm_align2
|
.word MC_put_o_16_align2
|
||||||
.word MC_put_o_16_arm_align3
|
.word MC_put_o_16_align3
|
||||||
|
|
||||||
@ ----------------------------------------------------------------
|
@ ----------------------------------------------------------------
|
||||||
.align
|
.align
|
||||||
.global MC_put_o_8_arm
|
.global MC_put_o_8
|
||||||
MC_put_o_8_arm:
|
MC_put_o_8:
|
||||||
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
stmfd sp!, {r4-r10, lr} @ R14 is also called LR
|
stmfd sp!, {r4-r10, lr} @ R14 is also called LR
|
||||||
and r4, r1, #3
|
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
|
add r5, r5, r4, lsl #2
|
||||||
ldr pc, [r5]
|
ldr pc, [r5]
|
||||||
MC_put_o_8_arm_align0:
|
MC_put_o_8_align0:
|
||||||
ldmia r1, {r4-r5}
|
ldmia r1, {r4-r5}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
stmia r0, {r4-r5}
|
stmia r0, {r4-r5}
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
subs r3, r3, #1
|
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.
|
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
|
||||||
|
|
||||||
.macro PROC8 shift
|
.macro PROC8 shift
|
||||||
|
@ -114,29 +114,29 @@ MC_put_o_8_arm_align0:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
MC_put_o_8_arm_align1:
|
MC_put_o_8_align1:
|
||||||
and r1, r1, #0xFFFFFFFC
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: PROC8(8)
|
1: PROC8(8)
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: PROC8(16)
|
1: PROC8(16)
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: PROC8(24)
|
1: PROC8(24)
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
|
ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
|
||||||
|
|
||||||
MC_put_o_8_arm_align_jt:
|
MC_put_o_8_align_jt:
|
||||||
.word MC_put_o_8_arm_align0
|
.word MC_put_o_8_align0
|
||||||
.word MC_put_o_8_arm_align1
|
.word MC_put_o_8_align1
|
||||||
.word MC_put_o_8_arm_align2
|
.word MC_put_o_8_align2
|
||||||
.word MC_put_o_8_arm_align3
|
.word MC_put_o_8_align3
|
||||||
|
|
||||||
@ ----------------------------------------------------------------
|
@ ----------------------------------------------------------------
|
||||||
.macro AVG_PW rW1, rW2
|
.macro AVG_PW rW1, rW2
|
||||||
|
@ -151,13 +151,13 @@ MC_put_o_8_arm_align_jt:
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.align
|
.align
|
||||||
.global MC_put_x_16_arm
|
.global MC_put_x_16
|
||||||
MC_put_x_16_arm:
|
MC_put_x_16:
|
||||||
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
stmfd sp!, {r4-r11,lr} @ R14 is also called LR
|
stmfd sp!, {r4-r11,lr} @ R14 is also called LR
|
||||||
and r4, r1, #3
|
and r4, r1, #3
|
||||||
adr r5, MC_put_x_16_arm_align_jt
|
adr r5, MC_put_x_16_align_jt
|
||||||
ldr r11, [r5]
|
ldr r11, [r5]
|
||||||
mvn r12, r11
|
mvn r12, r11
|
||||||
add r5, r5, r4, lsl #2
|
add r5, r5, r4, lsl #2
|
||||||
|
@ -176,7 +176,7 @@ MC_put_x_16_arm:
|
||||||
@ and \R4, \R4, #0xFF
|
@ and \R4, \R4, #0xFF
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
MC_put_x_16_arm_align0:
|
MC_put_x_16_align0:
|
||||||
ldmia r1, {r4-r8}
|
ldmia r1, {r4-r8}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
|
@ -187,9 +187,9 @@ MC_put_x_16_arm_align0:
|
||||||
stmia r0, {r5-r8}
|
stmia r0, {r5-r8}
|
||||||
subs r3, r3, #1
|
subs r3, r3, #1
|
||||||
add r0, r0, r2
|
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.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: ldmia r1, {r4-r8}
|
1: ldmia r1, {r4-r8}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
|
@ -204,7 +204,7 @@ MC_put_x_16_arm_align1:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: ldmia r1, {r4-r8}
|
1: ldmia r1, {r4-r8}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
|
@ -219,7 +219,7 @@ MC_put_x_16_arm_align2:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: ldmia r1, {r4-r8}
|
1: ldmia r1, {r4-r8}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
|
@ -234,22 +234,22 @@ MC_put_x_16_arm_align3:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
|
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 0x01010101
|
||||||
.word MC_put_x_16_arm_align0
|
.word MC_put_x_16_align0
|
||||||
.word MC_put_x_16_arm_align1
|
.word MC_put_x_16_align1
|
||||||
.word MC_put_x_16_arm_align2
|
.word MC_put_x_16_align2
|
||||||
.word MC_put_x_16_arm_align3
|
.word MC_put_x_16_align3
|
||||||
|
|
||||||
@ ----------------------------------------------------------------
|
@ ----------------------------------------------------------------
|
||||||
.align
|
.align
|
||||||
.global MC_put_x_8_arm
|
.global MC_put_x_8
|
||||||
MC_put_x_8_arm:
|
MC_put_x_8:
|
||||||
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
stmfd sp!, {r4-r11,lr} @ R14 is also called LR
|
stmfd sp!, {r4-r11,lr} @ R14 is also called LR
|
||||||
and r4, r1, #3
|
and r4, r1, #3
|
||||||
adr r5, MC_put_x_8_arm_align_jt
|
adr r5, MC_put_x_8_align_jt
|
||||||
ldr r11, [r5]
|
ldr r11, [r5]
|
||||||
mvn r12, r11
|
mvn r12, r11
|
||||||
add r5, r5, r4, lsl #2
|
add r5, r5, r4, lsl #2
|
||||||
|
@ -264,7 +264,7 @@ MC_put_x_8_arm:
|
||||||
@ and \R4, \R4, #0xFF
|
@ and \R4, \R4, #0xFF
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
MC_put_x_8_arm_align0:
|
MC_put_x_8_align0:
|
||||||
ldmia r1, {r4-r6}
|
ldmia r1, {r4-r6}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
@@ pld [r1]
|
@@ pld [r1]
|
||||||
|
@ -273,9 +273,9 @@ MC_put_x_8_arm_align0:
|
||||||
stmia r0, {r5-r6}
|
stmia r0, {r5-r6}
|
||||||
subs r3, r3, #1
|
subs r3, r3, #1
|
||||||
add r0, r0, r2
|
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.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: ldmia r1, {r4-r6}
|
1: ldmia r1, {r4-r6}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
|
@ -288,7 +288,7 @@ MC_put_x_8_arm_align1:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: ldmia r1, {r4-r6}
|
1: ldmia r1, {r4-r6}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
|
@ -301,7 +301,7 @@ MC_put_x_8_arm_align2:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
|
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
|
and r1, r1, #0xFFFFFFFC
|
||||||
1: ldmia r1, {r4-r6}
|
1: ldmia r1, {r4-r6}
|
||||||
add r1, r1, r2
|
add r1, r1, r2
|
||||||
|
@ -314,9 +314,9 @@ MC_put_x_8_arm_align3:
|
||||||
add r0, r0, r2
|
add r0, r0, r2
|
||||||
bne 1b
|
bne 1b
|
||||||
ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
|
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 0x01010101
|
||||||
.word MC_put_x_8_arm_align0
|
.word MC_put_x_8_align0
|
||||||
.word MC_put_x_8_arm_align1
|
.word MC_put_x_8_align1
|
||||||
.word MC_put_x_8_arm_align2
|
.word MC_put_x_8_align2
|
||||||
.word MC_put_x_8_arm_align3
|
.word MC_put_x_8_align3
|
||||||
|
|
|
@ -144,24 +144,12 @@ typedef enum {
|
||||||
} mpeg2_convert_stage_t;
|
} mpeg2_convert_stage_t;
|
||||||
typedef int mpeg2_convert_t (int stage, void * id,
|
typedef int mpeg2_convert_t (int stage, void * id,
|
||||||
const mpeg2_sequence_t * sequence, int stride,
|
const mpeg2_sequence_t * sequence, int stride,
|
||||||
uint32_t accel, void * arg,
|
void * arg, mpeg2_convert_init_t * result);
|
||||||
mpeg2_convert_init_t * result);
|
|
||||||
int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg);
|
int mpeg2_convert (mpeg2dec_t * mpeg2dec, mpeg2_convert_t convert, void * arg);
|
||||||
int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride);
|
int mpeg2_stride (mpeg2dec_t * mpeg2dec, int stride);
|
||||||
void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id);
|
void mpeg2_set_buf (mpeg2dec_t * mpeg2dec, uint8_t * buf[3], void * id);
|
||||||
void mpeg2_custom_fbuf (mpeg2dec_t * mpeg2dec, int custom_fbuf);
|
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);
|
mpeg2dec_t * mpeg2_init (void);
|
||||||
const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec);
|
const mpeg2_info_t * mpeg2_info (mpeg2dec_t * mpeg2dec);
|
||||||
void mpeg2_close (mpeg2dec_t * mpeg2dec);
|
void mpeg2_close (mpeg2dec_t * mpeg2dec);
|
||||||
|
|
|
@ -244,58 +244,18 @@ int mpeg2_header_extension (mpeg2dec_t * mpeg2dec);
|
||||||
int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);
|
int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);
|
||||||
void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec);
|
void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec);
|
||||||
void mpeg2_header_gop_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_slice_start (mpeg2dec_t * mpeg2dec);
|
||||||
mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec);
|
mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec);
|
||||||
void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type);
|
void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type);
|
||||||
|
|
||||||
/* idct.c */
|
/* idct.c */
|
||||||
void mpeg2_idct_init (uint32_t accel);
|
void mpeg2_idct_init (void);
|
||||||
|
|
||||||
/* 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);
|
|
||||||
|
|
||||||
/* motion_comp.c */
|
/* motion_comp.c */
|
||||||
void mpeg2_mc_init (uint32_t accel);
|
void mpeg2_mc_init (void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
mpeg2_mc_fct * put [8];
|
mpeg2_mc_fct * put [8];
|
||||||
mpeg2_mc_fct * avg [8];
|
mpeg2_mc_fct * avg [8];
|
||||||
} mpeg2_mc_t;
|
} 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;
|
|
||||||
|
|
|
@ -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_copy) (int16_t * block, uint8_t * dest, int stride);
|
||||||
extern void (* mpeg2_idct_add) (int last, int16_t * block,
|
extern void (* mpeg2_idct_add) (int last, int16_t * block,
|
||||||
uint8_t * dest, int stride);
|
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"
|
#include "vlc.h"
|
||||||
|
|
||||||
|
@ -1554,39 +1552,36 @@ static void motion_fi_conceal (mpeg2_decoder_t * const decoder)
|
||||||
#undef bits
|
#undef bits
|
||||||
#undef bit_ptr
|
#undef bit_ptr
|
||||||
|
|
||||||
#define MOTION_CALL(routine,direction) \
|
#define MOTION_CALL(routine,direction) \
|
||||||
do { \
|
do { \
|
||||||
if ((direction) & MACROBLOCK_MOTION_FORWARD) \
|
if ((direction) & MACROBLOCK_MOTION_FORWARD) \
|
||||||
routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
|
routine (decoder, &(decoder->f_motion), mpeg2_mc.put); \
|
||||||
if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
|
if ((direction) & MACROBLOCK_MOTION_BACKWARD) \
|
||||||
routine (decoder, &(decoder->b_motion), \
|
routine (decoder, &(decoder->b_motion), \
|
||||||
((direction) & MACROBLOCK_MOTION_FORWARD ? \
|
((direction) & MACROBLOCK_MOTION_FORWARD ? \
|
||||||
mpeg2_mc.avg : mpeg2_mc.put)); \
|
mpeg2_mc.avg : mpeg2_mc.put)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define NEXT_MACROBLOCK \
|
#define NEXT_MACROBLOCK \
|
||||||
do { \
|
do { \
|
||||||
decoder->offset += 16; \
|
decoder->offset += 16; \
|
||||||
if (decoder->offset == decoder->width) { \
|
if (decoder->offset == decoder->width) { \
|
||||||
do { /* just so we can use the break statement */ \
|
do { /* just so we can use the break statement */ \
|
||||||
if (decoder->convert) { \
|
if (decoder->convert) { \
|
||||||
decoder->convert (decoder->convert_id, decoder->dest, \
|
decoder->convert (decoder->convert_id, decoder->dest, \
|
||||||
decoder->v_offset); \
|
decoder->v_offset); \
|
||||||
if (decoder->coding_type == B_TYPE) \
|
if (decoder->coding_type == B_TYPE) \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
decoder->dest[0] += decoder->slice_stride; \
|
decoder->dest[0] += decoder->slice_stride; \
|
||||||
decoder->dest[1] += decoder->slice_uv_stride; \
|
decoder->dest[1] += decoder->slice_uv_stride; \
|
||||||
decoder->dest[2] += decoder->slice_uv_stride; \
|
decoder->dest[2] += decoder->slice_uv_stride; \
|
||||||
} while (0); \
|
} while (0); \
|
||||||
decoder->v_offset += 16; \
|
decoder->v_offset += 16; \
|
||||||
if (decoder->v_offset > decoder->limit_y) { \
|
if (decoder->v_offset > decoder->limit_y) \
|
||||||
if (mpeg2_cpu_state_restore) \
|
return; \
|
||||||
mpeg2_cpu_state_restore (&cpu_state); \
|
decoder->offset = 0; \
|
||||||
return; \
|
} \
|
||||||
} \
|
|
||||||
decoder->offset = 0; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
void mpeg2_init_fbuf (mpeg2_decoder_t * decoder, uint8_t * current_fbuf[3],
|
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 bit_buf (decoder->bitstream_buf)
|
||||||
#define bits (decoder->bitstream_bits)
|
#define bits (decoder->bitstream_bits)
|
||||||
#define bit_ptr (decoder->bitstream_ptr)
|
#define bit_ptr (decoder->bitstream_ptr)
|
||||||
cpu_state_t cpu_state;
|
|
||||||
|
|
||||||
bitstream_init (decoder, buffer);
|
bitstream_init (decoder, buffer);
|
||||||
|
|
||||||
if (slice_init (decoder, code))
|
if (slice_init (decoder, code))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mpeg2_cpu_state_save)
|
|
||||||
mpeg2_cpu_state_save (&cpu_state);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int macroblock_modes;
|
int macroblock_modes;
|
||||||
int mba_inc;
|
int mba_inc;
|
||||||
|
@ -2028,8 +2019,6 @@ void mpeg2_slice (mpeg2_decoder_t * const decoder, const int code,
|
||||||
NEEDBITS (bit_buf, bits, bit_ptr);
|
NEEDBITS (bit_buf, bits, bit_ptr);
|
||||||
continue;
|
continue;
|
||||||
default: /* end of slice, or error */
|
default: /* end of slice, or error */
|
||||||
if (mpeg2_cpu_state_restore)
|
|
||||||
mpeg2_cpu_state_restore (&cpu_state);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue