X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=fft_pass_effect.frag;fp=fft_pass_effect.frag;h=462a6734c9ba87eae62f67aa2d09c5d264066718;hp=0000000000000000000000000000000000000000;hb=c4f0d4e876a8177db5738596f22349e030e0a1dc;hpb=614bef1bce4e94e7774d965b790a1d95b55b81bc diff --git a/fft_pass_effect.frag b/fft_pass_effect.frag new file mode 100644 index 0000000..462a673 --- /dev/null +++ b/fft_pass_effect.frag @@ -0,0 +1,24 @@ +// DIRECTION_VERTICAL will be #defined to 1 if we are doing a vertical FFT, +// and 0 otherwise. + +uniform float PREFIX(num_repeats); +uniform sampler1D PREFIX(support_tex); + +vec4 FUNCNAME(vec2 tc) { +#if DIRECTION_VERTICAL + vec4 support = texture1D(PREFIX(support_tex), tc.y * PREFIX(num_repeats)); + vec4 c1 = INPUT(vec2(tc.x, 1.0 - (tc.y + support.x))); + vec4 c2 = INPUT(vec2(tc.x, 1.0 - (tc.y + support.y))); +#else + vec4 support = texture1D(PREFIX(support_tex), tc.x * PREFIX(num_repeats)); + vec4 c1 = INPUT(vec2(tc.x + support.x, tc.y)); + vec4 c2 = INPUT(vec2(tc.x + support.y, tc.y)); +#endif + // Two complex additions and multiplications in parallel; essentially + // + // result.xy = c1.xy + twiddle * c2.xy + // result.zw = c1.zw + twiddle * c2.zw + // + // where * is complex multiplication. + return c1 + support.z * c2 + support.w * vec4(-c2.y, c2.x, -c2.w, c2.z); +}