]> git.sesse.net Git - nageru/blob - futatabi/chroma_subsampler.h
Fix an issue where scrubbing in Futatabi could lock up if there were no inputs going...
[nageru] / futatabi / chroma_subsampler.h
1 #ifndef _CHROMA_SUBSAMPLER_H
2 #define _CHROMA_SUBSAMPLER_H 1
3
4 #include "flow.h"
5
6 #include <epoxy/gl.h>
7
8 class ChromaSubsampler {
9 public:
10         ChromaSubsampler();
11         ~ChromaSubsampler();
12
13         // Subsamples chroma (packed Cb and Cr) 2x1 to yield chroma suitable for
14         // planar 4:2:2. Chroma positioning is left (H.264 convention).
15         // width and height are the dimensions (in pixels) of the input texture.
16         void subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint cb_tex, GLuint cr_tex);
17
18 private:
19         PersistentFBOSet<2> fbos;
20
21         GLuint vao;
22         GLuint vbo;  // Holds position data.
23
24         GLuint cbcr_vs_obj, cbcr_fs_obj, cbcr_program;
25         GLuint uniform_cbcr_tex;
26         GLuint uniform_chroma_offset_0, uniform_chroma_offset_1;
27 };
28
29 #endif  // !defined(_CHROMA_SUBSAMPLER_H)