Commit a3883709 authored by Damien Fouilleul's avatar Damien Fouilleul

video_chroma: added I420_ABGR32 support (mostly for opengl), some clean up as well

parent 7b64c064
......@@ -155,6 +155,15 @@ static int Activate( vlc_object_t *p_this )
msg_Dbg(p_this, "RGB pixel format is A8R8G8B8");
p_vout->chroma.pf_convert = E_(I420_A8R8G8B8);
}
else if( p_vout->output.i_rmask == 0xff000000
&& p_vout->output.i_gmask == 0x00ff0000
&& p_vout->output.i_bmask == 0x0000ff00 )
{
/* R8G8B8A8 pixel format */
msg_Dbg(p_this, "RGB pixel format is R8G8B8A8");
//p_vout->chroma.pf_convert = E_(I420_B8G8R8A8);
return -1;
}
else if( p_vout->output.i_rmask == 0x0000ff00
&& p_vout->output.i_gmask == 0x00ff0000
&& p_vout->output.i_bmask == 0xff000000 )
......@@ -163,10 +172,18 @@ static int Activate( vlc_object_t *p_this )
msg_Dbg(p_this, "RGB pixel format is B8G8R8A8");
p_vout->chroma.pf_convert = E_(I420_B8G8R8A8);
}
else if( p_vout->output.i_rmask == 0x000000ff
&& p_vout->output.i_gmask == 0x0000ff00
&& p_vout->output.i_bmask == 0x00ff0000 )
{
/* A8B8G8R8 pixel format */
msg_Dbg(p_this, "RGB pixel format is A8B8G8R8");
p_vout->chroma.pf_convert = E_(I420_A8B8G8R8);
}
else
return -1;
#else
// generic C chroma converter */
/* generic C chroma converter */
p_vout->chroma.pf_convert = E_(I420_RGB32);
#endif
break;
......
......@@ -65,6 +65,7 @@ void E_(I420_R5G5B5) ( vout_thread_t *, picture_t *, picture_t * );
void E_(I420_R5G6B5) ( vout_thread_t *, picture_t *, picture_t * );
void E_(I420_A8R8G8B8) ( vout_thread_t *, picture_t *, picture_t * );
void E_(I420_B8G8R8A8) ( vout_thread_t *, picture_t *, picture_t * );
void E_(I420_A8B8G8R8) ( vout_thread_t *, picture_t *, picture_t * );
#endif
/*****************************************************************************
......
This diff is collapsed.
This diff is collapsed.
......@@ -307,7 +307,7 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
#if defined (MODULE_NAME_IS_i420_yuy2_mmx)
/* re-enable FPU registers */
__asm__ __volatile__ ( "emms" );
MMX_END;
#endif
#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
......@@ -348,8 +348,6 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
p_line1 += i_dest_margin;
p_line2 += i_dest_margin;
}
/* make sure all SSE2 stores are visible thereafter */
__asm__ __volatile__ ( "sfence" );
}
else
{
......@@ -379,6 +377,8 @@ static void I420_YUY2( vout_thread_t *p_vout, picture_t *p_source,
p_line2 += i_dest_margin;
}
}
/* make sure all SSE2 stores are visible thereafter */
SSE2_END;
#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
}
......@@ -518,7 +518,7 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
#if defined (MODULE_NAME_IS_i420_yuy2_mmx)
/* re-enable FPU registers */
__asm__ __volatile__ ( "emms" );
MMX_END;
#endif
#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
......@@ -558,8 +558,6 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
p_line1 += i_dest_margin;
p_line2 += i_dest_margin;
}
/* make sure all SSE2 stores are visible thereafter */
__asm__ __volatile__ ( "sfence" );
}
else
{
......@@ -589,6 +587,8 @@ static void I420_YVYU( vout_thread_t *p_vout, picture_t *p_source,
p_line2 += i_dest_margin;
}
}
/* make sure all SSE2 stores are visible thereafter */
SSE2_END;
#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
}
......@@ -727,7 +727,7 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
#if defined (MODULE_NAME_IS_i420_yuy2_mmx)
/* re-enable FPU registers */
__asm__ __volatile__ ( "emms" );
MMX_END;
#endif
#if defined (MODULE_NAME_IS_i420_yuy2_altivec)
......@@ -767,8 +767,6 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
p_line1 += i_dest_margin;
p_line2 += i_dest_margin;
}
/* make sure all SSE2 stores are visible thereafter */
__asm__ __volatile__ ( "sfence" );
}
else
{
......@@ -798,6 +796,8 @@ static void I420_UYVY( vout_thread_t *p_vout, picture_t *p_source,
p_line2 += i_dest_margin;
}
}
/* make sure all SSE2 stores are visible thereafter */
SSE2_END;
#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
}
......@@ -871,7 +871,7 @@ static void I420_cyuv( vout_thread_t *p_vout, picture_t *p_source,
#if defined (MODULE_NAME_IS_i420_yuy2_mmx)
/* re-enable FPU registers */
__asm__ __volatile__ ( "emms" );
MMX_END;
#endif
#else // defined(MODULE_NAME_IS_i420_yuy2_sse2)
......@@ -907,8 +907,6 @@ static void I420_cyuv( vout_thread_t *p_vout, picture_t *p_source,
p_line1 += i_dest_margin;
p_line2 += i_dest_margin;
}
/* make sure all SSE2 stores are visible thereafter */
__asm__ __volatile__ ( "sfence" );
}
else
{
......@@ -938,6 +936,8 @@ static void I420_cyuv( vout_thread_t *p_vout, picture_t *p_source,
p_line2 += i_dest_margin;
}
}
/* make sure all SSE2 stores are visible thereafter */
SSE2_END;
#endif // defined(MODULE_NAME_IS_i420_yuy2_sse2)
}
#endif // !defined (MODULE_NAME_IS_i420_yuy2_altivec)
......
This diff is collapsed.
......@@ -5,6 +5,7 @@
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Damien Fouilleul <damienf@videolan.org>
*
* 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
......@@ -160,15 +161,17 @@ static void I422_YUY2( vout_thread_t *p_vout, picture_t *p_source,
C_YUV422_YUYV( p_line, p_y, p_u, p_v );
C_YUV422_YUYV( p_line, p_y, p_u, p_v );
C_YUV422_YUYV( p_line, p_y, p_u, p_v );
#else
__asm__( ".p2align 3" MMX_YUV422_YUYV
: : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) );
p_line += 16; p_y += 8; p_u += 4; p_v += 4;
#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_CALL( MMX_YUV422_YUYV );
#endif
}
p_pixels += i_pitch;
}
#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_END;
#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
SSE2_END;
#endif
}
/*****************************************************************************
......@@ -195,15 +198,17 @@ static void I422_YVYU( vout_thread_t *p_vout, picture_t *p_source,
C_YUV422_YVYU( p_line, p_y, p_u, p_v );
C_YUV422_YVYU( p_line, p_y, p_u, p_v );
C_YUV422_YVYU( p_line, p_y, p_u, p_v );
#else
__asm__( ".p2align 3" MMX_YUV422_YVYU
: : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) );
p_line += 16; p_y += 8; p_u += 4; p_v += 4;
#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_CALL( MMX_YUV422_YVYU );
#endif
}
p_pixels += i_pitch;
}
#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_END;
#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
SSE2_END;
#endif
}
/*****************************************************************************
......@@ -230,15 +235,17 @@ static void I422_UYVY( vout_thread_t *p_vout, picture_t *p_source,
C_YUV422_UYVY( p_line, p_y, p_u, p_v );
C_YUV422_UYVY( p_line, p_y, p_u, p_v );
C_YUV422_UYVY( p_line, p_y, p_u, p_v );
#else
__asm__( ".p2align 3" MMX_YUV422_UYVY
: : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) );
p_line += 16; p_y += 8; p_u += 4; p_v += 4;
#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_CALL( MMX_YUV422_UYVY );
#endif
}
p_pixels += i_pitch;
}
#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_END;
#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
SSE2_END;
#endif
}
/*****************************************************************************
......@@ -275,14 +282,16 @@ static void I422_cyuv( vout_thread_t *p_vout, picture_t *p_source,
C_YUV422_UYVY( p_line, p_y, p_u, p_v );
C_YUV422_UYVY( p_line, p_y, p_u, p_v );
C_YUV422_UYVY( p_line, p_y, p_u, p_v );
#else
__asm__( ".p2align 3" MMX_YUV422_UYVY
: : "r" (p_line), "r" (p_y), "r" (p_u), "r" (p_v) );
p_line += 16; p_y += 8; p_u += 4; p_v += 4;
#elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_CALL( MMX_YUV422_UYVY );
#endif
}
}
#if defined (MODULE_NAME_IS_i422_yuy2_mmx)
MMX_END;
#elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
SSE2_END;
#endif
}
/*****************************************************************************
......
......@@ -5,6 +5,7 @@
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Damien Fouilleul <damienf@videolan.org>
*
* 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
......@@ -23,6 +24,24 @@
#ifdef MODULE_NAME_IS_i422_yuy2_mmx
#if defined(CAN_COMPILE_MMX)
/* MMX assembly */
#define MMX_CALL(MMX_INSTRUCTIONS) \
do { \
__asm__ __volatile__( \
".p2align 3 \n\t" \
MMX_INSTRUCTIONS \
: \
: "r" (p_line), "r" (p_y), \
"r" (p_u), "r" (p_v) ); \
p_line += 16; p_y += 8; \
p_u += 4; p_v += 4; \
} while(0)
#define MMX_END __asm__ __volatile__ ( "emms" )
#define MMX_YUV422_YUYV " \n\
movq (%1), %%mm0 # Load 8 Y y7 y6 y5 y4 y3 y2 y1 y0 \n\
movd (%2), %%mm1 # Load 4 Cb 00 00 00 00 u3 u2 u1 u0 \n\
......@@ -62,7 +81,36 @@ movq %%mm1, 8(%0) # Store high UYVY \n\
#define MMX_YUV422_Y211 " \n\
"
#else
#elif defined(HAVE_MMX_INTRINSICS)
/* MMX intrinsics */
#include <mmintrin.h>
#define MMX_END _mm_empty()
#endif
#elif defined( MODULE_NAME_IS_i422_yuy2_sse2 )
#if defined(CAN_COMPILE_SSE2)
/* SSE2 assembly */
#define SSE2_END __asm__ __volatile__ ( "sfence" ::: "memory" )
#elif defined(HAVE_SSE2_INTRINSICS)
/* SSE2 intrinsics */
#include <emmintrin.h>
#define SSE2_END _mm_sfence()
#endif
#elif defined (MODULE_NAME_IS_i422_yuy2)
#define C_YUV422_YUYV( p_line, p_y, p_u, p_v ) \
*(p_line)++ = *(p_y)++; \
......
Markdown is supported
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