|
@@ -24,10 +24,6 @@ gles2_debayer_new(int format)
|
|
case V4L2_PIX_FMT_SGBRG8:
|
|
case V4L2_PIX_FMT_SGBRG8:
|
|
case V4L2_PIX_FMT_SGRBG8:
|
|
case V4L2_PIX_FMT_SGRBG8:
|
|
case V4L2_PIX_FMT_SRGGB8:
|
|
case V4L2_PIX_FMT_SRGGB8:
|
|
- case V4L2_PIX_FMT_SBGGR10P:
|
|
|
|
- case V4L2_PIX_FMT_SGBRG10P:
|
|
|
|
- case V4L2_PIX_FMT_SGRBG10P:
|
|
|
|
- case V4L2_PIX_FMT_SRGGB10P:
|
|
|
|
case V4L2_PIX_FMT_SBGGR10:
|
|
case V4L2_PIX_FMT_SBGGR10:
|
|
case V4L2_PIX_FMT_SGBRG10:
|
|
case V4L2_PIX_FMT_SGBRG10:
|
|
case V4L2_PIX_FMT_SGRBG10:
|
|
case V4L2_PIX_FMT_SGRBG10:
|
|
@@ -38,6 +34,12 @@ gles2_debayer_new(int format)
|
|
case V4L2_PIX_FMT_SRGGB12:
|
|
case V4L2_PIX_FMT_SRGGB12:
|
|
shader = SHADER_DEBAYER;
|
|
shader = SHADER_DEBAYER;
|
|
break;
|
|
break;
|
|
|
|
+ case V4L2_PIX_FMT_SBGGR10P:
|
|
|
|
+ case V4L2_PIX_FMT_SGBRG10P:
|
|
|
|
+ case V4L2_PIX_FMT_SGRBG10P:
|
|
|
|
+ case V4L2_PIX_FMT_SRGGB10P:
|
|
|
|
+ shader = SHADER_DEBAYER_PACKED;
|
|
|
|
+ break;
|
|
case V4L2_PIX_FMT_YUYV:
|
|
case V4L2_PIX_FMT_YUYV:
|
|
shader = SHADER_YUV;
|
|
shader = SHADER_YUV;
|
|
break;
|
|
break;
|
|
@@ -65,11 +67,11 @@ gles2_debayer_new(int format)
|
|
snprintf(shader_vertex,
|
|
snprintf(shader_vertex,
|
|
64,
|
|
64,
|
|
"/org/postmarketos/Megapixels/%s.vert",
|
|
"/org/postmarketos/Megapixels/%s.vert",
|
|
- shader == SHADER_DEBAYER ? "debayer" : "yuv");
|
|
|
|
|
|
+ gles2_shader_to_vertex(shader));
|
|
snprintf(shader_fragment,
|
|
snprintf(shader_fragment,
|
|
64,
|
|
64,
|
|
"/org/postmarketos/Megapixels/%s.frag",
|
|
"/org/postmarketos/Megapixels/%s.frag",
|
|
- shader == SHADER_DEBAYER ? "debayer" : "yuv");
|
|
|
|
|
|
+ gles2_shader_to_fragment(shader));
|
|
|
|
|
|
GLuint shaders[] = {
|
|
GLuint shaders[] = {
|
|
gl_util_load_shader(shader_vertex, GL_VERTEX_SHADER, NULL, 0),
|
|
gl_util_load_shader(shader_vertex, GL_VERTEX_SHADER, NULL, 0),
|
|
@@ -246,3 +248,34 @@ gles2_debayer_process(GLES2Debayer *self, GLuint dst_id, GLuint source_id)
|
|
|
|
|
|
gl_util_draw_quad(self->quad);
|
|
gl_util_draw_quad(self->quad);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/* Returns which fragment file to use for a particular shader */
|
|
|
|
+const char*
|
|
|
|
+gles2_shader_to_fragment(int shader)
|
|
|
|
+{
|
|
|
|
+ switch (shader) {
|
|
|
|
+ case SHADER_DEBAYER:
|
|
|
|
+ return "debayer";
|
|
|
|
+ case SHADER_DEBAYER_PACKED:
|
|
|
|
+ return "debayer_packed";
|
|
|
|
+ case SHADER_YUV:
|
|
|
|
+ return "yuv";
|
|
|
|
+ default:
|
|
|
|
+ return "solid";
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* Returns which vertex file to use for a particular shader */
|
|
|
|
+const char*
|
|
|
|
+gles2_shader_to_vertex(int shader)
|
|
|
|
+{
|
|
|
|
+ switch (shader) {
|
|
|
|
+ case SHADER_DEBAYER:
|
|
|
|
+ case SHADER_DEBAYER_PACKED:
|
|
|
|
+ return "debayer";
|
|
|
|
+ case SHADER_YUV:
|
|
|
|
+ return "yuv";
|
|
|
|
+ default:
|
|
|
|
+ return "solid";
|
|
|
|
+ }
|
|
|
|
+}
|