From 8f78a1123b61211a51118fc57145ecf49f43ee8f Mon Sep 17 00:00:00 2001 From: cyy Date: Tue, 11 Sep 2018 14:47:39 +0800 Subject: [PATCH] fix uninitialized read errors reported by CUDA-INITCHECK --- .../opencv2/core/cuda/detail/transform_detail.hpp | 11 ++--------- .../include/opencv2/cudev/grid/detail/transform.hpp | 10 ++-------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/modules/core/include/opencv2/core/cuda/detail/transform_detail.hpp b/modules/core/include/opencv2/core/cuda/detail/transform_detail.hpp index 3b72b03dd6..1919848827 100644 --- a/modules/core/include/opencv2/core/cuda/detail/transform_detail.hpp +++ b/modules/core/include/opencv2/core/cuda/detail/transform_detail.hpp @@ -223,11 +223,7 @@ namespace cv { namespace cuda { namespace device if (x_shifted + ft::smart_shift - 1 < src_.cols) { const read_type src_n_el = ((const read_type*)src)[x]; - write_type dst_n_el = ((const write_type*)dst)[x]; - - OpUnroller::unroll(src_n_el, dst_n_el, mask, op, x_shifted, y); - - ((write_type*)dst)[x] = dst_n_el; + OpUnroller::unroll(src_n_el, ((write_type*)dst)[x], mask, op, x_shifted, y); } else { @@ -275,11 +271,8 @@ namespace cv { namespace cuda { namespace device { const read_type1 src1_n_el = ((const read_type1*)src1)[x]; const read_type2 src2_n_el = ((const read_type2*)src2)[x]; - write_type dst_n_el = ((const write_type*)dst)[x]; - OpUnroller::unroll(src1_n_el, src2_n_el, dst_n_el, mask, op, x_shifted, y); - - ((write_type*)dst)[x] = dst_n_el; + OpUnroller::unroll(src1_n_el, src2_n_el, ((write_type*)dst)[x], mask, op, x_shifted, y); } else { diff --git a/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp b/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp index dd39fe94a6..557797d7c8 100644 --- a/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp +++ b/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp @@ -199,11 +199,8 @@ namespace grid_transform_detail if (x_shifted + SHIFT - 1 < cols) { const read_type src_n_el = ((const read_type*)src)[x]; - write_type dst_n_el = ((const write_type*)dst)[x]; - OpUnroller::unroll(src_n_el, dst_n_el, op, mask, x_shifted, y); - - ((write_type*)dst)[x] = dst_n_el; + OpUnroller::unroll(src_n_el, ((write_type*)dst)[x], op, mask, x_shifted, y); } else { @@ -237,11 +234,8 @@ namespace grid_transform_detail { const read_type1 src1_n_el = ((const read_type1*)src1)[x]; const read_type2 src2_n_el = ((const read_type2*)src2)[x]; - write_type dst_n_el = ((const write_type*)dst)[x]; - OpUnroller::unroll(src1_n_el, src2_n_el, dst_n_el, op, mask, x_shifted, y); - - ((write_type*)dst)[x] = dst_n_el; + OpUnroller::unroll(src1_n_el, src2_n_el, ((write_type*)dst)[x], op, mask, x_shifted, y); } else {