X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=fft_pass_effect.cpp;h=ee0b983ae92002875d5b8e86538e21b09846991b;hp=9c8aeb058e71fa33435901d4f5a2588a38ccb4f3;hb=67b2debafd624d3be66588171d6ec677b54247ba;hpb=e9f0fb5e6ae193a5a853ac5aef82927b6a81267a diff --git a/fft_pass_effect.cpp b/fft_pass_effect.cpp index 9c8aeb0..ee0b983 100644 --- a/fft_pass_effect.cpp +++ b/fft_pass_effect.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "effect_chain.h" @@ -117,15 +117,17 @@ void FFTPassEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, // is that we can have multiple FFTs along the same line, // and want to reuse the support texture by repeating it. int base = k * stride * 2 + offset; - int support_texture_index; + int support_texture_index = i; + int src1 = base; + int src2 = base + stride; if (direction == FFTPassEffect::VERTICAL) { // Compensate for OpenGL's bottom-left convention. - support_texture_index = fft_size - i - 1; - } else { - support_texture_index = i; + support_texture_index = fft_size - support_texture_index - 1; + src1 = fft_size - src1 - 1; + src2 = fft_size - src2 - 1; } - tmp[support_texture_index * 4 + 0] = fp64_to_fp16((base - support_texture_index) / double(input_size)); - tmp[support_texture_index * 4 + 1] = fp64_to_fp16((base + stride - support_texture_index) / double(input_size)); + tmp[support_texture_index * 4 + 0] = fp64_to_fp16((src1 - support_texture_index) / double(input_size)); + tmp[support_texture_index * 4 + 1] = fp64_to_fp16((src2 - support_texture_index) / double(input_size)); tmp[support_texture_index * 4 + 2] = fp64_to_fp16(twiddle_real); tmp[support_texture_index * 4 + 3] = fp64_to_fp16(twiddle_imag); }