Commit f56c4db1 authored by Sam Hocevar's avatar Sam Hocevar

. merged the YUV plugins in the same directory to avoid too much code

   duplication
 . YUV transformations now use the new module API ; now only the vout
   and interface still depend on the old plugin API
 . changed TestMMX to TestCPU because we will be able to test for other
   specific extensions (3DNow, SSE) for the forthcoming IDCT we'll
   borrow to mpeg2dec (as usual :P)
 . don't show "hiding module" messages anymore except in debug mode
 . swapped C IDCT and Classic IDCT scores since the classic one seems
   to be faster ; anyway you should use the MMX one
 . fixed a Makefile bug under BeOS
 . tried to fix the cpuid code so that it compiles under BeOS (Polux, can
   you test it when you have time ?)
parent 2f64eb29
......@@ -277,7 +277,7 @@ endif
#
ifneq (,$(findstring 86,$(ARCH)))
ifneq (,$(findstring mmx,$(ARCH)))
ASM_OBJ = src/video_output/video_yuv_mmx.o
ASM_OBJ =
STD_PLUGIN_ASM = plugins/idct/idctmmx_asm.o
endif
endif
......@@ -338,19 +338,11 @@ PLUGIN_X11= plugins/x11/x11.o \
PLUGIN_YUV = plugins/yuv/yuv.o \
plugins/yuv/video_yuv.o \
plugins/yuv/video_yuv8.o \
plugins/yuv/video_yuv15.o \
plugins/yuv/video_yuv16.o \
plugins/yuv/video_yuv24.o \
plugins/yuv/video_yuv32.o
PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
plugins/yuvmmx/video_yuv.o \
plugins/yuvmmx/video_yuv8.o \
plugins/yuvmmx/video_yuv15.o \
plugins/yuvmmx/video_yuv16.o \
plugins/yuvmmx/video_yuv24.o \
plugins/yuvmmx/video_yuv32.o
plugins/yuv/transforms_yuv.o
PLUGIN_YUVMMX = plugins/yuv/yuvmmx.o \
plugins/yuv/video_yuvmmx.o \
plugins/yuv/transforms_yuvmmx.o
PLUGIN_IDCT = plugins/idct/idct.o \
plugins/idct/idct_common.o
......@@ -408,6 +400,7 @@ all: vlc @ALIASES@ plugins
clean:
rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
rm -f plugins/*/*.o src/*/*.o
rm -f vlc @ALIASES@ lib/*.so
distclean: clean
......@@ -533,12 +526,6 @@ lib/dsp.so: $(PLUGIN_DSP)
lib/alsa.so: $(PLUGIN_ALSA)
$(CC) $(PCFLAGS) -shared -o $@ $^ -lasound
lib/null.so: $(PLUGIN_NULL)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/fb.so: $(PLUGIN_FB)
$(CC) $(PCFLAGS) -shared -o $@ $^
......@@ -561,6 +548,12 @@ lib/sdl.so: $(PLUGIN_SDL)
$(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL)
ifeq ($(SYS),beos)
lib/null.so: $(PLUGIN_NULL)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/idct.so: $(PLUGIN_IDCT)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
......@@ -576,6 +569,12 @@ lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC)
lib/idctmmx.so: $(PLUGIN_IDCTMMX)
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
else
lib/null.so: $(PLUGIN_NULL)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/yuv.so: $(PLUGIN_YUV)
$(CC) $(PCFLAGS) -shared -o $@ $^
......
......@@ -85,6 +85,13 @@ typedef struct function_list_s
int i_idontcare );
} idct;
struct
{
int ( * pf_init ) ( struct vout_thread_s * p_vout );
int ( * pf_reset ) ( struct vout_thread_s * p_vout );
void ( * pf_end ) ( struct vout_thread_s * p_vout );
} yuv;
} functions;
} function_list_t;
......
......@@ -20,11 +20,93 @@
* 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
}
......@@ -49,6 +49,10 @@ typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
*****************************************************************************
* These tables are used by conversion and scaling functions.
*****************************************************************************/
typedef int (yuv_init_t) ( p_vout_thread_t p_vout );
typedef int (yuv_reset_t) ( p_vout_thread_t p_vout );
typedef void (yuv_end_t) ( p_vout_thread_t p_vout );
typedef struct vout_yuv_s
{
/* conversion functions */
......@@ -71,6 +75,13 @@ typedef struct vout_yuv_s
/* Temporary conversion buffer and offset array */
void * p_buffer; /* conversion buffer */
int * p_offset; /* offset array */
/* Plugin used and shortcuts to access its capabilities */
struct module_s * p_module;
yuv_init_t * pf_init; /* initialize YUV tables */
yuv_reset_t * pf_reset; /* reset YUV tables */
yuv_end_t * pf_end; /* free YUV tables */
} vout_yuv_t;
/*****************************************************************************
......@@ -113,10 +124,6 @@ typedef void (vout_sys_display_t) ( p_vout_thread_t p_vout );
typedef void (vout_set_palette_t) ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
typedef int (yuv_sys_init_t) ( p_vout_thread_t p_vout );
typedef int (yuv_sys_reset_t) ( p_vout_thread_t p_vout );
typedef void (yuv_sys_end_t) ( p_vout_thread_t p_vout );
typedef struct vout_thread_s
{
/* Thread properties and lock */
......@@ -168,10 +175,6 @@ typedef struct vout_thread_s
vout_set_palette_t * p_set_palette; /* set 8bpp palette */
yuv_sys_init_t * p_yuv_init; /* initialize YUV tables */
yuv_sys_reset_t * p_yuv_reset; /* reset YUV tables */
yuv_sys_end_t * p_yuv_end; /* free YUV tables */
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additional information */
......
......@@ -40,7 +40,6 @@
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "interface.h"
......
......@@ -35,7 +35,6 @@
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_inner.h"
......
......@@ -34,7 +34,6 @@
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_inner.h"
......
......@@ -2,7 +2,7 @@
* idct.c : IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.c,v 1.2 2001/01/15 06:18:23 sam Exp $
* $Id: idct.c,v 1.3 2001/01/16 02:16:38 sam Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
*
......@@ -143,7 +143,7 @@ static void idct_getfunctions( function_list_t * p_function_list )
static int idct_Probe( probedata_t *p_data )
{
/* This plugin always works */
return( 100 );
return( 50 );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctclassic.c : Classic IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctclassic.c,v 1.2 2001/01/15 06:18:23 sam Exp $
* $Id: idctclassic.c,v 1.3 2001/01/16 02:16:38 sam Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
*
......@@ -143,7 +143,7 @@ static void idct_getfunctions( function_list_t * p_function_list )
static int idct_Probe( probedata_t *p_data )
{
/* This plugin always works */
return( 50 );
return( 100 );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctmmx.c : MMX IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmx.c,v 1.2 2001/01/15 06:18:23 sam Exp $
* $Id: idctmmx.c,v 1.3 2001/01/16 02:16:38 sam Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
*
......@@ -34,6 +34,7 @@
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "video.h"
#include "video_output.h"
......@@ -142,8 +143,14 @@ static void idct_getfunctions( function_list_t * p_function_list )
*****************************************************************************/
static int idct_Probe( probedata_t *p_data )
{
/* This plugin always works */
return( 100 );
if( TestCPU() & CPU_CAPABILITY_MMX )
{
return( 100 );
}
else
{
return( 0 );
}
}
/*****************************************************************************
......
......@@ -34,7 +34,6 @@
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_inner.h"
......
/*****************************************************************************
* video_yuv_macros_truecolor.h: YUV transformation macros for truecolor
* transforms_common.h: YUV transformation macros for truecolor
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
......
/*****************************************************************************
* video_yuv32.c: YUV transformation functions for 32 bpp
* 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.
......@@ -39,13 +39,416 @@
#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_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);