Commit 3eb0086e authored by Sam Hocevar's avatar Sam Hocevar

  * ./include/threads.h: fixed a segfault under Solaris, thanks to Meuuh.
  * ./plugins/spudec/spu_decoder.c: RGB 24bpp and 32bpp support.
parent 9e607c80
...@@ -9,6 +9,8 @@ HEAD ...@@ -9,6 +9,8 @@ HEAD
0.3.1 0.3.1
Thu, 18 Apr 2002 06:43:42 +0200 Thu, 18 Apr 2002 06:43:42 +0200
* ./include/threads.h: fixed a segfault under Solaris, thanks to Meuuh.
* ./plugins/spudec/spu_decoder.c: RGB 24bpp and 32bpp support.
* ./configure.in: switched version to 0.3.1. * ./configure.in: switched version to 0.3.1.
* ./vlc.spec: imported Mandrakesoft's latest enhancements. * ./vlc.spec: imported Mandrakesoft's latest enhancements.
* ./configure.in, ./plugins/network/ipv6.c: support for the GNU glibc * ./configure.in, ./plugins/network/ipv6.c: support for the GNU glibc
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header provides a portable threads implementation. * This header provides a portable threads implementation.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: threads.h,v 1.40 2002/04/05 03:27:27 sam Exp $ * $Id: threads.h,v 1.41 2002/04/18 12:51:59 sam Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -339,7 +339,7 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -339,7 +339,7 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
_vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX ) _vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX )
#else #else
# define vlc_mutex_lock( P_MUTEX ) \ # define vlc_mutex_lock( P_MUTEX ) \
_vlc_mutex_lock( NULL, 0, P_MUTEX ) _vlc_mutex_lock( "(unknown)", 0, P_MUTEX )
#endif #endif
static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line, static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line,
...@@ -402,7 +402,7 @@ static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line, ...@@ -402,7 +402,7 @@ static __inline__ int _vlc_mutex_lock( char * psz_file, int i_line,
_vlc_mutex_unlock( __FILE__, __LINE__, P_MUTEX ) _vlc_mutex_unlock( __FILE__, __LINE__, P_MUTEX )
#else #else
# define vlc_mutex_unlock( P_MUTEX ) \ # define vlc_mutex_unlock( P_MUTEX ) \
_vlc_mutex_unlock( NULL, 0, P_MUTEX ) _vlc_mutex_unlock( "(unknown)", 0, P_MUTEX )
#endif #endif
static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line, static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line,
...@@ -463,7 +463,7 @@ static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line, ...@@ -463,7 +463,7 @@ static __inline__ int _vlc_mutex_unlock( char * psz_file, int i_line,
_vlc_mutex_destroy( __FILE__, __LINE__, P_MUTEX ) _vlc_mutex_destroy( __FILE__, __LINE__, P_MUTEX )
#else #else
# define vlc_mutex_destroy( P_MUTEX ) \ # define vlc_mutex_destroy( P_MUTEX ) \
_vlc_mutex_destroy( NULL, 0, P_MUTEX ) _vlc_mutex_destroy( "(unknown)", 0, P_MUTEX )
#endif #endif
static __inline__ int _vlc_mutex_destroy( char * psz_file, int i_line, static __inline__ int _vlc_mutex_destroy( char * psz_file, int i_line,
...@@ -717,7 +717,7 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar ) ...@@ -717,7 +717,7 @@ static __inline__ int vlc_cond_broadcast( vlc_cond_t *p_condvar )
_vlc_cond_wait( __FILE__, __LINE__, P_COND, P_MUTEX ) _vlc_cond_wait( __FILE__, __LINE__, P_COND, P_MUTEX )
#else #else
# define vlc_cond_wait( P_COND, P_MUTEX ) \ # define vlc_cond_wait( P_COND, P_MUTEX ) \
_vlc_cond_wait( NULL, 0, P_COND, P_MUTEX ) _vlc_cond_wait( "(unknown)", 0, P_COND, P_MUTEX )
#endif #endif
static __inline__ int _vlc_cond_wait( char * psz_file, int i_line, static __inline__ int _vlc_cond_wait( char * psz_file, int i_line,
...@@ -844,7 +844,7 @@ static __inline__ int _vlc_cond_wait( char * psz_file, int i_line, ...@@ -844,7 +844,7 @@ static __inline__ int _vlc_cond_wait( char * psz_file, int i_line,
_vlc_cond_destroy( __FILE__, __LINE__, P_COND ) _vlc_cond_destroy( __FILE__, __LINE__, P_COND )
#else #else
# define vlc_cond_destroy( P_COND ) \ # define vlc_cond_destroy( P_COND ) \
_vlc_cond_destroy( NULL, 0, P_COND ) _vlc_cond_destroy( "(unknown)", 0, P_COND )
#endif #endif
static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line, static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line,
...@@ -886,7 +886,7 @@ static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line, ...@@ -886,7 +886,7 @@ static __inline__ int _vlc_cond_destroy( char * psz_file, int i_line,
_vlc_thread_create( __FILE__, __LINE__, P_THREAD, PSZ_NAME, FUNC, P_DATA ) _vlc_thread_create( __FILE__, __LINE__, P_THREAD, PSZ_NAME, FUNC, P_DATA )
#else #else
# define vlc_thread_create( P_THREAD, PSZ_NAME, FUNC, P_DATA ) \ # define vlc_thread_create( P_THREAD, PSZ_NAME, FUNC, P_DATA ) \
_vlc_thread_create( NULL, 0, P_THREAD, PSZ_NAME, FUNC, P_DATA ) _vlc_thread_create( "(unknown)", 0, P_THREAD, PSZ_NAME, FUNC, P_DATA )
#endif #endif
static __inline__ int _vlc_thread_create( char * psz_file, int i_line, static __inline__ int _vlc_thread_create( char * psz_file, int i_line,
...@@ -1009,7 +1009,7 @@ static __inline__ void vlc_thread_exit( void ) ...@@ -1009,7 +1009,7 @@ static __inline__ void vlc_thread_exit( void )
_vlc_thread_join( __FILE__, __LINE__, THREAD ) _vlc_thread_join( __FILE__, __LINE__, THREAD )
#else #else
# define vlc_thread_join( THREAD ) \ # define vlc_thread_join( THREAD ) \
_vlc_thread_join( NULL, 0, THREAD ) _vlc_thread_join( "(unknown)", 0, THREAD )
#endif #endif
static __inline__ void _vlc_thread_join( char * psz_file, int i_line, static __inline__ void _vlc_thread_join( char * psz_file, int i_line,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread * spu_decoder.c : spu decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.14 2002/03/26 23:08:40 gbazin Exp $ * $Id: spu_decoder.c,v 1.15 2002/04/18 12:51:59 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -76,7 +76,7 @@ MODULE_CONFIG_START ...@@ -76,7 +76,7 @@ MODULE_CONFIG_START
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
SET_DESCRIPTION( "DVD subtitles decoder module" ) SET_DESCRIPTION( _("DVD subtitles decoder module") )
ADD_CAPABILITY( DECODER, 50 ) ADD_CAPABILITY( DECODER, 50 )
MODULE_INIT_STOP MODULE_INIT_STOP
...@@ -813,6 +813,7 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, ...@@ -813,6 +813,7 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
{ {
/* Common variables */ /* Common variables */
u16 p_clut16[4]; u16 p_clut16[4];
u32 p_clut32[4];
u8 *p_dest; u8 *p_dest;
u16 *p_source = (u16 *)p_spu->p_sys->p_data; u16 *p_source = (u16 *)p_spu->p_sys->p_data;
...@@ -873,8 +874,11 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, ...@@ -873,8 +874,11 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
case FOURCC_RV16: case FOURCC_RV16:
/* FIXME: get this from the DVD */ /* FIXME: get this from the DVD */
p_clut16[0] = 0xaaaa; p_clut16[1] = 0xffff; for( i_color = 0; i_color < 4; i_color++ )
p_clut16[2] = 0x8888; p_clut16[3] = 0x0000; {
p_clut16[i_color] = 0x1111
* ( (u16)p_spu->p_sys->pi_yuv[i_color][0] >> 4 );
}
i_xscale = ( p_vout->output.i_width << 6 ) / p_vout->render.i_width; i_xscale = ( p_vout->output.i_width << 6 ) / p_vout->render.i_width;
i_yscale = ( p_vout->output.i_height << 6 ) / p_vout->render.i_height; i_yscale = ( p_vout->output.i_height << 6 ) / p_vout->render.i_height;
...@@ -979,6 +983,119 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, ...@@ -979,6 +983,119 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
break; break;
/* RV32 target, scaling */
case FOURCC_RV24:
case FOURCC_RV32:
/* XXX: this is a COMPLETE HACK, memcpy is unable to do u32s anyway */
/* FIXME: get this from the DVD */
for( i_color = 0; i_color < 4; i_color++ )
{
p_clut32[i_color] = 0x11111111
* ( (u16)p_spu->p_sys->pi_yuv[i_color][0] >> 4 );
}
i_xscale = ( p_vout->output.i_width << 6 ) / p_vout->render.i_width;
i_yscale = ( p_vout->output.i_height << 6 ) / p_vout->render.i_height;
i_width = p_spu->i_width * i_xscale;
i_height = p_spu->i_height * i_yscale;
p_dest = p_pic->p->p_pixels + ( i_width >> 6 ) * 4
/* Add the picture coordinates and the SPU coordinates */
+ ( (p_spu->i_x * i_xscale) >> 6 ) * 4
+ ( (p_spu->i_y * i_yscale) >> 6 ) * p_vout->output.i_width * 4;
/* Draw until we reach the bottom of the subtitle */
for( i_y = 0 ; i_y < i_height ; )
{
i_ytmp = i_y >> 6;
i_y += i_yscale;
/* Check whether we need to draw one line or more than one */
if( i_ytmp + 1 >= ( i_y >> 6 ) )
{
/* Just one line : we precalculate i_y >> 6 */
i_yreal = p_vout->output.i_width * 4 * i_ytmp;
/* Draw until we reach the end of the line */
for( i_x = i_width ; i_x ; )
{
/* Get the RLE part, then draw the line */
i_color = *p_source & 0x3;
switch( p_spu->p_sys->pi_alpha[ i_color ] )
{
case 0x00:
i_x -= i_xscale * ( *p_source++ >> 2 );
break;
case 0x0f:
i_len = i_xscale * ( *p_source++ >> 2 );
memset( p_dest - 4 * ( i_x >> 6 ) + i_yreal,
p_clut32[ i_color ], 4 * ( ( i_len >> 6 ) + 1 ) );
i_x -= i_len;
break;
default:
/* FIXME: we should do transparency */
i_len = i_xscale * ( *p_source++ >> 2 );
memset( p_dest - 4 * ( i_x >> 6 ) + i_yreal,
p_clut32[ i_color ], 4 * ( ( i_len >> 6 ) + 1 ) );
i_x -= i_len;
break;
}
}
}
else
{
i_yreal = p_vout->output.i_width * 4 * i_ytmp;
i_ynext = p_vout->output.i_width * 4 * i_y >> 6;
/* Draw until we reach the end of the line */
for( i_x = i_width ; i_x ; )
{
/* Get the RLE part, then draw as many lines as needed */
i_color = *p_source & 0x3;
switch( p_spu->p_sys->pi_alpha[ i_color ] )
{
case 0x00:
i_x -= i_xscale * ( *p_source++ >> 2 );
break;
case 0x0f:
i_len = i_xscale * ( *p_source++ >> 2 );
for( i_ytmp = i_yreal ; i_ytmp < i_ynext ;
i_ytmp += p_vout->output.i_width * 4 )
{
memset( p_dest - 4 * ( i_x >> 6 ) + i_ytmp,
p_clut32[ i_color ],
4 * ( ( i_len >> 6 ) + 1 ) );
}
i_x -= i_len;
break;
default:
/* FIXME: we should do transparency */
i_len = i_xscale * ( *p_source++ >> 2 );
for( i_ytmp = i_yreal ; i_ytmp < i_ynext ;
i_ytmp += p_vout->output.i_width * 4 )
{
memset( p_dest - 4 * ( i_x >> 6 ) + i_ytmp,
p_clut32[ i_color ],
4 * ( ( i_len >> 6 ) + 1 ) );
}
i_x -= i_len;
break;
}
}
}
}
break;
default: default:
intf_ErrMsg( "vout error: unknown chroma, can't render SPU" ); intf_ErrMsg( "vout error: unknown chroma, can't render SPU" );
break; break;
......
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