]> git.sesse.net Git - movit/blob - slice_effect.h
Add a few check_error() calls.
[movit] / slice_effect.h
1 #ifndef _MOVIT_SLICE_EFFECT_H
2 #define _MOVIT_SLICE_EFFECT_H 1
3
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.
9 //
10 // Note that vertical slices happen from the top, consistent with the rest of
11 // Movit.
12
13 #include <epoxy/gl.h>
14 #include <string>
15
16 #include "effect.h"
17
18 namespace movit {
19
20 class SliceEffect : public Effect {
21 public:
22         SliceEffect();
23         virtual std::string effect_type_id() const { return "SliceEffect"; }
24         std::string output_fragment_shader();
25         virtual bool needs_texture_bounce() const { return true; }
26         virtual bool changes_output_size() const { return true; }
27         virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height);
28         virtual void get_output_size(unsigned *width, unsigned *height,
29                                      unsigned *virtual_width, unsigned *virtual_height) const;
30
31         void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
32         virtual void inform_added(EffectChain *chain) { this->chain = chain; }
33         
34         enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
35
36 private:
37         EffectChain *chain;
38         int input_width, input_height;
39         int input_slice_size, output_slice_size;
40         int offset;
41         Direction direction;
42 };
43
44 }  // namespace movit
45
46 #endif // !defined(_MOVIT_SLICE_EFFECT_H)