X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=slice_effect.h;fp=slice_effect.h;h=3448941873aebbfef9067e682d906fafc0308805;hp=0000000000000000000000000000000000000000;hb=8c7e53028a3ef4805d2608643041a5d7e6bd1b6e;hpb=818a3ca926f2acb93157b386fb1dcb511e6b56c4 diff --git a/slice_effect.h b/slice_effect.h new file mode 100644 index 0000000..3448941 --- /dev/null +++ b/slice_effect.h @@ -0,0 +1,43 @@ +#ifndef _MOVIT_SLICE_EFFECT_H +#define _MOVIT_SLICE_EFFECT_H 1 + +// SliceEffect takes an image, cuts it into (potentially overlapping) slices, +// and puts those slices back together again consecutively. It is primarily +// useful in an overlap-discard setting, where it can do both the overlap and +// 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. + +#include +#include + +#include "effect.h" + +namespace movit { + +class SliceEffect : public Effect { +public: + SliceEffect(); + virtual std::string effect_type_id() const { return "SliceEffect"; } + std::string output_fragment_shader(); + virtual bool needs_texture_bounce() const { return true; } + virtual bool changes_output_size() const { return true; } + virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height); + virtual void get_output_size(unsigned *width, unsigned *height, + unsigned *virtual_width, unsigned *virtual_height) const; + + void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num); + + enum Direction { HORIZONTAL = 0, VERTICAL = 1 }; + +private: + int input_width, input_height; + int input_slice_size, output_slice_size; + Direction direction; +}; + +} // namespace movit + +#endif // !defined(_MOVIT_SLICE_EFFECT_H)