]> git.sesse.net Git - movit/blobdiff - fft_input.cpp
Release Movit 1.3.2. (From a branch, since I do not want to break ABI compatibility...
[movit] / fft_input.cpp
index c88a7c4b12fe9947cc6cd2a43f3b4ff0ba2d6e01..f9339df24779fab2cb37fb00baba51e88f613d4b 100644 (file)
@@ -23,6 +23,7 @@ FFTInput::FFTInput(unsigned width, unsigned height)
 {
        register_int("fft_width", &fft_width);
        register_int("fft_height", &fft_height);
+       register_uniform_sampler2d("tex", &uniform_tex);
 }
 
 FFTInput::~FFTInput()
@@ -66,8 +67,8 @@ void FFTInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsig
                // Convert to fp16.
                fp16_int_t *kernel = new fp16_int_t[fft_width * fft_height * 2];
                for (int i = 0; i < fft_width * fft_height; ++i) {
-                       kernel[i * 2 + 0] = fp64_to_fp16(out[i][0]);
-                       kernel[i * 2 + 1] = fp64_to_fp16(out[i][1]);
+                       kernel[i * 2 + 0] = fp32_to_fp16(out[i][0]);
+                       kernel[i * 2 + 1] = fp32_to_fp16(out[i][1]);
                }
 
                // (Re-)upload the texture.
@@ -98,7 +99,7 @@ void FFTInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsig
        }
 
        // Bind it to a sampler.
-       set_uniform_int(glsl_program_num, prefix, "tex", *sampler_num);
+       uniform_tex = *sampler_num;
        ++*sampler_num;
 }