/*****************************************************************************
* i420_rgb16.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
- * Copyright (C) 2000 the VideoLAN team
+ * Copyright (C) 2000 VLC authors and VideoLAN
* $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
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <vlc_filter.h>
+#include <vlc_cpu.h>
#include "i420_rgb.h"
#if defined (MODULE_NAME_IS_i420_rgb)
# include "i420_rgb_c.h"
+# define VLC_TARGET
#elif defined (MODULE_NAME_IS_i420_rgb_mmx)
-# include "i420_rgb_mmx.h"
+# include "../mmx/i420_rgb_mmx.h"
+# define VLC_TARGET VLC_MMX
#elif defined (MODULE_NAME_IS_i420_rgb_sse2)
-# include "i420_rgb_mmx.h"
+# include "../sse2/i420_rgb_sse2.h"
+# define VLC_TARGET VLC_SSE
#endif
static void SetOffset( int, int, int, int, bool *,
}
i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
-
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
/* 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'
#if defined (MODULE_NAME_IS_i420_rgb)
-void I420_RGB16( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+void I420_RGB16( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
- p_src->p[1].i_visible_pitch;
i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
-
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
/* 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'
#else // ! defined (MODULE_NAME_IS_i420_rgb)
-void I420_R5G5B5( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+VLC_TARGET
+void I420_R5G5B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
#if defined (MODULE_NAME_IS_i420_rgb_sse2)
- if( p_filter->fmt_in.video.i_width & 15 )
- {
- i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
/*
** SSE2 128 bits fetch/store instructions are faster
#else // defined (MODULE_NAME_IS_i420_rgb_mmx)
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{
#endif
}
-void I420_R5G6B5( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+VLC_TARGET
+void I420_R5G6B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
#if defined (MODULE_NAME_IS_i420_rgb_sse2)
- if( p_filter->fmt_in.video.i_width & 15 )
- {
- i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
/*
** SSE2 128 bits fetch/store instructions are faster
#else // defined (MODULE_NAME_IS_i420_rgb_mmx)
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{
#if defined (MODULE_NAME_IS_i420_rgb)
-void I420_RGB32( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+void I420_RGB32( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
- p_src->p[1].i_visible_pitch;
i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
-
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
/* 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'
#else // defined (MODULE_NAME_IS_i420_rgb_mmx) || defined (MODULE_NAME_IS_i420_rgb_sse2)
+VLC_TARGET
void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
picture_t *p_dest )
{
#if defined (MODULE_NAME_IS_i420_rgb_sse2)
- if( p_filter->fmt_in.video.i_width & 15 )
- {
- i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
/*
** SSE2 128 bits fetch/store instructions are faster
#else // defined (MODULE_NAME_IS_i420_rgb_mmx)
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{
#endif
}
-void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+VLC_TARGET
+void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
#if defined (MODULE_NAME_IS_i420_rgb_sse2)
- if( p_filter->fmt_in.video.i_width & 15 )
- {
- i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
/*
** SSE2 128 bits fetch/store instructions are faster
#else // defined (MODULE_NAME_IS_i420_rgb_mmx)
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{
#endif
}
-void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+VLC_TARGET
+void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
#if defined (MODULE_NAME_IS_i420_rgb_sse2)
- if( p_filter->fmt_in.video.i_width & 15 )
- {
- i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
/*
** SSE2 128 bits fetch/store instructions are faster
#else
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{
#endif
}
-void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src,
- picture_t *p_dest )
+VLC_TARGET
+void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{
/* We got this one from the old arguments */
uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
#if defined (MODULE_NAME_IS_i420_rgb_sse2)
- if( p_filter->fmt_in.video.i_width & 15 )
- {
- i_rewind = 16 - ( p_filter->fmt_in.video.i_width & 15 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 15;
/*
** SSE2 128 bits fetch/store instructions are faster
#else
- if( p_filter->fmt_in.video.i_width & 7 )
- {
- i_rewind = 8 - ( p_filter->fmt_in.video.i_width & 7 );
- }
- else
- {
- i_rewind = 0;
- }
+ i_rewind = (-p_filter->fmt_in.video.i_width) & 7;
for( i_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{