Commit 2e2178f7 authored by Antoine Cellerier's avatar Antoine Cellerier

Chroma API change. Chromas are now normal video filters (almost).

parent efc57198
...@@ -221,7 +221,6 @@ typedef struct aout_filter_t aout_filter_t; ...@@ -221,7 +221,6 @@ typedef struct aout_filter_t aout_filter_t;
/* Video */ /* Video */
typedef struct vout_thread_t vout_thread_t; typedef struct vout_thread_t vout_thread_t;
typedef struct vout_sys_t vout_sys_t; typedef struct vout_sys_t vout_sys_t;
typedef struct chroma_sys_t chroma_sys_t;
typedef video_format_t video_frame_format_t; typedef video_format_t video_frame_format_t;
typedef struct picture_t picture_t; typedef struct picture_t picture_t;
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#ifndef _VLC_ES_H #ifndef _VLC_ES_H
#define _VLC_ES_H 1 #define _VLC_ES_H 1
/* FIXME: i'm not too sure about this include but it fixes compilation of
* video chromas -- dionoea */
#include "vlc_common.h"
/** /**
* \file * \file
* This file defines the elementary streams format types * This file defines the elementary streams format types
...@@ -130,6 +134,9 @@ struct video_format_t ...@@ -130,6 +134,9 @@ struct video_format_t
unsigned int i_frame_rate_base; /**< frame rate denominator */ unsigned int i_frame_rate_base; /**< frame rate denominator */
int i_rmask, i_gmask, i_bmask; /**< color masks for RGB chroma */ int i_rmask, i_gmask, i_bmask; /**< color masks for RGB chroma */
int i_rrshift, i_lrshift;
int i_rgshift, i_lgshift;
int i_rbshift, i_lbshift;
video_palette_t *p_palette; /**< video palette from demuxer */ video_palette_t *p_palette; /**< video palette from demuxer */
}; };
......
...@@ -60,6 +60,7 @@ struct filter_t ...@@ -60,6 +60,7 @@ struct filter_t
config_chain_t * p_cfg; config_chain_t * p_cfg;
picture_t * ( * pf_video_filter ) ( filter_t *, picture_t * ); picture_t * ( * pf_video_filter ) ( filter_t *, picture_t * );
void ( * pf_video_filter_io ) ( filter_t *, picture_t *, picture_t * ); /* Used by video filters with a preallocated output buffer (ie chroma conversion modules) */
block_t * ( * pf_audio_filter ) ( filter_t *, block_t * ); block_t * ( * pf_audio_filter ) ( filter_t *, block_t * );
void ( * pf_video_blend ) ( filter_t *, picture_t *, void ( * pf_video_blend ) ( filter_t *, picture_t *,
picture_t *, picture_t *, picture_t *, picture_t *,
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
#define VLC_OBJECT_HTTPD_HOST (-30) #define VLC_OBJECT_HTTPD_HOST (-30)
#define VLC_OBJECT_INTERACTION (-32) #define VLC_OBJECT_INTERACTION (-32)
#define VLC_OBJECT_CHROMA (-33)
#define VLC_OBJECT_GENERIC (-666) #define VLC_OBJECT_GENERIC (-666)
......
/***************************************************************************** /*****************************************************************************
* vlc_video.h: common video definitions * vlc_video.h: common video definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999 - 2005 the VideoLAN team * Copyright (C) 1999 - 2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
...@@ -365,31 +365,6 @@ VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic ...@@ -365,31 +365,6 @@ VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic
* @{ * @{
*/ */
/**
* Chroma conversion function
*
* This is the prototype common to all conversion functions.
* \param p_vout video output thread
* \param p_source source picture
* \param p_dest destination picture
* Picture width and source dimensions must be multiples of 16.
*/
typedef void (vout_chroma_convert_t)( vout_thread_t *,
picture_t *, picture_t * );
typedef struct vout_chroma_t
{
/** conversion functions */
vout_chroma_convert_t *pf_convert;
/** Private module-dependent data */
chroma_sys_t * p_sys; /* private data */
/** Plugin used and shortcuts to access its capabilities */
module_t * p_module;
} vout_chroma_t;
/** Maximum numbers of video filters2 that can be attached to a vout */ /** Maximum numbers of video filters2 that can be attached to a vout */
#define MAX_VFILTERS 10 #define MAX_VFILTERS 10
...@@ -462,7 +437,7 @@ struct vout_thread_t ...@@ -462,7 +437,7 @@ struct vout_thread_t
picture_heap_t render; /**< rendered pictures */ picture_heap_t render; /**< rendered pictures */
picture_heap_t output; /**< direct buffers */ picture_heap_t output; /**< direct buffers */
bool b_direct; /**< rendered are like direct ? */ bool b_direct; /**< rendered are like direct ? */
vout_chroma_t chroma; /**< translation tables */ filter_t *p_chroma; /**< translation tables */
video_format_t fmt_render; /* render format (from the decoder) */ video_format_t fmt_render; /* render format (from the decoder) */
video_format_t fmt_in; /* input (modified render) format */ video_format_t fmt_in; /* input (modified render) format */
......
This diff is collapsed.
...@@ -252,13 +252,13 @@ vlc_module_begin(); ...@@ -252,13 +252,13 @@ vlc_module_begin();
set_capability( "crop padd", 10 ); set_capability( "crop padd", 10 );
set_callbacks( OpenCropPadd, CloseFilter ); set_callbacks( OpenCropPadd, CloseFilter );
set_description( N_("FFmpeg crop padd filter") ); set_description( N_("FFmpeg crop padd filter") );
#endif
/* chroma conversion submodule */ /* chroma conversion submodule */
add_submodule(); add_submodule();
set_capability( "chroma", 50 ); set_capability( "chroma", 50 );
set_callbacks( OpenChroma, CloseChroma ); set_callbacks( OpenChroma, CloseChroma );
set_description( N_("FFmpeg chroma conversion") ); set_description( N_("FFmpeg chroma conversion") );
#endif
/* video filter submodule */ /* video filter submodule */
add_submodule(); add_submodule();
......
/***************************************************************************** /*****************************************************************************
* chain.c : chain multiple chroma modules as a last resort solution * chain.c : chain multiple chroma modules as a last resort solution
***************************************************************************** *****************************************************************************
* Copyright (C) 2007 the VideoLAN team * Copyright (C) 2007-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Antoine Cellerier <dionoea at videolan dot org> * Authors: Antoine Cellerier <dionoea at videolan dot org>
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_vout.h> #include <vlc_vout.h>
/***************************************************************************** /*****************************************************************************
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,7 @@
*****************************************************************************/ *****************************************************************************/
static int Activate ( vlc_object_t * ); static int Activate ( vlc_object_t * );
static void Destroy ( vlc_object_t * ); static void Destroy ( vlc_object_t * );
static void Chain ( vout_thread_t *, picture_t *, picture_t * ); static void Chain ( filter_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -51,12 +52,12 @@ vlc_module_end(); ...@@ -51,12 +52,12 @@ vlc_module_end();
#define MAX_CHROMAS 2 #define MAX_CHROMAS 2
struct chroma_sys_t struct filter_sys_t
{ {
vlc_fourcc_t i_chroma; vlc_fourcc_t i_chroma;
vout_chroma_t chroma1; filter_t *p_chroma1;
vout_chroma_t chroma2; filter_t *p_chroma2;
picture_t *p_tmp; picture_t *p_tmp;
}; };
...@@ -64,6 +65,8 @@ struct chroma_sys_t ...@@ -64,6 +65,8 @@ struct chroma_sys_t
static const vlc_fourcc_t pi_allowed_chromas[] = { static const vlc_fourcc_t pi_allowed_chromas[] = {
VLC_FOURCC('I','4','2','0'), VLC_FOURCC('I','4','2','0'),
VLC_FOURCC('I','4','2','2'), VLC_FOURCC('I','4','2','2'),
VLC_FOURCC('R','V','3','2'),
VLC_FOURCC('R','V','2','4'),
0 0
}; };
...@@ -74,8 +77,9 @@ static const vlc_fourcc_t pi_allowed_chromas[] = { ...@@ -74,8 +77,9 @@ static const vlc_fourcc_t pi_allowed_chromas[] = {
*****************************************************************************/ *****************************************************************************/
static int Activate( vlc_object_t *p_this ) static int Activate( vlc_object_t *p_this )
{ {
#if 0
static int hack = 1; static int hack = 1;
vout_thread_t *p_vout = (vout_thread_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
hack++; hack++;
if( hack > MAX_CHROMAS ) if( hack > MAX_CHROMAS )
...@@ -86,25 +90,25 @@ static int Activate( vlc_object_t *p_this ) ...@@ -86,25 +90,25 @@ static int Activate( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
chroma_sys_t *p_sys = (chroma_sys_t *)malloc( sizeof( chroma_sys_t ) ); filter_sys_t *p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) );
if( !p_sys ) if( !p_sys )
{ {
hack--; hack--;
return VLC_ENOMEM; return VLC_ENOMEM;
} }
memset( p_sys, 0, sizeof( chroma_sys_t ) ); memset( p_sys, 0, sizeof( filter_sys_t ) );
int i; int i;
vlc_fourcc_t i_output_chroma = p_vout->output.i_chroma; vlc_fourcc_t i_output_chroma = p_filter->fmt_in.video.i_chroma;
vlc_fourcc_t i_render_chroma = p_vout->render.i_chroma; vlc_fourcc_t i_render_chroma = p_filter->fmt_out.video.i_chroma;
for( i = 0; pi_allowed_chromas[i]; i++ ) for( i = 0; pi_allowed_chromas[i]; i++ )
{ {
msg_Warn( p_vout, "Trying %4s as a chroma chain", msg_Warn( p_filter, "Trying %4s as a chroma chain",
(const char *)&pi_allowed_chromas[i] ); (const char *)&pi_allowed_chromas[i] );
p_vout->output.i_chroma = pi_allowed_chromas[i]; p_filter->output.i_chroma = pi_allowed_chromas[i];
p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL, 0 ); p_filter->p_chroma1.p_module = module_Need( p_vout, "chroma", NULL, 0 );
p_vout->output.i_chroma = i_output_chroma; p_filter->output.i_chroma = i_output_chroma;
if( !p_vout->chroma.p_module ) if( !p_vout->chroma.p_module )
continue; continue;
...@@ -136,15 +140,16 @@ static int Activate( vlc_object_t *p_this ) ...@@ -136,15 +140,16 @@ static int Activate( vlc_object_t *p_this )
free( p_sys ); free( p_sys );
hack--; hack--;
#endif
return VLC_EGENERIC; return VLC_EGENERIC;
} }
static void Destroy( vlc_object_t *p_this ) static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; #if 0
filter_t *p_filter = (filter_t *)p_this;
vout_chroma_t chroma = p_vout->chroma; vout_chroma_t chroma = p_vout->chroma;
p_vout->chroma = chroma.p_sys->chroma1; p_vout->chroma = chroma.p_sys->chroma1;
module_Unneed( p_vout, p_vout->chroma.p_module ); module_Unneed( p_vout, p_vout->chroma.p_module );
p_vout->chroma = chroma.p_sys->chroma2; p_vout->chroma = chroma.p_sys->chroma2;
...@@ -158,14 +163,16 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -158,14 +163,16 @@ static void Destroy( vlc_object_t *p_this )
} }
free( chroma.p_sys ); free( chroma.p_sys );
chroma.p_sys = NULL; chroma.p_sys = NULL;
#endif
} }
/***************************************************************************** /*****************************************************************************
* Chain * Chain
*****************************************************************************/ *****************************************************************************/
static void Chain( vout_thread_t *p_vout, picture_t *p_source, static void Chain( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
#if 0
chroma_sys_t *p_sys = p_vout->chroma.p_sys; chroma_sys_t *p_sys = p_vout->chroma.p_sys;
if( !p_sys->p_tmp ) if( !p_sys->p_tmp )
...@@ -190,4 +197,5 @@ static void Chain( vout_thread_t *p_vout, picture_t *p_source, ...@@ -190,4 +197,5 @@ static void Chain( vout_thread_t *p_vout, picture_t *p_source,
p_vout->chroma = p_sys->chroma2; p_vout->chroma = p_sys->chroma2;
p_sys->chroma2.pf_convert( p_vout, p_sys->p_tmp, p_dest ); p_sys->chroma2.pf_convert( p_vout, p_sys->p_tmp, p_dest );
p_vout->chroma = chroma; p_vout->chroma = chroma;
#endif
} }
/***************************************************************************** /*****************************************************************************
* grey_yuv.c : grayscale to others conversion module for vlc * grey_yuv.c : grayscale to others conversion module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2007 the VideoLAN team * Copyright (C) 2007, 2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Sam Hocevar <sam@zoy.org> * Authors: Sam Hocevar <sam@zoy.org>
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#define SRC_FOURCC "GREY" #define SRC_FOURCC "GREY"
...@@ -41,8 +42,8 @@ ...@@ -41,8 +42,8 @@
*****************************************************************************/ *****************************************************************************/
static int Activate ( vlc_object_t * ); static int Activate ( vlc_object_t * );
static void GREY_I420 ( vout_thread_t *, picture_t *, picture_t * ); static void GREY_I420( filter_t *, picture_t *, picture_t * );
static void GREY_YUY2 ( vout_thread_t *, picture_t *, picture_t * ); static void GREY_YUY2( filter_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor. * Module descriptor.
...@@ -60,25 +61,26 @@ vlc_module_end(); ...@@ -60,25 +61,26 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static int Activate( vlc_object_t *p_this ) static int Activate( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) if( p_filter->fmt_out.video.i_width & 1
|| p_filter->fmt_out.video.i_height & 1 )
{ {
return -1; return -1;
} }
switch( p_vout->render.i_chroma ) switch( p_filter->fmt_in.video.i_chroma )
{ {
case VLC_FOURCC('Y','8','0','0'): case VLC_FOURCC('Y','8','0','0'):
p_vout->render.i_chroma = VLC_FOURCC('G','R','E','Y'); p_filter->fmt_in.video.i_chroma = VLC_FOURCC('G','R','E','Y');
case VLC_FOURCC('G','R','E','Y'): case VLC_FOURCC('G','R','E','Y'):
switch( p_vout->output.i_chroma ) switch( p_filter->fmt_out.video.i_chroma )
{ {
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
p_vout->chroma.pf_convert = GREY_I420; p_filter->pf_video_filter_io = GREY_I420;
break; break;
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
p_vout->chroma.pf_convert = GREY_YUY2; p_filter->pf_video_filter_io = GREY_YUY2;
break; break;
default: default:
return -1; return -1;
...@@ -97,7 +99,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -97,7 +99,7 @@ static int Activate( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* GREY_I420: 8-bit grayscale to planar YUV 4:2:0 * GREY_I420: 8-bit grayscale to planar YUV 4:2:0
*****************************************************************************/ *****************************************************************************/
static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source, static void GREY_I420( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_line = p_source->p->p_pixels; uint8_t *p_line = p_source->p->p_pixels;
...@@ -114,7 +116,7 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source, ...@@ -114,7 +116,7 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source,
const int i_dest_margin_c = p_dest->p[1].i_pitch const int i_dest_margin_c = p_dest->p[1].i_pitch
- p_dest->p[1].i_visible_pitch; - p_dest->p[1].i_visible_pitch;
for( i_y = p_vout->render.i_height / 2; i_y-- ; ) for( i_y = p_filter->fmt_in.video.i_height / 2; i_y-- ; )
{ {
memset(p_u, 0x80, p_dest->p[1].i_visible_pitch); memset(p_u, 0x80, p_dest->p[1].i_visible_pitch);
p_u += i_dest_margin_c; p_u += i_dest_margin_c;
...@@ -123,9 +125,9 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source, ...@@ -123,9 +125,9 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source,
p_v += i_dest_margin_c; p_v += i_dest_margin_c;
} }
for( i_y = p_vout->render.i_height; i_y-- ; ) for( i_y = p_filter->fmt_in.video.i_height; i_y-- ; )
{ {
for( i_x = p_vout->render.i_width / 8; i_x-- ; ) for( i_x = p_filter->fmt_in.video.i_width / 8; i_x-- ; )
{ {
*p_y++ = *p_line++; *p_y++ = *p_line++; *p_y++ = *p_line++; *p_y++ = *p_line++;
*p_y++ = *p_line++; *p_y++ = *p_line++; *p_y++ = *p_line++; *p_y++ = *p_line++;
...@@ -133,7 +135,7 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source, ...@@ -133,7 +135,7 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source,
*p_y++ = *p_line++; *p_y++ = *p_line++; *p_y++ = *p_line++; *p_y++ = *p_line++;
} }
for( i_x = p_vout->render.i_width % 8; i_x-- ; ) for( i_x = p_filter->fmt_in.video.i_width % 8; i_x-- ; )
{ {
*p_y++ = *p_line++; *p_y++ = *p_line++;
} }
...@@ -146,7 +148,7 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source, ...@@ -146,7 +148,7 @@ static void GREY_I420( vout_thread_t *p_vout, picture_t *p_source,
/***************************************************************************** /*****************************************************************************
* GREY_YUY2: 8-bit grayscale to packed YUY2 * GREY_YUY2: 8-bit grayscale to packed YUY2
*****************************************************************************/ *****************************************************************************/
static void GREY_YUY2( vout_thread_t *p_vout, picture_t *p_source, static void GREY_YUY2( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_in = p_source->p->p_pixels; uint8_t *p_in = p_source->p->p_pixels;
...@@ -159,9 +161,9 @@ static void GREY_YUY2( vout_thread_t *p_vout, picture_t *p_source, ...@@ -159,9 +161,9 @@ static void GREY_YUY2( vout_thread_t *p_vout, picture_t *p_source,
const int i_dest_margin = p_dest->p->i_pitch const int i_dest_margin = p_dest->p->i_pitch
- p_dest->p->i_visible_pitch; - p_dest->p->i_visible_pitch;
for( i_y = p_vout->render.i_height; i_y-- ; ) for( i_y = p_filter->fmt_out.video.i_height; i_y-- ; )
{ {
for( i_x = p_vout->render.i_width / 8; i_x-- ; ) for( i_x = p_filter->fmt_out.video.i_width / 8; i_x-- ; )
{ {
*p_out++ = *p_in++; *p_out++ = 0x80; *p_out++ = *p_in++; *p_out++ = 0x80;
*p_out++ = *p_in++; *p_out++ = 0x80; *p_out++ = *p_in++; *p_out++ = 0x80;
...@@ -173,7 +175,7 @@ static void GREY_YUY2( vout_thread_t *p_vout, picture_t *p_source, ...@@ -173,7 +175,7 @@ static void GREY_YUY2( vout_thread_t *p_vout, picture_t *p_source,
*p_out++ = *p_in++; *p_out++ = 0x80; *p_out++ = *p_in++; *p_out++ = 0x80;
} }
for( i_x = (p_vout->render.i_width % 8) / 2; i_x-- ; ) for( i_x = (p_filter->fmt_out.video.i_width % 8) / 2; i_x-- ; )
{ {
*p_out++ = *p_in++; *p_out++ = 0x80; *p_out++ = *p_in++; *p_out++ = 0x80;
*p_out++ = *p_in++; *p_out++ = 0x80; *p_out++ = *p_in++; *p_out++ = 0x80;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include <vlc_common.h> #include <vlc/vlc.h>
#include <vlc_filter.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include "i420_rgb.h" #include "i420_rgb.h"
...@@ -40,7 +41,7 @@ static void SetOffset( int, int, int, int, bool *, int *, int * ); ...@@ -40,7 +41,7 @@ static void SetOffset( int, int, int, int, bool *, int *, int * );
/***************************************************************************** /*****************************************************************************
* I420_RGB8: color YUV 4:2:0 to RGB 8 bpp * I420_RGB8: color YUV 4:2:0 to RGB 8 bpp
*****************************************************************************/ *****************************************************************************/
void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest ) void I420_RGB8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
{ {
/* We got this one from the old arguments */ /* We got this one from the old arguments */
uint8_t *p_pic = (uint8_t*)p_dest->p->p_pixels; uint8_t *p_pic = (uint8_t*)p_dest->p->p_pixels;
...@@ -54,13 +55,13 @@ void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest ) ...@@ -54,13 +55,13 @@ void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest )
unsigned int i_real_y; /* y % 4 */ unsigned int i_real_y; /* y % 4 */
int i_right_margin; int i_right_margin;
int i_scale_count; /* scale modulo counter */ int i_scale_count; /* scale modulo counter */
unsigned int i_chroma_width = p_vout->render.i_width / 2;/* chroma width */ unsigned int i_chroma_width = p_filter->fmt_in.video.i_width / 2;/* chroma width */
/* Lookup table */ /* Lookup table */
uint8_t * p_lookup = p_vout->chroma.p_sys->p_base; uint8_t * p_lookup = p_filter->p_sys->p_base;
/* Offset array pointer */ /* Offset array pointer */
int * p_offset_start = p_vout->chroma.p_sys->p_offset; int * p_offset_start = p_filter->p_sys->p_offset;
int * p_offset; int * p_offset;
const int i_source_margin = p_src->p[0].i_pitch const int i_source_margin = p_src->p[0].i_pitch
...@@ -79,8 +80,10 @@ void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest ) ...@@ -79,8 +80,10 @@ void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest )
static int dither22[4] = { 0x6, 0x16, 0x2, 0x12 }; static int dither22[4] = { 0x6, 0x16, 0x2, 0x12 };
static int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa }; static int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
SetOffset( p_vout->render.i_width, p_vout->render.i_height, SetOffset( p_filter->fmt_in.video.i_width,
p_vout->output.i_width, p_vout->output.i_height, p_filter->fmt_in.video.i_height,
p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height,
&b_hscale, &i_vscale, p_offset_start ); &b_hscale, &i_vscale, p_offset_start );
i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch; i_right_margin = p_dest->p->i_pitch - p_dest->p->i_visible_pitch;
...@@ -89,8 +92,9 @@ void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest ) ...@@ -89,8 +92,9 @@ void I420_RGB8( vout_thread_t *p_vout, picture_t *p_src, picture_t *p_dest )
* Perform conversion * Perform conversion
*/ */
i_scale_count = ( i_vscale == 1 ) ? i_scale_count = ( i_vscale == 1 ) ?
p_vout->output.i_height : p_vout->render.i_height; p_filter->fmt_out.video.i_height :
for( i_y = 0, i_real_y = 0; i_y < p_vout->render.i_height; i_y++ ) p_filter->fmt_in.video.i_height;
for( i_y = 0, i_real_y = 0; i_y < p_filter->fmt_in.video.i_height; i_y++ )
{ {
/* Do horizontal and vertical scaling */ /* Do horizontal and vertical scaling */
SCALE_WIDTH_DITHER( 420 ); SCALE_WIDTH_DITHER( 420 );
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#define SRC_FOURCC "I420,IYUV,YV12" #define SRC_FOURCC "I420,IYUV,YV12"
...@@ -41,7 +42,7 @@ ...@@ -41,7 +42,7 @@
* Local and extern prototypes. * Local and extern prototypes.
*****************************************************************************/ *****************************************************************************/
static int Activate ( vlc_object_t * ); static int Activate ( vlc_object_t * );
static void I420_YMGA ( vout_thread_t *, picture_t *, picture_t * ); static void I420_YMGA ( filter_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -65,22 +66,23 @@ vlc_module_end(); ...@@ -65,22 +66,23 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static int Activate( vlc_object_t *p_this ) static int Activate( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) if( p_filter->fmt_in.video.i_width & 1
|| p_filter->fmt_in.video.i_height & 1 )
{ {
return -1; return -1;
} }
switch( p_vout->render.i_chroma ) switch( p_filter->fmt_in.video.i_chroma )
{ {
case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('Y','V','1','2'):
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'): case VLC_FOURCC('I','Y','U','V'):
switch( p_vout->output.i_chroma ) switch( p_filter->fmt_out.video.i_chroma )
{ {
case VLC_FOURCC('Y','M','G','A'): case VLC_FOURCC('Y','M','G','A'):
p_vout->chroma.pf_convert = I420_YMGA; p_filter->pf_video_filter_io = I420_YMGA;
break; break;
default: default:
...@@ -100,7 +102,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -100,7 +102,7 @@ static int Activate( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* I420_YMGA: planar YUV 4:2:0 to Matrox's planar/packed YUV 4:2:0 * I420_YMGA: planar YUV 4:2:0 to Matrox's planar/packed YUV 4:2:0
*****************************************************************************/ *****************************************************************************/
static void I420_YMGA( vout_thread_t *p_vout, picture_t *p_source, static void I420_YMGA( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_uv = p_dest->U_PIXELS; uint8_t *p_uv = p_dest->U_PIXELS;
......
This diff is collapsed.
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#define SRC_FOURCC "I422,J422" #define SRC_FOURCC "I422,J422"
...@@ -42,9 +43,9 @@ ...@@ -42,9 +43,9 @@
*****************************************************************************/ *****************************************************************************/
static int Activate ( vlc_object_t * ); static int Activate ( vlc_object_t * );
static void I422_I420( vout_thread_t *, picture_t *, picture_t * ); static void I422_I420( filter_t *, picture_t *, picture_t * );
static void I422_YV12( vout_thread_t *, picture_t *, picture_t * ); static void I422_YV12( filter_t *, picture_t *, picture_t * );
static void I422_YUVA( vout_thread_t *, picture_t *, picture_t * ); static void I422_YUVA( filter_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -62,31 +63,32 @@ vlc_module_end(); ...@@ -62,31 +63,32 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static int Activate( vlc_object_t *p_this ) static int Activate( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) if( p_filter->fmt_in.video.i_width & 1
|| p_filter->fmt_in.video.i_height & 1 )
{ {
return -1; return -1;
} }
switch( p_vout->render.i_chroma ) switch( p_filter->fmt_in.video.i_chroma )
{ {
case VLC_FOURCC('I','4','2','2'): case VLC_FOURCC('I','4','2','2'):
case VLC_FOURCC('J','4','2','2'): case VLC_FOURCC('J','4','2','2'):
switch( p_vout->output.i_chroma ) switch( p_filter->fmt_out.video.i_chroma )
{ {
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'): case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('J','4','2','0'): case VLC_FOURCC('J','4','2','0'):
p_vout->chroma.pf_convert = I422_I420; p_filter->pf_video_filter_io = I422_I420;
break; break;
case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('Y','V','1','2'):
p_vout->chroma.pf_convert = I422_YV12; p_filter->pf_video_filter_io = I422_YV12;
break; break;
case VLC_FOURCC('Y','U','V','A'): case VLC_FOURCC('Y','U','V','A'):
p_vout->chroma.pf_convert = I422_YUVA; p_filter->pf_video_filter_io = I422_YUVA;
break; break;
default: default:
...@@ -105,15 +107,15 @@ static int Activate( vlc_object_t *p_this ) ...@@ -105,15 +107,15 @@ static int Activate( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* I422_I420: planar YUV 4:2:2 to planar I420 4:2:0 Y:U:V * I422_I420: planar YUV 4:2:2 to planar I420 4:2:0 Y:U:V
*****************************************************************************/ *****************************************************************************/
static void I422_I420( vout_thread_t *p_vout, picture_t *p_source, static void I422_I420( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint16_t i_dpy = p_dest->p[Y_PLANE].i_pitch; uint16_t i_dpy = p_dest->p[Y_PLANE].i_pitch;
uint16_t i_spy = p_source->p[Y_PLANE].i_pitch; uint16_t i_spy = p_source->p[Y_PLANE].i_pitch;
uint16_t i_dpuv = p_dest->p[U_PLANE].i_pitch; uint16_t i_dpuv = p_dest->p[U_PLANE].i_pitch;
uint16_t i_spuv = p_source->p[U_PLANE].i_pitch; uint16_t i_spuv = p_source->p[U_PLANE].i_pitch;
uint16_t i_width = p_vout->render.i_width; uint16_t i_width = p_filter->fmt_in.video.i_width;
uint16_t i_y = p_vout->render.i_height; uint16_t i_y = p_filter->fmt_in.video.i_height;
uint8_t *p_dy = p_dest->Y_PIXELS + (i_y-1)*i_dpy; uint8_t *p_dy = p_dest->Y_PIXELS + (i_y-1)*i_dpy;
uint8_t *p_y = p_source->Y_PIXELS + (i_y-1)*i_spy; uint8_t *p_y = p_source->Y_PIXELS + (i_y-1)*i_spy;
uint8_t *p_du = p_dest->U_PIXELS + (i_y/2-1)*i_dpuv; uint8_t *p_du = p_dest->U_PIXELS + (i_y/2-1)*i_dpuv;
...@@ -134,15 +136,15 @@ static void I422_I420( vout_thread_t *p_vout, picture_t *p_source, ...@@ -134,15 +136,15 @@ static void I422_I420( vout_thread_t *p_vout, picture_t *p_source,
/***************************************************************************** /*****************************************************************************
* I422_YV12: planar YUV 4:2:2 to planar YV12 4:2:0 Y:V:U * I422_YV12: planar YUV 4:2:2 to planar YV12 4:2:0 Y:V:U
*****************************************************************************/ *****************************************************************************/
static void I422_YV12( vout_thread_t *p_vout, picture_t *p_source, static void I422_YV12( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint16_t i_dpy = p_dest->p[Y_PLANE].i_pitch; uint16_t i_dpy = p_dest->p[Y_PLANE].i_pitch;
uint16_t i_spy = p_source->p[Y_PLANE].i_pitch; uint16_t i_spy = p_source->p[Y_PLANE].i_pitch;
uint16_t i_dpuv = p_dest->p[U_PLANE].i_pitch; uint16_t i_dpuv = p_dest->p[U_PLANE].i_pitch;
uint16_t i_spuv = p_source->p[U_PLANE].i_pitch; uint16_t i_spuv = p_source->p[U_PLANE].i_pitch;
uint16_t i_width = p_vout->render.i_width; uint16_t i_width = p_filter->fmt_in.video.i_width;
uint16_t i_y = p_vout->render.i_height; uint16_t i_y = p_filter->fmt_in.video.i_height;
uint8_t *p_dy = p_dest->Y_PIXELS + (i_y-1)*i_dpy; uint8_t *p_dy = p_dest->Y_PIXELS + (i_y-1)*i_dpy;
uint8_t *p_y = p_source->Y_PIXELS + (i_y-1)*i_spy; uint8_t *p_y = p_source->Y_PIXELS + (i_y-1)*i_spy;
uint8_t *p_du = p_dest->V_PIXELS + (i_y/2-1)*i_dpuv; /* U and V are swapped */ uint8_t *p_du = p_dest->V_PIXELS + (i_y/2-1)*i_dpuv; /* U and V are swapped */
...@@ -163,10 +165,10 @@ static void I422_YV12( vout_thread_t *p_vout, picture_t *p_source, ...@@ -163,10 +165,10 @@ static void I422_YV12( vout_thread_t *p_vout, picture_t *p_source,
/***************************************************************************** /*****************************************************************************
* I422_YUVA: planar YUV 4:2:2 to planar YUVA 4:2:0:4 Y:U:V:A * I422_YUVA: planar YUV 4:2:2 to planar YUVA 4:2:0:4 Y:U:V:A
*****************************************************************************/ *****************************************************************************/
static void I422_YUVA( vout_thread_t *p_vout, picture_t *p_source, static void I422_YUVA( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
I422_I420( p_vout, p_source, p_dest ); I422_I420( p_filter, p_source, p_dest );
vlc_memset( p_dest->p[A_PLANE].p_pixels, 0xff, vlc_memset( p_dest->p[A_PLANE].p_pixels, 0xff,
p_dest->p[A_PLANE].i_lines * p_dest->p[A_PLANE].i_pitch ); p_dest->p[A_PLANE].i_lines * p_dest->p[A_PLANE].i_pitch );
} }
This diff is collapsed.
This diff is collapsed.
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv" #define SRC_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,cyuv"
...@@ -41,10 +42,10 @@ ...@@ -41,10 +42,10 @@
*****************************************************************************/ *****************************************************************************/
static int Activate ( vlc_object_t * ); static int Activate ( vlc_object_t * );
static void YUY2_I422 ( vout_thread_t *, picture_t *, picture_t * ); static void YUY2_I422 ( filter_t *, picture_t *, picture_t * );
static void YVYU_I422 ( vout_thread_t *, picture_t *, picture_t * ); static void YVYU_I422 ( filter_t *, picture_t *, picture_t * );
static void UYVY_I422 ( vout_thread_t *, picture_t *, picture_t * ); static void UYVY_I422 ( filter_t *, picture_t *, picture_t * );
static void cyuv_I422 ( vout_thread_t *, picture_t *, picture_t * ); static void cyuv_I422 ( filter_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -62,35 +63,36 @@ vlc_module_end(); ...@@ -62,35 +63,36 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static int Activate( vlc_object_t *p_this ) static int Activate( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
if( p_vout->render.i_width & 1 || p_vout->render.i_height & 1 ) if( p_filter->fmt_in.video.i_width & 1
|| p_filter->fmt_in.video.i_height & 1 )
{ {
return -1; return -1;
} }
switch( p_vout->output.i_chroma ) switch( p_filter->fmt_out.video.i_chroma )
{ {
case VLC_FOURCC('I','4','2','2'): case VLC_FOURCC('I','4','2','2'):
switch( p_vout->render.i_chroma ) switch( p_filter->fmt_in.video.i_chroma )
{ {
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('Y','U','N','V'): case VLC_FOURCC('Y','U','N','V'):
p_vout->chroma.pf_convert = YUY2_I422; p_filter->pf_video_filter_io = YUY2_I422;
break; break;
case VLC_FOURCC('Y','V','Y','U'): case VLC_FOURCC('Y','V','Y','U'):
p_vout->chroma.pf_convert = YVYU_I422; p_filter->pf_video_filter_io = YVYU_I422;
break; break;
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
case VLC_FOURCC('U','Y','N','V'): case VLC_FOURCC('U','Y','N','V'):
case VLC_FOURCC('Y','4','2','2'): case VLC_FOURCC('Y','4','2','2'):
p_vout->chroma.pf_convert = UYVY_I422; p_filter->pf_video_filter_io = UYVY_I422;
break; break;
case VLC_FOURCC('c','y','u','v'): case VLC_FOURCC('c','y','u','v'):
p_vout->chroma.pf_convert = cyuv_I422; p_filter->pf_video_filter_io = cyuv_I422;
break; break;
default: default:
...@@ -109,7 +111,7 @@ static int Activate( vlc_object_t *p_this ) ...@@ -109,7 +111,7 @@ static int Activate( vlc_object_t *p_this )
/***************************************************************************** /*****************************************************************************
* YUY2_I422: packed YUY2 4:2:2 to planar YUV 4:2:2 * YUY2_I422: packed YUY2 4:2:2 to planar YUV 4:2:2
*****************************************************************************/ *****************************************************************************/
static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, static void YUY2_I422( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_line = p_source->p->p_pixels; uint8_t *p_line = p_source->p->p_pixels;
...@@ -127,9 +129,9 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -127,9 +129,9 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source,
const int i_source_margin = p_source->p->i_pitch const int i_source_margin = p_source->p->i_pitch
- p_source->p->i_visible_pitch; - p_source->p->i_visible_pitch;
for( i_y = p_vout->output.i_height ; i_y-- ; ) for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
{ {
for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
{ {
#define C_YUYV_YUV422( p_line, p_y, p_u, p_v ) \ #define C_YUYV_YUV422( p_line, p_y, p_u, p_v ) \
*p_y++ = *p_line++; *p_u++ = *p_line++; \ *p_y++ = *p_line++; *p_u++ = *p_line++; \
...@@ -139,7 +141,7 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -139,7 +141,7 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source,
C_YUYV_YUV422( p_line, p_y, p_u, p_v ); C_YUYV_YUV422( p_line, p_y, p_u, p_v );
C_YUYV_YUV422( p_line, p_y, p_u, p_v ); C_YUYV_YUV422( p_line, p_y, p_u, p_v );
} }
for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; ) for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
{ {
C_YUYV_YUV422( p_line, p_y, p_u, p_v ); C_YUYV_YUV422( p_line, p_y, p_u, p_v );
} }
...@@ -153,7 +155,7 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -153,7 +155,7 @@ static void YUY2_I422( vout_thread_t *p_vout, picture_t *p_source,
/***************************************************************************** /*****************************************************************************
* YVYU_I422: packed YVYU 4:2:2 to planar YUV 4:2:2 * YVYU_I422: packed YVYU 4:2:2 to planar YUV 4:2:2
*****************************************************************************/ *****************************************************************************/
static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, static void YVYU_I422( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_line = p_source->p->p_pixels; uint8_t *p_line = p_source->p->p_pixels;
...@@ -171,9 +173,9 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -171,9 +173,9 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source,
const int i_source_margin = p_source->p->i_pitch const int i_source_margin = p_source->p->i_pitch
- p_source->p->i_visible_pitch; - p_source->p->i_visible_pitch;
for( i_y = p_vout->output.i_height ; i_y-- ; ) for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
{ {
for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
{ {
#define C_YVYU_YUV422( p_line, p_y, p_u, p_v ) \ #define C_YVYU_YUV422( p_line, p_y, p_u, p_v ) \
*p_y++ = *p_line++; *p_v++ = *p_line++; \ *p_y++ = *p_line++; *p_v++ = *p_line++; \
...@@ -183,7 +185,7 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -183,7 +185,7 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source,
C_YVYU_YUV422( p_line, p_y, p_u, p_v ); C_YVYU_YUV422( p_line, p_y, p_u, p_v );
C_YVYU_YUV422( p_line, p_y, p_u, p_v ); C_YVYU_YUV422( p_line, p_y, p_u, p_v );
} }
for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; ) for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
{ {
C_YVYU_YUV422( p_line, p_y, p_u, p_v ); C_YVYU_YUV422( p_line, p_y, p_u, p_v );
} }
...@@ -197,7 +199,7 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -197,7 +199,7 @@ static void YVYU_I422( vout_thread_t *p_vout, picture_t *p_source,
/***************************************************************************** /*****************************************************************************
* UYVY_I422: packed UYVY 4:2:2 to planar YUV 4:2:2 * UYVY_I422: packed UYVY 4:2:2 to planar YUV 4:2:2
*****************************************************************************/ *****************************************************************************/
static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, static void UYVY_I422( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_line = p_source->p->p_pixels; uint8_t *p_line = p_source->p->p_pixels;
...@@ -215,9 +217,9 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -215,9 +217,9 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source,
const int i_source_margin = p_source->p->i_pitch const int i_source_margin = p_source->p->i_pitch
- p_source->p->i_visible_pitch; - p_source->p->i_visible_pitch;
for( i_y = p_vout->output.i_height ; i_y-- ; ) for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
{ {
for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
{ {
#define C_UYVY_YUV422( p_line, p_y, p_u, p_v ) \ #define C_UYVY_YUV422( p_line, p_y, p_u, p_v ) \
*p_u++ = *p_line++; *p_y++ = *p_line++; \ *p_u++ = *p_line++; *p_y++ = *p_line++; \
...@@ -227,7 +229,7 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -227,7 +229,7 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source,
C_UYVY_YUV422( p_line, p_y, p_u, p_v ); C_UYVY_YUV422( p_line, p_y, p_u, p_v );
C_UYVY_YUV422( p_line, p_y, p_u, p_v ); C_UYVY_YUV422( p_line, p_y, p_u, p_v );
} }
for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; ) for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
{ {
C_UYVY_YUV422( p_line, p_y, p_u, p_v ); C_UYVY_YUV422( p_line, p_y, p_u, p_v );
} }
...@@ -242,7 +244,7 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -242,7 +244,7 @@ static void UYVY_I422( vout_thread_t *p_vout, picture_t *p_source,
* cyuv_I422: upside-down packed UYVY 4:2:2 to planar YUV 4:2:2 * cyuv_I422: upside-down packed UYVY 4:2:2 to planar YUV 4:2:2
* FIXME * FIXME
*****************************************************************************/ *****************************************************************************/
static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source, static void cyuv_I422( filter_t *p_filter, picture_t *p_source,
picture_t *p_dest ) picture_t *p_dest )
{ {
uint8_t *p_line = p_source->p->p_pixels; uint8_t *p_line = p_source->p->p_pixels;
...@@ -260,9 +262,9 @@ static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -260,9 +262,9 @@ static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source,
const int i_source_margin = p_source->p->i_pitch const int i_source_margin = p_source->p->i_pitch
- p_source->p->i_visible_pitch; - p_source->p->i_visible_pitch;
for( i_y = p_vout->output.i_height ; i_y-- ; ) for( i_y = p_filter->fmt_out.video.i_height ; i_y-- ; )
{ {
for( i_x = p_vout->output.i_width / 8 ; i_x-- ; ) for( i_x = p_filter->fmt_out.video.i_width / 8 ; i_x-- ; )
{ {
#define C_cyuv_YUV422( p_line, p_y, p_u, p_v ) \ #define C_cyuv_YUV422( p_line, p_y, p_u, p_v ) \
*p_y++ = *p_line++; *p_v++ = *p_line++; \ *p_y++ = *p_line++; *p_v++ = *p_line++; \
...@@ -272,7 +274,7 @@ static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source, ...@@ -272,7 +274,7 @@ static void cyuv_I422( vout_thread_t *p_vout, picture_t *p_source,
C_cyuv_YUV422( p_line, p_y, p_u, p_v ); C_cyuv_YUV422( p_line, p_y, p_u, p_v );
C_cyuv_YUV422( p_line, p_y, p_u, p_v ); C_cyuv_YUV422( p_line, p_y, p_u, p_v );
} }
for( i_x = ( p_vout->output.i_width % 8 ) / 2; i_x-- ; ) for( i_x = ( p_filter->fmt_out.video.i_width % 8 ) / 2; i_x-- ; )
{ {
C_cyuv_YUV422( p_line, p_y, p_u, p_v ); C_cyuv_YUV422( p_line, p_y, p_u, p_v );
} }
......
...@@ -655,13 +655,34 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -655,13 +655,34 @@ static int InitThread( vout_thread_t *p_vout )
p_vout->b_direct = 0; p_vout->b_direct = 0;
/* Choose the best module */ /* Choose the best module */
p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL, 0 ); p_vout->p_chroma = vlc_object_create( p_vout, VLC_OBJECT_FILTER );
filter_t *p_chroma = p_vout->p_chroma;
if( p_vout->chroma.p_module == NULL ) vlc_object_attach( p_chroma, p_vout );
/* TODO: Set the fmt_in and fmt_out stuff here */
p_chroma->fmt_in.video = p_vout->fmt_render;
p_chroma->fmt_out.video = p_vout->fmt_out;
/* TODO: put in a function */
p_chroma->fmt_out.video.i_rmask = p_vout->output.i_rmask;
p_chroma->fmt_out.video.i_gmask = p_vout->output.i_gmask;
p_chroma->fmt_out.video.i_bmask = p_vout->output.i_bmask;
p_chroma->fmt_out.video.i_rrshift = p_vout->output.i_rrshift;
p_chroma->fmt_out.video.i_lrshift = p_vout->output.i_lrshift;
p_chroma->fmt_out.video.i_rgshift = p_vout->output.i_rgshift;
p_chroma->fmt_out.video.i_lgshift = p_vout->output.i_lgshift;
p_chroma->fmt_out.video.i_rbshift = p_vout->output.i_rbshift;
p_chroma->fmt_out.video.i_lbshift = p_vout->output.i_lbshift;
msg_Err( p_vout, "HOLA! %4.4s\n", (char*)&p_chroma->fmt_in.video.i_chroma );
msg_Err( p_vout, "HOLA! %4.4s\n", (char*)&p_chroma->fmt_out.video.i_chroma );
p_chroma->p_module = module_Need( p_chroma, "chroma", NULL, 0 );
if( p_chroma->p_module == NULL )
{ {
msg_Err( p_vout, "no chroma module for %4.4s to %4.4s", msg_Err( p_vout, "no chroma module for %4.4s to %4.4s",
(char*)&p_vout->render.i_chroma, (char*)&p_vout->render.i_chroma,
(char*)&p_vout->output.i_chroma ); (char*)&p_vout->output.i_chroma );
vlc_object_detach( p_vout->p_chroma );
p_vout->p_chroma = NULL;
p_vout->pf_end( p_vout ); p_vout->pf_end( p_vout );
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -1153,11 +1174,11 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1153,11 +1174,11 @@ static void RunThread( vout_thread_t *p_vout)
} }
/* Need to reinitialise the chroma plugin */ /* Need to reinitialise the chroma plugin */
if( p_vout->chroma.p_module ) if( p_vout->p_chroma->p_module )
{ {
if( p_vout->chroma.p_module->pf_deactivate ) if( p_vout->p_chroma->p_module->pf_deactivate )
p_vout->chroma.p_module->pf_deactivate( VLC_OBJECT(p_vout) ); p_vout->p_chroma->p_module->pf_deactivate( VLC_OBJECT(p_vout->p_chroma) );
p_vout->chroma.p_module->pf_activate( VLC_OBJECT(p_vout) ); p_vout->p_chroma->p_module->pf_activate( VLC_OBJECT(p_vout->p_chroma) );
} }
} }
...@@ -1172,7 +1193,8 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1172,7 +1193,8 @@ static void RunThread( vout_thread_t *p_vout)
if( !p_vout->b_direct ) if( !p_vout->b_direct )
{ {
module_Unneed( p_vout, p_vout->chroma.p_module ); module_Unneed( p_vout->p_chroma, p_vout->p_chroma->p_module );
p_vout->p_chroma = NULL;
} }
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -1245,7 +1267,8 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -1245,7 +1267,8 @@ static void EndThread( vout_thread_t *p_vout )
if( !p_vout->b_direct ) if( !p_vout->b_direct )
{ {
module_Unneed( p_vout, p_vout->chroma.p_module ); module_Unneed( p_vout->p_chroma, p_vout->p_chroma->p_module );
p_vout->p_chroma->p_module = NULL;
} }
/* Destroy all remaining pictures */ /* Destroy all remaining pictures */
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_osd.h> #include <vlc_osd.h>
#include <vlc_filter.h>
#include "vout_pictures.h" #include "vout_pictures.h"
#include <assert.h> #include <assert.h>
...@@ -377,7 +378,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -377,7 +378,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
} }
/* Convert image to the first direct buffer */ /* Convert image to the first direct buffer */
p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic ); p_vout->p_chroma->pf_video_filter_io( p_vout->p_chroma, p_pic, p_tmp_pic );
/* Render subpictures on the first direct buffer */ /* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_tmp_pic, spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_tmp_pic,
...@@ -397,7 +398,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -397,7 +398,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL; return NULL;
/* Convert image to the first direct buffer */ /* Convert image to the first direct buffer */
p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] ); p_vout->p_chroma->pf_video_filter_io( p_vout->p_chroma, p_pic, &p_vout->p_picture[0] );
/* Render subpictures on the first direct buffer */ /* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
......
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