st/omx/enc: fix scaling src alignment issue
authorLeo Liu <leo.liu@amd.com>
Mon, 3 Feb 2014 15:41:05 +0000 (10:41 -0500)
committerChristian König <christian.koenig@amd.com>
Fri, 14 Feb 2014 07:50:32 +0000 (08:50 +0100)
Signed-off-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/omx/vid_enc.c

index 1761bcb41b9e3b667d0e09cd575e37e53f4b4d2d..6e65274560cba0e63af89901e00b5e83cd1ec614 100644 (file)
@@ -746,10 +746,24 @@ static OMX_ERRORTYPE vid_enc_EncodeFrame(omx_base_PortType *port, OMX_BUFFERHEAD
       views = vbuf->get_sampler_view_planes(vbuf);
       dst_surface = priv->scale_buffer->get_surfaces(priv->scale_buffer);
       vl_compositor_clear_layers(s);
+
       for (i = 0; i < VL_MAX_SURFACES; ++i) {
+         struct u_rect src_rect;
+
          if (!views[i] || !dst_surface[i])
             continue;
-         vl_compositor_set_rgba_layer(s, compositor, 0, views[i], NULL, NULL, NULL);
+
+         src_rect.x0 = 0;
+         src_rect.y0 = 0;
+         src_rect.x1 = port->sPortParam.format.video.nFrameWidth;
+         src_rect.y1 = port->sPortParam.format.video.nFrameHeight;
+
+         if (i > 0) {
+            src_rect.x1 /= 2;
+            src_rect.y1 /= 2;
+         }
+
+         vl_compositor_set_rgba_layer(s, compositor, 0, views[i], &src_rect, NULL, NULL);
          vl_compositor_render(s, compositor, dst_surface[i], NULL, false);
       }