Add condition checking of residuals because it may be NULL.

Submitted by Chuanbo Weng on March 29, 2016, 3:04 a.m.

Details

Message ID 5A0E318D73C83C40A09BDBBE131796D702DF2FB1@shsmsx102.ccr.corp.intel.com
State New
Headers show
Series "Add condition checking of residuals because it may be NULL." ( rev: 2 ) in Beignet

Not browsing as part of any series.

Commit Message

Chuanbo Weng March 29, 2016, 3:04 a.m.
LGTM, thanks.

-----Original Message-----
From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of yan.wang@linux.intel.com

Sent: Monday, March 28, 2016 3:35 PM
To: beignet@lists.freedesktop.org
Cc: Yan Wang <yan.wang@linux.intel.com>
Subject: [Beignet] [PATCH] Add condition checking of residuals because it may be NULL.

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


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

-- 
2.5.0

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

Patch hide | download patch | download mbox

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];
     }
   }
 

Comments

Pushed, thanks.

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> Weng, Chuanbo

> Sent: Tuesday, March 29, 2016 11:04

> To: yan.wang@linux.intel.com; beignet@lists.freedesktop.org

> Subject: Re: [Beignet] [PATCH] Add condition checking of residuals because it

> may be NULL.

> 

> LGTM, thanks.

> 

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> yan.wang@linux.intel.com

> Sent: Monday, March 28, 2016 3:35 PM

> To: beignet@lists.freedesktop.org

> Cc: Yan Wang <yan.wang@linux.intel.com>

> Subject: [Beignet] [PATCH] Add condition checking of residuals because it

> may be NULL.

> 

> From: Yan Wang <yan.wang@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@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/beignet

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/beignet