1 #ifndef _MOVIT_SLICE_EFFECT_H
2 #define _MOVIT_SLICE_EFFECT_H 1
4 // SliceEffect takes an image, cuts it into (potentially overlapping) slices,
5 // and puts those slices back together again consecutively. It is primarily
6 // useful in an overlap-discard setting, where it can do both the overlap and
7 // discard roles, where one does convolutions by means of many small FFTs, but
8 // could also work as a (relatively boring) video effect on its own.
10 // Note that vertical slices happen from the top, consistent with the rest of
20 class SliceEffect : public Effect {
23 std::string effect_type_id() const override { return "SliceEffect"; }
24 std::string output_fragment_shader() override;
25 bool needs_texture_bounce() const override { return true; }
26 bool changes_output_size() const override { return true; }
27 bool sets_virtual_output_size() const override { return false; }
28 void inform_input_size(unsigned input_num, unsigned width, unsigned height) override;
29 void get_output_size(unsigned *width, unsigned *height,
30 unsigned *virtual_width, unsigned *virtual_height) const override;
32 void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num) override;
33 void inform_added(EffectChain *chain) override { this->chain = chain; }
35 enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
39 int input_width, input_height;
40 int input_slice_size, output_slice_size;
44 float uniform_output_coord_to_slice_num, uniform_slice_num_to_input_coord;
45 float uniform_slice_offset_to_input_coord, uniform_offset;
50 #endif // !defined(_MOVIT_SLICE_EFFECT_H)