Commit c36cfc38 authored by Sam Hocevar's avatar Sam Hocevar
Browse files

* ./plugins/chroma/i420_rgb16.c: MMX YUV to RGB transformation for 15bpp.

parent f9d9f469
List of known vlc bugs
$Id: BUGS,v 1.5 2002/01/21 00:52:06 sam Exp $
$Id: BUGS,v 1.6 2002/01/28 16:51:22 sam Exp $
Please try to keep this file up to date. Also, grep for FIXME in the
source files for more and more bugs to fix.
......@@ -12,12 +12,10 @@ Core:
* vlc_cond_broadcast unimplemented on most plaforms.
* --<moduletype> <module>:<args> doesn't work anymore.
Input:
-
* DVD raw device support doesn't seem to work.
Audio output:
......
......@@ -2,7 +2,7 @@
* i420_rgb.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: i420_rgb.c,v 1.2 2002/01/12 01:25:57 sam Exp $
* $Id: i420_rgb.c,v 1.3 2002/01/28 16:51:22 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -146,6 +146,9 @@ static int chroma_Init( vout_thread_t *p_vout )
break;
#endif
case FOURCC_RV15:
p_vout->chroma.pf_convert = _M( I420_RGB15 );
break;
case FOURCC_RV16:
p_vout->chroma.pf_convert = _M( I420_RGB16 );
break;
......
......@@ -2,7 +2,7 @@
* i420_rgb.h : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb.h,v 1.2 2002/01/12 01:25:57 sam Exp $
* $Id: i420_rgb.h,v 1.3 2002/01/28 16:51:22 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -40,6 +40,7 @@ typedef struct chroma_sys_s
#ifdef MODULE_NAME_IS_chroma_i420_rgb
void _M( I420_RGB8 ) ( vout_thread_t *, picture_t *, picture_t * );
#endif
void _M( I420_RGB15 )( vout_thread_t *, picture_t *, picture_t * );
void _M( I420_RGB16 )( vout_thread_t *, picture_t *, picture_t * );
void _M( I420_RGB32 )( vout_thread_t *, picture_t *, picture_t * );
......
......@@ -2,7 +2,7 @@
* i420_rgb16.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb16.c,v 1.2 2002/01/12 01:25:57 sam Exp $
* $Id: i420_rgb16.c,v 1.3 2002/01/28 16:51:22 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -43,6 +43,134 @@
static void SetOffset( int, int, int, int, boolean_t *, int *, int * );
/*****************************************************************************
* I420_RGB15: color YUV 4:2:0 to RGB 15 bpp
*****************************************************************************
* Horizontal alignment needed:
* - input: 8 pixels (8 Y bytes, 4 U/V bytes), margins not allowed
* - output: 1 pixel (2 bytes), margins allowed
* Vertical alignment needed:
* - input: 2 lines (2 Y lines, 1 U/V line)
* - output: 1 line
*****************************************************************************/
void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
picture_t *p_dest )
{
/* We got this one from the old arguments */
u16 *p_pic = (u16*)p_dest->p->p_pixels;
u8 *p_y = p_src->Y_PIXELS;
u8 *p_u = p_src->U_PIXELS;
u8 *p_v = p_src->V_PIXELS;
boolean_t b_hscale; /* horizontal scaling type */
int i_vscale; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_right_margin;
int i_rewind;
int i_scale_count; /* scale modulo counter */
int i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
u16 * p_pic_start; /* beginning of the current line for copy */
/* Conversion buffer pointer */
u16 * p_buffer_start = (u16*)p_vout->chroma.p_sys->p_buffer;
u16 * p_buffer;
/* Offset array pointer */
int * p_offset_start = p_vout->chroma.p_sys->p_offset;
int * p_offset;
if( p_dest->p->b_margin )
{
i_right_margin = (p_dest->p->i_pitch - p_dest->p->i_visible_bytes) / 2;
}
else
{
i_right_margin = 0;
}
if( p_vout->render.i_width & 7 )
{
i_rewind = 8 - ( p_vout->render.i_width & 7 );
}
else
{
i_rewind = 0;
}
/* Rule: when a picture of size (x1,y1) with aspect ratio r1 is rendered
* on a picture of size (x2,y2) with aspect ratio r2, if x1 grows to x1'
* then y1 grows to y1' = x1' * y2/x2 * r2/r1 */
SetOffset( p_vout->render.i_width, p_vout->render.i_height,
p_vout->output.i_width, p_vout->output.i_height,
&b_hscale, &i_vscale, p_offset_start );
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
intf_ErrMsg( "vout error: I420_RGB16 unimplemented, "
"please harass sam@zoy.org" );
#endif
/*
* Perform conversion
*/
i_scale_count = ( i_vscale == 1 ) ?
p_vout->output.i_height : p_vout->render.i_height;
for( i_y = 0; i_y < p_vout->render.i_height; i_y++ )
{
p_pic_start = p_pic;
p_buffer = b_hscale ? p_buffer_start : p_pic;
for ( i_x = p_vout->render.i_width / 8; i_x--; )
{
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
/* FIXME: TODO */
#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
__asm__( MMX_INIT_16
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
__asm__( ".align 8"
MMX_YUV_MUL
MMX_YUV_ADD
MMX_UNPACK_15
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
p_y += 8;
p_u += 4;
p_v += 4;
p_buffer += 8;
#endif
}
/* Here we do some unaligned reads and duplicate conversions, but
* at least we have all the pixels */
if( i_rewind )
{
p_y -= i_rewind;
p_u -= i_rewind >> 1;
p_v -= i_rewind >> 1;
p_buffer -= i_rewind;
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
/* FIXME: TODO */
#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
__asm__( MMX_INIT_16
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
__asm__( ".align 8"
MMX_YUV_MUL
MMX_YUV_ADD
MMX_UNPACK_15
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
p_y += 8;
p_u += 4;
p_v += 4;
p_buffer += 8;
#endif
}
SCALE_WIDTH;
SCALE_HEIGHT( 420, 2 );
}
}
/*****************************************************************************
* I420_RGB16: color YUV 4:2:0 to RGB 16 bpp
*****************************************************************************
......
......@@ -2,7 +2,7 @@
* transforms_yuvmmx.h: MMX YUV transformation assembly
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: i420_rgb_mmx.h,v 1.1 2002/01/04 14:01:34 sam Exp $
* $Id: i420_rgb_mmx.h,v 1.2 2002/01/28 16:51:22 sam Exp $
*
* Authors: Olie Lho <ollie@sis.com.tw>
* Gal Hendryckx <jimmy@via.ecp.fr>
......@@ -37,10 +37,8 @@ UNUSED_LONGLONG(mmx_U_blue) = 0x4093409340934093;
UNUSED_LONGLONG(mmx_V_red) = 0x3312331233123312;
UNUSED_LONGLONG(mmx_V_green) = 0xe5fce5fce5fce5fc;
UNUSED_LONGLONG(mmx_redmask) = 0xf8f8f8f8f8f8f8f8;
UNUSED_LONGLONG(mmx_grnmask) = 0xfcfcfcfcfcfcfcfc;
UNUSED_LONGLONG(mmx_grnshift) = 0x03;
UNUSED_LONGLONG(mmx_blueshift) = 0x03;
UNUSED_LONGLONG(mmx_mask_f8) = 0xf8f8f8f8f8f8f8f8;
UNUSED_LONGLONG(mmx_mask_fc) = 0xfcfcfcfcfcfcfcfc;
#undef UNUSED_LONGLONG
#define MMX_INIT_16 " \n\
......@@ -156,27 +154,63 @@ punpcklbw %%mm7, %%mm6 \n\
#define MMX_UNPACK_16_GRAY " \n\
movq %%mm6, %%mm5 \n\
pand mmx_redmask, %%mm6 \n\
pand mmx_grnmask, %%mm5 \n\
pand mmx_mask_f8, %%mm6 \n\
pand mmx_mask_fc, %%mm5 \n\
movq %%mm6, %%mm7 \n\
psrlw mmx_blueshift, %%mm7 \n\
psrlw $3, %%mm7 \n\
pxor %%mm3, %%mm3 \n\
movq %%mm7, %%mm2 \n\
movq %%mm5, %%mm0 \n\
punpcklbw %%mm3, %%mm5 \n\
punpcklbw %%mm6, %%mm7 \n\
psllw mmx_blueshift, %%mm5 \n\
psllw $3, %%mm5 \n\
por %%mm5, %%mm7 \n\
movq %%mm7, (%3) \n\
punpckhbw %%mm3, %%mm0 \n\
punpckhbw %%mm6, %%mm2 \n\
psllw mmx_blueshift, %%mm0 \n\
psllw $3, %%mm0 \n\
movq 8(%0), %%mm6 \n\
por %%mm0, %%mm2 \n\
movq %%mm2, 8(%3) \n\
"
/*
* convert RGB plane to RGB 15 bits,
* mm0 -> B, mm1 -> R, mm2 -> G,
* mm4 -> GB, mm5 -> AR pixel 4-7,
* mm6 -> GB, mm7 -> AR pixel 0-3
*/
#define MMX_UNPACK_15 " \n\
# mask unneeded bits off \n\
pand mmx_mask_f8, %%mm0 # b7b6b5b4 b3______ b7b6b5b4 b3______ \n\
psrlw $3,%%mm0 # ______b7 b6b5b4b3 ______b7 b6b5b4b3 \n\
pand mmx_mask_f8, %%mm2 # g7g6g5g4 g3______ g7g6g5g4 g3______ \n\
pand mmx_mask_f8, %%mm1 # r7r6r5r4 r3______ r7r6r5r4 r3______ \n\
psrlw $1,%%mm1 # __r7r6r5 r4r3____ __r7r6r5 r4r3____ \n\
pxor %%mm4, %%mm4 # zero mm4 \n\
movq %%mm0, %%mm5 # Copy B7-B0 \n\
movq %%mm2, %%mm7 # Copy G7-G0 \n\
\n\
# convert rgb24 plane to rgb15 pack for pixel 0-3 \n\
punpcklbw %%mm4, %%mm2 # ________ ________ g7g6g5g4 g3______ \n\
punpcklbw %%mm1, %%mm0 # r7r6r5r4 r3______ ______b7 b6b5b4b3 \n\
psllw $2,%%mm2 # ________ ____g7g6 g5g4g3__ ________ \n\
por %%mm2, %%mm0 # r7r6r5r4 r3__g7g6 g5g4g3b7 b6b5b4b3 \n\
movq 8(%0), %%mm6 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
movq %%mm0, (%3) # store pixel 0-3 \n\
\n\
# convert rgb24 plane to rgb16 pack for pixel 0-3 \n\
punpckhbw %%mm4, %%mm7 # ________ ________ g7g6g5g4 g3______ \n\
punpckhbw %%mm1, %%mm5 # r7r6r5r4 r3______ ______b7 b6b5b4b3 \n\
psllw $2,%%mm7 # ________ ____g7g6 g5g4g3__ ________ \n\
movd 4(%1), %%mm0 # Load 4 Cb __ __ __ __ u3 u2 u1 u0 \n\
por %%mm7, %%mm5 # r7r6r5r4 r3__g7g6 g5g4g3b7 b6b5b4b3 \n\
movd 4(%2), %%mm1 # Load 4 Cr __ __ __ __ v3 v2 v1 v0 \n\
movq %%mm5, 8(%3) # store pixel 4-7 \n\
"
/*
* convert RGB plane to RGB 16 bits,
* mm0 -> B, mm1 -> R, mm2 -> G,
......@@ -186,10 +220,10 @@ movq %%mm2, 8(%3) \n\
#define MMX_UNPACK_16 " \n\
# mask unneeded bits off \n\
pand mmx_redmask, %%mm0 # b7b6b5b4 b3______ b7b6b5b4 b3______ \n\
pand mmx_grnmask, %%mm2 # g7g6g5g4 g3g2____ g7g6g5g4 g3g2____ \n\
pand mmx_redmask, %%mm1 # r7r6r5r4 r3______ r7r6r5r4 r3______ \n\
psrlw mmx_blueshift,%%mm0 # ______b7 b6b5b4b3 ______b7 b6b5b4b3 \n\
pand mmx_mask_f8, %%mm0 # b7b6b5b4 b3______ b7b6b5b4 b3______ \n\
pand mmx_mask_fc, %%mm2 # g7g6g5g4 g3g2____ g7g6g5g4 g3g2____ \n\
pand mmx_mask_f8, %%mm1 # r7r6r5r4 r3______ r7r6r5r4 r3______ \n\
psrlw $3,%%mm0 # ______b7 b6b5b4b3 ______b7 b6b5b4b3 \n\
pxor %%mm4, %%mm4 # zero mm4 \n\
movq %%mm0, %%mm5 # Copy B7-B0 \n\
movq %%mm2, %%mm7 # Copy G7-G0 \n\
......@@ -197,7 +231,7 @@ movq %%mm2, %%mm7 # Copy G7-G0 \n\
# convert rgb24 plane to rgb16 pack for pixel 0-3 \n\
punpcklbw %%mm4, %%mm2 # ________ ________ g7g6g5g4 g3g2____ \n\
punpcklbw %%mm1, %%mm0 # r7r6r5r4 r3______ ______b7 b6b5b4b3 \n\
psllw mmx_blueshift,%%mm2 # ________ __g7g6g5 g4g3g2__ ________ \n\
psllw $3,%%mm2 # ________ __g7g6g5 g4g3g2__ ________ \n\
por %%mm2, %%mm0 # r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 \n\
movq 8(%0), %%mm6 # Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 \n\
movq %%mm0, (%3) # store pixel 0-3 \n\
......@@ -205,7 +239,7 @@ movq %%mm0, (%3) # store pixel 0-3 \n\
# convert rgb24 plane to rgb16 pack for pixel 0-3 \n\
punpckhbw %%mm4, %%mm7 # ________ ________ g7g6g5g4 g3g2____ \n\
punpckhbw %%mm1, %%mm5 # r7r6r5r4 r3______ ______b7 b6b5b4b3 \n\
psllw mmx_blueshift,%%mm7 # ________ __g7g6g5 g4g3g2__ ________ \n\
psllw $3,%%mm7 # ________ __g7g6g5 g4g3g2__ ________ \n\
movd 4(%1), %%mm0 # Load 4 Cb __ __ __ __ u3 u2 u1 u0 \n\
por %%mm7, %%mm5 # r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 \n\
movd 4(%2), %%mm1 # Load 4 Cr __ __ __ __ v3 v2 v1 v0 \n\
......
......@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.14 2002/01/25 17:18:37 sam Exp $
* $Id: xcommon.c,v 1.15 2002/01/28 16:51:22 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -1347,6 +1347,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
#else
case FOURCC_RV16:
case FOURCC_RV15:
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment