[vlc-devel] [PATCH 8/8] transcode: remove the converter between the decoder/prerender and user filters
Steve Lhomme
robux4 at ycbcr.xyz
Thu Sep 24 11:50:27 CEST 2020
Just like in the video output, the user filters should adapt to the source,
better than they should adapt to the encoder. In particular, hardware support
will be favored in more cases.
Just like in the video output, the last converter chain is responsible to adapt
the decoded + prerendered + filtered pictures to the encoder requested input
format (see osys->converters display.c).
In the end we have the same filters as the video output: static, user, final
converter.
---
modules/stream_out/transcode/transcode.h | 1 -
modules/stream_out/transcode/video.c | 55 +-----------------------
2 files changed, 2 insertions(+), 54 deletions(-)
diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index ee2f78e0d99..bdde41e91d6 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -122,7 +122,6 @@ struct sout_stream_id_sys_t
struct
{
filter_chain_t *p_f_chain; /**< deinterlace & fps video filters */
- filter_chain_t *p_conv_nonstatic;
filter_chain_t *p_uf_chain; /**< User-specified video filters */
filter_chain_t *p_final_conv_static; /**< converter to adapt filtered pics to the encoder */
vlc_blender_t *p_spu_blender;
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 0aa60d7b93c..0bb4f25f7bc 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -266,43 +266,6 @@ static const struct filter_video_callbacks transcode_filter_video_cbs =
transcode_video_filter_buffer_new, transcode_video_filter_hold_device,
};
-/* Take care of the scaling and chroma conversions. */
-static int transcode_video_set_conversions( sout_stream_t *p_stream,
- sout_stream_id_sys_t *id,
- const es_format_t **pp_src,
- vlc_video_context **pp_src_vctx,
- const es_format_t *p_dst )
-{
- filter_owner_t owner = {
- .video = &transcode_filter_video_cbs,
- .sys = id,
- };
-
- const bool b_do_scale = (*pp_src)->video.i_visible_width != p_dst->video.i_visible_width ||
- (*pp_src)->video.i_visible_height != p_dst->video.i_visible_height;
- const bool b_do_chroma = (*pp_src)->video.i_chroma != p_dst->video.i_chroma;
-
- if( ! (b_do_scale || b_do_chroma) )
- return VLC_SUCCESS;
-
- msg_Dbg( p_stream, "adding (scale %d,chroma %d) converters",
- b_do_scale, b_do_chroma);
-
- id->p_conv_nonstatic = filter_chain_NewVideo( p_stream, true, &owner );
- if( !id->p_conv_nonstatic )
- return VLC_EGENERIC;
- filter_chain_Reset( id->p_conv_nonstatic, *pp_src, *pp_src_vctx, p_dst );
-
- if( filter_chain_AppendConverter( id->p_conv_nonstatic, p_dst ) != VLC_SUCCESS )
- return VLC_EGENERIC;
-
- *pp_src = filter_chain_GetFmtOut( id->p_conv_nonstatic );
- *pp_src_vctx = filter_chain_GetVideoCtxOut( id->p_conv_nonstatic );
- debug_format( p_stream, *pp_src );
-
- return VLC_SUCCESS;
-}
-
static inline bool transcode_video_filters_configured( const sout_stream_id_sys_t *id )
{
return !!id->p_f_chain;
@@ -344,11 +307,6 @@ static int transcode_video_filters_init( sout_stream_t *p_stream,
src_ctx = filter_chain_GetVideoCtxOut( id->p_f_chain );
}
- /* Chroma and other conversions */
- if( transcode_video_set_conversions( p_stream, id, &p_src, &src_ctx, p_dst
- ) != VLC_SUCCESS )
- return VLC_EGENERIC;
-
/* User filters */
if( p_cfg->psz_filters )
{
@@ -385,7 +343,6 @@ void transcode_video_clean( sout_stream_id_sys_t *id )
/* Close filters */
transcode_remove_filters( &id->p_f_chain );
- transcode_remove_filters( &id->p_conv_nonstatic );
transcode_remove_filters( &id->p_uf_chain );
transcode_remove_filters( &id->p_final_conv_static );
if( id->p_spu_blender )
@@ -523,7 +480,6 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
);
/* Close filters, encoder format input can't change */
transcode_remove_filters( &id->p_f_chain );
- transcode_remove_filters( &id->p_conv_nonstatic );
transcode_remove_filters( &id->p_uf_chain );
transcode_remove_filters( &id->p_final_conv_static );
if( id->p_spu_blender )
@@ -622,14 +578,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
for ( picture_t *p_in = p_pic; ; p_in = NULL /* drain second time */ )
{
/* Run filter chain */
- filter_chain_t * primary_chains[] = { id->p_f_chain,
- id->p_conv_nonstatic };
- for( size_t i=0; p_in && i<ARRAY_SIZE(primary_chains); i++ )
- {
- if( !primary_chains[i] )
- continue;
- p_in = filter_chain_VideoFilter( primary_chains[i], p_in );
- }
+ if( id->p_f_chain )
+ p_in = filter_chain_VideoFilter( id->p_f_chain, p_in );
if( !p_in )
break;
@@ -670,7 +620,6 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
transcode_encoder_close( id->encoder );
/* Close filters */
transcode_remove_filters( &id->p_f_chain );
- transcode_remove_filters( &id->p_conv_nonstatic );
transcode_remove_filters( &id->p_uf_chain );
transcode_remove_filters( &id->p_final_conv_static );
tag_last_block_with_flag( out, BLOCK_FLAG_END_OF_SEQUENCE );
--
2.26.2
More information about the vlc-devel
mailing list