]> git.sesse.net Git - vlc/commitdiff
* ./configure.in: more modules are plugins.
authorSam Hocevar <sam@videolan.org>
Sat, 16 Mar 2002 23:03:19 +0000 (23:03 +0000)
committerSam Hocevar <sam@videolan.org>
Sat, 16 Mar 2002 23:03:19 +0000 (23:03 +0000)
  * ./src/misc/configuration.c: changed ~/.VideoLan/vlc to ~/.videolan/vlcrc,
    and a few cosmetic changes (sorry Gildas for the butchery).
  * ./plugins/chroma/i420_rgb16.c: C version of the I420 to RV15/16 chroma.

23 files changed:
configure
configure.in
include/config.h
include/defs.h.in
include/video.h
plugins/beos/vout_beos.cpp
plugins/chroma/i420_rgb.c
plugins/chroma/i420_rgb.h
plugins/chroma/i420_rgb16.c
plugins/chroma/i420_ymga.c
plugins/chroma/i420_yuy2.c
plugins/chroma/i422_yuy2.c
plugins/directx/vout_directx.c
plugins/dummy/vout_dummy.c
plugins/fb/fb.c
plugins/ggi/ggi.c
plugins/glide/glide.c
plugins/qnx/vout_qnx.c
plugins/sdl/vout_sdl.c
plugins/x11/xcommon.c
src/misc/configuration.c
src/video_output/video_output.c
src/video_output/vout_pictures.c

index 892f640f1d2fff653c5a0f7d2a12e565bfd80ab1..e7d05924424d7b3c6a1deb1ba36a0d1de4bc324d 100755 (executable)
--- a/configure
+++ b/configure
@@ -5454,8 +5454,8 @@ case x"${target_cpu}" in
     ;;
 esac
 
-BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts file udp http ipv4 memcpy idct idctclassic motion imdct downmix chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga mpeg_adec ac3_adec mpeg_vdec"
-PLUGINS="${PLUGINS} lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort fx_scope"
+BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga mpeg_adec ac3_adec mpeg_vdec"
+PLUGINS="${PLUGINS} mpeg_es mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort fx_scope"
 
 MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx"
 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
index c3e590f4fccd6d9c2d03123d3cc748b2a3ae82d8..1ae14a71891b5ab126eb54c1dc3faecc09d3a2e4 100644 (file)
@@ -444,8 +444,8 @@ esac
 dnl
 dnl  default modules
 dnl
-BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts file udp http ipv4 memcpy idct idctclassic motion imdct downmix chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga mpeg_adec ac3_adec mpeg_vdec"
-PLUGINS="${PLUGINS} lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort fx_scope"
+BUILTINS="${BUILTINS} idct idctclassic motion imdct downmix chroma_i420_rgb chroma_i420_yuy2 chroma_i422_yuy2 chroma_i420_ymga mpeg_adec ac3_adec mpeg_vdec"
+PLUGINS="${PLUGINS} mpeg_es mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort fx_scope"
 
 dnl
 dnl  Accelerated modules
@@ -810,7 +810,7 @@ AC_ARG_WITH(dvdcss,
     ;;
     xno)
       # don't use libdvdcss at all, build a DVD module that can dlopen() it
-      BUILTINS="${BUILTINS} dvd"
+      PLUGINS="${PLUGINS} dvd"
       DUMMY_LIBDVDCSS=1
       SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
       CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
@@ -838,7 +838,7 @@ AC_ARG_WITH(dvdcss,
       LIB_DVD="${LIB_DVD} lib/libdvdcss.a ${LIB_LIBDVDCSS}"
     else
       # XXX: no check for libdl is done, don't try this at home !
-      BUILTINS="${BUILTINS} dvd"
+      PLUGINS="${PLUGINS} dvd"
       DUMMY_LIBDVDCSS=1
       SRC_DVD_EXTRA="${SRC_DVD_EXTRA} dummy_dvdcss.c"
       CFLAGS_DVD="${CFLAGS_DVD} -DGOD_DAMN_DMCA"
@@ -912,19 +912,19 @@ AC_ARG_ENABLE(vcd,
 if test x$enable_vcd != xno
 then
   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
-    BUILTINS="${BUILTINS} vcd"
+    PLUGINS="${PLUGINS} vcd"
   ])
-fi
 
-if test x$enable_vcd != xno -a "${SYS}" = "bsdi"
-then
-  BUILTINS="${BUILTINS} vcd"
-fi
+  if test "x${SYS}" = "xbsdi"
+  then
+    PLUGINS="${PLUGINS} vcd"
+  fi
 
-if test x$enable_vcd != xno -a "${SYS}" = "darwin"
-then
-  BUILTINS="${BUILTINS} vcd"
-  LIB_VCD="${LIB_VCD} -framework IOKit" 
+  if test "x${SYS}" = "xdarwin"
+  then
+    PLUGINS="${PLUGINS} vcd"
+    LIB_VCD="${LIB_VCD} -framework IOKit" 
+  fi
 fi
 
 dnl
index c8dc180310541ca7bdb1b844a8b4c17e64b5386e..bc5bbac41e50145d6e1afd7ccebc08e9b04fe286 100644 (file)
  * outputting an error message (in second) */
 #define THREAD_COND_TIMEOUT             5
 
+/* The configuration file and directory */
+#define CONFIG_DIR                      ".videolan"
+#define CONFIG_FILE                     "vlcrc"
+
 /*****************************************************************************
  * Interface configuration
  *****************************************************************************/
index 2e8637a52183fee763dca136b59a5ce79d508a28..ddb70b97351f0f298658100bd7c6d3a714428dbd 100644 (file)
 /* Define if you have the getpagesize function.  */
 #undef HAVE_GETPAGESIZE
 
+/* Define if you have the getpwuid function.  */
+#undef HAVE_GETPWUID
+
+/* Define if you have the getpwuid_r function.  */
+#undef HAVE_GETPWUID_R
+
 /* Define if you have the gettimeofday function.  */
 #undef HAVE_GETTIMEOFDAY
 
 /* Define if you have the sigrelse function.  */
 #undef HAVE_SIGRELSE
 
-/* Define if you have the getpwuid_r function.  */
-#undef HAVE_GETPWUID_R
-
-/* Define if you have the getpwuid function.  */
-#undef HAVE_GETPWUID
-
 /* Define if you have the stpcpy function.  */
 #undef HAVE_STPCPY
 
index 6c94b5c542f6d05960dfd8d0879627e744a31930..e4c8590ab7f2fac41ffbf579963e14190aa00796 100644 (file)
@@ -4,7 +4,7 @@
  * includes all common video types and constants.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video.h,v 1.45 2002/03/15 04:41:54 sam Exp $
+ * $Id: video.h,v 1.46 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -44,11 +44,6 @@ typedef struct plane_s
     int i_visible_bytes;                 /* How many real pixels are there ? */
     boolean_t b_hidden;           /* Are we allowed to write to the margin ? */
 
-    /* Variables used for RGB planes */
-    int i_red_mask;
-    int i_green_mask;
-    int i_blue_mask;
-
 } plane_t;
 
 /*****************************************************************************
@@ -84,6 +79,9 @@ typedef struct picture_s
     boolean_t       b_repeat_first_field;                         /* RFF bit */
     boolean_t       b_top_field_first;               /* which field is first */
 
+    /* The picture heap we are attached to */
+    struct picture_heap_s* p_heap;
+
     /* Private data - the video output plugin might want to put stuff here to
      * keep track of the picture */
     struct picture_sys_s *p_sys;
@@ -96,20 +94,31 @@ typedef struct picture_s
  *****************************************************************************/
 typedef struct picture_heap_s
 {
-    int             i_pictures;                         /* current heap size */
+    int i_pictures;                                     /* current heap size */
 
     /* Picture static properties - those properties are fixed at initialization
      * and should NOT be modified */
-    int             i_width;                                /* picture width */
-    int             i_height;                              /* picture height */
-    u32             i_chroma;                              /* picture chroma */
-    int             i_aspect;                                /* aspect ratio */
+    int i_width;                                            /* picture width */
+    int i_height;                                          /* picture height */
+    u32 i_chroma;                                          /* picture chroma */
+    int i_aspect;                                            /* aspect ratio */
+
+    /* Variables used for RGB planes */
+    int i_rmask, i_rrshift, i_lrshift;
+    int i_gmask, i_rgshift, i_lgshift;
+    int i_bmask, i_rbshift, i_lbshift;
 
     /* Real pictures */
     picture_t*      pp_picture[VOUT_MAX_PICTURES];               /* pictures */
 
 } picture_heap_t;
 
+/* RGB2PIXEL: assemble RGB components to a pixel value, returns a u32 */
+#define RGB2PIXEL( p_vout, i_r, i_g, i_b )                                    \
+    (((((u32)i_r) >> p_vout->output.i_rrshift) << p_vout->output.i_lrshift) | \
+     ((((u32)i_g) >> p_vout->output.i_rgshift) << p_vout->output.i_lgshift) | \
+     ((((u32)i_b) >> p_vout->output.i_rbshift) << p_vout->output.i_lbshift))
+
 /*****************************************************************************
  * Flags used to describe the status of a picture
  *****************************************************************************/
@@ -138,6 +147,7 @@ typedef struct picture_heap_s
 #define FOURCC_BI_BITFIELDS  0x00000003            /* RGB, for 16, 24, 32bpp */
 #define FOURCC_RV15          0x35315652    /* RGB 15bpp, 0x1f, 0x7e0, 0xf800 */
 #define FOURCC_RV16          0x36315652    /* RGB 16bpp, 0x1f, 0x3e0, 0x7c00 */
+#define FOURCC_RV24          0x34325652 /* RGB 24bpp, 0xff, 0xff00, 0xff0000 */
 #define FOURCC_RV32          0x32335652 /* RGB 32bpp, 0xff, 0xff00, 0xff0000 */
 
 /* Planar YUV formats */
index 2993785cccbd354b4b01f55d909f572b9368a86e..fc2a09abb3bc2fd02afb22de2edb118197c72ca9 100644 (file)
@@ -2,7 +2,7 @@
  * vout_beos.cpp: beos video output display method
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_beos.cpp,v 1.44 2002/03/13 08:39:39 tcastley Exp $
+ * $Id: vout_beos.cpp,v 1.45 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -485,6 +485,10 @@ int vout_Init( vout_thread_t *p_vout )
                                * VOUT_ASPECT_FACTOR / p_vout->p_sys->i_height;
     p_vout->output.i_chroma = FOURCC_RV32;
 
+    p_vout->output.i_rmask  = 0x00ff0000;
+    p_vout->output.i_gmask  = 0x0000ff00;
+    p_vout->output.i_bmask  = 0x000000ff;
+
     p_pic = NULL;
 
     /* Find an empty picture slot */
@@ -509,10 +513,6 @@ int vout_Init( vout_thread_t *p_vout )
     p_pic->p->b_margin = 0;
     p_pic->p->i_pitch = 4 * p_vout->p_sys->i_width;
 
-    p_pic->p->i_red_mask   = 0x00ff0000;
-    p_pic->p->i_green_mask = 0x0000ff00;
-    p_pic->p->i_blue_mask  = 0x000000ff;
-
     p_pic->i_planes = 1;
 
     p_pic->i_status = DESTROYED_PICTURE;
index a30fd5c0156757c899557eea6eb37af86ef6317f..22748244a6303fdaa5c9fd86b4d2b063a3a650b7 100644 (file)
@@ -2,7 +2,7 @@
  * i420_rgb.c : YUV to bitmap RGB conversion module for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: i420_rgb.c,v 1.5 2002/02/15 13:32:53 sam Exp $
+ * $Id: i420_rgb.c,v 1.6 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -35,6 +35,9 @@
 #include "video_output.h"
 
 #include "i420_rgb.h"
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+#   include "i420_rgb_c.h"
+#endif
 
 /*****************************************************************************
  * Local and extern prototypes.
@@ -44,6 +47,11 @@ static void chroma_getfunctions ( function_list_t * p_function_list );
 static int  chroma_Init         ( vout_thread_t *p_vout );
 static void chroma_End          ( vout_thread_t *p_vout );
 
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+static void SetGammaTable       ( int *pi_table, double f_gamma );
+static void SetYUV              ( vout_thread_t *p_vout );
+#endif
+
 /*****************************************************************************
  * Build configuration tree.
  *****************************************************************************/
@@ -52,10 +60,10 @@ MODULE_CONFIG_STOP
 
 MODULE_INIT_START
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-    SET_DESCRIPTION( "I420/IYUV/YV12 to RGB 8/15/16/24/32 conversions" )
+    SET_DESCRIPTION( "I420,IYUV,YV12 to RGB,RV15,RV16,RV24,RV32 conversions" )
     ADD_CAPABILITY( CHROMA, 80 )
 #elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
-    SET_DESCRIPTION( "MMX I420/IYUV/YV12 to RGB 15/16/24/32 conversions" )
+    SET_DESCRIPTION( "MMX I420,IYUV,YV12 to RV15,RV16,RV24,RV32 conversions" )
     ADD_CAPABILITY( CHROMA, 100 )
     ADD_REQUIREMENT( MMX )
 #endif
@@ -85,6 +93,10 @@ static void chroma_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int chroma_Init( vout_thread_t *p_vout )
 {
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+    size_t i_tables_size;
+#endif
+
     if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 )
     {
         return -1;
@@ -98,7 +110,7 @@ static int chroma_Init( vout_thread_t *p_vout )
             switch( p_vout->output.i_chroma )
             {
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-                case FOURCC_BI_RGB:
+                case FOURCC_RGB:
                     p_vout->chroma.pf_convert = _M( I420_RGB8 );
                     break;
 #endif
@@ -132,7 +144,7 @@ static int chroma_Init( vout_thread_t *p_vout )
     switch( p_vout->output.i_chroma )
     {
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-        case FOURCC_BI_RGB:
+        case FOURCC_RGB:
             p_vout->chroma.p_sys->p_buffer = malloc( VOUT_MAX_WIDTH );
             break;
 #endif
@@ -166,6 +178,33 @@ static int chroma_Init( vout_thread_t *p_vout )
         return -1;
     }
 
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+    switch( p_vout->output.i_chroma )
+    {
+    case FOURCC_RGB:
+        i_tables_size = sizeof( u8 ) * PALETTE_TABLE_SIZE;
+        break;
+    case FOURCC_RV15:
+    case FOURCC_RV16:
+        i_tables_size = sizeof( u16 ) * RGB_TABLE_SIZE;
+        break;
+    default: /* RV24, RV32 */
+        i_tables_size = sizeof( u32 ) * RGB_TABLE_SIZE;
+        break;
+    }
+
+    p_vout->chroma.p_sys->p_base = malloc( i_tables_size );
+    if( p_vout->chroma.p_sys->p_base == NULL )
+    {
+        free( p_vout->chroma.p_sys->p_offset );
+        free( p_vout->chroma.p_sys->p_buffer );
+        free( p_vout->chroma.p_sys );
+        return -1;
+    }
+
+    SetYUV( p_vout );
+#endif
+
     return 0; 
 }
 
@@ -176,8 +215,217 @@ static int chroma_Init( vout_thread_t *p_vout )
  *****************************************************************************/
 static void chroma_End( vout_thread_t *p_vout )
 {
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+    free( p_vout->chroma.p_sys->p_base );
+#endif
     free( p_vout->chroma.p_sys->p_offset );
     free( p_vout->chroma.p_sys->p_buffer );
     free( p_vout->chroma.p_sys );
 }
 
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+/*****************************************************************************
+ * SetGammaTable: return intensity table transformed by gamma curve.
+ *****************************************************************************
+ * pi_table is a table of 256 entries from 0 to 255.
+ *****************************************************************************/
+static void SetGammaTable( int *pi_table, double f_gamma )
+{
+    int         i_y;                                       /* base intensity */
+
+    /* Use exp(gamma) instead of gamma */
+    f_gamma = exp( f_gamma );
+
+    /* Build gamma table */
+    for( i_y = 0; i_y < 256; i_y++ )
+    {
+        pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
+    }
+}
+
+/*****************************************************************************
+ * SetYUV: compute tables and set function pointers
+ *****************************************************************************/
+static void SetYUV( vout_thread_t *p_vout )
+{
+    int         pi_gamma[256];                                /* gamma table */
+    int         i_index;                                  /* index in tables */
+
+    /* Build gamma table */
+    SetGammaTable( pi_gamma, p_vout->f_gamma );
+
+    /*
+     * Set pointers and build YUV tables
+     */
+    /* Color: build red, green and blue tables */
+    switch( p_vout->output.i_chroma )
+    {
+    case FOURCC_RGB:
+        {
+            #define RGB_MIN 0
+            #define RGB_MAX 255
+            #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
+
+            int y,u,v;
+            int r,g,b;
+            int uvr, uvg, uvb;
+            int i = 0, j = 0;
+            u16 red[256], green[256], blue[256], transp[256];
+            unsigned char lookup[PALETTE_TABLE_SIZE];
+
+            p_vout->chroma.p_sys->yuv.p_rgb8 = (u8 *)p_vout->chroma.p_sys->p_base;
+
+            /* this loop calculates the intersection of an YUV box
+             * and the RGB cube. */
+            for ( y = 0; y <= 256; y += 16 )
+            {
+                for ( u = 0; u <= 256; u += 32 )
+                for ( v = 0; v <= 256; v += 32 )
+                {
+                    uvr = (V_RED_COEF*(v-128)) >> SHIFT;
+                    uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
+                    uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
+                    r = y + uvr;
+                    g = y + uvg;
+                    b = y + uvb;
+
+                    if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
+                            && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
+                    {
+                        /* this one should never happen unless someone fscked up my code */
+                        if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette" ); break; }
+
+                        /* clip the colors */
+                        red[j] = CLIP( r );
+                        green[j] = CLIP( g );
+                        blue[j] = CLIP( b );
+                        transp[j] = 0;
+
+                        /* allocate color */
+                        lookup[i] = 1;
+                        p_vout->chroma.p_sys->yuv.p_rgb8[i++] = j;
+                        j++;
+                    }
+                    else
+                    {
+                        lookup[i] = 0;
+                        p_vout->chroma.p_sys->yuv.p_rgb8[i++] = 0;
+                    }
+                }
+                i += 128-81;
+            }
+
+            /* the colors have been allocated, we can set the palette */
+            /* there will eventually be a way to know which colors
+             * couldn't be allocated and try to find a replacement */
+#if 0
+            p_vout->pf_setpalette( p_vout, red, green, blue, transp );
+
+            p_vout->i_white_pixel = 0xff;
+            p_vout->i_black_pixel = 0x00;
+            p_vout->i_gray_pixel = 0x44;
+            p_vout->i_blue_pixel = 0x3b;
+#endif
+
+            i = 0;
+            /* this loop allocates colors that got outside
+             * the RGB cube */
+            for ( y = 0; y <= 256; y += 16 )
+            {
+                for ( u = 0; u <= 256; u += 32 )
+                for ( v = 0; v <= 256; v += 32 )
+                {
+                    int u2, v2;
+                    int dist, mindist = 100000000;
+
+                    if( lookup[i] || y==0)
+                    {
+                        i++;
+                        continue;
+                    }
+
+                    /* heavy. yeah. */
+                    for( u2 = 0; u2 <= 256; u2 += 32 )
+                    for( v2 = 0; v2 <= 256; v2 += 32 )
+                    {
+                        j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
+                        dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
+                        if( lookup[j] )
+                        /* find the nearest color */
+                        if( dist < mindist )
+                        {
+                            p_vout->chroma.p_sys->yuv.p_rgb8[i] = p_vout->chroma.p_sys->yuv.p_rgb8[j];
+                            mindist = dist;
+                        }
+                        j -= 128;
+                        if( lookup[j] )
+                        /* find the nearest color */
+                        if( dist + 128 < mindist )
+                        {
+                            p_vout->chroma.p_sys->yuv.p_rgb8[i] = p_vout->chroma.p_sys->yuv.p_rgb8[j];
+                            mindist = dist + 128;
+                        }
+                    }
+                    i++;
+                }
+                i += 128-81;
+            }
+
+        }
+        break;
+
+    case FOURCC_RV15:
+    case FOURCC_RV16:
+        p_vout->chroma.p_sys->yuv.p_rgb16 = (u16 *)p_vout->chroma.p_sys->p_base;
+        for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+        }
+        for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+        }
+        for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+            p_vout->chroma.p_sys->yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+        }
+        for( i_index = 0; i_index < 256; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+        }
+        break;
+
+    case FOURCC_RV24:
+    case FOURCC_RV32:
+        p_vout->chroma.p_sys->yuv.p_rgb32 = (u32 *)p_vout->chroma.p_sys->p_base;
+        for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+        }
+        for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+        }
+        for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+            p_vout->chroma.p_sys->yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+        }
+        for( i_index = 0; i_index < 256; i_index++ )
+        {
+            p_vout->chroma.p_sys->yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+            p_vout->chroma.p_sys->yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+        }
+        break;
+    }
+}
+#endif
+
index 4014b09ba98efe126b1e851e84693034bc8738e5..7871ef9d9bfda090a5ec3220ad42046343e3e9c1 100644 (file)
@@ -2,7 +2,7 @@
  * i420_rgb.h : YUV to bitmap RGB conversion module for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: i420_rgb.h,v 1.3 2002/01/28 16:51:22 sam Exp $
+ * $Id: i420_rgb.h,v 1.4 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -32,6 +32,17 @@ typedef struct chroma_sys_s
     u8  *p_buffer;
     int *p_offset;
 
+#ifdef MODULE_NAME_IS_chroma_i420_rgb
+    /* Pre-calculated conversion tables */
+    void *              p_base;            /* base for all conversion tables */
+    union
+    {
+        u8 *            p_rgb8;                          /* RGB 8 bits table */
+        u16 *           p_rgb16;                        /* RGB 16 bits table */
+        u32 *           p_rgb32;                        /* RGB 32 bits table */
+    } yuv;
+#endif
+
 } chroma_sys_t;
 
 /*****************************************************************************
index ab594aa8695f23f9f8c691551e72bd6479964e1e..afdc74c7c055f7ff750a28215446881984ce94b5 100644 (file)
@@ -2,7 +2,7 @@
  * i420_rgb16.c : YUV to bitmap RGB conversion module for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: i420_rgb16.c,v 1.3 2002/01/28 16:51:22 sam Exp $
+ * $Id: i420_rgb16.c,v 1.4 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -70,6 +70,12 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
     int         i_scale_count;                       /* scale modulo counter */
     int         i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
     u16 *       p_pic_start;       /* beginning of the current line for copy */
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    u16 *       p_yuv = p_vout->chroma.p_sys->yuv.p_rgb16;
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+#endif
 
     /* Conversion buffer pointer */
     u16 *       p_buffer_start = (u16*)p_vout->chroma.p_sys->p_buffer;
@@ -104,11 +110,6 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
                p_vout->output.i_width, p_vout->output.i_height,
                &b_hscale, &i_vscale, p_offset_start );
 
-#if defined (MODULE_NAME_IS_chroma_i420_rgb)
-    intf_ErrMsg( "vout error: I420_RGB16 unimplemented, "
-                 "please harass sam@zoy.org" );
-#endif
-
     /*
      * Perform conversion
      */
@@ -122,7 +123,10 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
         for ( i_x = p_vout->render.i_width / 8; i_x--; )
         {
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-            /* FIXME: TODO */
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
 #elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
             __asm__( MMX_INIT_16
                      : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
@@ -149,7 +153,10 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
             p_v -= i_rewind >> 1;
             p_buffer -= i_rewind;
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-            /* FIXME: TODO */
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
 #elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
             __asm__( MMX_INIT_16
                      : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
@@ -198,6 +205,12 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src,
     int         i_scale_count;                       /* scale modulo counter */
     int         i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
     u16 *       p_pic_start;       /* beginning of the current line for copy */
+#if defined (MODULE_NAME_IS_chroma_i420_rgb)
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    u16 *       p_yuv = p_vout->chroma.p_sys->yuv.p_rgb16;
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+#endif
 
     /* Conversion buffer pointer */
     u16 *       p_buffer_start = (u16*)p_vout->chroma.p_sys->p_buffer;
@@ -232,11 +245,6 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src,
                p_vout->output.i_width, p_vout->output.i_height,
                &b_hscale, &i_vscale, p_offset_start );
 
-#if defined (MODULE_NAME_IS_chroma_i420_rgb)
-    intf_ErrMsg( "vout error: I420_RGB16 unimplemented, "
-                 "please harass sam@zoy.org" );
-#endif
-
     /*
      * Perform conversion
      */
@@ -250,7 +258,10 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src,
         for ( i_x = p_vout->render.i_width / 8; i_x--; )
         {
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-            /* FIXME: TODO */
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
 #elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
             __asm__( MMX_INIT_16
                      : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
@@ -277,7 +288,10 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src,
             p_v -= i_rewind >> 1;
             p_buffer -= i_rewind;
 #if defined (MODULE_NAME_IS_chroma_i420_rgb)
-            /* FIXME: TODO */
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
 #elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
             __asm__( MMX_INIT_16
                      : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
index 5b938f1ee2231c033be25213357447754f5daa8d..423e17857b1b11ffb8faaf92c35025f17b218a93 100644 (file)
@@ -2,7 +2,7 @@
  * i420_ymga.c : YUV to YUV conversion module for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: i420_ymga.c,v 1.2 2002/02/15 13:32:53 sam Exp $
+ * $Id: i420_ymga.c,v 1.3 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -34,7 +34,7 @@
 #include "video.h"
 #include "video_output.h"
 
-#define SRC_FOURCC  "I420/IYUV/YV12"
+#define SRC_FOURCC  "I420,IYUV,YV12"
 #define DEST_FOURCC "YMGA"
 
 /*****************************************************************************
index db7c3bcadd55060e39b59d7b2e27d45daa7335ab..38ce9f8d8a9f89f0c63c80844d30eba20cfe0e8c 100644 (file)
@@ -2,7 +2,7 @@
  * i420_yuy2.c : YUV to YUV conversion module for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: i420_yuy2.c,v 1.2 2002/02/15 13:32:53 sam Exp $
+ * $Id: i420_yuy2.c,v 1.3 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
 
 #include "i420_yuy2.h"
 
-#define SRC_FOURCC  "I420/IYUV/YV12"
+#define SRC_FOURCC  "I420,IYUV,YV12"
 
 #if defined (MODULE_NAME_IS_chroma_i420_yuy2)
-#    define DEST_FOURCC "YUY2/YUNV/YVYU/UYVY/UYNV/Y422/IUYV/cyuv/Y211"
+#    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv,Y211"
 #else
-#    define DEST_FOURCC "YUY2/YUNV/YVYU/UYVY/UYNV/Y422/IUYV/cyuv"
+#    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
 #endif
 
 /*****************************************************************************
index dd44d00aa318bf11104beb8a303557830c59f653..9f84497870755661b79ed3a89b7435c9043a1f8b 100644 (file)
@@ -2,7 +2,7 @@
  * i422_yuy2.c : YUV to YUV conversion module for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: i422_yuy2.c,v 1.2 2002/02/15 13:32:53 sam Exp $
+ * $Id: i422_yuy2.c,v 1.3 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -38,9 +38,9 @@
 
 #define SRC_FOURCC  "I422"
 #if defined (MODULE_NAME_IS_chroma_i422_yuy2)
-#    define DEST_FOURCC "YUY2/YUNV/YVYU/UYVY/UYNV/Y422/IUYV/cyuv/Y211"
+#    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv,Y211"
 #else
-#    define DEST_FOURCC "YUY2/YUNV/YVYU/UYVY/UYNV/Y422/IUYV/cyuv"
+#    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
 #endif
 
 /*****************************************************************************
index c4a65b65b67d0ff2be442c596a2671da4c7f96cb..bd1dcec11e3e009a78b7357357afcc564926e435 100644 (file)
@@ -2,7 +2,7 @@
  * vout_directx.c: Windows DirectX video output display method
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: vout_directx.c,v 1.24 2002/03/11 07:23:09 gbazin Exp $
+ * $Id: vout_directx.c,v 1.25 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -1045,6 +1045,9 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
     {
         /* FixMe */
         p_vout->output.i_chroma = FOURCC_RV16;
+        p_vout->output.i_rmask  = 0x001f;
+        p_vout->output.i_gmask  = 0x03e0;
+        p_vout->output.i_bmask  = 0x7c00;
 
         for( i = 0; i < i_num_pics; i++ )
         {
@@ -1176,10 +1179,6 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->p->i_pixel_bytes = 2;
             p_pic->p->b_margin = 0;
 
-            p_pic->p->i_red_mask   = 0x001f;
-            p_pic->p->i_green_mask = 0x03e0;
-            p_pic->p->i_blue_mask  = 0x7c00;
-
             p_pic->i_planes = 1;
             break;
 
@@ -1191,10 +1190,6 @@ static int UpdatePictureStruct( vout_thread_t *p_vout, picture_t *p_pic,
             p_pic->p->i_pixel_bytes = 2;
             p_pic->p->b_margin = 0;
 
-            p_pic->p->i_red_mask   = 0x001f;
-            p_pic->p->i_green_mask = 0x07e0;
-            p_pic->p->i_blue_mask  = 0xf800;
-
             p_pic->i_planes = 1;
             break;
 
index 803bf8582931827f5b202ed4b11c3ead45c76d77..de264a0af2de85de98435a3bef44004392b20e45 100644 (file)
@@ -2,7 +2,7 @@
  * vout_dummy.c: Dummy video output display method for testing purposes
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_dummy.c,v 1.18 2002/02/15 13:32:53 sam Exp $
+ * $Id: vout_dummy.c,v 1.19 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -119,6 +119,9 @@ static int vout_Init( vout_thread_t *p_vout )
 
         default:
             p_vout->output.i_chroma = FOURCC_RV16;
+            p_vout->output.i_rmask  = 0xf800;
+            p_vout->output.i_gmask  = 0x07e0;
+            p_vout->output.i_bmask  = 0x001f;
             p_vout->output.i_width  = p_vout->render.i_width;
             p_vout->output.i_height = p_vout->render.i_height;
             p_vout->output.i_aspect = p_vout->render.i_aspect;
@@ -270,9 +273,6 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
         p_pic->p->i_pitch = i_width;
         p_pic->p->i_pixel_bytes = 2;
         p_pic->p->b_margin = 0;
-        p_pic->p->i_red_mask   = 0xf800;
-        p_pic->p->i_green_mask = 0x07e0;
-        p_pic->p->i_blue_mask  = 0x001f;
 
         /* We allocated 1 plane */
         p_pic->i_planes = 1;
index 14bb58817dfae99ee148950ef7eb32969e1836cb..28b7a98bf990dc27e2d7e978f9704e05fd101c89 100644 (file)
@@ -2,7 +2,7 @@
  * fb.c : framebuffer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: fb.c,v 1.14 2002/02/24 20:51:09 gbazin Exp $
+ * $Id: fb.c,v 1.15 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -275,6 +275,14 @@ static int vout_Init( vout_thread_t *p_vout )
             return 0;
     }
 
+    /* Only useful for p_vout->p_sys->var_info.bits_per_pixel != 8 */
+    p_vout->output.i_rmask = ( (1 << p_vout->p_sys->var_info.red.length) - 1 )
+                     << p_vout->p_sys->var_info.red.offset;
+    p_vout->output.i_gmask = ( (1 << p_vout->p_sys->var_info.green.length) - 1 )
+                     << p_vout->p_sys->var_info.green.offset;
+    p_vout->output.i_bmask = ( (1 << p_vout->p_sys->var_info.blue.length) - 1 )
+                     << p_vout->p_sys->var_info.blue.offset;
+
     p_vout->output.i_width = p_vout->p_sys->i_width;
     p_vout->output.i_height = p_vout->p_sys->i_height;
 
@@ -326,14 +334,6 @@ static int vout_Init( vout_thread_t *p_vout )
                              * p_vout->p_sys->i_bytes_per_pixel;
     }
 
-    /* Only useful for p_vout->p_sys->var_info.bits_per_pixel != 8 */
-    p_pic->p->i_red_mask = ( (1 << p_vout->p_sys->var_info.red.length) - 1 )
-                             << p_vout->p_sys->var_info.red.offset;
-    p_pic->p->i_green_mask = ( (1 << p_vout->p_sys->var_info.green.length) - 1 )
-                               << p_vout->p_sys->var_info.green.offset;
-    p_pic->p->i_blue_mask = ( (1 << p_vout->p_sys->var_info.blue.length) - 1 )
-                              << p_vout->p_sys->var_info.blue.offset;
-
     p_pic->i_planes = 1;
 
     p_pic->i_status = DESTROYED_PICTURE;
index 96ac8bb85b384437fce1fa46ed74edf700c6e161..3d75040ee247b85d27a94b4260d1dc373cf67cf5 100644 (file)
@@ -2,7 +2,7 @@
  * ggi.c : GGI plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: ggi.c,v 1.16 2002/03/11 07:23:09 gbazin Exp $
+ * $Id: ggi.c,v 1.17 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -173,6 +173,11 @@ int vout_Init( vout_thread_t *p_vout )
             return 0;
     }
 
+    /* Only useful for bits_per_pixel != 8 */
+    p_vout->output.i_rmask = p_b[ 0 ]->buffer.plb.pixelformat->red_mask;
+    p_vout->output.i_gmask = p_b[ 0 ]->buffer.plb.pixelformat->green_mask;
+    p_vout->output.i_bmask = p_b[ 0 ]->buffer.plb.pixelformat->blue_mask;
+
     p_pic = NULL;
 
     /* Find an empty picture slot */
@@ -214,11 +219,6 @@ int vout_Init( vout_thread_t *p_vout )
         p_pic->p->i_pitch = p_b[ 0 ]->buffer.plb.stride;
     }
 
-    /* Only useful for bits_per_pixel != 8 */
-    p_pic->p->i_red_mask =   p_b[ 0 ]->buffer.plb.pixelformat->red_mask;
-    p_pic->p->i_green_mask = p_b[ 0 ]->buffer.plb.pixelformat->green_mask;
-    p_pic->p->i_blue_mask =  p_b[ 0 ]->buffer.plb.pixelformat->blue_mask;
-
     p_pic->i_planes = 1;
 
     p_pic->i_status = DESTROYED_PICTURE;
index 6be25a75c7a055a7eba0156d4eeff1fbb6feb88d..367c20277a30aca79cdf0e44e224343d263ff06d 100644 (file)
@@ -2,7 +2,7 @@
  * glide.c : 3dfx Glide plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: glide.c,v 1.12 2002/02/15 13:32:53 sam Exp $
+ * $Id: glide.c,v 1.13 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -146,6 +146,11 @@ int vout_Init( vout_thread_t *p_vout )
     int i_index;
     picture_t *p_pic;
 
+    /* FIXME: we don't set i_chroma !! */
+    p_vout->output.i_rmask = 0xf800;
+    p_vout->output.i_gmask = 0x07e0;
+    p_vout->output.i_bmask = 0x001f;
+
     I_OUTPUTPICTURES = 0;
 
     p_pic = NULL;
@@ -179,10 +184,6 @@ int vout_Init( vout_thread_t *p_vout )
     p_pic->p->i_pitch = p_vout->p_sys->p_buffer_info.strideInBytes;
                          /*1024 * GLIDE_BYTES_PER_PIXEL*/
 
-    p_pic->p->i_red_mask =   0xf800;
-    p_pic->p->i_green_mask = 0x07e0;
-    p_pic->p->i_blue_mask =  0x001f;
-
     p_pic->i_status = DESTROYED_PICTURE;
     p_pic->i_type   = DIRECT_PICTURE;
 
index 20d0b96f6677e26179cbb911f73f831e9e62d238..eb42220275ac63d7cb6b14b3e9d60b74c9119f53 100644 (file)
@@ -686,23 +686,23 @@ static int QNXInitDisplay( p_vout_thread_t p_vout )
     switch( p_vout->i_screen_depth )
     {
         case 15:
-            p_vout->i_red_mask   = 0x7c00;
-            p_vout->i_green_mask = 0x03e0;
-            p_vout->i_blue_mask  = 0x001f;
+            p_vout->output.i_rmask = 0x7c00;
+            p_vout->output.i_gmask = 0x03e0;
+            p_vout->output.i_bmask = 0x001f;
             break;
 
         case 16:
-            p_vout->i_red_mask   = 0xf800;
-            p_vout->i_green_mask = 0x07e0;
-            p_vout->i_blue_mask  = 0x001f;
+            p_vout->output.i_rmask = 0xf800;
+            p_vout->output.i_gmask = 0x07e0;
+            p_vout->output.i_bmask = 0x001f;
             break;
 
         case 24:
         case 32:
         default:
-            p_vout->i_red_mask   = 0xff0000;
-            p_vout->i_green_mask = 0x00ff00;
-            p_vout->i_blue_mask  = 0x0000ff;
+            p_vout->output.i_rmask = 0xff0000;
+            p_vout->output.i_gmask = 0x00ff00;
+            p_vout->output.i_bmask = 0x0000ff;
             break;
     }
 
index a6fa54f576a05df360b9080855a0dba99a67c0d3..5399fd6d00fe81c4fb6605dd79198145f8233b3b 100644 (file)
@@ -2,7 +2,7 @@
  * vout_sdl.c: SDL video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_sdl.c,v 1.82 2002/02/19 00:50:19 sam Exp $
+ * $Id: vout_sdl.c,v 1.83 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Pierre Baillet <oct@zoy.org>
@@ -70,9 +70,6 @@ typedef struct vout_sys_s
 
     /* For RGB output */
     int i_surfaces;
-    int i_red_mask;
-    int i_green_mask;
-    int i_blue_mask;
 
     boolean_t   b_cursor;
     boolean_t   b_cursor_autohidden;
@@ -648,7 +645,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
         switch( p_vout->p_sys->p_display->format->BitsPerPixel )
         {
             case 8:
-                p_vout->output.i_chroma = FOURCC_BI_RGB;
+                p_vout->output.i_chroma = FOURCC_RGB;
                 break;
             case 15:
                 p_vout->output.i_chroma = FOURCC_RV15;
@@ -657,10 +654,10 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
                 p_vout->output.i_chroma = FOURCC_RV16;
                 break;
             case 24:
-                p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
+                p_vout->output.i_chroma = FOURCC_RV24;
                 break;
             case 32:
-                p_vout->output.i_chroma = FOURCC_BI_BITFIELDS;
+                p_vout->output.i_chroma = FOURCC_RV32;
                 break;
             default:
                 intf_ErrMsg( "vout error: unknown screen depth" );
@@ -669,9 +666,9 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
                 return( -1 );
         }
 
-        p_vout->p_sys->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
-        p_vout->p_sys->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
-        p_vout->p_sys->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
+        p_vout->output.i_rmask = p_vout->p_sys->p_display->format->Rmask;
+        p_vout->output.i_gmask = p_vout->p_sys->p_display->format->Gmask;
+        p_vout->output.i_bmask = p_vout->p_sys->p_display->format->Bmask;
 
         SDL_WM_SetCaption( VOUT_TITLE " (software RGB SDL output)",
                            VOUT_TITLE " (software RGB SDL output)" );
@@ -750,10 +747,6 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
         }
 
-        p_pic->p->i_red_mask = p_vout->p_sys->p_display->format->Rmask;
-        p_pic->p->i_green_mask = p_vout->p_sys->p_display->format->Gmask;
-        p_pic->p->i_blue_mask = p_vout->p_sys->p_display->format->Bmask;
-
         p_vout->p_sys->i_surfaces++;
 
         p_pic->i_planes = 1;
index 6845b18659a383247c53a97e6e3da9ceec177c39..997041e7c52d25cdd69bcd90bb2df7bcac06d843 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.21 2002/03/11 07:23:09 gbazin Exp $
+ * $Id: xcommon.c,v 1.22 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -155,9 +155,6 @@ typedef struct vout_sys_s
     int                 i_screen_depth;
     int                 i_bytes_per_pixel;
     int                 i_bytes_per_line;
-    int                 i_red_mask;
-    int                 i_green_mask;
-    int                 i_blue_mask;
 #endif
 
     /* X11 generic properties */
@@ -432,21 +429,35 @@ static int vout_Init( vout_thread_t *p_vout )
     p_vout->output.i_height = p_vout->render.i_height;
     p_vout->output.i_aspect = p_vout->render.i_aspect;
 
+    switch( p_vout->output.i_chroma )
+    {
+        case FOURCC_RV15:
+            p_vout->output.i_rmask = 0x001f;
+            p_vout->output.i_gmask = 0x07e0;
+            p_vout->output.i_bmask = 0xf800;
+            break;
+        case FOURCC_RV16:
+            p_vout->output.i_rmask = 0x001f;
+            p_vout->output.i_gmask = 0x03e0;
+            p_vout->output.i_bmask = 0x7c00;
+            break;
+    }
+
 #else
     /* Initialize the output structure: RGB with square pixels, whatever
      * the input format is, since it's the only format we know */
     switch( p_vout->p_sys->i_screen_depth )
     {
         case 8: /* FIXME: set the palette */
-            p_vout->output.i_chroma = FOURCC_BI_RGB; break;
+            p_vout->output.i_chroma = FOURCC_RGB; break;
         case 15:
             p_vout->output.i_chroma = FOURCC_RV15; break;
         case 16:
             p_vout->output.i_chroma = FOURCC_RV16; break;
         case 24:
-            p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
+            p_vout->output.i_chroma = FOURCC_RV24; break;
         case 32:
-            p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
+            p_vout->output.i_chroma = FOURCC_RV24; break;
         default:
             intf_ErrMsg( "vout error: unknown screen depth" );
             return( 0 );
@@ -1276,10 +1287,6 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             p_pic->p->i_pixel_bytes = 2;
             p_pic->p->b_margin = 0;
 
-            p_pic->p->i_red_mask   = 0x001f;
-            p_pic->p->i_green_mask = 0x07e0;
-            p_pic->p->i_blue_mask  = 0xf800;
-
             p_pic->i_planes = 1;
             break;
 
@@ -1292,10 +1299,6 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             p_pic->p->i_pixel_bytes = 2;
             p_pic->p->b_margin = 0;
 
-            p_pic->p->i_red_mask   = 0x001f;
-            p_pic->p->i_green_mask = 0x03e0;
-            p_pic->p->i_blue_mask  = 0x7c00;
-
             p_pic->i_planes = 1;
             break;
 
@@ -1320,10 +1323,6 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
                 p_pic->p->i_visible_bytes = 2 * p_pic->p_sys->p_image->width;
             }
 
-            p_pic->p->i_red_mask   = p_pic->p_sys->p_image->red_mask;
-            p_pic->p->i_green_mask = p_pic->p_sys->p_image->green_mask;
-            p_pic->p->i_blue_mask  = p_pic->p_sys->p_image->blue_mask;
-
             p_pic->i_planes = 1;
 
             break;
@@ -1347,10 +1346,6 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
                 p_pic->p->i_visible_bytes = 4 * p_pic->p_sys->p_image->width;
             }
 
-            p_pic->p->i_red_mask   = p_pic->p_sys->p_image->red_mask;
-            p_pic->p->i_green_mask = p_pic->p_sys->p_image->green_mask;
-            p_pic->p->i_blue_mask  = p_pic->p_sys->p_image->blue_mask;
-
             p_pic->i_planes = 1;
 
             break;
@@ -2074,9 +2069,10 @@ static int InitDisplay( vout_thread_t *p_vout )
             intf_ErrMsg( "vout error: no TrueColor visual available" );
             return( 1 );
         }
-        p_vout->p_sys->i_red_mask =        p_xvisual->red_mask;
-        p_vout->p_sys->i_green_mask =      p_xvisual->green_mask;
-        p_vout->p_sys->i_blue_mask =       p_xvisual->blue_mask;
+
+        p_vout->output.i_rmask = p_xvisual->red_mask;
+        p_vout->output.i_gmask = p_xvisual->green_mask;
+        p_vout->output.i_bmask = p_xvisual->blue_mask;
 
         /* There is no difference yet between 3 and 4 Bpp. The only way
          * to find the actual number of bytes per pixel is to list supported
index 9afd4202282825ea792e8b104a63047fc2c289cd..cf1e0ff74d439924bebfd68534d43e68f805e3ae 100644 (file)
@@ -2,7 +2,7 @@
  * configuration.c management of the modules configuration
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.4 2002/03/16 01:40:58 gbazin Exp $
+ * $Id: configuration.c,v 1.5 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -20,6 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
+
 #include <stdio.h>                                              /* sprintf() */
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <string.h>                                              /* strdup() */
 #include <sys/stat.h>
 #include <sys/types.h>
 
-static char *config_GetHomeDir(void);
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static char *GetHomeDir( void );
 
 /*****************************************************************************
  * config_GetIntVariable: get the value of an int variable
@@ -52,15 +56,14 @@ int config_GetIntVariable( const char *psz_name )
     /* sanity checks */
     if( !p_config )
     {
-        intf_ErrMsg( "config_GetIntVariable: option %s doesn't exist",
-                     psz_name );
+        intf_ErrMsg( "config error: option %s doesn't exist", psz_name );
         return -1;
     }
     if( (p_config->i_type!=MODULE_CONFIG_ITEM_INTEGER) &&
         (p_config->i_type!=MODULE_CONFIG_ITEM_BOOL) )
     {
-        intf_ErrMsg( "config_GetIntVariable: option %s doesn't refer to an int"
-                     psz_name );
+        intf_ErrMsg( "config error: option %s doesn't refer to an int",
+                     psz_name );
         return -1;
     }
 
@@ -88,16 +91,15 @@ char * config_GetPszVariable( const char *psz_name )
     /* sanity checks */
     if( !p_config )
     {
-        intf_ErrMsg( "config_GetPszVariable: option %s doesn't exist",
-                     psz_name );
+        intf_ErrMsg( "config error: option %s doesn't exist", psz_name );
         return NULL;
     }
     if( (p_config->i_type!=MODULE_CONFIG_ITEM_STRING) &&
         (p_config->i_type!=MODULE_CONFIG_ITEM_FILE) &&
         (p_config->i_type!=MODULE_CONFIG_ITEM_PLUGIN) )
     {
-        intf_ErrMsg( "config_GetPszVariable: option %s doesn't refer to a "
-                     "string", psz_name );
+        intf_ErrMsg( "config error: option %s doesn't refer to a string",
+                     psz_name );
         return NULL;
     }
 
@@ -125,16 +127,15 @@ void config_PutPszVariable( const char *psz_name, char *psz_value )
     /* sanity checks */
     if( !p_config )
     {
-        intf_ErrMsg( "config_PutPszVariable: option %s doesn't exist",
-                     psz_name );
+        intf_ErrMsg( "config error: option %s doesn't exist", psz_name );
         return;
     }
     if( (p_config->i_type!=MODULE_CONFIG_ITEM_STRING) &&
         (p_config->i_type!=MODULE_CONFIG_ITEM_FILE) &&
         (p_config->i_type!=MODULE_CONFIG_ITEM_PLUGIN) )
     {
-        intf_ErrMsg( "config_PutPszVariable: option %s doesn't refer to a "
-                     "string", psz_name );
+        intf_ErrMsg( "config error: option %s doesn't refer to a string",
+                     psz_name );
         return;
     }
 
@@ -166,15 +167,14 @@ void config_PutIntVariable( const char *psz_name, int i_value )
     /* sanity checks */
     if( !p_config )
     {
-        intf_ErrMsg( "config_PutIntVariable: option %s doesn't exist",
-                     psz_name );
+        intf_ErrMsg( "config error: option %s doesn't exist", psz_name );
         return;
     }
     if( (p_config->i_type!=MODULE_CONFIG_ITEM_INTEGER) &&
         (p_config->i_type!=MODULE_CONFIG_ITEM_BOOL) )
     {
-        intf_ErrMsg( "config_PutIntVariable: option %s doesn't refer to an int"
-                     psz_name );
+        intf_ErrMsg( "config error: option %s doesn't refer to an int",
+                     psz_name );
         return;
     }
 
@@ -227,7 +227,7 @@ module_config_t *config_Duplicate( module_t *p_module )
                                           * p_module->i_config_lines );
     if( p_config == NULL )
     {
-        intf_ErrMsg( "config_Duplicate error: can't allocate p_config" );
+        intf_ErrMsg( "config error: can't duplicate p_config" );
         return( NULL );
     }
 
@@ -280,33 +280,32 @@ int config_LoadConfigFile( const char *psz_module_name )
     /* Acquire config file lock */
     vlc_mutex_lock( &p_main->config_lock );
 
-    psz_homedir = config_GetHomeDir();
+    psz_homedir = GetHomeDir();
     if( !psz_homedir )
     {
-        intf_ErrMsg( "config_LoadConfigFile: GetHomeDir failed" );
+        intf_ErrMsg( "config error: GetHomeDir failed" );
         vlc_mutex_unlock( &p_main->config_lock );
         return -1;
     }
-    psz_filename = (char *)malloc( strlen("/.VideoLan/vlc") +
+    psz_filename = (char *)malloc( strlen("/" CONFIG_DIR "/" CONFIG_FILE) +
                                    strlen(psz_homedir) + 1 );
     if( !psz_filename )
     {
-        intf_ErrMsg( "config err: couldn't malloc psz_filename" );
+        intf_ErrMsg( "config error: couldn't malloc psz_filename" );
         free( psz_homedir );
         vlc_mutex_unlock( &p_main->config_lock );
         return -1;
     }
-    sprintf( psz_filename, "%s/.VideoLan/vlc", psz_homedir );
+    sprintf( psz_filename, "%s/" CONFIG_DIR "/" CONFIG_FILE, psz_homedir );
     free( psz_homedir );
 
-    intf_WarnMsg( 5, "config_SaveConfigFile: opening config file %s",
-                  psz_filename );
+    intf_WarnMsg( 5, "config: opening config file %s", psz_filename );
 
     file = fopen( psz_filename, "r" );
     if( !file )
     {
-        intf_WarnMsg( 1, "config_LoadConfigFile: couldn't open config file %s "
-                      "for reading", psz_filename );
+        intf_WarnMsg( 1, "config: couldn't open config file %s for reading",
+                         psz_filename );
         free( psz_filename );
         vlc_mutex_unlock( &p_main->config_lock );
         return -1;
@@ -330,8 +329,8 @@ int config_LoadConfigFile( const char *psz_module_name )
                 !memcmp( &line[1], p_module->psz_name,
                          strlen(p_module->psz_name) ) )
             {
-                intf_WarnMsg( 5, "config_LoadConfigFile: loading config for "
-                              "module <%s>", p_module->psz_name );
+                intf_WarnMsg( 5, "config: loading config for module <%s>",
+                                 p_module->psz_name );
 
                 break;
             }
@@ -375,8 +374,7 @@ int config_LoadConfigFile( const char *psz_module_name )
                     case MODULE_CONFIG_ITEM_INTEGER:
                         p_module->p_config[i].i_value =
                             atoi( psz_option_value);
-                        intf_WarnMsg( 7, "config_LoadConfigFile: found <%s> "
-                                      "option %s=%i",
+                        intf_WarnMsg( 7, "config: found <%s> option %s=%i",
                                       p_module->psz_name,
                                       p_module->p_config[i].psz_name,
                                       p_module->p_config[i].i_value );
@@ -394,8 +392,7 @@ int config_LoadConfigFile( const char *psz_module_name )
 
                         vlc_mutex_unlock( p_module->p_config[i].p_lock );
 
-                        intf_WarnMsg( 7, "config_LoadConfigFile: found <%s> "
-                                      "option %s=%s",
+                        intf_WarnMsg( 7, "config: found <%s> option %s=%s",
                                       p_module->psz_name,
                                       p_module->p_config[i].psz_name,
                                       p_module->p_config[i].psz_value );
@@ -447,40 +444,39 @@ int config_SaveConfigFile( const char *psz_module_name )
     /* Acquire config file lock */
     vlc_mutex_lock( &p_main->config_lock );
 
-    psz_homedir = config_GetHomeDir();
+    psz_homedir = GetHomeDir();
     if( !psz_homedir )
     {
-        intf_ErrMsg( "config_SaveConfigFile: GetHomeDir failed" );
+        intf_ErrMsg( "config error: GetHomeDir failed" );
         vlc_mutex_unlock( &p_main->config_lock );
         return -1;
     }
-    psz_filename = (char *)malloc( strlen("/.VideoLan/vlc") +
+    psz_filename = (char *)malloc( strlen("/" CONFIG_DIR "/" CONFIG_FILE) +
                                    strlen(psz_homedir) + 1 );
     if( !psz_filename )
     {
-        intf_ErrMsg( "config err: couldn't malloc psz_filename" );
+        intf_ErrMsg( "config error: couldn't malloc psz_filename" );
         free( psz_homedir );
         vlc_mutex_unlock( &p_main->config_lock );
         return -1;
     }
-    sprintf( psz_filename, "%s/.VideoLan", psz_homedir );
+    sprintf( psz_filename, "%s/" CONFIG_DIR, psz_homedir );
     free( psz_homedir );
 #ifndef WIN32
     mkdir( psz_filename, 0755 );
 #else
     mkdir( psz_filename );
 #endif
-    strcat( psz_filename, "/vlc" );
+    strcat( psz_filename, "/" CONFIG_FILE );
 
 
-    intf_WarnMsg( 5, "config_SaveConfigFile: opening config file %s",
-                  psz_filename );
+    intf_WarnMsg( 5, "config: opening config file %s", psz_filename );
 
     file = fopen( psz_filename, "r" );
     if( !file )
     {
-        intf_WarnMsg( 1, "config_SaveConfigFile: couldn't open config file %s "
-                      "for reading", psz_filename );
+        intf_WarnMsg( 1, "config: couldn't open config file %s for reading",
+                         psz_filename );
     }
     else
     {
@@ -493,7 +489,7 @@ int config_SaveConfigFile( const char *psz_module_name )
     p_bigbuffer = p_index = malloc( i_sizebuf+1 );
     if( !p_bigbuffer )
     {
-        intf_ErrMsg( "config err: couldn't malloc bigbuffer" );
+        intf_ErrMsg( "config error: couldn't malloc bigbuffer" );
         if( file ) fclose( file );
         free( psz_filename );
         vlc_mutex_unlock( &p_main->config_lock );
@@ -528,8 +524,8 @@ int config_SaveConfigFile( const char *psz_module_name )
                 /* we don't have this section in our list so we need to back
                  * it up */
                 *p_index2 = 0;
-                intf_WarnMsg( 5, "config_SaveConfigFile: backing up config for"
-                              unknown module <%s>", &p_line[1] );
+                intf_WarnMsg( 5, "config: backing up config for "
+                                 "unknown module <%s>", &p_line[1] );
                 *p_index2 = ']';
 
                 b_backup = 1;
@@ -559,14 +555,14 @@ int config_SaveConfigFile( const char *psz_module_name )
     file = fopen( psz_filename, "w" );
     if( !file )
     {
-        intf_WarnMsg( 1, "config_SaveConfigFile: couldn't open config file %s "
-                      "for writing", psz_filename );
+        intf_WarnMsg( 1, "config: couldn't open config file %s for writing",
+                         psz_filename );
         free( psz_filename );
         vlc_mutex_unlock( &p_main->config_lock );
         return -1;
     }
 
-    fprintf( file, "#\n# "COPYRIGHT_MESSAGE"\n#\n\n" );
+    fprintf( file, "###\n###  " COPYRIGHT_MESSAGE "\n###\n\n" );
 
     /* Look for the selected module, if NULL then save everything */
     for( p_module = p_module_bank->first ; p_module != NULL ;
@@ -579,12 +575,13 @@ int config_SaveConfigFile( const char *psz_module_name )
         if( !p_module->i_config_items )
             continue;
 
-        intf_WarnMsg( 5, "config_SaveConfigFile: saving config for "
-                      "module <%s>", p_module->psz_name );
+        intf_WarnMsg( 5, "config: saving config for module <%s>",
+                         p_module->psz_name );
 
-        fprintf( file, "[%s]\n", p_module->psz_name );
         if( p_module->psz_longname )
-            fprintf( file, "# %s\n#\n", p_module->psz_longname );
+            fprintf( file, "###\n###  %s\n###\n", p_module->psz_longname );
+
+        fprintf( file, "[%s]\n", p_module->psz_name );
 
         for( i = 0; i < p_module->i_config_lines; i++ )
         {
@@ -631,12 +628,14 @@ int config_SaveConfigFile( const char *psz_module_name )
     return 0;
 }
 
+/* Following functions are local. */
+
 /*****************************************************************************
- * config_GetHomeDir: find the user's home directory.
+ * GetHomeDir: find the user's home directory.
  *****************************************************************************
  * This function will try by different ways to find the user's home path.
  *****************************************************************************/
-static char *config_GetHomeDir(void)
+static char *GetHomeDir( void )
 {
     char *p_tmp, *p_homedir = NULL;
 
@@ -653,22 +652,19 @@ static char *config_GetHomeDir(void)
     p_buffer = (char *)malloc( bufsize );
 
     if( ( ret = getpwuid_r( getuid(), &pwd, p_buffer, bufsize, &p_pw ) ) < 0 )
-    {
-
 #elif defined(HAVE_GETPWUID)
     if( ( p_pw = getpwuid( getuid() ) ) == NULL )
-    {
-
 #endif
+    {
         if( ( p_tmp = getenv( "HOME" ) ) == NULL )
         {
-            intf_ErrMsg( "Unable to get home directory, set it to /tmp" );
+            intf_ErrMsg( "config error: unable to get home directory, "
+                         "using /tmp instead" );
             p_homedir = strdup( "/tmp" );
         }
         else p_homedir = strdup( p_tmp );
-
-#if defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWUID)
     }
+#if defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWUID)
     else
     {
         if( p_pw ) p_homedir = strdup( p_pw->pw_dir );
index f01c734b46e3def6de077e9b9628bd915fcdbe65..f0754e22f542b304cea4e4d1a46203ece90fc08d 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.166 2002/03/15 04:41:54 sam Exp $
+ * $Id: video_output.c,v 1.167 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -49,7 +49,10 @@ static void     RunThread         ( vout_thread_t *p_vout );
 static void     ErrorThread       ( vout_thread_t *p_vout );
 static void     EndThread         ( vout_thread_t *p_vout );
 static void     DestroyThread     ( vout_thread_t *p_vout, int i_status );
+
 static int      ReduceHeight      ( int );
+static int      BinaryLog         ( u32 );
+static void     MaskToShift       ( int *, int *, u32 );
 
 /*****************************************************************************
  * vout_InitBank: initialize the video output bank.
@@ -133,15 +136,31 @@ vout_thread_t * vout_CreateThread   ( int *pi_status,
         p_vout->p_subpicture[i_index].i_type   = EMPTY_SUBPICTURE;
     }
 
-    /* Initialize the rendering heap */
+    /* No images in the heap */
     p_vout->i_heap_size = 0;
 
+    /* Initialize the rendering heap */
     I_RENDERPICTURES = 0;
     p_vout->render.i_width    = i_width;
     p_vout->render.i_height   = i_height;
     p_vout->render.i_chroma   = i_chroma;
     p_vout->render.i_aspect   = i_aspect;
 
+    p_vout->render.i_rmask    = 0;
+    p_vout->render.i_gmask    = 0;
+    p_vout->render.i_bmask    = 0;
+
+    /* Zero the output heap */
+    I_OUTPUTPICTURES = 0;
+    p_vout->output.i_width    = 0;
+    p_vout->output.i_height   = 0;
+    p_vout->output.i_chroma   = 0;
+    p_vout->output.i_aspect   = 0;
+
+    p_vout->output.i_rmask    = 0;
+    p_vout->output.i_gmask    = 0;
+    p_vout->output.i_bmask    = 0;
+
     /* Initialize misc stuff */
     p_vout->i_changes    = 0;
     p_vout->f_gamma      = 0;
@@ -260,7 +279,7 @@ static int InitThread( vout_thread_t *p_vout )
     p_vout->c_loops = 0;
 #endif
 
-    /* Initialize output method, it issues its own error messages */
+    /* Initialize output method, it allocates direct buffers for us */
     if( p_vout->pf_init( p_vout ) )
     {
         vlc_mutex_unlock( &p_vout->change_lock );
@@ -294,6 +313,14 @@ static int InitThread( vout_thread_t *p_vout )
                   p_vout->output.i_aspect / i_pgcd,
                   VOUT_ASPECT_FACTOR / i_pgcd );
 
+    /* Calculate shifts from system-updated masks */
+    MaskToShift( &p_vout->output.i_lrshift, &p_vout->output.i_rrshift,
+                 p_vout->output.i_rmask );
+    MaskToShift( &p_vout->output.i_lgshift, &p_vout->output.i_rgshift,
+                 p_vout->output.i_gmask );
+    MaskToShift( &p_vout->output.i_lbshift, &p_vout->output.i_rbshift,
+                 p_vout->output.i_bmask );
+
     /* Check whether we managed to create direct buffers similar to
      * the render buffers, ie same size, chroma and aspect ratio */
     if( ( p_vout->output.i_width == p_vout->render.i_width )
@@ -316,7 +343,6 @@ static int InitThread( vout_thread_t *p_vout )
             PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i ];
             I_RENDERPICTURES++;
         }
-
     }
     else
     {
@@ -374,6 +400,17 @@ static int InitThread( vout_thread_t *p_vout )
         }
     }
 
+    /* Link pictures back to their heap */
+    for( i = 0 ; i < I_RENDERPICTURES ; i++ )
+    {
+        PP_RENDERPICTURE[ i ]->p_heap = &p_vout->render;
+    }
+
+    for( i = 0 ; i < I_OUTPUTPICTURES ; i++ )
+    {
+        PP_OUTPUTPICTURE[ i ]->p_heap = &p_vout->output;
+    }
+
     /* Mark thread as running and return */
     p_vout->b_active = 1;
     *p_vout->pi_status = THREAD_READY;
@@ -685,6 +722,8 @@ static void DestroyThread( vout_thread_t *p_vout, int i_status )
     *pi_status = i_status;
 }
 
+/* following functions are local */
+
 static int ReduceHeight( int i_ratio )
 {
     int i_dummy = VOUT_ASPECT_FACTOR;
@@ -720,3 +759,55 @@ static int ReduceHeight( int i_ratio )
     return i_pgcd;
 }
 
+/*****************************************************************************
+ * BinaryLog: computes the base 2 log of a binary value
+ *****************************************************************************
+ * This functions is used by MaskToShift, to get a bit index from a binary
+ * value.
+ *****************************************************************************/
+static int BinaryLog(u32 i)
+{
+    int i_log = 0;
+
+    if(i & 0xffff0000) i_log += 16;
+    if(i & 0xff00ff00) i_log += 8;
+    if(i & 0xf0f0f0f0) i_log += 4;
+    if(i & 0xcccccccc) i_log += 2;
+    if(i & 0xaaaaaaaa) i_log += 1;
+
+    if (i != ((u32)1 << i_log))
+    {
+        intf_ErrMsg( "vout error: binary log overflow for %i", i );
+    }
+
+    return( i_log );
+}
+
+/*****************************************************************************
+ * MaskToShift: transform a color mask into right and left shifts
+ *****************************************************************************
+ * This function is used for obtaining color shifts from masks.
+ *****************************************************************************/
+static void MaskToShift( int *pi_left, int *pi_right, u32 i_mask )
+{
+    u32 i_low, i_high;                 /* lower hand higher bits of the mask */
+
+    if( !i_mask )
+    {
+        *pi_left = *pi_right = 0;
+        return;
+    }
+
+    /* Get bits */
+    i_low =  i_mask & (- i_mask);                   /* lower bit of the mask */
+    i_high = i_mask + i_low;                       /* higher bit of the mask */
+
+    /* Transform bits into an index */
+    i_low =  BinaryLog (i_low);
+    i_high = BinaryLog (i_high);
+
+    /* Update pointers and return */
+    *pi_left =   i_low;
+    *pi_right = (8 - i_high + i_low);
+}
+
index 5fa3fc0dddc0a76bf12fc476db2f9ca9c6c5a841..d1420972933fb40d09fc1d2ad2e2ee11a21c48e0 100644 (file)
@@ -2,7 +2,7 @@
  * vout_pictures.c : picture management functions
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vout_pictures.c,v 1.18 2002/02/27 18:19:21 sam Exp $
+ * $Id: vout_pictures.c,v 1.19 2002/03/16 23:03:19 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -465,9 +465,9 @@ void vout_AllocatePicture( picture_t *p_pic,
             p_pic->p->i_lines = i_height;
             p_pic->p->i_pitch = i_width * 2;
             p_pic->p->i_pixel_bytes = 2;
-            p_pic->p->i_red_mask =   0x001f;
-            p_pic->p->i_green_mask = 0x03e0;
-            p_pic->p->i_blue_mask =  0x7c00;
+            p_pic->p_heap->i_rmask = 0x001f;
+            p_pic->p_heap->i_gmask = 0x03e0;
+            p_pic->p_heap->i_bmask = 0x7c00;
             p_pic->i_planes = 1;
             break;
 
@@ -475,9 +475,9 @@ void vout_AllocatePicture( picture_t *p_pic,
             p_pic->p->i_lines = i_height;
             p_pic->p->i_pitch = i_width * 2;
             p_pic->p->i_pixel_bytes = 2;
-            p_pic->p->i_red_mask =   0x001f;
-            p_pic->p->i_green_mask = 0x07e0;
-            p_pic->p->i_blue_mask =  0xf800;
+            p_pic->p_heap->i_rmask = 0x001f;
+            p_pic->p_heap->i_gmask = 0x07e0;
+            p_pic->p_heap->i_bmask = 0xf800;
             p_pic->i_planes = 1;
             break;
 
@@ -485,9 +485,9 @@ void vout_AllocatePicture( picture_t *p_pic,
             p_pic->p->i_lines = i_height;
             p_pic->p->i_pitch = i_width * 4;
             p_pic->p->i_pixel_bytes = 4;
-            p_pic->p->i_red_mask =   0xff0000;
-            p_pic->p->i_green_mask = 0x00ff00;
-            p_pic->p->i_blue_mask =  0x0000ff;
+            p_pic->p_heap->i_rmask = 0xff0000;
+            p_pic->p_heap->i_gmask = 0x00ff00;
+            p_pic->p_heap->i_bmask = 0x0000ff;
             p_pic->i_planes = 1;
             break;