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
2985c713
Commit
2985c713
authored
Sep 28, 2010
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed short and float reading/writing in gpu::cvtColor
parent
60e572bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
15 deletions
+6
-15
color.cu
modules/gpu/src/cuda/color.cu
+6
-15
No files found.
modules/gpu/src/cuda/color.cu
View file @
2985c713
...
...
@@ -52,35 +52,26 @@ using namespace cv::gpu;
namespace imgproc
{
template<typename T, int N> struct TypeVec {};
template<> struct TypeVec<uchar, 1> { typedef uchar1 vec_t; };
template<> struct TypeVec<uchar, 2> { typedef uchar2 vec_t; };
template<> struct TypeVec<uchar, 3> { typedef uchar3 vec_t; };
template<> struct TypeVec<uchar, 4> { typedef uchar4 vec_t; };
template<> struct TypeVec<unsigned short, 1> { typedef ushort1 vec_t; };
template<> struct TypeVec<unsigned short, 2> { typedef ushort2 vec_t; };
template<> struct TypeVec<unsigned short, 3> { typedef ushort3 vec_t; };
template<> struct TypeVec<unsigned short, 4> { typedef ushort4 vec_t; };
template<> struct TypeVec<float, 1> { typedef float1 vec_t; };
template<> struct TypeVec<float, 2> { typedef float2 vec_t; };
template<> struct TypeVec<float, 3> { typedef float3 vec_t; };
template<> struct TypeVec<float, 4> { typedef float4 vec_t; };
template<typename T> struct ColorChannel {};
template<> struct ColorChannel<uchar>
{
typedef float worktype_f;
static __device__ unsigned char max() { return UCHAR_MAX; }
static __device__ unsigned char half() { return (unsigned char)(max()/2 + 1); }
};
template<> struct ColorChannel<unsigned short>
{
typedef float worktype_f;
static __device__ unsigned short max() { return USHRT_MAX; }
static __device__ unsigned short half() { return (unsigned short)(max()/2 + 1); }
};
template<> struct ColorChannel<float>
{
typedef float worktype_f;
...
...
@@ -124,7 +115,7 @@ namespace imgproc
if (y < rows && x < cols)
{
src_t src = *(const src_t*)(src_ + y * src_step + x * SRCCN);
src_t src = *(const src_t*)(src_ + y * src_step + x * SRCCN
* sizeof(T)
);
dst_t dst;
dst.x = ((const T*)(&src))[bidx];
...
...
@@ -132,7 +123,7 @@ namespace imgproc
dst.z = ((const T*)(&src))[bidx ^ 2];
setAlpha(dst, getAlpha<T>(src));
*(dst_t*)(dst_ + y * dst_step + x * DSTCN) = dst;
*(dst_t*)(dst_ + y * dst_step + x * DSTCN
* sizeof(T)
) = dst;
}
}
}
...
...
@@ -817,12 +808,12 @@ namespace imgproc
if (y < rows && x < cols)
{
src_t src = *(const src_t*)(src_ + y * src_step + x * SRCCN);
src_t src = *(const src_t*)(src_ + y * src_step + x * SRCCN
* sizeof(T)
);
dst_t dst;
RGB2YCrCbConverter<T>::cvt(((const T*)(&src)), dst, bidx);
*(dst_t*)(dst_ + y * dst_step + x * 3) = dst;
*(dst_t*)(dst_ + y * dst_step + x * 3
* sizeof(T)
) = dst;
}
}
...
...
@@ -865,13 +856,13 @@ namespace imgproc
if (y < rows && x < cols)
{
src_t src = *(const src_t*)(src_ + y * src_step + x * 3);
src_t src = *(const src_t*)(src_ + y * src_step + x * 3
* sizeof(T)
);
dst_t dst;
YCrCb2RGBConvertor<T>::cvt(src, ((T*)(&dst)), bidx);
setAlpha(dst, ColorChannel<T>::max());
*(dst_t*)(dst_ + y * dst_step + x * DSTCN) = dst;
*(dst_t*)(dst_ + y * dst_step + x * DSTCN
* sizeof(T)
) = dst;
}
}
}
...
...
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