[vlc-commits] yuvp: simplify
Lyndon Brown
git at videolan.org
Sun Feb 24 10:45:26 CET 2019
vlc | branch: master | Lyndon Brown <jnqnfe at gmail.com> | Mon May 7 20:30:50 2018 +0100| [928bd8650cb9a8d5e4127f4e507ba2864da5e5db] | committer: Jean-Baptiste Kempf
yuvp: simplify
make use of VIDEO_FILTER_WRAPPER
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=928bd8650cb9a8d5e4127f4e507ba2864da5e5db
---
modules/video_chroma/yuvp.c | 41 ++++++++++++++---------------------------
1 file changed, 14 insertions(+), 27 deletions(-)
diff --git a/modules/video_chroma/yuvp.c b/modules/video_chroma/yuvp.c
index ced5b8aa38..b2eba4fda7 100644
--- a/modules/video_chroma/yuvp.c
+++ b/modules/video_chroma/yuvp.c
@@ -52,7 +52,8 @@ vlc_module_end ()
/****************************************************************************
* Local prototypes
****************************************************************************/
-static picture_t *Filter( filter_t *, picture_t * );
+static picture_t *Convert_Filter( filter_t *, picture_t * );
+static void Convert( filter_t *, picture_t *, picture_t * );
static void Yuv2Rgb( uint8_t *r, uint8_t *g, uint8_t *b, int y1, int u1, int v1 );
/*****************************************************************************
@@ -76,7 +77,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- p_filter->pf_video_filter = Filter;
+ p_filter->pf_video_filter = Convert_Filter;
msg_Dbg( p_filter, "YUVP to %4.4s converter",
(const char*)&p_filter->fmt_out.video.i_chroma );
@@ -95,13 +96,11 @@ static void Close( vlc_object_t *p_this )
/****************************************************************************
* Filter: the whole thing
****************************************************************************/
-static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
-{
- picture_t *p_out;
-
- if( !p_pic )
- return NULL;
+VIDEO_FILTER_WRAPPER( Convert )
+static void Convert( filter_t *p_filter, picture_t *p_source,
+ picture_t *p_dest )
+{
const video_palette_t *p_yuvp = p_filter->fmt_in.video.p_palette;
assert( p_yuvp != NULL );
@@ -109,23 +108,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
assert( p_filter->fmt_in.video.i_width == p_filter->fmt_out.video.i_width );
assert( p_filter->fmt_in.video.i_height == p_filter->fmt_out.video.i_height );
- /* Request output picture */
- p_out = filter_NewPicture( p_filter );
- if( !p_out )
- {
- picture_Release( p_pic );
- return NULL;
- }
-
if( p_filter->fmt_out.video.i_chroma == VLC_CODEC_YUVA )
{
for( unsigned int y = 0; y < p_filter->fmt_in.video.i_height; y++ )
{
- const uint8_t *p_line = &p_pic->p->p_pixels[y*p_pic->p->i_pitch];
- uint8_t *p_y = &p_out->Y_PIXELS[y*p_out->Y_PITCH];
- uint8_t *p_u = &p_out->U_PIXELS[y*p_out->U_PITCH];
- uint8_t *p_v = &p_out->V_PIXELS[y*p_out->V_PITCH];
- uint8_t *p_a = &p_out->A_PIXELS[y*p_out->A_PITCH];
+ const uint8_t *p_line = &p_source->p->p_pixels[y*p_source->p->i_pitch];
+ uint8_t *p_y = &p_dest->Y_PIXELS[y*p_dest->Y_PITCH];
+ uint8_t *p_u = &p_dest->U_PIXELS[y*p_dest->U_PITCH];
+ uint8_t *p_v = &p_dest->V_PIXELS[y*p_dest->V_PITCH];
+ uint8_t *p_a = &p_dest->A_PIXELS[y*p_dest->A_PITCH];
for( unsigned int x = 0; x < p_filter->fmt_in.video.i_width; x++ )
{
@@ -170,8 +161,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
for( unsigned int y = 0; y < p_filter->fmt_in.video.i_height; y++ )
{
- const uint8_t *p_line = &p_pic->p->p_pixels[y*p_pic->p->i_pitch];
- uint8_t *p_pixels = &p_out->p->p_pixels[y*p_out->p->i_pitch];
+ const uint8_t *p_line = &p_source->p->p_pixels[y*p_source->p->i_pitch];
+ uint8_t *p_pixels = &p_dest->p->p_pixels[y*p_dest->p->i_pitch];
for( unsigned int x = 0; x < p_filter->fmt_in.video.i_width; x++ )
{
@@ -188,10 +179,6 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
}
}
-
- picture_CopyProperties( p_out, p_pic );
- picture_Release( p_pic );
- return p_out;
}
/* FIXME copied from blend.c */
More information about the vlc-commits
mailing list