Commit 8826fb82 authored by Gildas Bazin's avatar Gildas Bazin

* src/video_output/*: optimized/simplified vout_RenderPicture().

parent 716cd870
...@@ -280,7 +280,7 @@ void vout_InitSPU( vout_thread_t * ); ...@@ -280,7 +280,7 @@ void vout_InitSPU( vout_thread_t * );
void vout_DestroySPU( vout_thread_t * ); void vout_DestroySPU( vout_thread_t * );
subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t ); subpicture_t * vout_SortSubPictures ( vout_thread_t *, mtime_t );
void vout_RenderSubPictures( vout_thread_t *, picture_t *, void vout_RenderSubPictures( vout_thread_t *, picture_t *,
subpicture_t * ); picture_t *, subpicture_t * );
/** @}*/ /** @}*/
/** /**
* @} * @}
......
...@@ -299,7 +299,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -299,7 +299,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
if( p_pic->i_type == DIRECT_PICTURE ) if( p_pic->i_type == DIRECT_PICTURE )
{ {
if( !p_vout->render.b_allow_modify_pics || p_pic->i_refcount ) if( !p_vout->render.b_allow_modify_pics || p_pic->i_refcount ||
p_pic->b_force )
{ {
/* Picture is in a direct buffer and is still in use, /* Picture is in a direct buffer and is still in use,
* we need to copy it to another direct buffer before * we need to copy it to another direct buffer before
...@@ -311,7 +312,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -311,7 +312,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
* subtitles. */ * subtitles. */
CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] ); CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_subpic ); vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0],
p_pic , p_subpic );
return PP_OUTPUTPICTURE[0]; return PP_OUTPUTPICTURE[0];
} }
...@@ -325,7 +327,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -325,7 +327,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
/* Picture is in a direct buffer but isn't used by the /* Picture is in a direct buffer but isn't used by the
* decoder. We can safely render subtitles on it and * decoder. We can safely render subtitles on it and
* display it. */ * display it. */
vout_RenderSubPictures( p_vout, p_pic, p_subpic ); vout_RenderSubPictures( p_vout, p_pic, p_pic, p_subpic );
return p_pic; return p_pic;
} }
...@@ -347,41 +349,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -347,41 +349,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL; return NULL;
} }
if( p_subpic == NULL ||
( p_vout->render.b_allow_modify_pics && !p_pic->i_refcount ) )
{
vout_RenderSubPictures( p_vout, p_pic, p_subpic );
CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] ); CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
} vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_pic, p_subpic );
else if( PP_OUTPUTPICTURE[0]->b_slow )
{
/* The picture buffer is in slow memory. We'll use
* the "2 * VOUT_MAX_PICTURES + 1" picture as a temporary
* one for subpictures rendering. */
picture_t *p_tmp_pic = &p_vout->p_picture[2 * VOUT_MAX_PICTURES];
if( p_tmp_pic->i_status == FREE_PICTURE )
{
vout_AllocatePicture( VLC_OBJECT(p_vout),
p_tmp_pic, p_vout->render.i_chroma,
p_vout->render.i_width,
p_vout->render.i_height,
p_vout->render.i_aspect );
p_tmp_pic->i_type = MEMORY_PICTURE;
p_tmp_pic->i_status = RESERVED_PICTURE;
}
CopyPicture( p_vout, p_pic, p_tmp_pic );
vout_RenderSubPictures( p_vout, p_tmp_pic, p_subpic );
CopyPicture( p_vout, p_tmp_pic, PP_OUTPUTPICTURE[0] );
}
else
{
CopyPicture( p_vout, p_pic, PP_OUTPUTPICTURE[0] );
vout_RenderSubPictures( p_vout, PP_OUTPUTPICTURE[0], p_subpic );
}
if( PP_OUTPUTPICTURE[0]->pf_unlock ) if( PP_OUTPUTPICTURE[0]->pf_unlock )
PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] ); PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
...@@ -415,7 +384,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -415,7 +384,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic ); p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic );
/* Render subpictures on the first direct buffer */ /* Render subpictures on the first direct buffer */
vout_RenderSubPictures( p_vout, p_tmp_pic, p_subpic ); vout_RenderSubPictures( p_vout, p_tmp_pic, p_tmp_pic, p_subpic );
if( p_vout->p_picture[0].pf_lock ) if( p_vout->p_picture[0].pf_lock )
if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) ) if( p_vout->p_picture[0].pf_lock( p_vout, &p_vout->p_picture[0] ) )
...@@ -433,7 +402,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -433,7 +402,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] ); p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
/* Render subpictures on the first direct buffer */ /* Render subpictures on the first direct buffer */
vout_RenderSubPictures( p_vout, &p_vout->p_picture[0], p_subpic ); vout_RenderSubPictures( p_vout, &p_vout->p_picture[0],
&p_vout->p_picture[0], p_subpic );
} }
if( p_vout->p_picture[0].pf_unlock ) if( p_vout->p_picture[0].pf_unlock )
......
...@@ -355,8 +355,8 @@ void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) ...@@ -355,8 +355,8 @@ void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
***************************************************************************** *****************************************************************************
* This function renders all sub picture units in the list. * This function renders all sub picture units in the list.
*****************************************************************************/ *****************************************************************************/
void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic, void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic_dst,
subpicture_t *p_subpic ) picture_t *p_pic_src, subpicture_t *p_subpic )
{ {
/* Load the blending module */ /* Load the blending module */
if( !p_vout->p_blend && p_subpic && p_subpic->p_region ) if( !p_vout->p_blend && p_subpic && p_subpic->p_region )
...@@ -392,7 +392,7 @@ void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -392,7 +392,7 @@ void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic,
if( p_subpic->pf_render ) if( p_subpic->pf_render )
{ {
p_subpic->pf_render( p_vout, p_pic, p_subpic ); p_subpic->pf_render( p_vout, p_pic_dst, p_subpic );
} }
else while( p_region && p_vout->p_blend && else while( p_region && p_vout->p_blend &&
p_vout->p_blend->pf_video_blend ) p_vout->p_blend->pf_video_blend )
...@@ -457,8 +457,8 @@ void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -457,8 +457,8 @@ void vout_RenderSubPictures( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->pi_alpha[3]; p_vout->pi_alpha[3];
} }
p_vout->p_blend->pf_video_blend( p_vout->p_blend, p_vout->p_blend->pf_video_blend( p_vout->p_blend, p_pic_dst,
p_pic, p_pic, &p_region->picture, i_x_offset, i_y_offset ); p_pic_src, &p_region->picture, i_x_offset, i_y_offset );
p_region = p_region->p_next; p_region = p_region->p_next;
} }
......
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