]> git.sesse.net Git - vlc/commitdiff
* ./include/threads.h: fixed a segfault under Solaris, thanks to Meuuh.
authorSam Hocevar <sam@videolan.org>
Thu, 18 Apr 2002 12:51:59 +0000 (12:51 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 18 Apr 2002 12:51:59 +0000 (12:51 +0000)
  * ./plugins/spudec/spu_decoder.c: RGB 24bpp and 32bpp support.

ChangeLog
include/threads.h
plugins/spudec/spu_decoder.c

index 1a118ad44a58ba6cfd4954a1c2e8a0cb96a06e1b..d9e69f29c777411227c7b08f1df9592c8f2d7584 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,8 @@ HEAD
 0.3.1
 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.
   * ./vlc.spec: imported Mandrakesoft's latest enhancements.
   * ./configure.in, ./plugins/network/ipv6.c: support for the GNU glibc
index 01b385ad99b6c50ae3ca2d29eab05d55d1182ecc..f56180e7e4633abc5a13ec95adef06022ebe28ba 100644 (file)
@@ -3,7 +3,7 @@
  * This header provides a portable threads implementation.
  *****************************************************************************
  * 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>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -339,7 +339,7 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
         _vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX )
 #else
 #   define vlc_mutex_lock( P_MUTEX )                                        \
-        _vlc_mutex_lock( NULL, 0, P_MUTEX )
+        _vlc_mutex_lock( "(unknown)", 0, P_MUTEX )
 #endif
 
 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 )
 #else
 #   define vlc_mutex_unlock( P_MUTEX )                                      \
-        _vlc_mutex_unlock( NULL, 0, P_MUTEX )
+        _vlc_mutex_unlock( "(unknown)", 0, P_MUTEX )
 #endif
 
 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 )
 #else
 #   define vlc_mutex_destroy( P_MUTEX )                                     \
-        _vlc_mutex_destroy( NULL, 0, P_MUTEX )
+        _vlc_mutex_destroy( "(unknown)", 0, P_MUTEX )
 #endif
 
 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 )
         _vlc_cond_wait( __FILE__, __LINE__, P_COND, P_MUTEX  )
 #else
 #   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
 
 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 )
 #else
 #   define vlc_cond_destroy( P_COND )                                       \
-        _vlc_cond_destroy( NULL, 0, P_COND )
+        _vlc_cond_destroy( "(unknown)", 0, P_COND )
 #endif
 
 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 )
 #else
 #   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
 
 static __inline__ int _vlc_thread_create( char * psz_file, int i_line,
@@ -1009,7 +1009,7 @@ static __inline__ void vlc_thread_exit( void )
         _vlc_thread_join( __FILE__, __LINE__, THREAD ) 
 #else
 #   define vlc_thread_join( THREAD )                                        \
-        _vlc_thread_join( NULL, 0, THREAD ) 
+        _vlc_thread_join( "(unknown)", 0, THREAD ) 
 #endif
 
 static __inline__ void _vlc_thread_join( char * psz_file, int i_line,
index 25c71e6d8c636a92f413991290f7a0717e0b5cf1..967c257229af993d4a3c65d525ca055d67244f69 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.c : spu decoder thread
  *****************************************************************************
  * 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>
  *
@@ -76,7 +76,7 @@ MODULE_CONFIG_START
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
-    SET_DESCRIPTION( "DVD subtitles decoder module" )
+    SET_DESCRIPTION( _("DVD subtitles decoder module") )
     ADD_CAPABILITY( DECODER, 50 )
 MODULE_INIT_STOP
 
@@ -813,6 +813,7 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
 {
     /* Common variables */
     u16  p_clut16[4];
+    u32  p_clut32[4];
     u8  *p_dest;
     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,
     case FOURCC_RV16:
 
     /* FIXME: get this from the DVD */
-    p_clut16[0] = 0xaaaa; p_clut16[1] = 0xffff;
-    p_clut16[2] = 0x8888; p_clut16[3] = 0x0000;
+    for( i_color = 0; i_color < 4; i_color++ )
+    {
+        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_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,
 
     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:
         intf_ErrMsg( "vout error: unknown chroma, can't render SPU" );
         break;