Avoid scaling if the source & destination region have the same size
authorXiang, Haihao <haihao.xiang@intel.com>
Mon, 26 Mar 2012 07:11:15 +0000 (15:11 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 27 Mar 2012 08:44:47 +0000 (16:44 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/i965_post_processing.c

index fe4c27a..8cb2b39 100644 (file)
@@ -4069,14 +4069,27 @@ i965_proc_picture(VADriverContextP ctx,
 
     dst_surface.id = proc_state->current_render_target;
     dst_surface.type = I965_SURFACE_TYPE_SURFACE;
-    i965_post_processing_internal(ctx, &proc_context->pp_context,
-                                  &src_surface,
-                                  &src_rect,
-                                  &dst_surface,
-                                  &dst_rect,
-                                  (pipeline_param->filter_flags & VA_FILTER_SCALING_MASK) == VA_FILTER_SCALING_NL_ANAMORPHIC ?
-                                  PP_NV12_AVS : PP_NV12_SCALING,
-                                  NULL);
+
+    if (src_rect.width == dst_rect.width &&
+        src_rect.height == dst_rect.height) {
+        i965_post_processing_internal(ctx, &proc_context->pp_context,
+                                      &src_surface,
+                                      &src_rect,
+                                      &dst_surface,
+                                      &dst_rect,
+                                      PP_NV12_LOAD_SAVE_N12,
+                                      NULL);
+    } else {
+
+        i965_post_processing_internal(ctx, &proc_context->pp_context,
+                                      &src_surface,
+                                      &src_rect,
+                                      &dst_surface,
+                                      &dst_rect,
+                                      (pipeline_param->filter_flags & VA_FILTER_SCALING_MASK) == VA_FILTER_SCALING_NL_ANAMORPHIC ?
+                                      PP_NV12_AVS : PP_NV12_SCALING,
+                                      NULL);
+    }
 
     if (num_tmp_surfaces)
         i965_DestroySurfaces(ctx,