From cc44598df520ffb69ef432a665103a53f01d2ca3 Mon Sep 17 00:00:00 2001 From: Vincent Seguin Date: Tue, 18 Jan 2000 23:43:52 +0000 Subject: [PATCH] YUV MMX, avec aspect ratio !!! --- Makefile | 2 +- include/video_yuv.h | 22 +++++++++++ src/video_output/video_yuv.c | 64 +++++++++++++++++--------------- src/video_output/video_yuv_mmx.S | 6 +-- 4 files changed, 60 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index f2a4673dba..1645e93a67 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ VIDEO=X11 # Target architecture and optimization #ARCH= -#ARCH=MMX +ARCH=MMX #ARCH=PPC # Decoder choice - ?? old decoder will be removed soon diff --git a/include/video_yuv.h b/include/video_yuv.h index 4a80108802..6b682ab942 100644 --- a/include/video_yuv.h +++ b/include/video_yuv.h @@ -13,3 +13,25 @@ int vout_InitTables ( vout_thread_t *p_vout ); int vout_ResetTables ( vout_thread_t *p_vout ); void vout_EndTables ( vout_thread_t *p_vout ); +/******************************************************************************* + * External prototypes + *******************************************************************************/ +#ifdef HAVE_MMX + +/* YUV transformations for MMX - in video_yuv_mmx.S + * p_y, p_u, p_v: Y U and V planes + * i_width, i_height: frames dimensions (pixels) + * i_ypitch, i_vpitch: Y and V lines sizes (bytes) + * i_aspect: vertical aspect factor + * p_pic: RGB frame + * i_dci_offset: ?? x offset for left image border + * i_offset_to_line_0: ?? x offset for left image border + * i_pitch: RGB line size (bytes) + * i_colortype: 0 for 565, 1 for 555 */ +void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v, + unsigned int i_width, unsigned int i_height, + unsigned int i_ypitch, unsigned int i_vpitch, + unsigned int i_aspect, u8 *p_pic, + u32 i_dci_offset, u32 i_offset_to_line_0, + int CCOPitch, int i_colortype ); +#endif diff --git a/src/video_output/video_yuv.c b/src/video_output/video_yuv.c index 47bbfdb7cd..10be5be918 100644 --- a/src/video_output/video_yuv.c +++ b/src/video_output/video_yuv.c @@ -25,6 +25,7 @@ #include "vlc_thread.h" #include "video.h" #include "video_output.h" +#include "video_yuv.h" #include "intf_msg.h" /******************************************************************************* @@ -276,8 +277,26 @@ int vout_InitTables( vout_thread_t *p_vout ) size_t tables_size; /* tables size, in bytes */ /* Computes tables size */ - //?? - tables_size = 4 * 4 * 1024; + switch( p_vout->i_screen_depth ) + { + case 15: + case 16: + tables_size = sizeof( u16 ) * 1024 * (p_vout->b_grayscale ? 1 : 3); + break; + case 24: + case 32: +#ifndef DEBUG + default: +#endif + tables_size = sizeof( u32 ) * 1024 * (p_vout->b_grayscale ? 1 : 3); + break; +#ifdef DEBUG + default: + intf_DbgMsg("error: invalid screen depth %d\n", p_vout->i_screen_depth ); + tables_size = 0; + break; +#endif + } /* Allocate memory */ p_vout->tables.p_base = malloc( tables_size ); @@ -300,7 +319,7 @@ int vout_InitTables( vout_thread_t *p_vout ) *******************************************************************************/ int vout_ResetTables( vout_thread_t *p_vout ) { - // ?? realloc ? + // ?? realloc if b_grayscale or i_screen_depth changed SetTables( p_vout ); return( 0 ); } @@ -597,6 +616,17 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, int i_width, int i_height, int i_eol, int i_pic_eol, int i_scale, int i_matrix_coefficients ) { +#ifdef HAVE_MMX + int i_chroma_width, i_chroma_eol; /* width and eol for chroma */ + + i_chroma_width = i_width / 2; + i_chroma_eol = i_eol / 2; + ConvertYUV420RGB16MMX( p_y, p_u, p_v, i_width, i_height, + (i_width + i_eol) * sizeof( yuv_data_t ), + (i_chroma_width + i_chroma_eol) * sizeof( yuv_data_t), + i_scale, (u8 *)p_pic, 0, 0, (i_width + i_pic_eol) * sizeof( u16 ), + p_vout->i_screen_depth == 15 ); +#else u16 * p_pic_src; /* source pointer in case of copy */ u16 * p_red; /* red table */ u16 * p_green; /* green table */ @@ -616,6 +646,7 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, i_chroma_width = i_width / 2; i_chroma_eol = i_eol / 2; CONVERT_YUV_RGB( 420 ) +#endif } /******************************************************************************* @@ -823,35 +854,8 @@ static void Scale32( p_vout_thread_t p_vout, void *p_pic, void *p_buffer, //??? } -//------------------------- - -/******************************************************************************* - * External prototypes - *******************************************************************************/ -#ifdef HAVE_MMX -/* YUV transformations for MMX - in video_yuv_mmx.S - * p_y, p_u, p_v: Y U and V planes - * i_width, i_height: frames dimensions (pixels) - * i_ypitch, i_vpitch: Y and V lines sizes (bytes) - * i_aspect: vertical aspect factor - * p_pic: RGB frame - * i_dci_offset: ?? x offset for left image border - * i_offset_to_line_0: ?? x offset for left image border - * i_pitch: RGB line size (bytes) - * i_colortype: 0 for 565, 1 for 555 */ -static YUV420_16_MMX( u8* p_y, u8* p_u, u8 *p_v, - unsigned int i_width, unsigned int i_height, - unsigned int i_ypitch, unsigned int i_vpitch, - unsigned int i_aspect, u8 *p_pic, - u32 i_dci_offset, u32 i_offset_to_line_0, - int CCOPitch, int i_colortype ); -#endif - //-------------------- walken code follow -------------------------------- - - - /* * YUV to RGB routines. * diff --git a/src/video_output/video_yuv_mmx.S b/src/video_output/video_yuv_mmx.S index 0b3c9db7af..7010a32982 100644 --- a/src/video_output/video_yuv_mmx.S +++ b/src/video_output/video_yuv_mmx.S @@ -90,7 +90,7 @@ sixbitu: .quad 0xc0c0c0c0c0c0c0c0 #define BUpperLimit 148 /* - * extern void C vout_YUV420_16_MMX ( + * extern void C ConvertYUV420RGB16MMX ( * U8* YPlane, * U8* UPlane, * U8* VPlane, @@ -116,8 +116,8 @@ sixbitu: .quad 0xc0c0c0c0c0c0c0c0 * RGB655 = 3 */ -.globl vout_YUV420_16_MMX -vout_YUV420_16_MMX: +.globl ConvertYUV420RGB16MMX +ConvertYUV420RGB16MMX: pushl %esi pushl %edi