]> git.sesse.net Git - movit/blob - ycbcr_conversion_effect.h
Invert the meaning of the last_phase boolean to execute_phase().
[movit] / ycbcr_conversion_effect.h
1 #ifndef _MOVIT_YCBCR_CONVERSION_EFFECT_H
2 #define _MOVIT_YCBCR_CONVERSION_EFFECT_H 1
3
4 // Converts from R'G'B' to Y'CbCr; that is, more or less the opposite of YCbCrInput,
5 // except that it keeps the data as 4:4:4 chunked Y'CbCr; you'll need to subsample
6 // and/or convert to planar somehow else.
7
8 #include <epoxy/gl.h>
9 #include <Eigen/Core>
10 #include <string>
11
12 #include "effect.h"
13 #include "ycbcr.h"
14
15 namespace movit {
16
17 class YCbCrConversionEffect : public Effect {
18 private:
19         // Should not be instantiated by end users;
20         // call EffectChain::add_ycbcr_output() instead.
21         YCbCrConversionEffect(const YCbCrFormat &ycbcr_format, GLenum type);
22         friend class EffectChain;
23
24 public:
25         virtual std::string effect_type_id() const { return "YCbCrConversionEffect"; }
26         std::string output_fragment_shader();
27         void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
28         virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
29         virtual bool one_to_one_sampling() const { return true; }
30
31         // Should not be called by end users; call
32         // EffectChain::change_ycbcr_output_format() instead.
33         void change_output_format(const YCbCrFormat &ycbcr_format) {
34                 this->ycbcr_format = ycbcr_format;
35         }
36
37 private:
38         YCbCrFormat ycbcr_format;
39         GLenum type;
40
41         Eigen::Matrix3d uniform_ycbcr_matrix;
42         float uniform_offset[3];
43         bool uniform_clamp_range;
44         float uniform_ycbcr_min[3], uniform_ycbcr_max[3];
45 };
46
47 }  // namespace movit
48
49 #endif // !defined(_MOVIT_YCBCR_CONVERSION_EFFECT_H)