aboutsummaryrefslogtreecommitdiff
path: root/system/shaders/yuv2rgb_basic_2d_YUY2.arb
blob: 72586d0ebe724b5f229e6f92ae7d141cb0f9081c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
!!ARBfp1.0

#
#      Copyright (C) 2010-2013 Team XBMC
#      http://xbmc.org
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with XBMC; see the file COPYING.  If not, see
#  <http://www.gnu.org/licenses/>.
#
#

PARAM yuvmat[4] = { program.local[0..3] };
#stepx, stepy, width, height
PARAM dims[1]   = { program.local[4]    };
TEMP  f;
TEMP  pos;
MAD   pos.x  , dims[0].x, -0.25, fragment.texcoord[0].x;
MOV   pos.y  , fragment.texcoord[0].y;
MUL   f.x    , dims[0].z, pos.x;
MUL   f.y    , dims[0].w, pos.y;
FRC   f      , f;

TEMP  c1pos;
TEMP  c2pos;
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;
MOV   c2pos.y, pos.y;

TEMP  c1;
TEMP  c2;
TEX   c1, c1pos, texture[0], 2D;
TEX   c2, c2pos, texture[0], 2D;

TEMP  cint;
MUL   cint.x, f.x, 2.0;
MAD   cint.y, f.x, 2.0, -1.0;
SGE   cint.z, f.x, 0.5;

TEMP  yuv;
LRP   yuv.g, cint.x, c1.r , c1.b;
LRP   yuv.b, cint.y, c2.b , c1.r;
LRP   yuv.r, cint.z, yuv.b, yuv.g;

LRP   yuv.g, f.x   , c2.g , c1.g;
LRP   yuv.b, f.x   , c2.a , c1.a;

TEMP  rgb;
DPH   rgb.r, yuv, yuvmat[0];
DPH   rgb.g, yuv, yuvmat[1];
DPH   rgb.b, yuv, yuvmat[2];
MOV   rgb.a, fragment.color.a;
MOV   result.color, rgb;

END