18 #ifndef _SEFRAMEWORK_FFT_FFTHELPER_H
19 #define _SEFRAMEWORK_FFT_FFTHELPER_H
43 template <
typename T,
template <
typename>
class Img>
45 int width = origin.getWidth();
46 int height = origin.getHeight();
47 int pad = 2 * (width / 2 + 1) - width;
48 int stride = width + pad;
49 assert(buffer.
size() ==
static_cast<size_t>(height * (width + pad)));
50 for (
int y = 0;
y < height; ++
y) {
51 for (
int x = 0;
x < width; ++
x) {
52 buffer[
x +
y * stride] = origin.getValue(
x,
y);
86 template <
typename T,
template <
typename>
class Img>
88 bool normalize =
true) {
89 const int width = dest.getWidth();
90 const int height = dest.getHeight();
91 const int padded_width = width + rpad + lpad;
92 const int padded_height = height + tpad + bpad;
93 const int fftw_pad = 2 * (padded_width / 2 + 1) - padded_width;
94 const int stride = padded_width + fftw_pad;
95 const int total_size = normalize ? padded_width * padded_height : 1;
96 assert(buffer.
size() ==
static_cast<size_t>(padded_height * (padded_width + fftw_pad)));
97 for (
int y = 0;
y < height; ++
y) {
98 for (
int x = 0;
x < width; ++
x) {
99 dest.setValue(
x,
y, buffer[
x + lpad + (
y + tpad) * stride] / total_size);
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y