]> git.sesse.net Git - movit/commitdiff
Make SliceEffect slice from the top, not the bottom.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 15 Mar 2014 20:53:10 +0000 (21:53 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 15 Mar 2014 21:24:39 +0000 (22:24 +0100)
This is more consistent with the rest of Movit, and makes the rest
of the FFT implementation easier.

slice_effect.frag
slice_effect.h
slice_effect_test.cpp

index 84165154b3f01b7e795fee7dc9b14e0ea71dd005..1598cb034565addd4289be93c4f119771ace62da 100644 (file)
@@ -6,7 +6,7 @@ vec4 FUNCNAME(vec2 tc) {
        // DIRECTION_VERTICAL will be #defined to 1 if we are expanding vertically,
        // and 0 otherwise.
 #if DIRECTION_VERTICAL
        // DIRECTION_VERTICAL will be #defined to 1 if we are expanding vertically,
        // and 0 otherwise.
 #if DIRECTION_VERTICAL
-       float sliced_coord = tc.y;
+       float sliced_coord = 1.0 - tc.y;
 #else
        float sliced_coord = tc.x;
 #endif
 #else
        float sliced_coord = tc.x;
 #endif
@@ -19,7 +19,7 @@ vec4 FUNCNAME(vec2 tc) {
        float input_coord = slice_num * PREFIX(slice_num_to_input_coord) + slice_offset * PREFIX(slice_offset_to_input_coord);
 
 #if DIRECTION_VERTICAL
        float input_coord = slice_num * PREFIX(slice_num_to_input_coord) + slice_offset * PREFIX(slice_offset_to_input_coord);
 
 #if DIRECTION_VERTICAL
-       return INPUT(vec2(tc.x, input_coord));
+       return INPUT(vec2(tc.x, 1.0 - input_coord));
 #else
        return INPUT(vec2(input_coord, tc.y));
 #endif
 #else
        return INPUT(vec2(input_coord, tc.y));
 #endif
index 17202d77c97577e720cf023426c8c28f095ab8c5..31a13fd60a736c5f32154080b7de4022157d67fe 100644 (file)
@@ -7,8 +7,8 @@
 // discard roles, where one does convolutions by means of many small FFTs, but
 // could also work as a (relatively boring) video effect on its own.
 //
 // discard roles, where one does convolutions by means of many small FFTs, but
 // could also work as a (relatively boring) video effect on its own.
 //
-// Note that vertical slices happen from the bottom, not the top, due to the
-// OpenGL coordinate system.
+// Note that vertical slices happen from the top, consistent with the rest of
+// Movit.
 
 #include <GL/glew.h>
 #include <string>
 
 #include <GL/glew.h>
 #include <string>
index efa6803fdbd7225d02c2c2d12b69e64b5730aa92..88b77a21e62fe750784712abb63340ca9eb9d5f0 100644 (file)
@@ -84,21 +84,21 @@ TEST(SliceEffectTest, HorizontalDiscard) {
        expect_equal(expected_data, out_data, 4, 2);
 }
 
        expect_equal(expected_data, out_data, 4, 2);
 }
 
-TEST(SliceEffectTest, VerticalOverlapSlicesFromBottom) {
+TEST(SliceEffectTest, VerticalOverlapSlicesFromTop) {
        float data[2 * 3] = {
                0.0f, 0.1f,
        float data[2 * 3] = {
                0.0f, 0.1f,
-
                0.4f, 0.3f,
                0.4f, 0.3f,
+
                0.6f, 0.2f,
        };
        float expected_data[2 * 6] = {
                0.6f, 0.2f,
        };
        float expected_data[2 * 6] = {
-               0.0f, 0.1f,
-               0.0f, 0.1f,
-               0.0f, 0.1f,
-
                0.0f, 0.1f,
                0.4f, 0.3f,
                0.6f, 0.2f,
                0.0f, 0.1f,
                0.4f, 0.3f,
                0.6f, 0.2f,
+
+               0.6f, 0.2f,
+               0.6f, 0.2f,
+               0.6f, 0.2f,
        };
        float out_data[2 * 6];
 
        };
        float out_data[2 * 6];