vl/compositor: make a helper function for YUV deinterlacing
authorLeo Liu <leo.liu@amd.com>
Tue, 29 Aug 2017 00:58:48 +0000 (20:58 -0400)
committerLeo Liu <leo.liu@amd.com>
Thu, 7 Sep 2017 17:32:36 +0000 (13:32 -0400)
The similar function is in OMX, and only used by OMX. Now have it
moved to vl/compositor for other state tracker to use later.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h

index a79bf112646a6ed0a1c5fb796441415aef648f5e..6963a5650700fb25e2e41a8f77be91263916f471 100644 (file)
@@ -1215,6 +1215,37 @@ vl_compositor_render(struct vl_compositor_state *s,
    draw_layers(c, s, dirty_area);
 }
 
+void
+vl_compositor_yuv_deint(struct vl_compositor_state *s,
+                        struct vl_compositor *c,
+                        struct pipe_video_buffer *src,
+                        struct pipe_video_buffer *dst)
+{
+   struct pipe_surface **dst_surfaces;
+   struct u_rect dst_rect;
+
+   dst_surfaces = dst->get_surfaces(dst);
+   vl_compositor_clear_layers(s);
+
+   dst_rect.x0 = 0;
+   dst_rect.x1 = src->width;
+   dst_rect.y0 = 0;
+   dst_rect.y1 = src->height;
+
+   vl_compositor_set_yuv_layer(s, c, 0, src, NULL, NULL, true);
+   vl_compositor_set_layer_dst_area(s, 0, &dst_rect);
+   vl_compositor_render(s, c, dst_surfaces[0], NULL, false);
+
+   dst_rect.x1 /= 2;
+   dst_rect.y1 /= 2;
+
+   vl_compositor_set_yuv_layer(s, c, 0, src, NULL, NULL, false);
+   vl_compositor_set_layer_dst_area(s, 0, &dst_rect);
+   vl_compositor_render(s, c, dst_surfaces[1], NULL, false);
+
+   s->pipe->flush(s->pipe, NULL, 0);
+}
+
 bool
 vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
 {
index 535abb75cd19740c84418b6c82e6be9a8dd794c0..88a54efdb8277364366d5307728bca9c629376ee 100644 (file)
@@ -276,4 +276,13 @@ vl_compositor_cleanup(struct vl_compositor *compositor);
 void
 vl_compositor_cleanup_state(struct vl_compositor_state *state);
 
+/**
+ * deinterlace yuv buffer
+ */
+void
+vl_compositor_yuv_deint(struct vl_compositor_state *state,
+                        struct vl_compositor *compositor,
+                        struct pipe_video_buffer *src,
+                        struct pipe_video_buffer *dst);
+
 #endif /* vl_compositor_h */