diff options
author | bobo1on1 <bobo1on1@svn> | 2010-07-10 19:31:13 +0000 |
---|---|---|
committer | bobo1on1 <bobo1on1@svn> | 2010-07-10 19:31:13 +0000 |
commit | 652da10c25d932b110f94fdc95c9262d20e65b4b (patch) | |
tree | 20a3cee6b6ea28b7707b813a6dbc91fea9bf147f /system/shaders | |
parent | cdc94dba577adc493ef15e2a581c725d872198ab (diff) |
fixed: sampling coordinates
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31698 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'system/shaders')
-rw-r--r-- | system/shaders/yuv2rgb_basic.glsl | 11 | ||||
-rw-r--r-- | system/shaders/yuv2rgb_basic_2d_YUY2.arb | 4 | ||||
-rw-r--r-- | system/shaders/yuv2rgb_basic_rect_YUY2.arb | 4 |
3 files changed, 11 insertions, 8 deletions
diff --git a/system/shaders/yuv2rgb_basic.glsl b/system/shaders/yuv2rgb_basic.glsl index 9f432b67b4..138ffd89bd 100644 --- a/system/shaders/yuv2rgb_basic.glsl +++ b/system/shaders/yuv2rgb_basic.glsl @@ -48,18 +48,21 @@ void main() #if(XBMC_texture_rectangle) vec2 stepxy = vec2(1.0, 1.0); - vec2 pos = stretch(vec2(m_cordY.x - 0.25, m_cordY.y)); + vec2 pos = stretch(m_cordY); + pos = vec2(pos.x - 0.25, pos.y); vec2 f = fract(pos); #else vec2 stepxy = m_step; - vec2 pos = stretch(vec2(m_cordY.x - stepxy.x * 0.25, m_cordY.y)); + vec2 pos = stretch(m_cordY); + pos = vec2(pos.x - stepxy.x * 0.25, pos.y); vec2 f = fract(pos / stepxy); #endif + //y axis will be correctly interpolated by opengl //x axis will not, so we grab two pixels at the center of two columns and interpolate ourselves - vec4 c1 = texture2D(m_sampY, vec2(pos.x + (-0.5 - f.x) * stepxy.x, pos.y)); - vec4 c2 = texture2D(m_sampY, vec2(pos.x + ( 0.5 - f.x) * stepxy.x, pos.y)); + vec4 c1 = texture2D(m_sampY, vec2(pos.x + (0.5 - f.x) * stepxy.x, pos.y)); + vec4 c2 = texture2D(m_sampY, vec2(pos.x + (1.5 - f.x) * stepxy.x, pos.y)); /* each pixel has two Y subpixels and one UV subpixel YUV Y YUV diff --git a/system/shaders/yuv2rgb_basic_2d_YUY2.arb b/system/shaders/yuv2rgb_basic_2d_YUY2.arb index 9882df269b..7a51969e9c 100644 --- a/system/shaders/yuv2rgb_basic_2d_YUY2.arb +++ b/system/shaders/yuv2rgb_basic_2d_YUY2.arb @@ -12,8 +12,8 @@ FRC f , f; TEMP c1pos; TEMP c2pos; -SUB c1pos.x, -0.5, f.x; -SUB c2pos.x, 0.5, f.x; +SUB c1pos.x, 0.5, f.x; +SUB c2pos.x, 1.5, f.x; MAD c1pos.x, c1pos.x, dims[0].x, pos.x; MAD c2pos.x, c2pos.x, dims[0].x, pos.x; MOV c1pos.y, pos.y; diff --git a/system/shaders/yuv2rgb_basic_rect_YUY2.arb b/system/shaders/yuv2rgb_basic_rect_YUY2.arb index 059af428a0..c2ca3e7964 100644 --- a/system/shaders/yuv2rgb_basic_rect_YUY2.arb +++ b/system/shaders/yuv2rgb_basic_rect_YUY2.arb @@ -8,8 +8,8 @@ FRC f , pos; TEMP c1pos; TEMP c2pos; -SUB c1pos.x, -0.5, f.x; -SUB c2pos.x, 0.5, f.x; +SUB c1pos.x, 0.5, f.x; +SUB c2pos.x, 1.5, f.x; ADD c1pos.x, c1pos.x, pos.x; ADD c2pos.x, c2pos.x, pos.x; MOV c1pos.y, pos.y; |