mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
glcolorconvert: re-enable -Wformat-nonliteral warning
We can pass string constants here to g_strdup_printf(), so do so and re-enable the -Wformat-nonliteral warning we had to disable when merging the opengl libs.
This commit is contained in:
parent
ae4f9aebcc
commit
c117460420
2 changed files with 99 additions and 78 deletions
|
@ -426,10 +426,9 @@ AG_GST_CHECK_GST_DEBUG_DISABLED([NO_WARNINGS="-Wno-unused"], [NO_WARNINGS=""])
|
|||
dnl define an ERROR_CFLAGS Makefile variable
|
||||
dnl -Wformat-nonliteral - see ext/pango/gstclockoverlay.c and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438
|
||||
dnl -Waggregate-return - xcb_intern_atom() returns an aggregate value
|
||||
dnl FIXME: -Wformat-nonliteral triggers in gst-libs/gst/gl/gstglcolorconvert.c (should be fixable)
|
||||
AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
|
||||
-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef
|
||||
-Wwrite-strings -Wformat-security
|
||||
-Wwrite-strings -Wformat-nonliteral -Wformat-security
|
||||
-Winit-self -Wmissing-include-dirs -Waddress
|
||||
-Wno-multichar -Wnested-externs $NO_WARNINGS])
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ struct shader_templ
|
|||
const gchar *extensions;
|
||||
const gchar *uniforms;
|
||||
const gchar *functions[MAX_FUNCTIONS];
|
||||
const gchar *body;
|
||||
|
||||
GstGLTextureTarget target;
|
||||
};
|
||||
|
@ -172,13 +171,15 @@ struct shader_templ
|
|||
"}\n"
|
||||
|
||||
/* Channel reordering for XYZ <-> ZYX conversion */
|
||||
static const gchar templ_REORDER_BODY[] =
|
||||
"vec4 t = texture2D(tex, texcoord * tex_scale0);\n"
|
||||
"%s\n" /* clobber alpha channel? */
|
||||
"gl_FragColor = vec4(t.%c, t.%c, t.%c, t.%c);\n";
|
||||
|
||||
static const struct shader_templ templ_REORDER =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS "uniform sampler2D tex;\n",
|
||||
{ NULL, },
|
||||
"vec4 t = texture2D(tex, texcoord * tex_scale0);\n"
|
||||
"%s\n" /* clobber alpha channel? */
|
||||
"gl_FragColor = vec4(t.%c, t.%c, t.%c, t.%c);\n",
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
|
@ -188,47 +189,50 @@ static const struct shader_templ templ_REORDER =
|
|||
* ([0~1] denormalize to [0~255],shift to high byte,normalize to [0~1])
|
||||
* low byte weight as : 255/65535 (similar)
|
||||
* */
|
||||
static const struct shader_templ templ_COMPOSE =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS COMPOSE_WEIGHT "uniform sampler2D tex;\n",
|
||||
{ NULL, },
|
||||
static const gchar templ_COMPOSE_BODY[] =
|
||||
"vec4 rgba;\n"
|
||||
"vec4 t = texture2D(tex, texcoord * tex_scale0);\n"
|
||||
"rgba.rgb = vec3 (dot(t.%c%c, compose_weight));"
|
||||
"rgba.a = 1.0;\n"
|
||||
"gl_FragColor = vec4(rgba.%c, rgba.%c, rgba.%c, rgba.%c);\n",
|
||||
"gl_FragColor = vec4(rgba.%c, rgba.%c, rgba.%c, rgba.%c);\n";
|
||||
|
||||
static const struct shader_templ templ_COMPOSE =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS COMPOSE_WEIGHT "uniform sampler2D tex;\n",
|
||||
{ NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
static const gchar templ_AYUV_to_RGB_BODY[] =
|
||||
"vec4 texel, rgba;\n"
|
||||
"texel = texture2D(tex, texcoord * tex_scale0);\n"
|
||||
"rgba.rgb = yuv_to_rgb (texel.yzw, offset, coeff1, coeff2, coeff3);\n"
|
||||
"rgba.a = texel.r;\n"
|
||||
"gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n";
|
||||
|
||||
static const struct shader_templ templ_AYUV_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D tex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
"vec4 texel, rgba;\n"
|
||||
"texel = texture2D(tex, texcoord * tex_scale0);\n"
|
||||
"rgba.rgb = yuv_to_rgb (texel.yzw, offset, coeff1, coeff2, coeff3);\n"
|
||||
"rgba.a = texel.r;\n"
|
||||
"gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
static const gchar templ_RGB_to_AYUV_BODY[] =
|
||||
"vec4 texel, ayuv;\n"
|
||||
"texel = texture2D(tex, texcoord).%c%c%c%c;\n"
|
||||
"ayuv.yzw = rgb_to_yuv (texel.rgb, offset, coeff1, coeff2, coeff3);\n"
|
||||
"ayuv.x = %s;\n"
|
||||
"gl_FragColor = ayuv;\n";
|
||||
|
||||
static const struct shader_templ templ_RGB_to_AYUV =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
"vec4 texel, ayuv;\n"
|
||||
"texel = texture2D(tex, texcoord).%c%c%c%c;\n"
|
||||
"ayuv.yzw = rgb_to_yuv (texel.rgb, offset, coeff1, coeff2, coeff3);\n"
|
||||
"ayuv.x = %s;\n"
|
||||
"gl_FragColor = ayuv;\n",
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
/* YUV to RGB conversion */
|
||||
static const struct shader_templ templ_PLANAR_YUV_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex, Utex, Vtex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
static const gchar templ_PLANAR_YUV_to_RGB_BODY[] =
|
||||
"vec4 texel, rgba;\n"
|
||||
/* FIXME: should get the sampling right... */
|
||||
"texel.x = texture2D(Ytex, texcoord * tex_scale0).r;\n"
|
||||
|
@ -236,24 +240,24 @@ static const struct shader_templ templ_PLANAR_YUV_to_RGB =
|
|||
"texel.z = texture2D(Vtex, texcoord * tex_scale2).r;\n"
|
||||
"rgba.rgb = yuv_to_rgb (texel.xyz, offset, coeff1, coeff2, coeff3);\n"
|
||||
"rgba.a = 1.0;\n"
|
||||
"gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
|
||||
"gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n";
|
||||
|
||||
static const struct shader_templ templ_PLANAR_YUV_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex, Utex, Vtex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
static const struct shader_templ templ_RGB_to_PLANAR_YUV =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n"
|
||||
"uniform vec2 chroma_sampling;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
static const gchar templ_RGB_to_PLANAR_YUV_BODY[] =
|
||||
"vec4 texel;\n"
|
||||
"vec3 yuv;\n"
|
||||
"texel = texture2D(tex, texcoord).%c%c%c%c;\n"
|
||||
/* FIXME: this is not quite correct yet */
|
||||
"vec4 uv_texel = vec4(0.0);\n"
|
||||
/* One u and v sample can be generated by a nxm sized block given by
|
||||
* @chroma_sampling. The result is the average of all the values in the
|
||||
* block computed with a rolling average.
|
||||
*/
|
||||
/* One u and v sample can be generated by a nxm sized block given by */
|
||||
/* @chroma_sampling. The result is the average of all the values in the */
|
||||
/* block computed with a rolling average. */
|
||||
"vec2 unnormalization;\n"
|
||||
"if (texcoord.x == v_texcoord.x) {\n"
|
||||
" unnormalization = vec2(width, height);\n"
|
||||
|
@ -280,15 +284,18 @@ static const struct shader_templ templ_RGB_to_PLANAR_YUV =
|
|||
"yuv.yz = rgb_to_yuv (uv_texel.rgb, offset, coeff1, coeff2, coeff3).yz;\n"
|
||||
"gl_FragData[0] = vec4(yuv.x, 0.0, 0.0, 1.0);\n"
|
||||
"gl_FragData[1] = vec4(yuv.y, 0.0, 0.0, 1.0);\n"
|
||||
"gl_FragData[2] = vec4(yuv.z, 0.0, 0.0, 1.0);\n",
|
||||
"gl_FragData[2] = vec4(yuv.z, 0.0, 0.0, 1.0);\n";
|
||||
|
||||
static const struct shader_templ templ_RGB_to_PLANAR_YUV =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n"
|
||||
"uniform vec2 chroma_sampling;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
/* NV12/NV21 to RGB conversion */
|
||||
static const struct shader_templ templ_NV12_NV21_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex, UVtex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
static const gchar templ_NV12_NV21_to_RGB_BODY[] =
|
||||
"vec4 rgba;\n"
|
||||
"vec3 yuv;\n"
|
||||
/* FIXME: should get the sampling right... */
|
||||
|
@ -296,17 +303,19 @@ static const struct shader_templ templ_NV12_NV21_to_RGB =
|
|||
"yuv.yz=texture2D(UVtex, texcoord * tex_scale1).%c%c;\n"
|
||||
"rgba.rgb = yuv_to_rgb (yuv, offset, coeff1, coeff2, coeff3);\n"
|
||||
"rgba.a = 1.0;\n"
|
||||
"gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
|
||||
"gl_FragColor=vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n";
|
||||
|
||||
static const struct shader_templ templ_NV12_NV21_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex, UVtex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
/* RGB to NV12/NV21 conversion */
|
||||
/* NV12: u, v
|
||||
NV21: v, u */
|
||||
static const struct shader_templ templ_RGB_to_NV12_NV21 =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
static const gchar templ_RGB_to_NV12_NV21_BODY[] =
|
||||
"vec4 texel, uv_texel;\n"
|
||||
"vec3 yuv;\n"
|
||||
"texel = texture2D(tex, texcoord).%c%c%c%c;\n"
|
||||
|
@ -314,16 +323,18 @@ static const struct shader_templ templ_RGB_to_NV12_NV21 =
|
|||
"yuv.x = rgb_to_yuv (texel.rgb, offset, coeff1, coeff2, coeff3).x;\n"
|
||||
"yuv.yz = rgb_to_yuv (uv_texel.rgb, offset, coeff1, coeff2, coeff3).yz;\n"
|
||||
"gl_FragData[0] = vec4(yuv.x, 0.0, 0.0, 1.0);\n"
|
||||
"gl_FragData[1] = vec4(yuv.%c, yuv.%c, 0.0, 1.0);\n",
|
||||
"gl_FragData[1] = vec4(yuv.%c, yuv.%c, 0.0, 1.0);\n";
|
||||
|
||||
static const struct shader_templ templ_RGB_to_NV12_NV21 =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
/* YUY2:r,g,a
|
||||
UYVY:a,b,r */
|
||||
static const struct shader_templ templ_YUY2_UYVY_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
static const gchar templ_YUY2_UYVY_to_RGB_BODY[] =
|
||||
"vec4 rgba, uv_texel;\n"
|
||||
"vec3 yuv;\n"
|
||||
/* FIXME: should get the sampling right... */
|
||||
|
@ -341,14 +352,16 @@ static const struct shader_templ templ_YUY2_UYVY_to_RGB =
|
|||
"yuv.yz = uv_texel.%c%c;\n"
|
||||
"rgba.rgb = yuv_to_rgb (yuv, offset, coeff1, coeff2, coeff3);\n"
|
||||
"rgba.a = 1.0;\n"
|
||||
"gl_FragColor = vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n",
|
||||
"gl_FragColor = vec4(rgba.%c,rgba.%c,rgba.%c,rgba.%c);\n";
|
||||
|
||||
static const struct shader_templ templ_YUY2_UYVY_to_RGB =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS YUV_TO_RGB_COEFFICIENTS "uniform sampler2D Ytex;\n",
|
||||
{ glsl_func_yuv_to_rgb, NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
static const struct shader_templ templ_RGB_to_YUY2_UYVY =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
static const gchar templ_RGB_to_YUY2_UYVY_BODY[] =
|
||||
"vec4 texel1, texel2;\n"
|
||||
"vec3 yuv, yuv1, yuv2;\n"
|
||||
"float fx, dx, fy;\n"
|
||||
|
@ -370,7 +383,12 @@ static const struct shader_templ templ_RGB_to_YUY2_UYVY =
|
|||
" gl_FragColor = vec4(yuv.%c, yuv.%c, 0.0, 0.0);\n"
|
||||
"} else {\n"
|
||||
" gl_FragColor = vec4(yuv.%c, yuv.%c, 0.0, 0.0);\n"
|
||||
"}\n",
|
||||
"}\n";
|
||||
|
||||
static const struct shader_templ templ_RGB_to_YUY2_UYVY =
|
||||
{ NULL,
|
||||
DEFAULT_UNIFORMS RGB_TO_YUV_COEFFICIENTS "uniform sampler2D tex;\n",
|
||||
{ glsl_func_rgb_to_yuv, NULL, },
|
||||
GST_GL_TEXTURE_TARGET_2D
|
||||
};
|
||||
|
||||
|
@ -1451,7 +1469,7 @@ _RGB_to_RGB (GstGLColorConvert * convert)
|
|||
alpha = g_strdup_printf ("t.%c = 1.0;", input_alpha_channel);
|
||||
}
|
||||
info->templ = &templ_REORDER;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, alpha ? alpha : "",
|
||||
info->frag_body = g_strdup_printf (templ_REORDER_BODY, alpha ? alpha : "",
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "tex";
|
||||
|
||||
|
@ -1491,15 +1509,15 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
* for us */
|
||||
info->templ = &templ_REORDER;
|
||||
info->frag_body =
|
||||
g_strdup_printf (info->templ->body, "", pixel_order[0], pixel_order[1],
|
||||
g_strdup_printf (templ_REORDER_BODY, "", pixel_order[0], pixel_order[1],
|
||||
pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "tex";
|
||||
} else {
|
||||
switch (GST_VIDEO_INFO_FORMAT (&convert->in_info)) {
|
||||
case GST_VIDEO_FORMAT_AYUV:
|
||||
info->templ = &templ_AYUV_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, pixel_order[0],
|
||||
pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->frag_body = g_strdup_printf (templ_AYUV_to_RGB_BODY,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "tex";
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_I420:
|
||||
|
@ -1508,7 +1526,7 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
case GST_VIDEO_FORMAT_Y41B:
|
||||
info->templ = &templ_PLANAR_YUV_to_RGB;
|
||||
info->frag_body =
|
||||
g_strdup_printf (info->templ->body, pixel_order[0],
|
||||
g_strdup_printf (templ_PLANAR_YUV_to_RGB_BODY, pixel_order[0],
|
||||
pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
info->shader_tex_names[1] = "Utex";
|
||||
|
@ -1517,7 +1535,7 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
case GST_VIDEO_FORMAT_YV12:
|
||||
info->templ = &templ_PLANAR_YUV_to_RGB;
|
||||
info->frag_body =
|
||||
g_strdup_printf (info->templ->body, pixel_order[0],
|
||||
g_strdup_printf (templ_PLANAR_YUV_to_RGB_BODY, pixel_order[0],
|
||||
pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
info->shader_tex_names[1] = "Vtex";
|
||||
|
@ -1527,8 +1545,9 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
{
|
||||
char uv_val = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_YUY2_UYVY_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, 'r', uv_val,
|
||||
uv_val, 'g', 'a', pixel_order[0], pixel_order[1], pixel_order[2],
|
||||
info->frag_body =
|
||||
g_strdup_printf (templ_YUY2_UYVY_to_RGB_BODY, 'r', uv_val, uv_val,
|
||||
'g', 'a', pixel_order[0], pixel_order[1], pixel_order[2],
|
||||
pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
break;
|
||||
|
@ -1537,8 +1556,9 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
{
|
||||
char y_val = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_YUY2_UYVY_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, y_val, 'g',
|
||||
'g', 'r', 'b', pixel_order[0], pixel_order[1], pixel_order[2],
|
||||
info->frag_body =
|
||||
g_strdup_printf (templ_YUY2_UYVY_to_RGB_BODY, y_val, 'g', 'g', 'r',
|
||||
'b', pixel_order[0], pixel_order[1], pixel_order[2],
|
||||
pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
break;
|
||||
|
@ -1547,7 +1567,8 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
{
|
||||
char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_NV12_NV21_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, 'r', val2,
|
||||
info->frag_body =
|
||||
g_strdup_printf (templ_NV12_NV21_to_RGB_BODY, 'r', val2,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
info->shader_tex_names[1] = "UVtex";
|
||||
|
@ -1557,7 +1578,8 @@ _YUV_to_RGB (GstGLColorConvert * convert)
|
|||
{
|
||||
char val2 = convert->priv->in_tex_formats[1] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_NV12_NV21_to_RGB;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, val2, 'r',
|
||||
info->frag_body =
|
||||
g_strdup_printf (templ_NV12_NV21_to_RGB_BODY, val2, 'r',
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->shader_tex_names[0] = "Ytex";
|
||||
info->shader_tex_names[1] = "UVtex";
|
||||
|
@ -1603,7 +1625,7 @@ _RGB_to_YUV (GstGLColorConvert * convert)
|
|||
case GST_VIDEO_FORMAT_AYUV:
|
||||
alpha = _is_RGBx (in_format) ? "1.0" : "texel.a";
|
||||
info->templ = &templ_RGB_to_AYUV;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, pixel_order[0],
|
||||
info->frag_body = g_strdup_printf (templ_RGB_to_AYUV_BODY, pixel_order[0],
|
||||
pixel_order[1], pixel_order[2], pixel_order[3], alpha);
|
||||
info->out_n_textures = 1;
|
||||
break;
|
||||
|
@ -1613,7 +1635,7 @@ _RGB_to_YUV (GstGLColorConvert * convert)
|
|||
case GST_VIDEO_FORMAT_Y42B:
|
||||
case GST_VIDEO_FORMAT_Y41B:
|
||||
info->templ = &templ_RGB_to_PLANAR_YUV;
|
||||
info->frag_body = g_strdup_printf (info->templ->body,
|
||||
info->frag_body = g_strdup_printf (templ_RGB_to_PLANAR_YUV_BODY,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
info->out_n_textures = 3;
|
||||
|
@ -1631,7 +1653,7 @@ _RGB_to_YUV (GstGLColorConvert * convert)
|
|||
break;
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
info->templ = &templ_RGB_to_YUY2_UYVY;
|
||||
info->frag_body = g_strdup_printf (info->templ->body,
|
||||
info->frag_body = g_strdup_printf (templ_RGB_to_YUY2_UYVY_BODY,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
'x', 'y', 'x', 'z');
|
||||
|
@ -1639,7 +1661,7 @@ _RGB_to_YUV (GstGLColorConvert * convert)
|
|||
break;
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
info->templ = &templ_RGB_to_YUY2_UYVY,
|
||||
info->frag_body = g_strdup_printf (info->templ->body,
|
||||
info->frag_body = g_strdup_printf (templ_RGB_to_YUY2_UYVY_BODY,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
'y', 'x', 'z', 'x');
|
||||
|
@ -1647,7 +1669,7 @@ _RGB_to_YUV (GstGLColorConvert * convert)
|
|||
break;
|
||||
case GST_VIDEO_FORMAT_NV12:
|
||||
info->templ = &templ_RGB_to_NV12_NV21,
|
||||
info->frag_body = g_strdup_printf (info->templ->body,
|
||||
info->frag_body = g_strdup_printf (templ_RGB_to_NV12_NV21_BODY,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
'y', 'z');
|
||||
|
@ -1655,7 +1677,7 @@ _RGB_to_YUV (GstGLColorConvert * convert)
|
|||
break;
|
||||
case GST_VIDEO_FORMAT_NV21:
|
||||
info->templ = &templ_RGB_to_NV12_NV21,
|
||||
info->frag_body = g_strdup_printf (info->templ->body,
|
||||
info->frag_body = g_strdup_printf (templ_RGB_to_NV12_NV21_BODY,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3],
|
||||
'z', 'y');
|
||||
|
@ -1700,7 +1722,7 @@ _RGB_to_GRAY (GstGLColorConvert * convert)
|
|||
switch (GST_VIDEO_INFO_FORMAT (&convert->out_info)) {
|
||||
case GST_VIDEO_FORMAT_GRAY8:
|
||||
info->templ = &templ_REORDER;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, alpha ? alpha : "",
|
||||
info->frag_body = g_strdup_printf (templ_REORDER_BODY, alpha ? alpha : "",
|
||||
pixel_order[0], pixel_order[0], pixel_order[0], pixel_order[3]);
|
||||
break;
|
||||
default:
|
||||
|
@ -1724,14 +1746,14 @@ _GRAY_to_RGB (GstGLColorConvert * convert)
|
|||
switch (GST_VIDEO_INFO_FORMAT (&convert->in_info)) {
|
||||
case GST_VIDEO_FORMAT_GRAY8:
|
||||
info->templ = &templ_REORDER;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, "", pixel_order[0],
|
||||
info->frag_body = g_strdup_printf (templ_REORDER_BODY, "", pixel_order[0],
|
||||
pixel_order[0], pixel_order[0], pixel_order[3]);
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_GRAY16_LE:
|
||||
{
|
||||
char val2 = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_COMPOSE;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, val2, 'r',
|
||||
info->frag_body = g_strdup_printf (templ_COMPOSE_BODY, val2, 'r',
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
break;
|
||||
}
|
||||
|
@ -1739,7 +1761,7 @@ _GRAY_to_RGB (GstGLColorConvert * convert)
|
|||
{
|
||||
char val2 = convert->priv->in_tex_formats[0] == GST_GL_RG ? 'g' : 'a';
|
||||
info->templ = &templ_COMPOSE;
|
||||
info->frag_body = g_strdup_printf (info->templ->body, 'r', val2,
|
||||
info->frag_body = g_strdup_printf (templ_COMPOSE_BODY, 'r', val2,
|
||||
pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue