#
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
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
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
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 $@ $^
$(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_
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 $@ $^
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;
* 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
+}
*****************************************************************************
* 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 */
/* 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;
/*****************************************************************************
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 */
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 */
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
-#include "tests.h"
#include "interface.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
-#include "tests.h"
#include "modules.h"
#include "modules_inner.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
-#include "tests.h"
#include "modules.h"
#include "modules_inner.h"
* 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>
*
static int idct_Probe( probedata_t *p_data )
{
/* This plugin always works */
- return( 100 );
+ return( 50 );
}
/*****************************************************************************
* 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>
*
static int idct_Probe( probedata_t *p_data )
{
/* This plugin always works */
- return( 50 );
+ return( 100 );
}
/*****************************************************************************
* 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>
*
#include "common.h"
#include "threads.h"
#include "mtime.h"
+#include "tests.h" /* TestCPU() */
#include "video.h"
#include "video_output.h"
*****************************************************************************/
static int idct_Probe( probedata_t *p_data )
{
- /* This plugin always works */
- return( 100 );
+ if( TestCPU() & CPU_CAPABILITY_MMX )
+ {
+ return( 100 );
+ }
+ else
+ {
+ return( 0 );
+ }
}
/*****************************************************************************
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
-#include "tests.h"
#include "modules.h"
#include "modules_inner.h"
/*****************************************************************************
- * video_yuv_macros_truecolor.h: YUV transformation macros for truecolor
+ * transforms_common.h: YUV transformation macros for truecolor
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
--- /dev/null
+/*****************************************************************************
+ * 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);
+ }
+}
+
/*****************************************************************************
- * video_yuv_macros_8bpp.h: YUV transformation macros for 8bpp
+ * transforms_yuv.h: C specific YUV transformation macros
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
/*****************************************************************************
- * 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 )
{
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 */
* 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,
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 );
}
}
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 */
*/
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,
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 );
}
}
*****************************************************************************/
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 */
* 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,
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" );
+}
+
/*****************************************************************************
- * video_yuv_asm.h: MMX YUV transformation assembly
+ * transforms_yuvmmx.h: MMX YUV transformation assembly
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
/*****************************************************************************
- * 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.
#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 );
#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 */
}
/*****************************************************************************
- * 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 );
}
/*****************************************************************************
- * 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 */
/*****************************************************************************
* 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 */
* 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 */
+++ /dev/null
-/*****************************************************************************
- * 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" );
-}
-
+++ /dev/null
-/*****************************************************************************
- * 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);
- }
-}
-
+++ /dev/null
-/*****************************************************************************
- * 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" );
-}
-
/*****************************************************************************
- * 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 */
}
/*****************************************************************************
- * 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 */
* 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 */
/*****************************************************************************
- * yuv.c : C YUV functions for vlc
+ * yuv.c : C YUV module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* 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 );
}
--- /dev/null
+/*****************************************************************************
+ * 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 );
+}
+
+++ /dev/null
-/*****************************************************************************
- * 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 );
-
+++ /dev/null
-/*****************************************************************************
- * 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" );
-}
-
+++ /dev/null
-/*****************************************************************************
- * 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" );
-}
-
+++ /dev/null
-/*****************************************************************************
- * 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" );
-}
-
+++ /dev/null
-/*****************************************************************************
- * 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" );
-}
-
+++ /dev/null
-/*****************************************************************************
- * 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; \
- } \
-
+++ /dev/null
-/*****************************************************************************
- * 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;
-}
-
#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"
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
* 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" );
return( errno );
}
- /*
- * Set signal handling policy up for all the threads that will be created
- */
- InitSignalHandler(); /* prepare signals for interception */
-
/*
* Read configuration
*/
}
#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 );
+ }
}
/*
}
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 );
}
}
SEEK_PLUGIN( "ggi" );
SEEK_PLUGIN( "sdl" );
- /* Video calculus */
- SEEK_PLUGIN( "yuvmmx" );
- SEEK_PLUGIN( "yuv" );
-
/* Dummy plugin */
SEEK_PLUGIN( "dummy" );
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
-}
-
-
#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 ) );
}
/*****************************************************************************
*****************************************************************************/
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 ) );
}
/*****************************************************************************
*****************************************************************************/
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 );
}