Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
cd2b7448
Commit
cd2b7448
authored
May 30, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eliminate unnecessary double arithmetics in CUDA
parent
0b270e2b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
26 additions
and
17 deletions
+26
-17
reduce.cu
modules/gpuarithm/src/cuda/reduce.cu
+13
-4
mog2.cu
modules/gpubgsegm/src/cuda/mog2.cu
+1
-1
perf_features2d.cpp
modules/gpufeatures2d/perf/perf_features2d.cpp
+1
-1
orb.cu
modules/gpufeatures2d/src/cuda/orb.cu
+3
-3
bilateral_filter.cu
modules/gpuimgproc/src/cuda/bilateral_filter.cu
+1
-1
canny.cu
modules/gpuimgproc/src/cuda/canny.cu
+1
-1
needle_map.cu
modules/gpuoptflow/src/cuda/needle_map.cu
+1
-1
icf-sc.cu
modules/softcascade/src/cuda/icf-sc.cu
+4
-4
perf_superres.cpp
modules/superres/perf/perf_superres.cpp
+1
-1
No files found.
modules/gpuarithm/src/cuda/reduce.cu
View file @
cd2b7448
...
...
@@ -72,7 +72,7 @@ namespace reduce
}
template <typename T>
__device__ __forceinline__ T result(T r,
double
) const
__device__ __forceinline__ T result(T r,
int
) const
{
return r;
}
...
...
@@ -81,6 +81,15 @@ namespace reduce
__host__ __device__ __forceinline__ Sum(const Sum&) {}
};
template <typename T> struct OutputType
{
typedef float type;
};
template <> struct OutputType<double>
{
typedef double type;
};
struct Avg
{
template <typename T>
...
...
@@ -96,7 +105,7 @@ namespace reduce
}
template <typename T>
__device__ __forceinline__ typename TypeVec<
double, VecTraits<T>::cn>::vec_type result(T r, double
sz) const
__device__ __forceinline__ typename TypeVec<
typename OutputType<typename VecTraits<T>::elem_type>::type, VecTraits<T>::cn>::vec_type result(T r, float
sz) const
{
return r / sz;
}
...
...
@@ -121,7 +130,7 @@ namespace reduce
}
template <typename T>
__device__ __forceinline__ T result(T r,
double
) const
__device__ __forceinline__ T result(T r,
int
) const
{
return r;
}
...
...
@@ -146,7 +155,7 @@ namespace reduce
}
template <typename T>
__device__ __forceinline__ T result(T r,
double
) const
__device__ __forceinline__ T result(T r,
int
) const
{
return r;
}
...
...
modules/gpubgsegm/src/cuda/mog2.cu
View file @
cd2b7448
...
...
@@ -227,7 +227,7 @@ namespace cv { namespace gpu { namespace cudev
//check prune
if (weight < -prune)
{
weight = 0.0;
weight = 0.0
f
;
nmodes--;
}
...
...
modules/gpufeatures2d/perf/perf_features2d.cpp
View file @
cd2b7448
...
...
@@ -123,7 +123,7 @@ PERF_TEST_P(Image_NFeatures, ORB,
sortKeyPoints
(
gpu_keypoints
,
gpu_descriptors
);
SANITY_CHECK_KEYPOINTS
(
gpu_keypoints
);
SANITY_CHECK_KEYPOINTS
(
gpu_keypoints
,
1e-4
);
SANITY_CHECK
(
gpu_descriptors
);
}
else
...
...
modules/gpufeatures2d/src/cuda/orb.cu
View file @
cd2b7448
...
...
@@ -197,8 +197,8 @@ namespace cv { namespace gpu { namespace cudev
if (threadIdx.x == 0)
{
float kp_dir = ::atan2f((float)m_01, (float)m_10);
kp_dir += (kp_dir < 0) * (2.0f * CV_PI);
kp_dir *= 180.0f / CV_PI;
kp_dir += (kp_dir < 0) * (2.0f * CV_PI
_F
);
kp_dir *= 180.0f / CV_PI
_F
;
angle[ptidx] = kp_dir;
}
...
...
@@ -349,7 +349,7 @@ namespace cv { namespace gpu { namespace cudev
if (ptidx < npoints && descidx < dsize)
{
float angle = angle_[ptidx];
angle *= (float)(CV_PI / 180.f);
angle *= (float)(CV_PI
_F
/ 180.f);
float sina, cosa;
::sincosf(angle, &sina, &cosa);
...
...
modules/gpuimgproc/src/cuda/bilateral_filter.cu
View file @
cd2b7448
...
...
@@ -133,7 +133,7 @@ namespace cv { namespace gpu { namespace cudev
B<T> b(src.rows, src.cols);
float sigma_spatial2_inv_half = -0.5f/(sigma_spatial * sigma_spatial);
float sigma_color2_inv_half = -0.5f/(sigma_color * sigma_color);
float sigma_color2_inv_half = -0.5f/(sigma_color * sigma_color);
cudaSafeCall( cudaFuncSetCacheConfig (bilateral_kernel<T, B<T> >, cudaFuncCachePreferL1) );
bilateral_kernel<<<grid, block>>>((PtrStepSz<T>)src, (PtrStepSz<T>)dst, b, kernel_size, sigma_spatial2_inv_half, sigma_color2_inv_half);
...
...
modules/gpuimgproc/src/cuda/canny.cu
View file @
cd2b7448
...
...
@@ -43,7 +43,7 @@
#if !defined CUDA_DISABLER
#include <utility>
#include <algorithm>
//std::swap
#include <algorithm>
#include "opencv2/core/cuda/common.hpp"
#include "opencv2/core/cuda/emulation.hpp"
#include "opencv2/core/cuda/transform.hpp"
...
...
modules/gpuoptflow/src/cuda/needle_map.cu
View file @
cd2b7448
...
...
@@ -140,7 +140,7 @@ namespace cv { namespace gpu { namespace cudev
const float u_avg_val = u_avg(y, x);
const float v_avg_val = v_avg(y, x);
const float theta = ::atan2f(v_avg_val, u_avg_val);
// + CV_PI;
const float theta = ::atan2f(v_avg_val, u_avg_val);
float r = ::sqrtf(v_avg_val * v_avg_val + u_avg_val * u_avg_val);
r = fmin(14.0f * (r / max_flow), 14.0f);
...
...
modules/softcascade/src/cuda/icf-sc.cu
View file @
cd2b7448
...
...
@@ -137,10 +137,10 @@ typedef unsigned char uchar;
template<bool isDefaultNum>
__device__ __forceinline__ int fast_angle_bin(const float& dx, const float& dy)
{
const float angle_quantum = CV_PI / 6.f;
const float angle_quantum = CV_PI
_F
/ 6.f;
float angle = atan2(dx, dy) + (angle_quantum / 2.f);
if (angle < 0) angle += CV_PI;
if (angle < 0) angle += CV_PI
_F
;
const float angle_scaling = 1.f / angle_quantum;
return static_cast<int>(angle * angle_scaling) % 6;
...
...
@@ -174,8 +174,8 @@ typedef unsigned char uchar;
{
int i = 3;
float2 bin_vector_i;
bin_vector_i.x = ::cos(i * (CV_PI / 6.f));
bin_vector_i.y = ::sin(i * (CV_PI / 6.f));
bin_vector_i.x = ::cos(i * (CV_PI
_F
/ 6.f));
bin_vector_i.y = ::sin(i * (CV_PI
_F
/ 6.f));
const float dot_product = fabs(dx * bin_vector_i.x + dy * bin_vector_i.y);
if(dot_product > max_dot)
...
...
modules/superres/perf/perf_superres.cpp
View file @
cd2b7448
...
...
@@ -160,7 +160,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1,
TEST_CYCLE_N
(
10
)
superRes
->
nextFrame
(
dst
);
GPU_SANITY_CHECK
(
dst
);
GPU_SANITY_CHECK
(
dst
,
2
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment