| 280 | } |
| 281 | |
| 282 | void PrepareInputBuffer(const float* input_data, int input_height, |
| 283 | int input_width, int fft_height, int fft_width, |
| 284 | double** fft_input_output) { |
| 285 | int valid_input_height = std::min(input_height, fft_height); |
| 286 | int valid_input_width = std::min(input_width, fft_width); |
| 287 | for (int i = 0; i < valid_input_height; ++i) { |
| 288 | int in_pos = i * input_width; |
| 289 | for (int j = 0; j < valid_input_width; ++j) { |
| 290 | fft_input_output[i][j] = input_data[in_pos++]; |
| 291 | } |
| 292 | // Zero-pad the rest of the input buffer |
| 293 | for (int j = valid_input_width; j < fft_width + 2; ++j) { |
| 294 | fft_input_output[i][j] = 0; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | // Zero-pad input buffer, if fft_height is greater than valid_input_height. |
| 299 | for (int i = valid_input_height; i < fft_height; ++i) { |
| 300 | for (int j = 0; j < fft_width + 2; ++j) { |
| 301 | fft_input_output[i][j] = 0; |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | void PrepareOutputBuffer(complex<float>* output_data, int fft_height, |
| 307 | int fft_width, double** fft_input_output) { |