From 4a41107b0121606f925bb0506bace20a58f9ce51 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Sat, 31 Mar 2012 17:05:33 +0000 Subject: [PATCH] applied patch #1734 --- modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu index 9efb80d..44e6fde 100644 --- a/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu +++ b/modules/gpu/src/nvidia/NCVBroxOpticalFlow.cu @@ -551,10 +551,10 @@ template __global__ void sor_pass(float *new_du, return; const int pos = j * stride + i; - const int pos_r = pos + 1; - const int pos_u = pos + stride; - const int pos_d = pos - stride; - const int pos_l = pos - 1; + const int pos_r = i < width - 1 ? pos + 1 : pos; + const int pos_u = j < height - 1 ? pos + stride : pos; + const int pos_d = j > 0 ? pos - stride : pos; + const int pos_l = i > 0 ? pos - 1 : pos; //load smooth term float s_up, s_left, s_right, s_down; -- 2.7.4