aboutsummaryrefslogtreecommitdiff
path: root/system/shaders
diff options
context:
space:
mode:
authorChris "koying" Browet <cbro@semperpax.com>2015-01-14 16:34:39 +0100
committerChris "koying" Browet <cbro@semperpax.com>2015-01-20 14:17:09 +0100
commitd16066960f7fc50f6043460fd7906cd60461ec74 (patch)
tree3bcfbcf944e4240eb1b016b71d2a0b452a8f88bc /system/shaders
parent46258d2e6889e799446ee2005bdf030ec68392c3 (diff)
CHG: [gles] use shader for generic yuv bob deinterlacing
GLES 2 does not support GL_UNPACK_ROW_LENGTH. That makes de-deinterlacing a texture in CPU unbearably slow on some SoC's.
Diffstat (limited to 'system/shaders')
-rw-r--r--system/shaders/yuv2rgb_bob_gles.glsl33
1 files changed, 26 insertions, 7 deletions
diff --git a/system/shaders/yuv2rgb_bob_gles.glsl b/system/shaders/yuv2rgb_bob_gles.glsl
index 292541aa77..f76b5a5ebc 100644
--- a/system/shaders/yuv2rgb_bob_gles.glsl
+++ b/system/shaders/yuv2rgb_bob_gles.glsl
@@ -18,7 +18,7 @@
*
*/
-precision mediump float;
+precision highp float;
uniform sampler2D m_sampY;
uniform sampler2D m_sampU;
uniform sampler2D m_sampV;
@@ -38,18 +38,37 @@ void main()
vec2 offsetY;
vec2 offsetU;
vec2 offsetV;
- float temp1 = mod(m_cordY.y, 2*m_stepY);
+ float temp1 = mod(m_cordY.y, 2.0*m_stepY);
offsetY = m_cordY;
offsetU = m_cordU;
offsetV = m_cordV;
- offsetY.y -= (temp1 - m_stepY/2 + float(m_field)*m_stepY);
- offsetU.y -= (temp1 - m_stepY/2 + float(m_field)*m_stepY)/2;
- offsetV.y -= (temp1 - m_stepY/2 + float(m_field)*m_stepY)/2;
+ offsetY.y -= (temp1 - m_stepY/2.0 + float(m_field)*m_stepY);
+ offsetU.y -= (temp1 - m_stepY/2.0 + float(m_field)*m_stepY)/2.0;
+ offsetV.y -= (temp1 - m_stepY/2.0 + float(m_field)*m_stepY)/2.0;
- yuv.rgba = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).r, texture2D(m_sampV, offsetV).r, 1.0);
+ float bstep = step(m_stepY, temp1);
+
+ // Blend missing line
+ vec2 belowY, belowU, belowV;
+
+ belowY.x = offsetY.x;
+ belowY.y = offsetY.y + (2.0*m_stepY*bstep);
+ belowU.x = offsetU.x;
+ belowU.y = offsetU.y + (m_stepY*bstep);
+ belowV.x = offsetV.x;
+ belowV.y = offsetV.y + (m_stepY*bstep);
+
+ vec4 yuvBelow, rgbBelow;
+
+ yuv.rgba = vec4(texture2D(m_sampY, offsetY).r, texture2D(m_sampU, offsetU).g, texture2D(m_sampV, offsetV).a, 1.0);
rgb = m_yuvmat * yuv;
rgb.a = m_alpha;
- gl_FragColor = rgb;
+
+ yuvBelow.rgba = vec4(texture2D(m_sampY, belowY).r, texture2D(m_sampU, belowU).g, texture2D(m_sampV, belowV).a, 1.0);
+ rgbBelow = m_yuvmat * yuvBelow;
+ rgbBelow.a = m_alpha;
+
+ gl_FragColor.rgba = mix(rgb, rgbBelow, 0.5);
}