Merge pull request #4401 from Jalle19/fix-recording-thumbnail
[vuplus_xbmc] / system / shaders / yuv2rgb_basic_2d_UYVY.arb
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
23 PARAM yuvmat[4] = { program.local[0..3] };
24 #stepx, stepy, width, height
25 PARAM dims[1]   = { program.local[4]    };
26 TEMP  f;
27 TEMP  pos;
28 MAD   pos.x  , dims[0].x, -0.25, fragment.texcoord[0].x;
29 MOV   pos.y  , fragment.texcoord[0].y;
30 MUL   f.x    , dims[0].z, pos.x;
31 MUL   f.y    , dims[0].w, pos.y;
32 FRC   f      , f;
33
34 TEMP  c1pos;
35 TEMP  c2pos;
36 SUB   c1pos.x, 0.5, f.x;
37 SUB   c2pos.x, 1.5, f.x;
38 MAD   c1pos.x, c1pos.x, dims[0].x, pos.x;
39 MAD   c2pos.x, c2pos.x, dims[0].x, pos.x;
40 MOV   c1pos.y, pos.y;
41 MOV   c2pos.y, pos.y;
42
43 TEMP  c1;
44 TEMP  c2;
45 TEX   c1, c1pos, texture[0], 2D;
46 TEX   c2, c2pos, texture[0], 2D;
47
48 TEMP  cint;
49 MUL   cint.x, f.x, 2.0;
50 MAD   cint.y, f.x, 2.0, -1.0;
51 SGE   cint.z, f.x, 0.5;
52
53 TEMP  yuv;
54 LRP   yuv.g, cint.x, c1.a , c1.g;
55 LRP   yuv.b, cint.y, c2.g , c1.a;
56 LRP   yuv.r, cint.z, yuv.b, yuv.g;
57
58 LRP   yuv.g, f.x   , c2.b , c1.b;
59 LRP   yuv.b, f.x   , c2.r , c1.r;
60
61 TEMP  rgb;
62 DPH   rgb.r, yuv, yuvmat[0];
63 DPH   rgb.g, yuv, yuvmat[1];
64 DPH   rgb.b, yuv, yuvmat[2];
65 MOV   rgb.a, fragment.color.a;
66 MOV   result.color, rgb;
67
68 END