[Beignet] [PATCH] Add condition checking of residuals because it may be NULL.

Weng, Chuanbo chuanbo.weng at intel.com
Tue Mar 29 03:04:07 UTC 2016


LGTM, thanks.

-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of yan.wang at linux.intel.com
Sent: Monday, March 28, 2016 3:35 PM
To: beignet at lists.freedesktop.org
Cc: Yan Wang <yan.wang at linux.intel.com>
Subject: [Beignet] [PATCH] Add condition checking of residuals because it may be NULL.

From: Yan Wang <yan.wang at linux.intel.com>

---
 src/kernels/cl_internal_block_motion_estimate_intel.cl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/kernels/cl_internal_block_motion_estimate_intel.cl b/src/kernels/cl_internal_block_motion_estimate_intel.cl
index 23c5488..e56520a 100644
--- a/src/kernels/cl_internal_block_motion_estimate_intel.cl
+++ b/src/kernels/cl_internal_block_motion_estimate_intel.cl
@@ -341,7 +341,8 @@ void block_motion_estimate_intel(accelerator_intel_t accel,
     mv_index = index * 1;
     if( lid_x == 0 ){
       motion_vector_buffer[mv_index] = mv[lid_x];
-      residuals[mv_index] = 2 * res[lid_x];
+      if(residuals)
+        residuals[mv_index] = 2 * res[lid_x];
     }
   }
   //CL_ME_MB_TYPE_8x8_INTEL
@@ -350,7 +351,8 @@ void block_motion_estimate_intel(accelerator_intel_t accel,
       mv_index = lgid_y * num_groups_x * 4 + lgid_x * 2;
       mv_index = mv_index + num_groups_x * 2 * (lid_x / 2) + (lid_x % 2);
       motion_vector_buffer[mv_index] = mv[lid_x];
-      residuals[mv_index] = 2 * res[lid_x];
+      if(residuals)
+        residuals[mv_index] = 2 * res[lid_x];
     }
   }
   //CL_ME_MB_TYPE_4x4_INTEL
@@ -359,7 +361,8 @@ void block_motion_estimate_intel(accelerator_intel_t accel,
       mv_index = lgid_y * num_groups_x * 16 + lgid_x * 4;
       mv_index = mv_index + num_groups_x * 4 * (lid_x / 4) + (lid_x % 4);
       motion_vector_buffer[mv_index] = mv[lid_x];
-      residuals[mv_index] = 2 * res[lid_x];
+      if(residuals)
+        residuals[mv_index] = 2 * res[lid_x];
     }
   }
 
-- 
2.5.0

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list