mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
glcolorconvert: improve RGBA->YUY2/UYVY conversion shader
We should only average the chroma samples not the luma sample. https://bugzilla.gnome.org/show_bug.cgi?id=758904
This commit is contained in:
parent
8ab57b5b23
commit
bb7422e91b
1 changed files with 5 additions and 4 deletions
|
@ -343,15 +343,16 @@ static const struct shader_templ templ_RGB_to_YUY2_UYVY =
|
|||
"float inorder = mod (texcoord.x * width, 2.0);\n"
|
||||
"fx = texcoord.x;\n"
|
||||
"dx = 1.0 / width;\n"
|
||||
"if (texcoord.x >= (1.0 - 0.5 * dx) || (texcoord.x > 0.5 * dx && inorder < 1.0)) {\n"
|
||||
"if (inorder > 1.0) {\n"
|
||||
" dx = -dx;\n"
|
||||
"}\n"
|
||||
"fy = texcoord.y;\n"
|
||||
"texel1 = texture2D(tex, vec2(fx, fy)).%c%c%c%c;\n"
|
||||
"texel2 = texture2D(tex, vec2(fx + dx, fy)).%c%c%c%c;\n"
|
||||
"yuv1 = rgb_to_yuv (texel1.rgb, offset, coeff1, coeff2, coeff3);"
|
||||
"yuv2 = rgb_to_yuv (texel2.rgb, offset, coeff1, coeff2, coeff3);"
|
||||
"yuv = (yuv1 + yuv2) / 2.0;\n"
|
||||
"yuv1 = rgb_to_yuv (texel1.rgb, offset, coeff1, coeff2, coeff3);\n"
|
||||
"yuv2 = rgb_to_yuv (texel2.rgb, offset, coeff1, coeff2, coeff3);\n"
|
||||
"yuv.x = yuv1.x;\n"
|
||||
"yuv.yz = (yuv1.yz + yuv2.yz) * 0.5;\n"
|
||||
"if (inorder < 1.0) {\n"
|
||||
" gl_FragColor = vec4(yuv.%c, yuv.%c, 0.0, 0.0);\n"
|
||||
"} else {\n"
|
||||
|
|
Loading…
Reference in a new issue