[vlc-commits] deinterlace: add function to initialize the deinterlacing context

Steve Lhomme git at videolan.org
Sat Jul 1 19:23:56 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Wed Jun 28 13:52:42 2017 +0200| [ed564cbcb76a150264e683f6648bbb55c09c4047] | committer: Jean-Baptiste Kempf

deinterlace: add function to initialize the deinterlacing context

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed564cbcb76a150264e683f6648bbb55c09c4047
---

 modules/video_filter/deinterlace/common.c      | 18 ++++++++++++++++++
 modules/video_filter/deinterlace/common.h      |  2 ++
 modules/video_filter/deinterlace/deinterlace.c | 11 +----------
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/modules/video_filter/deinterlace/common.c b/modules/video_filter/deinterlace/common.c
index a1b68dc869..cfd3a38983 100644
--- a/modules/video_filter/deinterlace/common.c
+++ b/modules/video_filter/deinterlace/common.c
@@ -33,6 +33,24 @@
 
 #include "common.h"
 
+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->meta[0].pi_date = VLC_TS_INVALID;
+    p_context->meta[0].pi_nb_fields = 2;
+    p_context->meta[0].pb_top_field_first = true;
+    for( int i = 1; i < METADATA_SIZE; i++ )
+        p_context->meta[i] = p_context->meta[i-1];
+
+    p_context->i_frame_offset = 0; /* start with default value (first-ever frame
+                                  cannot have offset) */
+    for( int i = 0; i < HISTORY_SIZE; i++ )
+        p_context->pp_history[i] = NULL;
+}
+
 void FlushDeinterlacing(struct deinterlace_ctx *p_context)
 {
     p_context->meta[0].pi_date = VLC_TS_INVALID;
diff --git a/modules/video_filter/deinterlace/common.h b/modules/video_filter/deinterlace/common.h
index a8e3de430a..ad74b5353d 100644
--- a/modules/video_filter/deinterlace/common.h
+++ b/modules/video_filter/deinterlace/common.h
@@ -89,6 +89,8 @@ struct deinterlace_ctx
 
 #define DEINTERLACE_DST_SIZE 3
 
+void InitDeinterlacingContext( struct deinterlace_ctx * );
+
 /**
  * @brief Get the field duration based on the previous fields or the frame rate
  * @param fmt output format of the deinterlacer with the frame rate
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index 210557716d..9888e58d25 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -333,16 +333,7 @@ notsupp:
     char *psz_mode = var_InheritString( p_filter, FILTER_CFG_PREFIX "mode" );
     SetFilterMethod( p_filter, psz_mode, packed );
 
-    for( int i = 0; i < METADATA_SIZE; i++ )
-    {
-        p_sys->context.meta[i].pi_date = VLC_TS_INVALID;
-        p_sys->context.meta[i].pi_nb_fields = 2;
-        p_sys->context.meta[i].pb_top_field_first = true;
-    }
-    p_sys->context.i_frame_offset = 0; /* start with default value (first-ever frame
-                                  cannot have offset) */
-    for( int i = 0; i < HISTORY_SIZE; i++ )
-        p_sys->context.pp_history[i] = NULL;
+    InitDeinterlacingContext( &p_sys->context );
 
     IVTCClearState( p_filter );
 



More information about the vlc-commits mailing list