1 #ifndef _CHROMA_SUBSAMPLER_H
2 #define _CHROMA_SUBSAMPLER_H 1
12 class ChromaSubsampler {
14 ChromaSubsampler(movit::ResourcePool *resource_pool);
17 // Subsamples chroma (packed Cb and Cr) 2x2 to yield chroma suitable for
18 // NV12 (semiplanar 4:2:0). Chroma positioning is left/center (H.264 convention).
19 // width and height are the dimensions (in pixels) of the input texture.
21 // You can get two equal copies if you'd like; just set dst2_tex to a texture
22 // number and it will receive an exact copy of what goes into dst_tex.
23 void subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex, GLuint dst2_tex = 0);
25 // Subsamples and interleaves luma and chroma to give 4:2:2 packed Y'CbCr (UYVY).
26 // Chroma positioning is left (H.264 convention).
27 // width and height are the dimensions (in pixels) of the input textures.
28 void create_uyvy(GLuint y_tex, GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex);
31 movit::ResourcePool *resource_pool;
33 GLuint vbo; // Holds position and texcoord data.
35 GLuint cbcr_program_num; // Owned by <resource_pool>.
36 GLuint cbcr_texture_sampler_uniform;
37 GLuint cbcr_position_attribute_index, cbcr_texcoord_attribute_index;
39 GLuint uyvy_program_num; // Owned by <resource_pool>.
40 GLuint uyvy_y_texture_sampler_uniform, uyvy_cbcr_texture_sampler_uniform;
41 GLuint uyvy_position_attribute_index, uyvy_texcoord_attribute_index;
44 #endif // !defined(_CHROMA_SUBSAMPLER_H)