vlc | branch: master | Steve Lhomme <[email protected]> | Fri Jun 30 13:12:50 2017 +0200| [7f4ebec5b62c3a1218a4f6f35de2f16e8fc7a621] | committer: Jean-Baptiste Kempf
deinterlace: move the deinterlacing parameters in a structure Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7f4ebec5b62c3a1218a4f6f35de2f16e8fc7a621 --- modules/video_filter/deinterlace/common.c | 22 ++++++++++---------- modules/video_filter/deinterlace/common.h | 10 ++++++--- modules/video_filter/deinterlace/deinterlace.c | 28 +++++++++++++------------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/modules/video_filter/deinterlace/common.c b/modules/video_filter/deinterlace/common.c index cfd3a38983..3d144f5fc1 100644 --- a/modules/video_filter/deinterlace/common.c +++ b/modules/video_filter/deinterlace/common.c @@ -35,9 +35,9 @@ void InitDeinterlacingContext( struct deinterlace_ctx *p_context ) { - p_context->b_double_rate = false; - p_context->b_half_height = false; - p_context->b_use_frame_history = false; + p_context->settings.b_double_rate = false; + p_context->settings.b_half_height = false; + p_context->settings.b_use_frame_history = false; p_context->meta[0].pi_date = VLC_TS_INVALID; p_context->meta[0].pi_nb_fields = 2; @@ -108,7 +108,7 @@ void GetDeinterlacingOutput( const struct deinterlace_ctx *p_context, { *p_dst = *p_src; - if( p_context->b_half_height ) + if( p_context->settings.b_half_height ) { p_dst->i_height /= 2; p_dst->i_visible_height /= 2; @@ -116,7 +116,7 @@ void GetDeinterlacingOutput( const struct deinterlace_ctx *p_context, p_dst->i_sar_den *= 2; } - if( p_context->b_double_rate ) + if( p_context->settings.b_double_rate ) { p_dst->i_frame_rate *= 2; } @@ -151,7 +151,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter, /* Update the input frame history, if the currently active algorithm needs it. */ - if( p_context->b_use_frame_history ) + if( p_context->settings.b_use_frame_history ) { /* Keep reference for the picture */ picture_t *p_dup = picture_Hold( p_pic ); @@ -192,7 +192,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter, /* Framerate doublers must not request CUSTOM_PTS, as they need the original field timings, and need Deinterlace() to allocate the correct number of output frames. */ - assert( !p_context->b_double_rate ); + assert( !p_context->settings.b_double_rate ); /* NOTE: i_nb_fields is only used for framerate doublers, so it is unused in this case. b_top_field_first is only passed to the @@ -211,7 +211,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter, framerate doublers. Will be inited below. Declared here because the PTS logic needs the result. */ - if( p_context->b_double_rate ) + if( p_context->settings.b_double_rate ) { i_double_rate_alloc_end = i_nb_fields; if( i_nb_fields > DEINTERLACE_DST_SIZE ) @@ -256,11 +256,11 @@ picture_t *DoDeinterlacing( filter_t *p_filter, Note that now p_dst[i] != NULL for 0 <= i < i_double_rate_alloc_end. */ } - assert( p_context->b_double_rate || p_dst[1] == NULL ); + assert( p_context->settings.b_double_rate || p_dst[1] == NULL ); assert( i_nb_fields > 2 || p_dst[2] == NULL ); /* Render */ - if ( !p_context->b_double_rate ) + if ( !p_context->settings.b_double_rate ) { if ( p_context->pf_render_single_pic( p_filter, p_dst[0], p_pic ) ) goto drop; @@ -294,7 +294,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter, when i_frame_offset > 0. */ p_dst[0]->date = i_base_pts; - if( p_context->b_double_rate ) + if( p_context->settings.b_double_rate ) { mtime_t i_field_dur = GetFieldDuration( p_context, &p_filter->fmt_out.video, p_pic ); /* Processing all actually allocated output frames. */ diff --git a/modules/video_filter/deinterlace/common.h b/modules/video_filter/deinterlace/common.h index ad74b5353d..0c5fa91e75 100644 --- a/modules/video_filter/deinterlace/common.h +++ b/modules/video_filter/deinterlace/common.h @@ -56,12 +56,16 @@ typedef struct { #define HISTORY_SIZE (3) #define CUSTOM_PTS -1 +typedef struct { + bool b_double_rate; /**< Shall we double the framerate? */ + bool b_use_frame_history; /**< Use the input frame history buffer? */ + bool b_half_height; /**< Shall be divide the height by 2 */ +} deinterlace_algo; + struct deinterlace_ctx { /* Algorithm behaviour flags */ - bool b_double_rate; /**< Shall we double the framerate? */ - bool b_half_height; /**< Shall be divide the height by 2 */ - bool b_use_frame_history; /**< Use the input frame history buffer? */ + deinterlace_algo settings; /** * Metadata history (PTS, nb_fields, TFF). Used for framerate doublers. diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c index 9888e58d25..ebaea0564b 100644 --- a/modules/video_filter/deinterlace/deinterlace.c +++ b/modules/video_filter/deinterlace/deinterlace.c @@ -151,9 +151,9 @@ static void SetFilterMethod( filter_t *p_filter, const char *mode, bool pack ) if ( mode == NULL ) mode = "auto"; - p_sys->context.b_double_rate = false; - p_sys->context.b_half_height = false; - p_sys->context.b_use_frame_history = false; + p_sys->context.settings.b_double_rate = false; + p_sys->context.settings.b_half_height = false; + p_sys->context.settings.b_use_frame_history = false; if ( !strcmp( mode, "auto" ) ) { @@ -162,22 +162,22 @@ static void SetFilterMethod( filter_t *p_filter, const char *mode, bool pack ) else if( !strcmp( mode, "discard" ) ) { p_sys->context.pf_render_single_pic = RenderDiscard; - p_sys->context.b_half_height = true; + p_sys->context.settings.b_half_height = true; } else if( !strcmp( mode, "bob" ) || !strcmp( mode, "progressive-scan" ) ) { p_sys->context.pf_render_ordered = RenderBob; - p_sys->context.b_double_rate = true; + p_sys->context.settings.b_double_rate = true; } else if( !strcmp( mode, "linear" ) ) { p_sys->context.pf_render_ordered = RenderLinear; - p_sys->context.b_double_rate = true; + p_sys->context.settings.b_double_rate = true; } else if( !strcmp( mode, "mean" ) ) { p_sys->context.pf_render_single_pic = RenderMean; - p_sys->context.b_half_height = true; + p_sys->context.settings.b_half_height = true; } else if( !strcmp( mode, "blend" ) ) { @@ -192,13 +192,13 @@ static void SetFilterMethod( filter_t *p_filter, const char *mode, bool pack ) else if( !strcmp( mode, "yadif" ) ) { p_sys->context.pf_render_ordered = RenderYadif; - p_sys->context.b_use_frame_history = true; + p_sys->context.settings.b_use_frame_history = true; } else if( !strcmp( mode, "yadif2x" ) ) { p_sys->context.pf_render_ordered = RenderYadif; - p_sys->context.b_double_rate = true; - p_sys->context.b_use_frame_history = true; + p_sys->context.settings.b_double_rate = true; + p_sys->context.settings.b_use_frame_history = true; } else if( p_sys->chroma->pixel_size > 1 ) { @@ -213,13 +213,13 @@ static void SetFilterMethod( filter_t *p_filter, const char *mode, bool pack ) else if( !strcmp( mode, "phosphor" ) ) { p_sys->context.pf_render_ordered = RenderPhosphor; - p_sys->context.b_double_rate = true; - p_sys->context.b_use_frame_history = true; + p_sys->context.settings.b_double_rate = true; + p_sys->context.settings.b_use_frame_history = true; } else if( !strcmp( mode, "ivtc" ) ) { p_sys->context.pf_render_single_pic = RenderIVTC; - p_sys->context.b_use_frame_history = true; + p_sys->context.settings.b_use_frame_history = true; } else msg_Err( p_filter, "unknown deinterlace mode \"%s\"", mode ); @@ -276,7 +276,7 @@ int Mouse( filter_t *p_filter, { VLC_UNUSED(p_old); *p_mouse = *p_new; - if( p_filter->p_sys->context.b_half_height ) + if( p_filter->p_sys->context.settings.b_half_height ) p_mouse->i_y *= 2; return VLC_SUCCESS; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
