[vlc-devel] [PATCH v1 19/33] vaapi: deinterlace: only support push mode in deinterlacer code

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 25 16:46:55 CEST 2020


---
 modules/hw/vaapi/filters.c | 54 ++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index debe2b507b1..2acfc744ef0 100644
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -813,15 +813,15 @@ Deinterlace_UpdatePipelineParams
     pipeline_param->num_forward_references = p_deint_data->forward_refs.sz;
 }
 
-static picture_t *
-Deinterlace(filter_t * filter, picture_t * src)
+static int
+Deinterlace(filter_t * filter, picture_t * src, struct vlc_video_sink *sink)
 {
     filter_sys_t *const         filter_sys = filter->p_sys;
     struct deint_data *const    p_deint_data = filter_sys->p_data;
 
     src = Deinterlace_UpdateHistory(p_deint_data, src);
     if (p_deint_data->history.num_pics < p_deint_data->history.sz)
-        return NULL;
+        return VLC_EGENERIC;
 
     picture_t *const    dest =
         Filter(filter, src,
@@ -829,14 +829,15 @@ Deinterlace(filter_t * filter, picture_t * src)
                Deinterlace_UpdateReferenceFrames,
                Deinterlace_UpdatePipelineParams);
 
-    if (dest)
-        dest->b_progressive = true;
+    if (dest == NULL)
+        return VLC_EGENERIC;
 
-    return dest;
+    dest->b_progressive = true;
+    return vlc_video_sink_PutPicture( sink, dest );
 }
 
-static picture_t *
-DeinterlaceX2(filter_t * filter, picture_t * src)
+static int
+DeinterlaceX2(filter_t * filter, picture_t * src, struct vlc_video_sink *sink)
 {
     filter_sys_t *const         filter_sys = filter->p_sys;
     struct deint_data *const    p_deint_data = filter_sys->p_data;
@@ -852,7 +853,7 @@ DeinterlaceX2(filter_t * filter, picture_t * src)
 
     picture_t * cur = Deinterlace_UpdateHistory(p_deint_data, src);
     if (p_deint_data->history.num_pics < p_deint_data->history.sz)
-        return NULL;
+        return VLC_EGENERIC;
 
     vlc_tick_t i_field_dur = 0;
     unsigned int i = 0;
@@ -868,36 +869,33 @@ DeinterlaceX2(filter_t * filter, picture_t * src)
     else if (fmt->i_frame_rate_base)
         i_field_dur = vlc_tick_from_samples(fmt->i_frame_rate_base, fmt->i_frame_rate);
 
-    picture_t *dest[2] = {NULL, NULL};
+    picture_t *dest;
+    int res;
     for (i = 0; i < 2; ++i)
     {
         p_deint_data->cur_frame = i;
-        dest[i] = Filter(filter, cur,
+        dest = Filter(filter, cur,
                          Deinterlace_UpdateFilterParams,
                          Deinterlace_UpdateReferenceFrames,
                          Deinterlace_UpdatePipelineParams);
-        if (!dest[i])
+        if (!dest)
            goto error;
 
-        dest[i]->b_progressive = true;
-        dest[i]->i_nb_fields = 1;
+        dest->b_progressive = true;
+        dest->i_nb_fields = 1;
+        dest->date = cur->date;
+        if (i == 1 && cur->date != VLC_TICK_INVALID)
+            dest->date += i_field_dur;
+        res = vlc_video_sink_PutPicture( sink, dest );
     }
 
-    vlc_picture_chain_AppendChain( dest[0], dest[1] );
-    dest[0]->date = cur->date;
-    if (dest[0]->date != VLC_TICK_INVALID)
-        dest[1]->date = dest[0]->date + i_field_dur;
-    else
-        dest[1]->date = VLC_TICK_INVALID;
-
-    return dest[0];
+    return res;
 
 error:
-    for (i = 0; i < 2; ++i)
-        if (dest[i])
-            picture_Release(dest[i]);
+    if (dest)
+        picture_Release(dest);
 
-    return NULL;
+    return VLC_EGENERIC;
 }
 
 static void
@@ -1079,9 +1077,9 @@ OpenDeinterlace(vlc_object_t * obj)
         goto error;
 
     if (p_data->b_double_rate)
-        filter->pf_video_filter = DeinterlaceX2;
+        filter->pf_video_filter_into = DeinterlaceX2;
     else
-        filter->pf_video_filter = Deinterlace;
+        filter->pf_video_filter_into = Deinterlace;
     filter->pf_flush = Deinterlace_Flush;
 
     for (unsigned int i = 0; i < METADATA_SIZE; ++i)
-- 
2.26.2



More information about the vlc-devel mailing list