[Libva] [PATCH] Fix scaling of NV12 surfaces when no output_region is set

Antti Seppälä a.seppala at gmail.com
Mon Jan 5 10:31:35 PST 2015


The code block filling destination surface target rectangle is too early 
and incorrectly fills input surface width & height as final target width 
and height. This results in improper scaling of the source surface.

Move the destination code block further below the point when actual 
target surface is referenced and its width and height are known and use 
them to fill the destination rectangle.

Signed-off-by: Antti Seppälä <a.seppala at gmail.com>
---
 src/i965_post_processing.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/i965_post_processing.c b/src/i965_post_processing.c
index 865dc3f..0481408 100755
--- a/src/i965_post_processing.c
+++ b/src/i965_post_processing.c
@@ -5550,18 +5550,6 @@ i965_proc_picture(VADriverContextP ctx,
         src_rect.height = in_height;
     }
 
-    if (pipeline_param->output_region) {
-        dst_rect.x = pipeline_param->output_region->x;
-        dst_rect.y = pipeline_param->output_region->y;
-        dst_rect.width = pipeline_param->output_region->width;
-        dst_rect.height = pipeline_param->output_region->height;
-    } else {
-        dst_rect.x = 0;
-        dst_rect.y = 0;
-        dst_rect.width = in_width;
-        dst_rect.height = in_height;
-    }
-
     proc_context->pp_context.pipeline_param = pipeline_param;
 
     for (i = 0; i < pipeline_param->num_filters; i++) {
@@ -5621,6 +5609,18 @@ i965_proc_picture(VADriverContextP ctx,
         goto error;
     }
 
+    if (pipeline_param->output_region) {
+        dst_rect.x = pipeline_param->output_region->x;
+        dst_rect.y = pipeline_param->output_region->y;
+        dst_rect.width = pipeline_param->output_region->width;
+        dst_rect.height = pipeline_param->output_region->height;
+    } else {
+        dst_rect.x = 0;
+        dst_rect.y = 0;
+        dst_rect.width = obj_surface->orig_width;
+        dst_rect.height = obj_surface->orig_height;
+    }
+
     int csc_needed = 0;
     if (obj_surface->fourcc && obj_surface->fourcc !=  VA_FOURCC_NV12){
         csc_needed = 1;
-- 
2.0.5



More information about the Libva mailing list