"#version 130 \n"
"in vec2 tc0, tc1; \n"
"uniform sampler2D cbcr_tex; \n"
- "out vec4 FragColor; \n"
+ "out vec4 FragColor, FragColor2; \n"
"void main() { \n"
" FragColor = 0.5 * (texture(cbcr_tex, tc0) + texture(cbcr_tex, tc1)); \n"
+ " FragColor2 = FragColor; \n"
"} \n";
cbcr_program_num = resource_pool->compile_glsl_program(cbcr_vert_shader, cbcr_frag_shader, frag_shader_outputs);
check_error();
" vec2 cbcr0 = texture(cbcr_tex, cbcr_tc0).rg; \n"
" vec2 cbcr1 = texture(cbcr_tex, cbcr_tc1).rg; \n"
" vec2 cbcr = 0.5 * (cbcr0 + cbcr1); \n"
- " FragColor = vec4(cbcr.g, y0, cbcr.r, y1); \n" // FIXME: swap y0 and y1?
+ " FragColor = vec4(cbcr.g, y0, cbcr.r, y1); \n"
"} \n";
uyvy_program_num = resource_pool->compile_glsl_program(uyvy_vert_shader, uyvy_frag_shader, frag_shader_outputs);
check_error();
}
-void ChromaSubsampler::subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex)
+void ChromaSubsampler::subsample_chroma(GLuint cbcr_tex, unsigned width, unsigned height, GLuint dst_tex, GLuint dst2_tex)
{
GLuint vao;
glGenVertexArrays(1, &vao);
check_error();
// Extract Cb/Cr.
- GLuint fbo = resource_pool->create_fbo(dst_tex);
+ GLuint fbo;
+ if (dst2_tex <= 0) {
+ fbo = resource_pool->create_fbo(dst_tex);
+ } else {
+ fbo = resource_pool->create_fbo(dst_tex, dst2_tex);
+ }
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glViewport(0, 0, width/2, height/2);
check_error();