PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/system/shaders/yuv2rgb_basic_2d_YUY2.arb

http://github.com/xbmc/xbmc
Unknown | 68 lines | 59 code | 9 blank | 0 comment | 0 complexity | fd989b3806d8a7941b95bdc15404ff96 MD5 | raw file
 1!!ARBfp1.0
 2
 3#
 4#      Copyright (C) 2010-2013 Team XBMC
 5#      http://xbmc.org
 6#
 7#  This Program is free software; you can redistribute it and/or modify
 8#  it under the terms of the GNU General Public License as published by
 9#  the Free Software Foundation; either version 2, or (at your option)
10#  any later version.
11#
12#  This Program is distributed in the hope that it will be useful,
13#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15#  GNU General Public License for more details.
16#
17#  You should have received a copy of the GNU General Public License
18#  along with XBMC; see the file COPYING.  If not, see
19#  <http://www.gnu.org/licenses/>.
20#
21#
22
23PARAM yuvmat[4] = { program.local[0..3] };
24#stepx, stepy, width, height
25PARAM dims[1]   = { program.local[4]    };
26TEMP  f;
27TEMP  pos;
28MAD   pos.x  , dims[0].x, -0.25, fragment.texcoord[0].x;
29MOV   pos.y  , fragment.texcoord[0].y;
30MUL   f.x    , dims[0].z, pos.x;
31MUL   f.y    , dims[0].w, pos.y;
32FRC   f      , f;
33
34TEMP  c1pos;
35TEMP  c2pos;
36SUB   c1pos.x, 0.5, f.x;
37SUB   c2pos.x, 1.5, f.x;
38MAD   c1pos.x, c1pos.x, dims[0].x, pos.x;
39MAD   c2pos.x, c2pos.x, dims[0].x, pos.x;
40MOV   c1pos.y, pos.y;
41MOV   c2pos.y, pos.y;
42
43TEMP  c1;
44TEMP  c2;
45TEX   c1, c1pos, texture[0], 2D;
46TEX   c2, c2pos, texture[0], 2D;
47
48TEMP  cint;
49MUL   cint.x, f.x, 2.0;
50MAD   cint.y, f.x, 2.0, -1.0;
51SGE   cint.z, f.x, 0.5;
52
53TEMP  yuv;
54LRP   yuv.g, cint.x, c1.r , c1.b;
55LRP   yuv.b, cint.y, c2.b , c1.r;
56LRP   yuv.r, cint.z, yuv.b, yuv.g;
57
58LRP   yuv.g, f.x   , c2.g , c1.g;
59LRP   yuv.b, f.x   , c2.a , c1.a;
60
61TEMP  rgb;
62DPH   rgb.r, yuv, yuvmat[0];
63DPH   rgb.g, yuv, yuvmat[1];
64DPH   rgb.b, yuv, yuvmat[2];
65MOV   rgb.a, fragment.color.a;
66MOV   result.color, rgb;
67
68END