]> git.sesse.net Git - vlc/commitdiff
. merged the YUV plugins in the same directory to avoid too much code
authorSam Hocevar <sam@videolan.org>
Tue, 16 Jan 2001 02:16:38 +0000 (02:16 +0000)
committerSam Hocevar <sam@videolan.org>
Tue, 16 Jan 2001 02:16:38 +0000 (02:16 +0000)
   duplication
 . YUV transformations now use the new module API ; now only the vout
   and interface still depend on the old plugin API
 . changed TestMMX to TestCPU because we will be able to test for other
   specific extensions (3DNow, SSE) for the forthcoming IDCT we'll
   borrow to mpeg2dec (as usual :P)
 . don't show "hiding module" messages anymore except in debug mode
 . swapped C IDCT and Classic IDCT scores since the classic one seems
   to be faster ; anyway you should use the MMX one
 . fixed a Makefile bug under BeOS
 . tried to fix the cpuid code so that it compiles under BeOS (Polux, can
   you test it when you have time ?)

38 files changed:
Makefile.in
include/modules.h
include/tests.h
include/video_output.h
plugins/alsa/alsa.c
plugins/dsp/dsp.c
plugins/esd/esd.c
plugins/idct/idct.c
plugins/idct/idctclassic.c
plugins/idct/idctmmx.c
plugins/null/null.c
plugins/yuv/transforms_common.h [moved from plugins/yuv/video_yuv_macros.h with 99% similarity]
plugins/yuv/transforms_yuv.c [new file with mode: 0644]
plugins/yuv/transforms_yuv.h [moved from plugins/yuv/video_yuv_macros_8bpp.h with 99% similarity]
plugins/yuv/transforms_yuvmmx.c [moved from plugins/yuv/video_yuv16.c with 53% similarity]
plugins/yuv/transforms_yuvmmx.h [moved from plugins/yuvmmx/video_yuv_asm.h with 99% similarity]
plugins/yuv/video_common.h [moved from plugins/yuv/video_yuv.h with 89% similarity]
plugins/yuv/video_yuv.c
plugins/yuv/video_yuv15.c [deleted file]
plugins/yuv/video_yuv24.c [deleted file]
plugins/yuv/video_yuv32.c [deleted file]
plugins/yuv/video_yuv8.c [deleted file]
plugins/yuv/video_yuvmmx.c [moved from plugins/yuvmmx/video_yuv.c with 85% similarity]
plugins/yuv/yuv.c
plugins/yuv/yuvmmx.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv.h [deleted file]
plugins/yuvmmx/video_yuv15.c [deleted file]
plugins/yuvmmx/video_yuv16.c [deleted file]
plugins/yuvmmx/video_yuv24.c [deleted file]
plugins/yuvmmx/video_yuv32.c [deleted file]
plugins/yuvmmx/video_yuv8.c [deleted file]
plugins/yuvmmx/video_yuv_macros.h [deleted file]
plugins/yuvmmx/yuvmmx.c [deleted file]
src/interface/main.c
src/misc/modules.c
src/misc/plugins.c
src/misc/tests.c
src/video_output/video_yuv.c

index 60001e3a68ae26737f0d043388e489109b9f40bf..9b6f011904c028f01ca3a8b86784e610263b09de 100644 (file)
@@ -277,7 +277,7 @@ endif
 # 
 ifneq (,$(findstring 86,$(ARCH)))
 ifneq (,$(findstring mmx,$(ARCH)))
-ASM_OBJ =              src/video_output/video_yuv_mmx.o
+ASM_OBJ =              
 STD_PLUGIN_ASM =       plugins/idct/idctmmx_asm.o
 endif
 endif
@@ -338,19 +338,11 @@ PLUGIN_X11=       plugins/x11/x11.o \
 
 PLUGIN_YUV =   plugins/yuv/yuv.o \
                plugins/yuv/video_yuv.o \
-               plugins/yuv/video_yuv8.o \
-               plugins/yuv/video_yuv15.o \
-               plugins/yuv/video_yuv16.o \
-               plugins/yuv/video_yuv24.o \
-               plugins/yuv/video_yuv32.o
-
-PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
-               plugins/yuvmmx/video_yuv.o \
-               plugins/yuvmmx/video_yuv8.o \
-               plugins/yuvmmx/video_yuv15.o \
-               plugins/yuvmmx/video_yuv16.o \
-               plugins/yuvmmx/video_yuv24.o \
-               plugins/yuvmmx/video_yuv32.o
+               plugins/yuv/transforms_yuv.o
+
+PLUGIN_YUVMMX =        plugins/yuv/yuvmmx.o \
+               plugins/yuv/video_yuvmmx.o \
+               plugins/yuv/transforms_yuvmmx.o
 
 PLUGIN_IDCT =  plugins/idct/idct.o \
                plugins/idct/idct_common.o
@@ -408,6 +400,7 @@ all: vlc @ALIASES@ plugins
 
 clean:
        rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
+       rm -f plugins/*/*.o src/*/*.o
        rm -f vlc @ALIASES@ lib/*.so
 
 distclean: clean
@@ -533,12 +526,6 @@ lib/dsp.so: $(PLUGIN_DSP)
 lib/alsa.so: $(PLUGIN_ALSA)
        $(CC) $(PCFLAGS) -shared -o $@ $^ -lasound
 
-lib/null.so: $(PLUGIN_NULL)
-       $(CC) $(PCFLAGS) -shared -o $@ $^
-
-lib/dummy.so: $(PLUGIN_DUMMY)
-       $(CC) $(PCFLAGS) -shared -o $@ $^
-
 lib/fb.so: $(PLUGIN_FB)
        $(CC) $(PCFLAGS) -shared -o $@ $^
 
@@ -561,6 +548,12 @@ lib/sdl.so: $(PLUGIN_SDL)
        $(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL)
 
 ifeq ($(SYS),beos)
+lib/null.so: $(PLUGIN_NULL)
+       $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
+
+lib/dummy.so: $(PLUGIN_DUMMY)
+       $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
+
 lib/idct.so: $(PLUGIN_IDCT)
        $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
 
@@ -576,6 +569,12 @@ lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC)
 lib/idctmmx.so: $(PLUGIN_IDCTMMX)
        $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
 else
+lib/null.so: $(PLUGIN_NULL)
+       $(CC) $(PCFLAGS) -shared -o $@ $^
+
+lib/dummy.so: $(PLUGIN_DUMMY)
+       $(CC) $(PCFLAGS) -shared -o $@ $^
+
 lib/yuv.so: $(PLUGIN_YUV)
        $(CC) $(PCFLAGS) -shared -o $@ $^
 
index 96932ecfada9763c4d5f240387cae830a1451641..e65ebdd736ece30920fd0c0aefeffef7c84e95c0 100644 (file)
@@ -85,6 +85,13 @@ typedef struct function_list_s
                                          int i_idontcare );
         } idct;
 
+        struct
+        {
+            int  ( * pf_init )         ( struct vout_thread_s * p_vout );
+            int  ( * pf_reset )        ( struct vout_thread_s * p_vout );
+            void ( * pf_end )          ( struct vout_thread_s * p_vout );
+        } yuv;
+
     } functions;
 
 } function_list_t;
index c9104a376957a233b412f495aaa21bd3d5de3e55..047bffd23790023319d6efc9933e9e1094b07ca5 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define CPU_CAPABILITY_NONE    0
+#define CPU_CAPABILITY_MMX     1<<0
+#define CPU_CAPABILITY_3DNOW   1<<1
+#define CPU_CAPABILITY_MMXEXT  1<<2
+
+#define cpuid( a, eax, ebx, ecx, edx ) \
+    asm volatile ( "pushl %%ebx      \n\
+                    cpuid            \n\
+                    popl %%ebx"        \
+                 : "=a" ( eax ),       \
+                   "=c" ( ecx ),       \
+                   "=d" ( edx )        \
+                 : "a"  ( a )          \
+                 : "cc" );
+
 /*****************************************************************************
- * Prototypes
+ * TestVersion: tests if the given string equals the current version
  *****************************************************************************/
+int TestVersion( char * psz_version );
 int TestProgram( char * psz_program );
 int TestMethod( char * psz_var, char * psz_method );
-int TestVersion( char * psz_version );
-int TestMMX( void );
+
+/*****************************************************************************
+ * TestCPU: tests if the processor has MMX support and other capabilities
+ *****************************************************************************
+ * This function is called to check extensions the CPU may have.
+ *****************************************************************************/
+static __inline__ int TestCPU( void )
+{
+#ifndef __i386__
+    return( CPU_CAPABILITY_NONE );
+#else
+    int i_reg, i_dummy = 0;
+
+    /* test for a 386 CPU */
+    asm volatile ( "pushfl
+                    popl %%eax
+                    movl %%eax, %%ecx
+                    xorl $0x40000, %%eax
+                    pushl %%eax
+                    popfl
+                    pushfl
+                    popl %%eax
+                    xorl %%ecx, %%eax
+                    andl $0x40000, %%eax"
+                 : "=a" ( i_reg ) );
+
+    if( !i_reg )
+    {
+        return( CPU_CAPABILITY_NONE );
+    }
+
+    /* test for a 486 CPU */
+    asm volatile ( "movl %%ecx, %%eax
+                    xorl $0x200000, %%eax
+                    pushl %%eax
+                    popfl
+                    pushfl
+                    popl %%eax
+                    xorl %%ecx, %%eax
+                    pushl %%ecx
+                    popfl
+                    andl $0x200000, %%eax"
+                 : "=a" ( i_reg ) );
+
+    if( !i_reg )
+    {
+        return( CPU_CAPABILITY_NONE );
+    }
+
+    /* the CPU supports the CPUID instruction - get its level */
+    cpuid( 0, i_reg, i_dummy, i_dummy, i_dummy );
+
+    if( !i_reg )
+    {
+        return( CPU_CAPABILITY_NONE );
+    }
+
+    /* test for the MMX flag */
+    cpuid( 1, i_dummy, i_dummy, i_dummy, i_reg );
+
+    if( ! (i_reg & 0x00800000) )
+    {
+        return( CPU_CAPABILITY_NONE );
+    }
+
+    return( CPU_CAPABILITY_MMX );
+#endif
+}
 
index 828ad6311b634ee13e09fccb0ebfb80e6b1930dc..f5182d0c38780e505c00a1e572c5ae1e33f04962 100644 (file)
@@ -49,6 +49,10 @@ typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
  *****************************************************************************
  * These tables are used by conversion and scaling functions.
  *****************************************************************************/
+typedef int  (yuv_init_t)           ( p_vout_thread_t p_vout );
+typedef int  (yuv_reset_t)          ( p_vout_thread_t p_vout );
+typedef void (yuv_end_t)            ( p_vout_thread_t p_vout );
+
 typedef struct vout_yuv_s
 {
     /* conversion functions */
@@ -71,6 +75,13 @@ typedef struct vout_yuv_s
     /* Temporary conversion buffer and offset array */
     void *              p_buffer;                       /* conversion buffer */
     int *               p_offset;                            /* offset array */
+
+    /* Plugin used and shortcuts to access its capabilities */
+    struct module_s *   p_module;
+    yuv_init_t *        pf_init;                    /* initialize YUV tables */
+    yuv_reset_t *       pf_reset;                        /* reset YUV tables */
+    yuv_end_t *         pf_end;                           /* free YUV tables */
+
 } vout_yuv_t;
 
 /*****************************************************************************
@@ -113,10 +124,6 @@ typedef void (vout_sys_display_t)   ( p_vout_thread_t p_vout );
 typedef void (vout_set_palette_t)   ( p_vout_thread_t p_vout, u16 *red,
                                       u16 *green, u16 *blue, u16 *transp );
 
-typedef int  (yuv_sys_init_t)       ( p_vout_thread_t p_vout );
-typedef int  (yuv_sys_reset_t)      ( p_vout_thread_t p_vout );
-typedef void (yuv_sys_end_t)        ( p_vout_thread_t p_vout );
-
 typedef struct vout_thread_s
 {
     /* Thread properties and lock */
@@ -168,10 +175,6 @@ typedef struct vout_thread_s
 
     vout_set_palette_t *    p_set_palette;               /* set 8bpp palette */
 
-    yuv_sys_init_t *        p_yuv_init;             /* initialize YUV tables */
-    yuv_sys_reset_t *       p_yuv_reset;                 /* reset YUV tables */
-    yuv_sys_end_t *         p_yuv_end;                    /* free YUV tables */
-
     /* Pictures and rendering properties */
     boolean_t           b_grayscale;           /* color or grayscale display */
     boolean_t           b_info;              /* print additional information */
index 7485cc770af85567bd352d5b5691cd18cc92fc0d..80734da46bd38f461b922ffd7384766830e0c138 100644 (file)
@@ -40,7 +40,6 @@
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
-#include "tests.h"
 
 #include "interface.h"
 
index 2db3d0d5ec4a167f0ad92bb3298b396c2365653c..ec882eb2bdf06313cc005e9f55de931a83dc2895 100644 (file)
@@ -35,7 +35,6 @@
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
-#include "tests.h"
 
 #include "modules.h"
 #include "modules_inner.h"
index f843ab1e54bd7467760404e5bdb22d0cc565b3f1..cefa673d590e47c59abdb4d1ae94d61577dce7b6 100644 (file)
@@ -34,7 +34,6 @@
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
-#include "tests.h"
 
 #include "modules.h"
 #include "modules_inner.h"
index 4688b672543dc15a113732855925961d7a304f98..8e40b1a04136c893761ebcd5736d96a9436bfcf8 100644 (file)
@@ -2,7 +2,7 @@
  * idct.c : IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idct.c,v 1.2 2001/01/15 06:18:23 sam Exp $
+ * $Id: idct.c,v 1.3 2001/01/16 02:16:38 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -143,7 +143,7 @@ static void idct_getfunctions( function_list_t * p_function_list )
 static int idct_Probe( probedata_t *p_data )
 {
     /* This plugin always works */
-    return( 100 );
+    return( 50 );
 }
 
 /*****************************************************************************
index d9e3d877094ce7cd1cd2fc330d3ab3d83e0f1b9d..ef148665c160112f21f2749052209c5110ad42c7 100644 (file)
@@ -2,7 +2,7 @@
  * idctclassic.c : Classic IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctclassic.c,v 1.2 2001/01/15 06:18:23 sam Exp $
+ * $Id: idctclassic.c,v 1.3 2001/01/16 02:16:38 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -143,7 +143,7 @@ static void idct_getfunctions( function_list_t * p_function_list )
 static int idct_Probe( probedata_t *p_data )
 {
     /* This plugin always works */
-    return( 50 );
+    return( 100 );
 }
 
 /*****************************************************************************
index 6552e33f591e8d5a001c5e3a3c556c1aa68f7056..15540e6bbe6c6b939cfab7b7bb6a3ad0152deb23 100644 (file)
@@ -2,7 +2,7 @@
  * idctmmx.c : MMX IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctmmx.c,v 1.2 2001/01/15 06:18:23 sam Exp $
+ * $Id: idctmmx.c,v 1.3 2001/01/16 02:16:38 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -34,6 +34,7 @@
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
+#include "tests.h"                                              /* TestCPU() */
 
 #include "video.h"
 #include "video_output.h"
@@ -142,8 +143,14 @@ static void idct_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int idct_Probe( probedata_t *p_data )
 {
-    /* This plugin always works */
-    return( 100 );
+    if( TestCPU() & CPU_CAPABILITY_MMX )
+    {
+        return( 100 );
+    }
+    else
+    {
+        return( 0 );
+    }
 }
 
 /*****************************************************************************
index f4078a4638236248dd0fc79d1eacd01751ad870f..ec7c820ab7ff690ae7365e07c650be6ddcee5bf1 100644 (file)
@@ -34,7 +34,6 @@
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
-#include "tests.h"
 
 #include "modules.h"
 #include "modules_inner.h"
similarity index 99%
rename from plugins/yuv/video_yuv_macros.h
rename to plugins/yuv/transforms_common.h
index 0aab9dde0c010ee70728a1a793369b2bf0ce6953..87c5a9e3afefb618291dbab6ba0bdbe8aaa554f6 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * video_yuv_macros_truecolor.h: YUV transformation macros for truecolor
+ * transforms_common.h: YUV transformation macros for truecolor
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
  *
diff --git a/plugins/yuv/transforms_yuv.c b/plugins/yuv/transforms_yuv.c
new file mode 100644 (file)
index 0000000..eabdeb4
--- /dev/null
@@ -0,0 +1,694 @@
+/*****************************************************************************
+ * transforms_yuv.c: C YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "video_common.h"
+#include "transforms_common.h"
+#include "transforms_yuv.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
+ *****************************************************************************/
+void ConvertY4Gray8( YUV_ARGS_8BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u8 *        p_gray;                             /* base conversion table */
+    u8 *        p_pic_start;       /* beginning of the current line for copy */
+    u8 *        p_buffer_start;                   /* conversion buffer start */
+    u8 *        p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray8;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 1);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV420RGB8( YUV_ARGS_8BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_real_y;                                           /* y % 4 */
+    u8 *        p_lookup;                                    /* lookup table */
+    int         i_chroma_width;                              /* chroma width */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /* 
+     * The dithering matrices
+     */
+    static int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
+    static int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
+    static int dither12[4] = {  0x3,  0xb,  0x1,  0x9 };
+    static int dither13[4] = {  0xf,  0x7,  0xd,  0x5 };
+
+    static int dither20[4] = {  0x0, 0x10,  0x4, 0x14 };
+    static int dither21[4] = { 0x18,  0x8, 0x1c,  0xc };
+    static int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
+    static int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_offset_start =    p_vout->yuv.p_offset;
+    p_lookup =          p_vout->yuv.p_base;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 1 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    i_real_y = 0;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH_DITHER( 420 );
+        SCALE_HEIGHT_DITHER( 420 );
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV422RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 8" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV444RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 8" );
+}
+
+/*****************************************************************************
+ * ConvertY4Gray16: grayscale YUV 4:x:x to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u16 *       p_gray;                             /* base conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            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);
+            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);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(420, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            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);
+            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);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(422, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(444, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, grayscale, bpp = 24" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, bpp = 24" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 24" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 24" );
+}
+
+/*****************************************************************************
+ * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertY4Gray32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u32 *       p_gray;                             /* base conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 4);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_ybase;                     /* Y dependant conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(420, 4);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_ybase;                     /* Y dependant conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(422, 4);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_ybase;                     /* Y dependant conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(444, 4);
+    }
+}
+
similarity index 99%
rename from plugins/yuv/video_yuv_macros_8bpp.h
rename to plugins/yuv/transforms_yuv.h
index 76ce3fd77f3ce8d9c7bbbe006c690649623f0822..da658b47c111879a59bba4ef1230072f47dc8980 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * video_yuv_macros_8bpp.h: YUV transformation macros for 8bpp
+ * transforms_yuv.h: C specific YUV transformation macros
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
  *
similarity index 53%
rename from plugins/yuv/video_yuv16.c
rename to plugins/yuv/transforms_yuvmmx.c
index eafb631b89a63c2dd7a6f1ebee4ef478b134a1b5..1e8dbb987da248b735c72b2ee00d690a3a84204d 100644 (file)
@@ -1,8 +1,6 @@
 /*****************************************************************************
- * video_yuv16.c: YUV transformation functions for 16bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
+ * transforms_yuvmmx.c: MMX YUV transformation functions
+ * Provides functions to perform the YUV conversion.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
  *
 #include "threads.h"
 #include "mtime.h"
 #include "plugins.h"
+
 #include "video.h"
 #include "video_output.h"
-#include "video_yuv.h"
-#include "video_yuv_macros.h"
+
+#include "video_common.h"
+#include "transforms_common.h"
+#include "transforms_yuvmmx.h"
 
 #include "intf_msg.h"
 
 /*****************************************************************************
- * ConvertY4Gray16: grayscale YUV 4:x:x to RGB 2 Bpp
+ * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
+ *****************************************************************************/
+void ConvertY4Gray8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 8" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV420RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 8" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV422RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 8" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV444RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 8" );
+}
+
+/*****************************************************************************
+ * ConvertY4Gray16: color YUV 4:4:4 to RGB 2 Bpp
  *****************************************************************************/
 void ConvertY4Gray16( YUV_ARGS_16BPP )
 {
@@ -55,8 +88,7 @@ void ConvertY4Gray16( YUV_ARGS_16BPP )
     int         i_vertical_scaling;                 /* vertical scaling type */
     int         i_x, i_y;                 /* horizontal and vertical indexes */
     int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u16 *       p_gray;                             /* base conversion table */
+    int         i_chroma_width;                              /* chroma width */
     u16 *       p_pic_start;       /* beginning of the current line for copy */
     u16 *       p_buffer_start;                   /* conversion buffer start */
     u16 *       p_buffer;                       /* conversion buffer pointer */
@@ -67,7 +99,7 @@ void ConvertY4Gray16( YUV_ARGS_16BPP )
      * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
-    p_gray =            p_vout->yuv.yuv.p_gray16;
+    i_chroma_width =    i_width / 2;
     p_buffer_start =    p_vout->yuv.p_buffer;
     p_offset_start =    p_vout->yuv.p_offset;
     SetOffset( i_width, i_height, i_pic_width, i_pic_height,
@@ -84,23 +116,24 @@ void ConvertY4Gray16( YUV_ARGS_16BPP )
         p_pic_start =   p_pic;
         p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
+        for ( i_x = i_width / 8; i_x--; )
         {
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            __asm__( MMX_INIT_16_GRAY
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            __asm__( ".align 8"
+                     MMX_YUV_GRAY
+                     MMX_UNPACK_16_GRAY
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            p_y += 8;
+            p_u += 4;
+            p_v += 4;
+            p_buffer += 8;
         }
 
-        /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(400, 2);
+        SCALE_HEIGHT( 420, 2 );
     }
 }
 
@@ -113,11 +146,7 @@ void ConvertYUV420RGB16( YUV_ARGS_16BPP )
     int         i_vertical_scaling;                 /* vertical scaling type */
     int         i_x, i_y;                 /* horizontal and vertical indexes */
     int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
     int         i_chroma_width;                              /* chroma width */
-    u16 *       p_yuv;                              /* base conversion table */
-    u16 *       p_ybase;                     /* Y dependant conversion table */
     u16 *       p_pic_start;       /* beginning of the current line for copy */
     u16 *       p_buffer_start;                   /* conversion buffer start */
     u16 *       p_buffer;                       /* conversion buffer pointer */
@@ -129,7 +158,6 @@ void ConvertYUV420RGB16( YUV_ARGS_16BPP )
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb16;
     p_buffer_start =    p_vout->yuv.p_buffer;
     p_offset_start =    p_vout->yuv.p_offset;
     SetOffset( i_width, i_height, i_pic_width, i_pic_height,
@@ -146,23 +174,25 @@ void ConvertYUV420RGB16( YUV_ARGS_16BPP )
         p_pic_start =   p_pic;
         p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
+        for ( i_x = i_width / 8; i_x--; )
         {
-            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);
-            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);
+            __asm__( MMX_INIT_16
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            __asm__( ".align 8"
+                     MMX_YUV_MUL
+                     MMX_YUV_ADD
+                     MMX_UNPACK_16
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            p_y += 8;
+            p_u += 4;
+            p_v += 4;
+            p_buffer += 8;
         }
 
-        /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(420, 2);
+        SCALE_HEIGHT( 420, 2 );
     }
 }
 
@@ -171,80 +201,70 @@ void ConvertYUV420RGB16( YUV_ARGS_16BPP )
  *****************************************************************************/
 void ConvertYUV422RGB16( YUV_ARGS_16BPP )
 {
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_yuv;                              /* base conversion table */
-    u16 *       p_ybase;                     /* Y dependant conversion table */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 16" );
+}
 
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+/*****************************************************************************
+ * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB16( YUV_ARGS_16BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 16" );
+}
 
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+/*****************************************************************************
+ * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 24" );
+}
 
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            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);
-            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);
-        }
+/*****************************************************************************
+ * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 24" );
+}
 
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(422, 2);
-    }
+/*****************************************************************************
+ * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 24" );
 }
 
 /*****************************************************************************
- * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
+ * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
  *****************************************************************************/
-void ConvertYUV444RGB16( YUV_ARGS_16BPP )
+void ConvertYUV444RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 24" );
+}
+
+/*****************************************************************************
+ * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertY4Gray32( YUV_ARGS_32BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 32" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB32( YUV_ARGS_32BPP )
 {
     boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
     int         i_vertical_scaling;                 /* vertical scaling type */
     int         i_x, i_y;                 /* horizontal and vertical indexes */
     int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u16 *       p_yuv;                              /* base conversion table */
-    u16 *       p_ybase;                     /* Y dependant conversion table */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int         i_chroma_width;                              /* chroma width */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
 
@@ -252,7 +272,7 @@ void ConvertYUV444RGB16( YUV_ARGS_16BPP )
      * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
-    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    i_chroma_width =    i_width / 2;
     p_buffer_start =    p_vout->yuv.p_buffer;
     p_offset_start =    p_vout->yuv.p_offset;
     SetOffset( i_width, i_height, i_pic_width, i_pic_height,
@@ -269,23 +289,42 @@ void ConvertYUV444RGB16( YUV_ARGS_16BPP )
         p_pic_start =   p_pic;
         p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
+        for ( i_x = i_width / 8; i_x--; )
         {
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            __asm__( ".align 8"
+                     MMX_INIT_32
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            __asm__( ".align 8"
+                     MMX_YUV_MUL
+                     MMX_YUV_ADD
+                     MMX_UNPACK_32
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            p_y += 8;
+            p_u += 4;
+            p_v += 4;
+            p_buffer += 8;
         }
 
-        /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(444, 2);
+        SCALE_HEIGHT( 420, 4 );
     }
 }
 
+/*****************************************************************************
+ * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB32( YUV_ARGS_32BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 32" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB32( YUV_ARGS_32BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 32" );
+}
+
similarity index 99%
rename from plugins/yuvmmx/video_yuv_asm.h
rename to plugins/yuv/transforms_yuvmmx.h
index 19622b885e914df008ade08c00c3b4325ea1ba99..12562df597f5e392831d52b9aa7ea84ab0727736 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * video_yuv_asm.h: MMX YUV transformation assembly
+ * transforms_yuvmmx.h: MMX YUV transformation assembly
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
  *
similarity index 89%
rename from plugins/yuv/video_yuv.h
rename to plugins/yuv/video_common.h
index 8f5d7bbc3b35769536c792d44d602a256be87764..2445f1a51a80bd868b1c0c0e4ac9a3fe72ead174 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * video_yuv.h: YUV transformation functions
+ * video_common.h: YUV transformation functions
  * Provides functions to perform the YUV conversion. The functions provided here
  * are a complete and portable C implementation, and may be replaced in certain
  * case by optimized functions.
@@ -64,14 +64,12 @@ int i_matrix_coefficients
 #define YUV_ARGS_32BPP   YUV_ARGS( u32 )
 
 /*****************************************************************************
- * Local prototypes
+ * Extern prototypes
  *****************************************************************************/
-void SetGammaTable        ( int *pi_table, double f_gamma );
-void SetYUV               ( vout_thread_t *p_vout );
-void SetOffset            ( int i_width, int i_height, int i_pic_width,
-                            int i_pic_height, boolean_t *pb_h_scaling,
-                            int *pi_v_scaling, int *p_offset,
-                            boolean_t b_double );
+
+void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
+                boolean_t *pb_h_scaling, int *pi_v_scaling,
+                int *p_offset, boolean_t b_double );
 
 void ConvertY4Gray8       ( YUV_ARGS_8BPP );
 void ConvertYUV420RGB8    ( YUV_ARGS_8BPP );
index 607d0f37f6088412136fc5b6d526ce2e16314f12..0d60637b8d2a3f45140c2636f66454707a49fbb7 100644 (file)
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
-#include "plugins.h"
+#include "modules.h"
+
 #include "video.h"
 #include "video_output.h"
-#include "video_yuv.h"
+
+#include "video_common.h"
 
 #include "intf_msg.h"
 
+static int     yuv_Probe      ( probedata_t *p_data );
+static int     yuv_Init       ( vout_thread_t *p_vout );
+static int     yuv_Reset      ( vout_thread_t *p_vout );
+static void    yuv_End        ( vout_thread_t *p_vout );
+
+static void    SetGammaTable  ( int *pi_table, double f_gamma );
+static void    SetYUV         ( vout_thread_t *p_vout );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void yuv_getfunctions( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = yuv_Probe;
+    p_function_list->functions.yuv.pf_init = yuv_Init;
+    p_function_list->functions.yuv.pf_reset = yuv_Reset;
+    p_function_list->functions.yuv.pf_end = yuv_End;
+}
+
 /*****************************************************************************
- * vout_InitYUV: allocate and initialize translations tables
+ * yuv_Probe: tests probe the audio device and return a score
+ *****************************************************************************
+ * This function tries to open the DSP and returns a score to the plugin
+ * manager so that it can choose the most appropriate one.
+ *****************************************************************************/
+static int yuv_Probe( probedata_t *p_data )
+{
+    /* This module always works */
+    return( 100 );
+}
+
+/*****************************************************************************
+ * yuv_Init: allocate and initialize translations tables
  *****************************************************************************
  * This function will allocate memory to store translation tables, depending
  * of the screen depth.
  *****************************************************************************/
-int yuv_CInit( vout_thread_t *p_vout )
+static int yuv_Init( vout_thread_t *p_vout )
 {
     size_t      tables_size;                        /* tables size, in bytes */
 
@@ -109,11 +143,11 @@ int yuv_CInit( vout_thread_t *p_vout )
 }
 
 /*****************************************************************************
- * yuv_CEnd: destroy translations tables
+ * yuv_End: destroy translations tables
  *****************************************************************************
  * Free memory allocated by yuv_CCreate.
  *****************************************************************************/
-void yuv_CEnd( vout_thread_t *p_vout )
+static void yuv_End( vout_thread_t *p_vout )
 {
     free( p_vout->yuv.p_base );
     free( p_vout->yuv.p_buffer );
@@ -121,25 +155,23 @@ void yuv_CEnd( vout_thread_t *p_vout )
 }
 
 /*****************************************************************************
- * yuv_CReset: re-initialize translations tables
+ * yuv_Reset: re-initialize translations tables
  *****************************************************************************
  * This function will initialize the tables allocated by vout_CreateTables and
  * set functions pointers.
  *****************************************************************************/
-int yuv_CReset( vout_thread_t *p_vout )
+static int yuv_Reset( vout_thread_t *p_vout )
 {
-    yuv_CEnd( p_vout );
-    return( yuv_CInit( p_vout ) );
+    yuv_End( p_vout );
+    return( yuv_Init( p_vout ) );
 }
 
-/* following functions are local */
-
 /*****************************************************************************
  * SetGammaTable: return intensity table transformed by gamma curve.
  *****************************************************************************
  * pi_table is a table of 256 entries from 0 to 255.
  *****************************************************************************/
-void SetGammaTable( int *pi_table, double f_gamma )
+static void SetGammaTable( int *pi_table, double f_gamma )
 {
     int         i_y;                                       /* base intensity */
 
@@ -155,8 +187,8 @@ void SetGammaTable( int *pi_table, double f_gamma )
 
 /*****************************************************************************
  * SetYUV: compute tables and set function pointers
-+ *****************************************************************************/
-void SetYUV( vout_thread_t *p_vout )
+ *****************************************************************************/
+static void SetYUV( vout_thread_t *p_vout )
 {
     int         pi_gamma[256];                                /* gamma table */
     int         i_index;                                  /* index in tables */
@@ -459,8 +491,8 @@ void SetYUV( vout_thread_t *p_vout )
  * is set, the p_offset structure has interleaved Y and U/V offsets.
  *****************************************************************************/
 void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
-                boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset,
-                boolean_t b_double )
+                boolean_t *pb_h_scaling, int *pi_v_scaling,
+                int *p_offset, boolean_t b_double )
 {
     int i_x;                                    /* x position in destination */
     int i_scale_count;                                     /* modulo counter */
diff --git a/plugins/yuv/video_yuv15.c b/plugins/yuv/video_yuv15.c
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/plugins/yuv/video_yuv24.c b/plugins/yuv/video_yuv24.c
deleted file mode 100644 (file)
index e9e3f62..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*****************************************************************************
- * video_yuv24.c: YUV transformation functions for 24 bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-#include "video_yuv_macros.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
- *****************************************************************************/
-void ConvertY4Gray24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, grayscale, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV420RGB24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV422RGB24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV444RGB24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 24" );
-}
-
diff --git a/plugins/yuv/video_yuv32.c b/plugins/yuv/video_yuv32.c
deleted file mode 100644 (file)
index 02c717f..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/*****************************************************************************
- * video_yuv32.c: YUV transformation functions for 32 bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-#include "video_yuv_macros.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
- *****************************************************************************/
-void ConvertY4Gray32( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u32 *       p_gray;                             /* base conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_gray =            p_vout->yuv.yuv.p_gray32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(400, 4);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
- *****************************************************************************/
-void ConvertYUV420RGB32( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u32 *       p_yuv;                              /* base conversion table */
-    u32 *       p_ybase;                     /* Y dependant conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(420, 4);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
- *****************************************************************************/
-void ConvertYUV422RGB32( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                              /* chroma width */
-    u32 *       p_yuv;                              /* base conversion table */
-    u32 *       p_ybase;                     /* Y dependant conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(422, 4);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
- *****************************************************************************/
-void ConvertYUV444RGB32( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_uval, i_vval;                           /* U and V samples */
-    int         i_red, i_green, i_blue;          /* U and V modified samples */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u32 *       p_yuv;                              /* base conversion table */
-    u32 *       p_ybase;                     /* Y dependant conversion table */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(444, 4);
-    }
-}
-
diff --git a/plugins/yuv/video_yuv8.c b/plugins/yuv/video_yuv8.c
deleted file mode 100644 (file)
index 04620cd..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*****************************************************************************
- * video_yuv8.c: YUV transformation functions for 8bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-#include "video_yuv_macros.h"
-#include "video_yuv_macros_8bpp.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
- *****************************************************************************/
-void ConvertY4Gray8( YUV_ARGS_8BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                    /* chroma width, not used */
-    u8 *        p_gray;                             /* base conversion table */
-    u8 *        p_pic_start;       /* beginning of the current line for copy */
-    u8 *        p_buffer_start;                   /* conversion buffer start */
-    u8 *        p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    p_gray =            p_vout->yuv.yuv.p_gray8;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        /* Do YUV conversion to buffer - YUV picture is always formed of 16
-         * pixels wide blocks */
-        for( i_x = i_width / 16; i_x--;  )
-        {
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }
-
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH;
-        SCALE_HEIGHT(400, 1);
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
- *****************************************************************************/
-void ConvertYUV420RGB8( YUV_ARGS_8BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_real_y;                                           /* y % 4 */
-    u8 *        p_lookup;                                    /* lookup table */
-    int         i_chroma_width;                              /* chroma width */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /* 
-     * The dithering matrices
-     */
-    static int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
-    static int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
-    static int dither12[4] = {  0x3,  0xb,  0x1,  0x9 };
-    static int dither13[4] = {  0xf,  0x7,  0xd,  0x5 };
-
-    static int dither20[4] = {  0x0, 0x10,  0x4, 0x14 };
-    static int dither21[4] = { 0x18,  0x8, 0x1c,  0xc };
-    static int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
-    static int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_offset_start =    p_vout->yuv.p_offset;
-    p_lookup =          p_vout->yuv.p_base;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 1 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    i_real_y = 0;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Do horizontal and vertical scaling */
-        SCALE_WIDTH_DITHER( 420 );
-        SCALE_HEIGHT_DITHER( 420 );
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
- *****************************************************************************/
-void ConvertYUV422RGB8( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
- *****************************************************************************/
-void ConvertYUV444RGB8( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 8" );
-}
-
similarity index 85%
rename from plugins/yuvmmx/video_yuv.c
rename to plugins/yuv/video_yuvmmx.c
index ae5b92947f1f0a5c6ce3aa22efd082bfca6c3cdc..4f795862b1f0ac766aec7b76dc9b30c2c108e5e9 100644 (file)
@@ -1,8 +1,6 @@
 /*****************************************************************************
- * video_yuv.c: MMX YUV transformation functions
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
+ * video_yuvmmx.c: MMX YUV transformation functions
+ * Provides functions to perform the YUV conversion.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
  *
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
-#include "plugins.h"
+#include "tests.h"
+
+#include "modules.h"
+
 #include "video.h"
 #include "video_output.h"
-#include "video_yuv.h"
+
+#include "video_common.h"
 
 #include "intf_msg.h"
 
+static int     yuv_Probe      ( probedata_t *p_data );
+static int     yuv_Init       ( vout_thread_t *p_vout );
+static int     yuv_Reset      ( vout_thread_t *p_vout );
+static void    yuv_End        ( vout_thread_t *p_vout );
+
+static void    SetYUV         ( vout_thread_t *p_vout );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void yuv_getfunctions( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = yuv_Probe;
+    p_function_list->functions.yuv.pf_init = yuv_Init;
+    p_function_list->functions.yuv.pf_reset = yuv_Reset;
+    p_function_list->functions.yuv.pf_end = yuv_End;
+}
+
+/*****************************************************************************
+ * yuv_Probe: tests probe the audio device and return a score
+ *****************************************************************************
+ * This function tries to open the DSP and returns a score to the plugin
+ * manager so that it can choose the most appropriate one.
+ *****************************************************************************/
+static int yuv_Probe( probedata_t *p_data )
+{
+    /* Test for MMX support in the CPU */
+    if( TestCPU() & CPU_CAPABILITY_MMX )
+    {
+        return( 100 );
+    }
+    else
+    {
+        return( 0 );
+    }
+}
+
 /*****************************************************************************
- * vout_InitYUV: allocate and initialize translations tables
+ * yuv_Init: allocate and initialize translations tables
  *****************************************************************************
  * This function will allocate memory to store translation tables, depending
  * of the screen depth.
  *****************************************************************************/
-int yuv_MMXInit( vout_thread_t *p_vout )
+static int yuv_Init( vout_thread_t *p_vout )
 {
     size_t      tables_size;                        /* tables size, in bytes */
 
@@ -97,39 +137,33 @@ int yuv_MMXInit( vout_thread_t *p_vout )
 }
 
 /*****************************************************************************
- * yuv_MMXEnd: destroy translations tables
+ * yuv_End: destroy translations tables
  *****************************************************************************
- * Free memory allocated by yuv_MMXCreate.
+ * Free memory allocated by yuv_CCreate.
  *****************************************************************************/
-void yuv_MMXEnd( vout_thread_t *p_vout )
+static void yuv_End( vout_thread_t *p_vout )
 {
-    if( p_vout->i_bytes_per_pixel == 1 )
-    {
-        free( p_vout->yuv.p_base );
-    }
-
+    free( p_vout->yuv.p_base );
     free( p_vout->yuv.p_buffer );
     free( p_vout->yuv.p_offset );
 }
 
 /*****************************************************************************
- * yuv_MMXReset: re-initialize translations tables
+ * yuv_Reset: re-initialize translations tables
  *****************************************************************************
  * This function will initialize the tables allocated by vout_CreateTables and
  * set functions pointers.
  *****************************************************************************/
-int yuv_MMXReset( vout_thread_t *p_vout )
+static int yuv_Reset( vout_thread_t *p_vout )
 {
-    yuv_MMXEnd( p_vout );
-    return( yuv_MMXInit( p_vout ) );
+    yuv_End( p_vout );
+    return( yuv_Init( p_vout ) );
 }
 
-/* following functions are local */
-
 /*****************************************************************************
  * SetYUV: compute tables and set function pointers
-+ *****************************************************************************/
-void SetYUV( vout_thread_t *p_vout )
+ *****************************************************************************/
+static void SetYUV( vout_thread_t *p_vout )
 {
     int         i_index;                                  /* index in tables */
 
@@ -340,11 +374,12 @@ void SetYUV( vout_thread_t *p_vout )
  * SetOffset: build offset array for conversion functions
  *****************************************************************************
  * This function will build an offset array used in later conversion functions.
- * It will also set horizontal and vertical scaling indicators.
+ * It will also set horizontal and vertical scaling indicators. If b_double
+ * is set, the p_offset structure has interleaved Y and U/V offsets.
  *****************************************************************************/
 void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
-                boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset,
-                boolean_t b_double )
+                boolean_t *pb_h_scaling, int *pi_v_scaling,
+                int *p_offset, boolean_t b_double )
 {
     int i_x;                                    /* x position in destination */
     int i_scale_count;                                     /* modulo counter */
index 712266250803cf7f1b9abd3f7246de5349e87cfd..a90d23e70f81c1f073caf0a3b54b81d146de9de3 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * yuv.c : C YUV functions for vlc
+ * yuv.c : C YUV module for vlc
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
  *
@@ -20,6 +20,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define MODULE_NAME yuv
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
 #include "common.h"                                     /* boolean_t, byte_t */
 #include "threads.h"
 #include "mtime.h"
-#include "tests.h"
-#include "plugins.h"
 
-#include "interface.h"
-#include "audio_output.h"
 #include "video.h"
 #include "video_output.h"
 
+#include "modules.h"
+#include "modules_inner.h"
+
 /*****************************************************************************
- * Exported prototypes
+ * Local and extern prototypes.
  *****************************************************************************/
-static void yuv_GetPlugin( p_vout_thread_t p_vout );
+extern void yuv_getfunctions( function_list_t * p_function_list );
 
-/* YUV transformations */
-int     yuv_CInit          ( p_vout_thread_t p_vout );
-int     yuv_CReset         ( p_vout_thread_t p_vout );
-void    yuv_CEnd           ( p_vout_thread_t p_vout );
+/*****************************************************************************
+ * Build configuration tree.
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for YUV module" )
+    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
+MODULE_CONFIG_END
 
 /*****************************************************************************
- * GetConfig: get the plugin structure and configuration
+ * InitModule: get the module structure and configuration.
+ *****************************************************************************
+ * We have to fill psz_name, psz_longname and psz_version. These variables
+ * will be strdup()ed later by the main application because the module can
+ * be unloaded later to save memory, and we want to be able to access this
+ * data even after the module has been unloaded.
  *****************************************************************************/
-plugin_info_t * GetConfig( void )
+int InitModule( module_t * p_module )
 {
-    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
-
-    p_info->psz_name    = "C YUV to RGB transformations";
-    p_info->psz_version = VERSION;
-    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+    p_module->psz_name = MODULE_STRING;
+    p_module->psz_longname = "C YUV module";
+    p_module->psz_version = VERSION;
 
-    p_info->aout_GetPlugin = NULL;
-    p_info->vout_GetPlugin = NULL;
-    p_info->intf_GetPlugin = NULL;
-    p_info->yuv_GetPlugin  = yuv_GetPlugin;
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL
+                                | MODULE_CAPABILITY_YUV;
 
-    /* The C YUV functions should always work */
-    p_info->i_score = 0x100;
+    return( 0 );
+}
 
-    /* If this plugin was requested, score it higher */
-    if( TestMethod( YUV_METHOD_VAR, "nommx" ) )
+/*****************************************************************************
+ * ActivateModule: set the module to an usable state.
+ *****************************************************************************
+ * This function fills the capability functions and the configuration
+ * structure. Once ActivateModule() has been called, the i_usage can
+ * be set to 0 and calls to NeedModule() be made to increment it. To unload
+ * the module, one has to wait until i_usage == 0 and call DeactivateModule().
+ *****************************************************************************/
+int ActivateModule( module_t * p_module )
+{
+    p_module->p_functions = malloc( sizeof( module_functions_t ) );
+    if( p_module->p_functions == NULL )
     {
-        p_info->i_score += 0x200;
+        return( -1 );
     }
 
-    return( p_info );
+    yuv_getfunctions( &p_module->p_functions->yuv );
+
+    p_module->p_config = p_config;
+
+    return( 0 );
 }
 
 /*****************************************************************************
- * Following functions are only called through the p_info structure
+ * DeactivateModule: make sure the module can be unloaded.
+ *****************************************************************************
+ * This function must only be called when i_usage == 0. If it successfully
+ * returns, i_usage can be set to -1 and the module unloaded. Be careful to
+ * lock usage_lock during the whole process.
  *****************************************************************************/
-
-static void yuv_GetPlugin( p_vout_thread_t p_vout )
+int DeactivateModule( module_t * p_module )
 {
-    p_vout->p_yuv_init   = yuv_CInit;
-    p_vout->p_yuv_reset  = yuv_CReset;
-    p_vout->p_yuv_end    = yuv_CEnd;
+    free( p_module->p_functions );
+
+    return( 0 );
 }
 
diff --git a/plugins/yuv/yuvmmx.c b/plugins/yuv/yuvmmx.c
new file mode 100644 (file)
index 0000000..6a8bc3d
--- /dev/null
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * yuvmmx.c : Accelerated MMX YUV module for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME yuvmmx
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "modules.h"
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Local and extern prototypes.
+ *****************************************************************************/
+extern void yuv_getfunctions( function_list_t * p_function_list );
+
+/*****************************************************************************
+ * Build configuration tree.
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for MMX YUV module" )
+    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
+MODULE_CONFIG_END
+
+/*****************************************************************************
+ * InitModule: get the module structure and configuration.
+ *****************************************************************************
+ * We have to fill psz_name, psz_longname and psz_version. These variables
+ * will be strdup()ed later by the main application because the module can
+ * be unloaded later to save memory, and we want to be able to access this
+ * data even after the module has been unloaded.
+ *****************************************************************************/
+int InitModule( module_t * p_module )
+{
+    p_module->psz_name = MODULE_STRING;
+    p_module->psz_longname = "MMX YUV module";
+    p_module->psz_version = VERSION;
+
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL
+                                | MODULE_CAPABILITY_YUV;
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * ActivateModule: set the module to an usable state.
+ *****************************************************************************
+ * This function fills the capability functions and the configuration
+ * structure. Once ActivateModule() has been called, the i_usage can
+ * be set to 0 and calls to NeedModule() be made to increment it. To unload
+ * the module, one has to wait until i_usage == 0 and call DeactivateModule().
+ *****************************************************************************/
+int ActivateModule( module_t * p_module )
+{
+    p_module->p_functions = malloc( sizeof( module_functions_t ) );
+    if( p_module->p_functions == NULL )
+    {
+        return( -1 );
+    }
+
+    yuv_getfunctions( &p_module->p_functions->yuv );
+
+    p_module->p_config = p_config;
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * DeactivateModule: make sure the module can be unloaded.
+ *****************************************************************************
+ * This function must only be called when i_usage == 0. If it successfully
+ * returns, i_usage can be set to -1 and the module unloaded. Be careful to
+ * lock usage_lock during the whole process.
+ *****************************************************************************/
+int DeactivateModule( module_t * p_module )
+{
+    free( p_module->p_functions );
+
+    return( 0 );
+}
+
diff --git a/plugins/yuvmmx/video_yuv.h b/plugins/yuvmmx/video_yuv.h
deleted file mode 100644 (file)
index cf313d3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*****************************************************************************
- * video_yuv.h: MMX YUV transformation functions
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Constants
- *****************************************************************************/
-
-#define GRAY_MARGIN     384
-#define GRAY_TABLE_SIZE 1024                             /* total table size */
-
-#define PALETTE_TABLE_SIZE 2176          /* YUV -> 8bpp palette lookup table */
-
-/* argument lists for YUV functions */
-#define YUV_ARGS( word_size ) p_vout_thread_t p_vout, word_size *p_pic, \
-yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, \
-int i_pic_width, int i_pic_height, int i_pic_line_width, \
-int i_matrix_coefficients
-
-#define YUV_ARGS_8BPP    YUV_ARGS( u8 )
-#define YUV_ARGS_16BPP   YUV_ARGS( u16 )
-#define YUV_ARGS_24BPP   YUV_ARGS( u32 )
-#define YUV_ARGS_32BPP   YUV_ARGS( u32 )
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-void SetYUV               ( vout_thread_t *p_vout );
-void SetOffset            ( int i_width, int i_height, int i_pic_width,
-                            int i_pic_height, boolean_t *pb_h_scaling,
-                            int *pi_v_scaling, int *p_offset,
-                            boolean_t b_double );
-
-void ConvertY4Gray8       ( YUV_ARGS_8BPP );
-void ConvertYUV420RGB8    ( YUV_ARGS_8BPP );
-void ConvertYUV422RGB8    ( YUV_ARGS_8BPP );
-void ConvertYUV444RGB8    ( YUV_ARGS_8BPP );
-
-void ConvertY4Gray16      ( YUV_ARGS_16BPP );
-void ConvertYUV420RGB16   ( YUV_ARGS_16BPP );
-void ConvertYUV422RGB16   ( YUV_ARGS_16BPP );
-void ConvertYUV444RGB16   ( YUV_ARGS_16BPP );
-
-void ConvertY4Gray24      ( YUV_ARGS_24BPP );
-void ConvertYUV420RGB24   ( YUV_ARGS_24BPP );
-void ConvertYUV422RGB24   ( YUV_ARGS_24BPP );
-void ConvertYUV444RGB24   ( YUV_ARGS_24BPP );
-
-void ConvertY4Gray32      ( YUV_ARGS_32BPP );
-void ConvertYUV420RGB32   ( YUV_ARGS_32BPP );
-void ConvertYUV422RGB32   ( YUV_ARGS_32BPP );
-void ConvertYUV444RGB32   ( YUV_ARGS_32BPP );
-
diff --git a/plugins/yuvmmx/video_yuv15.c b/plugins/yuvmmx/video_yuv15.c
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/plugins/yuvmmx/video_yuv16.c b/plugins/yuvmmx/video_yuv16.c
deleted file mode 100644 (file)
index 41e8898..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*****************************************************************************
- * video_yuv16.c: YUV transformation functions for 16bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-#include "video_yuv_macros.h"
-#include "video_yuv_asm.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray16: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertY4Gray16( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( MMX_INIT_16_GRAY
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_GRAY
-                     MMX_UNPACK_16_GRAY
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 2 );
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV420RGB16( YUV_ARGS_16BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u16 *       p_pic_start;       /* beginning of the current line for copy */
-    u16 *       p_buffer_start;                   /* conversion buffer start */
-    u16 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( MMX_INIT_16
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_MUL
-                     MMX_YUV_ADD
-                     MMX_UNPACK_16
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 2 );
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV422RGB16( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 16" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV444RGB16( YUV_ARGS_16BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 16" );
-}
-
diff --git a/plugins/yuvmmx/video_yuv24.c b/plugins/yuvmmx/video_yuv24.c
deleted file mode 100644 (file)
index 1002c47..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*****************************************************************************
- * video_yuv24.c: MMX YUV transformation functions for 24 bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
- *****************************************************************************/
-void ConvertY4Gray24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV420RGB24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV422RGB24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 24" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
- *****************************************************************************/
-void ConvertYUV444RGB24( YUV_ARGS_24BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 24" );
-}
-
diff --git a/plugins/yuvmmx/video_yuv32.c b/plugins/yuvmmx/video_yuv32.c
deleted file mode 100644 (file)
index 5f4ceed..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*****************************************************************************
- * video_yuv32.c: MMX YUV transformation functions for 32 bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-#include "video_yuv_macros.h"
-#include "video_yuv_asm.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
- *****************************************************************************/
-void ConvertY4Gray32( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 32" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
- *****************************************************************************/
-void ConvertYUV420RGB32( YUV_ARGS_32BPP )
-{
-    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
-    int         i_vertical_scaling;                 /* vertical scaling type */
-    int         i_x, i_y;                 /* horizontal and vertical indexes */
-    int         i_scale_count;                       /* scale modulo counter */
-    int         i_chroma_width;                              /* chroma width */
-    u32 *       p_pic_start;       /* beginning of the current line for copy */
-    u32 *       p_buffer_start;                   /* conversion buffer start */
-    u32 *       p_buffer;                       /* conversion buffer pointer */
-    int *       p_offset_start;                        /* offset array start */
-    int *       p_offset;                            /* offset array pointer */
-
-    /*
-     * Initialize some values  - i_pic_line_width will store the line skip
-     */
-    i_pic_line_width -= i_pic_width;
-    i_chroma_width =    i_width / 2;
-    p_buffer_start =    p_vout->yuv.p_buffer;
-    p_offset_start =    p_vout->yuv.p_offset;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
-               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
-
-    /*
-     * Perform conversion
-     */
-    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
-    for( i_y = 0; i_y < i_height; i_y++ )
-    {
-        /* Mark beginnning of line for possible later line copy, and initialize
-         * buffer */
-        p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
-
-        for ( i_x = i_width / 8; i_x--; )
-        {
-            __asm__( ".align 8"
-                     MMX_INIT_32
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            __asm__( ".align 8"
-                     MMX_YUV_MUL
-                     MMX_YUV_ADD
-                     MMX_UNPACK_32
-                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
-
-            p_y += 8;
-            p_u += 4;
-            p_v += 4;
-            p_buffer += 8;
-        }
-
-        SCALE_WIDTH;
-        SCALE_HEIGHT( 420, 4 );
-    }
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
- *****************************************************************************/
-void ConvertYUV422RGB32( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 32" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
- *****************************************************************************/
-void ConvertYUV444RGB32( YUV_ARGS_32BPP )
-{
-    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 32" );
-}
-
diff --git a/plugins/yuvmmx/video_yuv8.c b/plugins/yuvmmx/video_yuv8.c
deleted file mode 100644 (file)
index 14cf5ef..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*****************************************************************************
- * video_yuv8.c: MMX YUV transformation functions for 8bpp
- * Provides functions to perform the YUV conversion. The functions provided here
- * are a complete and portable C implementation, and may be replaced in certain
- * case by optimized functions.
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <math.h>                                            /* exp(), pow() */
-#include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "plugins.h"
-#include "video.h"
-#include "video_output.h"
-#include "video_yuv.h"
-
-#include "intf_msg.h"
-
-/*****************************************************************************
- * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
- *****************************************************************************/
-void ConvertY4Gray8( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
- *****************************************************************************/
-void ConvertYUV420RGB8( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
- *****************************************************************************/
-void ConvertYUV422RGB8( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 8" );
-}
-
-/*****************************************************************************
- * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
- *****************************************************************************/
-void ConvertYUV444RGB8( YUV_ARGS_8BPP )
-{
-    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 8" );
-}
-
diff --git a/plugins/yuvmmx/video_yuv_macros.h b/plugins/yuvmmx/video_yuv_macros.h
deleted file mode 100644 (file)
index 96e7882..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*****************************************************************************
- * video_yuv_macros.h: MMX YUV transformation macros
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * SCALE_WIDTH: scale a line horizontally
- *****************************************************************************
- * This macro scales a line using rendering buffer and offset array. It works
- * for 1, 2 and 4 Bpp.
- *****************************************************************************/
-#define SCALE_WIDTH                                                           \
-    if( b_horizontal_scaling )                                                \
-    {                                                                         \
-        /* Horizontal scaling, conversion has been done to buffer.            \
-         * Rewind buffer and offset, then copy and scale line */              \
-        p_buffer = p_buffer_start;                                            \
-        p_offset = p_offset_start;                                            \
-        for( i_x = i_pic_width / 16; i_x--; )                                 \
-        {                                                                     \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
-        }                                                                     \
-        p_pic += i_pic_line_width;                                            \
-    }                                                                         \
-    else                                                                      \
-    {                                                                         \
-        /* No scaling, conversion has been done directly in picture memory.   \
-         * Increment of picture pointer to end of line is still needed */     \
-        p_pic += i_pic_width + i_pic_line_width;                              \
-    }                                                                         \
-
-/*****************************************************************************
- * SCALE_HEIGHT: handle vertical scaling
- *****************************************************************************
- * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
- * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
- * and 4 Bpp.
- *****************************************************************************/
-#define SCALE_HEIGHT( CHROMA, BPP )                                           \
-    /* If line is odd, rewind 4:2:0 U and V samples */                        \
-    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
-    {                                                                         \
-        p_u -= i_chroma_width;                                                \
-        p_v -= i_chroma_width;                                                \
-    }                                                                         \
-                                                                              \
-    /*                                                                        \
-     * Handle vertical scaling. The current line can be copied or next one    \
-     * can be ignored.                                                        \
-     */                                                                       \
-    switch( i_vertical_scaling )                                              \
-    {                                                                         \
-    case -1:                             /* vertical scaling factor is < 1 */ \
-        while( (i_scale_count -= i_pic_height) >= 0 )                         \
-        {                                                                     \
-            /* Height reduction: skip next source line */                     \
-            p_y += i_width;                                                   \
-            i_y++;                                                            \
-            if( (CHROMA == 420) || (CHROMA == 422) )                          \
-            {                                                                 \
-                if( i_y & 0x1 )                                               \
-                {                                                             \
-                    p_u += i_chroma_width;                                    \
-                    p_v += i_chroma_width;                                    \
-                }                                                             \
-            }                                                                 \
-            else if( CHROMA == 444 )                                          \
-            {                                                                 \
-                p_u += i_width;                                               \
-                p_v += i_width;                                               \
-            }                                                                 \
-        }                                                                     \
-        i_scale_count += i_height;                                            \
-        break;                                                                \
-    case 1:                              /* vertical scaling factor is > 1 */ \
-        while( (i_scale_count -= i_height) > 0 )                              \
-        {                                                                     \
-            /* Height increment: copy previous picture line */                \
-            for( i_x = i_pic_width / 16; i_x--; )                             \
-            {                                                                 \
-                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
-                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
-                if( BPP > 1 )                               /* 2, 3, 4 Bpp */ \
-                {                                                             \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                }                                                             \
-                if( BPP > 2 )                                  /* 3, 4 Bpp */ \
-                {                                                             \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                }                                                             \
-                if( BPP > 3 )                                     /* 4 Bpp */ \
-                {                                                             \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
-                }                                                             \
-            }                                                                 \
-            p_pic +=        i_pic_line_width;                                 \
-            p_pic_start +=  i_pic_line_width;                                 \
-        }                                                                     \
-        i_scale_count += i_pic_height;                                        \
-        break;                                                                \
-    }                                                                         \
-
diff --git a/plugins/yuvmmx/yuvmmx.c b/plugins/yuvmmx/yuvmmx.c
deleted file mode 100644 (file)
index 955ef4a..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * yuvmmx.c : Accelerated MMX YUV functions for vlc
- *****************************************************************************
- * Copyright (C) 2000 VideoLAN
- *
- * Authors:
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <stdlib.h>                                      /* malloc(), free() */
-
-#include "config.h"
-#include "common.h"                                     /* boolean_t, byte_t */
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"                                              /* TestMMX() */
-#include "plugins.h"
-
-#include "interface.h"
-#include "audio_output.h"
-#include "video.h"
-#include "video_output.h"
-
-/*****************************************************************************
- * Exported prototypes
- *****************************************************************************/
-static void yuv_GetPlugin( p_vout_thread_t p_vout );
-
-/* YUV transformations */
-int     yuv_MMXInit          ( p_vout_thread_t p_vout );
-int     yuv_MMXReset         ( p_vout_thread_t p_vout );
-void    yuv_MMXEnd           ( p_vout_thread_t p_vout );
-
-/*****************************************************************************
- * GetConfig: get the plugin structure and configuration
- *****************************************************************************/
-plugin_info_t * GetConfig( void )
-{
-    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
-
-    p_info->psz_name    = "Accelerated MMX YUV to RGB transformations";
-    p_info->psz_version = VERSION;
-    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
-
-    p_info->aout_GetPlugin = NULL;
-    p_info->vout_GetPlugin = NULL;
-    p_info->intf_GetPlugin = NULL;
-    p_info->yuv_GetPlugin  = yuv_GetPlugin;
-
-    if( TestMMX() )
-    {
-        p_info->i_score = 0x200;
-    }
-    else
-    {
-        p_info->i_score = 0x0;
-    }
-
-    /* If this plugin was requested, score it higher */
-    if( TestMethod( YUV_METHOD_VAR, "mmx" ) )
-    {
-        p_info->i_score += 0x200;
-    }
-
-    return( p_info );
-}
-
-/*****************************************************************************
- * Following functions are only called through the p_info structure
- *****************************************************************************/
-
-static void yuv_GetPlugin( p_vout_thread_t p_vout )
-{
-    p_vout->p_yuv_init   = yuv_MMXInit;
-    p_vout->p_yuv_reset  = yuv_MMXReset;
-    p_vout->p_yuv_end    = yuv_MMXEnd;
-}
-
index 27f44de4af751b9a96ac66e426eb3aeacd748213..d15b7da488668a3bb01be349442e0f00db32f69e 100644 (file)
@@ -43,7 +43,7 @@
 #include "debug.h"
 #include "threads.h"
 #include "mtime.h"
-#include "tests.h"                                              /* TestMMX() */
+#include "tests.h"                                              /* TestCPU() */
 #include "plugins.h"
 #include "modules.h"
 #include "playlist.h"
@@ -165,9 +165,6 @@ static void Version                 ( void );
 static void InitSignalHandler       ( void );
 static void SimpleSignalHandler     ( int i_signal );
 static void FatalSignalHandler      ( int i_signal );
-#ifdef HAVE_MMX
-       int  TestMMX                 ( void );
-#endif
 
 /*****************************************************************************
  * main: parse command line, start interface and spawn threads
@@ -196,7 +193,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
      * Test if our code is likely to run on this CPU 
      */
 #ifdef HAVE_MMX
-    if( !TestMMX() )
+    if( !( TestCPU() & CPU_CAPABILITY_MMX ) )
     {
         fprintf( stderr, "Sorry, this program needs an MMX processor. "
                          "Please run the non-MMX version.\n" );
@@ -215,11 +212,6 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
         return( errno );
     }
 
-    /*
-     * Set signal handling policy up for all the threads that will be created
-     */
-    InitSignalHandler();                 /* prepare signals for interception */
-
     /*
      * Read configuration
      */
@@ -282,40 +274,47 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     }
 #endif
 
-    /*
-     * Open audio device and start aout thread
-     */
-    if( p_main->b_audio )
-    {
-        p_main->p_aout = aout_CreateThread( NULL );
-        if( p_main->p_aout == NULL )
-        {
-            /* On error during audio initialization, switch off audio */
-            intf_ErrMsg( "aout error: audio initialization failed, audio is deactivated" );
-            p_main->b_audio = 0;
-        }
-    }
-
     /*
      * Run interface
      */
     p_main->p_intf = intf_Create();
+
     if( p_main->p_intf != NULL )
     {
+        /*
+         * Set signal handling policy for all threads
+         */
+        InitSignalHandler();
+
+        /*
+         * Open audio device and start aout thread
+         */
+        if( p_main->b_audio )
+        {
+            p_main->p_aout = aout_CreateThread( NULL );
+            if( p_main->p_aout == NULL )
+            {
+                /* On error during audio initialization, switch off audio */
+                intf_ErrMsg( "aout error: audio initialization failed,"
+                             " audio is deactivated" );
+                p_main->b_audio = 0;
+            }
+        }
+
         /*
          * This is the main loop
          */
         intf_Run( p_main->p_intf );
 
         intf_Destroy( p_main->p_intf );
-    }
 
-    /*
-     * Close audio device
-     */
-    if( p_main->b_audio )
-    {
-        aout_DestroyThread( p_main->p_aout, NULL );
+        /*
+         * Close audio device
+         */
+        if( p_main->b_audio )
+        {
+            aout_DestroyThread( p_main->p_aout, NULL );
+        }
     }
 
     /*
index 47a6a506da4827fabd2e7404cce5a51e0a364d2f..2bf9b94fcfb3636b30d0f24fb82d7c289d7de9f1 100644 (file)
@@ -224,8 +224,8 @@ void module_ManageBank( module_bank_t * p_bank )
             }
             else
             {
-                intf_Msg( "module: hiding unused module `%s'",
-                          p_module->psz_name );
+                intf_DbgMsg( "module: hiding unused module `%s'",
+                             p_module->psz_name );
                 HideModule( p_module );
             }
         }
index 908934e37c8da21ac4eb1ef0aae9c6cf8e3a2b6a..ae9574dab2c0265f0cd86cd55f9b5c1c970e60a9 100644 (file)
@@ -104,10 +104,6 @@ void bank_Init( plugin_bank_t * p_bank )
     SEEK_PLUGIN( "ggi" );
     SEEK_PLUGIN( "sdl" );
    
-    /* Video calculus */
-    SEEK_PLUGIN( "yuvmmx" );
-    SEEK_PLUGIN( "yuv" );
-
     /* Dummy plugin */
     SEEK_PLUGIN( "dummy" );
 
index 095f2a71e45df369a6a270b797c4a6ad9ec339b2..25fae290a4b47b26709eaada82f5553b1b49038c 100644 (file)
@@ -58,85 +58,3 @@ int TestMethod( char * psz_var, char * psz_method )
     return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) );
 }
 
-/*****************************************************************************
- * TestMMX: tests if the processor has MMX support.
- *****************************************************************************
- * This function is called if HAVE_MMX is enabled, to check whether the
- * CPU really supports MMX.
- *****************************************************************************/
-int TestMMX( void )
-{
-#ifndef __i386__
-    return( 0 );
-#else
-/* FIXME: under beos, gcc does not support the following inline assembly */ 
-#ifdef SYS_BEOS
-    return( 1 );
-#else
-
-    int i_reg, i_dummy = 0;
-
-    /* test for a 386 CPU */
-    asm volatile ( "pushfl
-                    popl %%eax
-                    movl %%eax, %%ecx
-                    xorl $0x40000, %%eax
-                    pushl %%eax
-                    popfl
-                    pushfl
-                    popl %%eax
-                    xorl %%ecx, %%eax
-                    andl $0x40000, %%eax"
-                 : "=a" ( i_reg ) );
-
-    if( !i_reg )
-        return( 0 );
-
-    /* test for a 486 CPU */
-    asm volatile ( "movl %%ecx, %%eax
-                    xorl $0x200000, %%eax
-                    pushl %%eax
-                    popfl
-                    pushfl
-                    popl %%eax
-                    xorl %%ecx, %%eax
-                    pushl %%ecx
-                    popfl
-                    andl $0x200000, %%eax"
-                 : "=a" ( i_reg ) );
-
-    if( !i_reg )
-        return( 0 );
-
-    /* the CPU supports the CPUID instruction - get its level */
-    asm volatile ( "cpuid"
-                 : "=a" ( i_reg ),
-                   "=b" ( i_dummy ),
-                   "=c" ( i_dummy ),
-                   "=d" ( i_dummy )
-                 : "a"  ( 0 ),       /* level 0 */
-                   "b"  ( i_dummy ) ); /* buggy compiler shouldn't complain */
-
-    /* this shouldn't happen on a normal CPU */
-    if( !i_reg )
-        return( 0 );
-
-    /* test for the MMX flag */
-    asm volatile ( "cpuid
-                    andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
-                 : "=a" ( i_dummy ),
-                   "=b" ( i_dummy ),
-                   "=c" ( i_dummy ),
-                   "=d" ( i_reg )
-                 : "a"  ( 1 ),       /* level 1 */
-                   "b"  ( i_dummy ) ); /* buggy compiler shouldn't complain */
-
-    if( !i_reg )
-        return( 0 );
-
-    return( 1 );
-#endif
-#endif
-}
-
-
index 4d46a41f338ec58c7587981a759450c8679ca76e..432d89e1c35d05f1452849d7cd11b93f6a341f51 100644 (file)
@@ -36,7 +36,8 @@
 #include "common.h"
 #include "threads.h"
 #include "mtime.h"
-#include "plugins.h"
+#include "modules.h"
+
 #include "video.h"
 #include "video_output.h"
 #include "video_yuv.h"
  *****************************************************************************/
 int vout_InitYUV( vout_thread_t *p_vout )
 {
-    typedef void ( yuv_getplugin_t ) ( vout_thread_t * p_vout );
-    
-    int          i_index;
-    int          i_best_index = 0, i_best_score = 0;
+    /* Choose the best module */
+    p_vout->yuv.p_module = module_Need( p_main->p_module_bank,
+                                        MODULE_CAPABILITY_YUV, NULL );
 
-    /* Get a suitable YUV plugin */
-    for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ )
+    if( p_vout->yuv.p_module == NULL )
     {
-        /* If there's a plugin in p_info ... */
-        if( p_main->p_bank->p_info[ i_index ] != NULL )
-        {
-            /* ... and if this plugin provides the functions we want ... */
-            if( p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin != NULL )
-            {
-                /* ... and if this plugin has a good score ... */
-                if(  p_main->p_bank->p_info[ i_index ]->i_score > i_best_score )
-                {
-                    /* ... then take it */
-                    i_best_score = p_main->p_bank->p_info[ i_index ]->i_score;
-                    i_best_index = i_index;
-                }
-            }
-        }
+        intf_ErrMsg( "vout error: no suitable yuv module" );
+       return( -1 );
     }
 
-    if( i_best_score == 0 )
-    {
-        /* this should NEVER happen ! */
-        free( p_vout );
-        return( 12 ); 
-    }
+#define yuv_functions p_vout->yuv.p_module->p_functions->yuv.functions.yuv
+    p_vout->yuv.pf_init       = yuv_functions.pf_init;
+    p_vout->yuv.pf_reset      = yuv_functions.pf_reset;
+    p_vout->yuv.pf_end        = yuv_functions.pf_end;
+#undef yuv_functions
 
-    /* Get the plugin functions */
-    ( ( yuv_getplugin_t * ) p_main->p_bank->p_info[ i_best_index ]->yuv_GetPlugin)( p_vout );
-    
-    return p_vout->p_yuv_init( p_vout );
+    return( p_vout->yuv.pf_init( p_vout ) );
 }
 
 /*****************************************************************************
@@ -100,8 +81,8 @@ int vout_InitYUV( vout_thread_t *p_vout )
  *****************************************************************************/
 int vout_ResetYUV( vout_thread_t *p_vout )
 {
-    p_vout->p_yuv_end( p_vout );
-    return( p_vout->p_yuv_init( p_vout ) );
+    p_vout->yuv.pf_end( p_vout );
+    return( p_vout->yuv.pf_init( p_vout ) );
 }
 
 /*****************************************************************************
@@ -111,6 +92,7 @@ int vout_ResetYUV( vout_thread_t *p_vout )
  *****************************************************************************/
 void vout_EndYUV( vout_thread_t *p_vout )
 {
-    p_vout->p_yuv_end( p_vout );
+    p_vout->yuv.pf_end( p_vout );
+    module_Unneed( p_main->p_module_bank, p_vout->yuv.p_module );
 }