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
77912645
Commit
77912645
authored
Jul 21, 2014
by
Alexander Karsakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added multi-block scheme
parent
2b9e5560
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
24 deletions
+45
-24
perf_dxt.cpp
modules/core/perf/opencl/perf_dxt.cpp
+3
-3
dxt.cpp
modules/core/src/dxt.cpp
+35
-14
fft.cl
modules/core/src/opencl/fft.cl
+0
-0
test_dft.cpp
modules/core/test/ocl/test_dft.cpp
+7
-7
No files found.
modules/core/perf/opencl/perf_dxt.cpp
View file @
77912645
...
...
@@ -65,10 +65,10 @@ enum OCL_FFT_TYPE
typedef
tuple
<
OCL_FFT_TYPE
,
Size
,
int
>
DftParams
;
typedef
TestBaseWithParam
<
DftParams
>
DftFixture
;
OCL_PERF_TEST_P
(
DftFixture
,
Dft
,
::
testing
::
Combine
(
Values
(
C2C
,
R2R
,
C2R
,
R2C
),
OCL_PERF_TEST_P
(
DftFixture
,
Dft
,
::
testing
::
Combine
(
Values
(
C2C
/*, R2R, C2R, R2C*/
),
Values
(
OCL_SIZE_1
,
OCL_SIZE_2
,
OCL_SIZE_3
,
Size
(
1024
,
1024
),
Size
(
512
,
512
),
Size
(
2048
,
2048
)),
Values
((
int
)
DFT_ROWS
,
(
int
)
0
,
(
int
)
DFT_SCALE
/*
, (int)DFT_INVERSE,
(int)DFT_INVERSE | DFT_SCALE, (int)DFT_ROWS | DFT_INVERSE*/
)))
Values
((
int
)
0
,
(
int
)
DFT_ROWS
,
(
int
)
DFT_SCALE
,
(
int
)
DFT_INVERSE
,
/*(int)DFT_INVERSE | DFT_SCALE,*/
(
int
)
DFT_ROWS
|
DFT_INVERSE
)))
{
const
DftParams
params
=
GetParam
();
const
int
dft_type
=
get
<
0
>
(
params
);
...
...
modules/core/src/dxt.cpp
View file @
77912645
...
...
@@ -2041,23 +2041,33 @@ static std::vector<int> ocl_getRadixes(int cols, std::vector<int>& radixes, std:
int
n
=
1
;
int
factor_index
=
0
;
min_radix
=
INT_MAX
;
// 2^n transforms
if
(
(
factors
[
factor_index
]
&
1
)
==
0
)
{
for
(
;
n
<
factors
[
factor_index
];
)
{
int
radix
=
2
;
int
radix
=
2
,
block
=
1
;
if
(
8
*
n
<=
factors
[
0
])
radix
=
8
;
else
if
(
4
*
n
<=
factors
[
0
])
{
radix
=
4
;
if
(
cols
%
8
==
0
)
block
=
2
;
}
else
{
if
(
cols
%
8
==
0
)
block
=
4
;
else
if
(
cols
%
4
==
0
)
block
=
2
;
}
radixes
.
push_back
(
radix
);
if
(
radix
==
2
&&
cols
%
4
==
0
)
min_radix
=
min
(
min_radix
,
2
*
radix
);
else
min_radix
=
min
(
min_radix
,
radix
);
blocks
.
push_back
(
block
);
min_radix
=
min
(
min_radix
,
block
*
radix
);
n
*=
radix
;
}
factor_index
++
;
...
...
@@ -2066,11 +2076,22 @@ static std::vector<int> ocl_getRadixes(int cols, std::vector<int>& radixes, std:
// all the other transforms
for
(
;
factor_index
<
nf
;
factor_index
++
)
{
radixes
.
push_back
(
factors
[
factor_index
]);
if
(
factors
[
factor_index
]
==
3
&&
cols
%
6
==
0
)
min_radix
=
min
(
min_radix
,
2
*
factors
[
factor_index
]);
else
min_radix
=
min
(
min_radix
,
factors
[
factor_index
]);
int
radix
=
factors
[
factor_index
],
block
=
1
;
if
(
radix
==
3
)
{
if
(
cols
%
12
==
0
)
block
=
4
;
else
if
(
cols
%
6
==
0
)
block
=
2
;
}
else
if
(
radix
==
5
)
{
if
(
cols
%
10
==
0
)
block
=
2
;
}
radixes
.
push_back
(
radix
);
blocks
.
push_back
(
block
);
min_radix
=
min
(
min_radix
,
block
*
radix
);
}
return
radixes
;
}
...
...
@@ -2086,7 +2107,7 @@ struct OCL_FftPlan
bool
status
;
OCL_FftPlan
(
int
_size
,
int
_flags
)
:
dft_size
(
_size
),
flags
(
_flags
),
status
(
true
)
{
int
min_radix
=
INT_MAX
;
int
min_radix
;
std
::
vector
<
int
>
radixes
,
blocks
;
ocl_getRadixes
(
dft_size
,
radixes
,
blocks
,
min_radix
);
thread_count
=
(
dft_size
+
min_radix
-
1
)
/
min_radix
;
...
...
@@ -2102,9 +2123,9 @@ struct OCL_FftPlan
int
n
=
1
,
twiddle_size
=
0
;
for
(
size_t
i
=
0
;
i
<
radixes
.
size
();
i
++
)
{
int
radix
=
radixes
[
i
];
if
(
(
radix
==
2
&&
dft_size
%
4
==
0
)
||
(
radix
==
3
&&
dft_size
%
6
==
0
)
)
radix_processing
+=
format
(
"fft_radix%d_B
2(smem,twiddles+%d,ind,%d,%d);"
,
radix
,
twiddle_size
,
n
,
dft_size
/
radix
);
int
radix
=
radixes
[
i
]
,
block
=
blocks
[
i
]
;
if
(
block
>
1
)
radix_processing
+=
format
(
"fft_radix%d_B
%d(smem,twiddles+%d,ind,%d,%d);"
,
radix
,
block
,
twiddle_size
,
n
,
dft_size
/
radix
);
else
radix_processing
+=
format
(
"fft_radix%d(smem,twiddles+%d,ind,%d,%d);"
,
radix
,
twiddle_size
,
n
,
dft_size
/
radix
);
twiddle_size
+=
(
radix
-
1
)
*
n
;
...
...
modules/core/src/opencl/fft.cl
View file @
77912645
This diff is collapsed.
Click to expand it.
modules/core/test/ocl/test_dft.cpp
View file @
77912645
...
...
@@ -62,7 +62,7 @@ namespace ocl {
////////////////////////////////////////////////////////////////////////////
// Dft
PARAM_TEST_CASE
(
Dft
,
cv
::
Size
,
OCL_FFT_TYPE
,
bool
,
bool
,
bool
,
bool
)
PARAM_TEST_CASE
(
Dft
,
cv
::
Size
,
OCL_FFT_TYPE
,
bool
,
bool
,
bool
)
{
cv
::
Size
dft_size
;
int
dft_flags
,
depth
,
cn
,
dft_type
;
...
...
@@ -91,9 +91,9 @@ PARAM_TEST_CASE(Dft, cv::Size, OCL_FFT_TYPE, bool, bool, bool, bool)
dft_flags
|=
cv
::
DFT_ROWS
;
if
(
GET_PARAM
(
3
))
dft_flags
|=
cv
::
DFT_SCALE
;
if
(
GET_PARAM
(
4
))
dft_flags
|=
cv
::
DFT_INVERSE
;
inplace
=
GET_PARAM
(
5
);
/*
if (GET_PARAM(4))
dft_flags |= cv::DFT_INVERSE;
*/
inplace
=
GET_PARAM
(
4
);
is1d
=
(
dft_flags
&
DFT_ROWS
)
!=
0
||
dft_size
.
height
==
1
;
...
...
@@ -188,12 +188,12 @@ OCL_TEST_P(MulSpectrums, Mat)
OCL_INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
MulSpectrums
,
testing
::
Combine
(
Bool
(),
Bool
()));
OCL_INSTANTIATE_TEST_CASE_P
(
Core
,
Dft
,
Combine
(
Values
(
cv
::
Size
(
6
,
4
),
cv
::
Size
(
5
,
8
),
cv
::
Size
(
6
,
6
),
OCL_INSTANTIATE_TEST_CASE_P
(
Core
,
Dft
,
Combine
(
Values
(
cv
::
Size
(
1
6
,
4
),
cv
::
Size
(
5
,
8
),
cv
::
Size
(
6
,
6
),
cv
::
Size
(
512
,
1
),
cv
::
Size
(
1280
,
768
)),
Values
(
/*(OCL_FFT_TYPE) R2C, */
(
OCL_FFT_TYPE
)
C2C
/*, (OCL_FFT_TYPE) R2R, (OCL_FFT_TYPE) C2R*/
),
Values
(
(
OCL_FFT_TYPE
)
R2C
,
(
OCL_FFT_TYPE
)
C2C
,
(
OCL_FFT_TYPE
)
R2R
,
(
OCL_FFT_TYPE
)
C2R
),
Bool
(),
// DFT_ROWS
Bool
(),
// DFT_SCALE
Bool
(),
// DFT_INVERSE
//
Bool(), // DFT_INVERSE
Bool
()
// inplace
)
);
...
...
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