#include "chroma_subsampler.h"
-#include <string>
#include <movit/util.h>
+#include <string>
+
+#include "embedded_files.h"
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
using namespace std;
-string read_file(const string &filename);
+string read_file(const string &filename, const unsigned char *start = nullptr, const size_t size = 0);
GLuint compile_shader(const string &shader_src, GLenum type);
GLuint link_program(GLuint vs_obj, GLuint fs_obj);
void bind_sampler(GLuint program, GLint location, GLuint texture_unit, GLuint tex, GLuint sampler);
//
// See also http://www.poynton.com/PDFs/Merging_RGB_and_422.pdf, pages 6–7.
- cbcr_vs_obj = compile_shader(read_file("chroma_subsample.vert"), GL_VERTEX_SHADER);
- cbcr_fs_obj = compile_shader(read_file("chroma_subsample.frag"), GL_FRAGMENT_SHADER);
+ cbcr_vs_obj = compile_shader(read_file("chroma_subsample.vert", _binary_chroma_subsample_vert_data, _binary_chroma_subsample_vert_size), GL_VERTEX_SHADER);
+ cbcr_fs_obj = compile_shader(read_file("chroma_subsample.frag", _binary_chroma_subsample_frag_data, _binary_chroma_subsample_frag_size), GL_FRAGMENT_SHADER);
cbcr_program = link_program(cbcr_vs_obj, cbcr_fs_obj);
// Set up the VAO containing all the required position data.
2.0f, 0.0f
};
glCreateBuffers(1, &vbo);
- glNamedBufferData(vbo, sizeof(vertices), vertices, GL_STATIC_DRAW);
+ glNamedBufferData(vbo, sizeof(vertices), vertices, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
- GLint position_attrib = 0; // Hard-coded in every vertex shader.
+ GLint position_attrib = 0; // Hard-coded in every vertex shader.
glEnableVertexArrayAttrib(vao, position_attrib);
glVertexAttribPointer(position_attrib, 2, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
glProgramUniform2f(cbcr_program, uniform_chroma_offset_0, -1.0f / width, 0.0f);
glProgramUniform2f(cbcr_program, uniform_chroma_offset_1, -0.0f / width, 0.0f);
- glViewport(0, 0, width/2, height);
+ glViewport(0, 0, width / 2, height);
fbos.render_to(cb_tex, cr_tex);
glBindVertexArray(vao);