X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fchroma_subsampler.h;fp=futatabi%2Fchroma_subsampler.h;h=ec43fe084627f3532da549fb1411051081ecc0ab;hb=6e116a6bbeb2c047a3bfb084395ec601ce211e6c;hp=0000000000000000000000000000000000000000;hpb=ce2e0615420b706e1ff2405fffcedfba37a9adac;p=nageru diff --git a/futatabi/chroma_subsampler.h b/futatabi/chroma_subsampler.h new file mode 100644 index 0000000..ec43fe0 --- /dev/null +++ b/futatabi/chroma_subsampler.h @@ -0,0 +1,29 @@ +#ifndef _CHROMA_SUBSAMPLER_H +#define _CHROMA_SUBSAMPLER_H 1 + +#include "flow.h" + +#include + +class ChromaSubsampler { +public: + ChromaSubsampler(); + ~ChromaSubsampler(); + + // Subsamples chroma (packed Cb and Cr) 2x1 to yield chroma suitable for + // planar 4:2:2. Chroma positioning is left (H.264 convention). + // width and height are the dimensions (in pixels) of the input texture. + void subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint cb_tex, GLuint cr_tex); + +private: + PersistentFBOSet<2> fbos; + + GLuint vao; + GLuint vbo; // Holds position data. + + GLuint cbcr_vs_obj, cbcr_fs_obj, cbcr_program; + GLuint uniform_cbcr_tex; + GLuint uniform_chroma_offset_0, uniform_chroma_offset_1; +}; + +#endif // !defined(_CHROMA_SUBSAMPLER_H)