Commit ecbcf0b3 authored by Christophe Massiot's avatar Christophe Massiot

* Altivec-enabled version of fastmemcpy

* Use ImageBuffer instead of ScreenBuffer in OS X video output (should be
faster)
parent c5dd4153
......@@ -115,6 +115,7 @@ PLUGINS_TARGETS := a52/a52 \
memcpy/memcpymmx \
memcpy/memcpymmxext \
memcpy/memcpy3dn \
memcpy/memcpyaltivec \
mga/mga \
mga/xmga \
motion/motion \
......
......@@ -388,7 +388,7 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->p_sys->i_seq,
p_pic->p_sys->p_info,
p_pic->p_sys->i_size,
codecFlagUseScreenBuffer, &flags, nil ) != noErr ) )
codecFlagUseImageBuffer, &flags, nil ) != noErr ) )
{
intf_ErrMsg( "DecompressSequenceFrameS failed: %d", err );
}
......@@ -569,7 +569,7 @@ static int QTCreateSequence( vout_thread_t *p_vout )
NULL, NULL,
p_vout->p_sys->p_matrix,
0, NULL,
codecFlagUseScreenBuffer,
codecFlagUseImageBuffer,
codecLosslessQuality,
p_vout->p_sys->img_dc ) ) )
{
......
......@@ -2,3 +2,4 @@ memcpy_SOURCES = memcpy.c
memcpymmx_SOURCES = memcpy.c
memcpymmxext_SOURCES = memcpy.c
memcpy3dn_SOURCES = memcpy.c
memcpyaltivec_SOURCES = memcpy.c
/*****************************************************************************
* fastmemcpy.h : fast memcpy routines
*****************************************************************************
* $Id: fastmemcpy.h,v 1.1 2001/12/03 16:18:37 sam Exp $
* $Id: fastmemcpy.h,v 1.2 2002/04/02 22:16:07 massiot Exp $
*
* Authors: various Linux kernel hackers
* various MPlayer hackers
* Nick Kurshev <nickols_k@mail.ru>
* Christophe Massiot <massiot@via.ecp.fr> (Altivec)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -382,3 +383,71 @@ void * _M( fast_memcpy )(void * to, const void * from, size_t len)
#endif /* #if defined( HAVE_MMX2 ) || defined( HAVE_3DNOW ) || defined( HAVE_MMX ) */
#ifdef HAVE_ALTIVEC
# if defined(CAN_COMPILE_C_ALTIVEC) || defined( __BUILD_ALTIVEC_ASM )
#define vector_s16_t vector signed short
#define vector_u16_t vector unsigned short
#define vector_s8_t vector signed char
#define vector_u8_t vector unsigned char
#define vector_s32_t vector signed int
#define vector_u32_t vector unsigned int
#undef MMREG_SIZE
#define MMREG_SIZE 16
void * _M( fast_memcpy )(void * _to, const void * _from, size_t len)
{
void * retval = _to;
u8 * to = (u8 *)_to;
u8 * from = (u8 *)_from;
if( len > 16 )
{
/* Align destination to MMREG_SIZE -boundary */
register unsigned long int delta;
delta = ((unsigned long)to)&(MMREG_SIZE-1);
if( delta )
{
delta = MMREG_SIZE - delta;
len -= delta;
memcpy(to, from, delta);
to += delta;
from += delta;
}
if( len & ~(MMREG_SIZE-1) )
{
vector_u8_t perm, ref0, ref1, tmp;
perm = vec_lvsl( 0, from );
ref0 = vec_ld( 0, from );
ref1 = vec_ld( 15, from );
from += 16;
len -= 16;
tmp = vec_perm( ref0, ref1, perm );
do
{
ref0 = vec_ld( 0, from );
ref1 = vec_ld( 15, from );
from += 16;
len -= 16;
vec_st( tmp, 0, to );
tmp = vec_perm( ref0, ref1, perm );
to += 16;
} while( len & ~(MMREG_SIZE-1) );
vec_st( tmp, 0, to );
}
}
if( len )
{
memcpy( to, from, len );
}
return retval;
}
# endif
#endif
......@@ -2,7 +2,7 @@
* memcpy.c : classic memcpy module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: memcpy.c,v 1.5 2002/02/15 13:32:53 sam Exp $
* $Id: memcpy.c,v 1.6 2002/04/02 22:16:07 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -34,6 +34,7 @@
#undef HAVE_SSE
#undef HAVE_SSE2
#undef HAVE_3DNOW
#undef HAVE_ALTIVEC
#if defined( MODULE_NAME_IS_memcpy3dn )
# define HAVE_3DNOW
......@@ -44,6 +45,9 @@
#elif defined( MODULE_NAME_IS_memcpymmxext )
# define HAVE_MMX2
# include "fastmemcpy.h"
#elif defined( MODULE_NAME_IS_memcpyaltivec )
# define HAVE_ALTIVEC
# include "fastmemcpy.h"
#endif
/*****************************************************************************
......@@ -87,6 +91,12 @@ MODULE_INIT_START
ADD_REQUIREMENT( MMXEXT )
ADD_SHORTCUT( "mmxext" )
ADD_SHORTCUT( "memcpymmxext" )
#elif defined( MODULE_NAME_IS_memcpyaltivec )
SET_DESCRIPTION( "Altivec memcpy module" )
ADD_CAPABILITY( MEMCPY, 100 )
ADD_REQUIREMENT( ALTIVEC )
ADD_SHORTCUT( "altivec" )
ADD_SHORTCUT( "memcpyaltivec" )
#endif
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* input_ext-plugins.c: useful functions for access and demux plug-ins
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: input_ext-plugins.c,v 1.3 2002/03/26 23:08:40 gbazin Exp $
* $Id: input_ext-plugins.c,v 1.4 2002/04/02 22:16:07 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -537,8 +537,11 @@ ssize_t input_FillBuffer( input_thread_t * p_input )
if( p_input->p_data_buffer != NULL )
{
FAST_MEMCPY( (byte_t *)p_buf + sizeof(data_buffer_t),
p_input->p_current_data, (size_t)i_remains );
if( i_remains )
{
FAST_MEMCPY( (byte_t *)p_buf + sizeof(data_buffer_t),
p_input->p_current_data, (size_t)i_remains );
}
ReleaseBuffer( p_input->p_method_data, p_input->p_data_buffer );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment