annotate TOOLS/edgedetect.fp @ 17345:16ebf01c5179

Quote some values to silence debconf warnings.
author diego
date Sun, 08 Jan 2006 17:37:48 +0000
parents 3191dcb27a12
children 69785427a61e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16488
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
1 !!ARBfp1.0
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
2 # Custom YUV->RGB conversion program for MPlayer's -vo gl.
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
3 # Copyleft (C) Reimar Döffinger, 2005
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
4 # Licensed under the GNU GPL v2
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
5 # Usage: mplayer -vo gl:yuv=4:customprog=edgedetect.fp
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
6 # This is some custom edge-detect like effect.
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
7 # Try adjusting the gamma!
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
8 # program.env[0].xy contains the size of one source texel
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
9 PARAM sizes = program.env[0];
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
10 TEMP res, y, u, v, pos, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
11 TEX y, fragment.texcoord[0], texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
12 MUL y, y, {4, 4, 4, 0};
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
13 ADD pos, fragment.texcoord[0], sizes.xwww; # texel to the right
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
14 TEX tmp, pos, texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
15 SUB y, y, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
16 SUB pos, fragment.texcoord[0], sizes.xwww; # texel to the left
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
17 TEX tmp, pos, texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
18 SUB y, y, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
19 ADD pos, fragment.texcoord[0], sizes.wyww; # texel... umm.. above?
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
20 TEX tmp, pos, texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
21 SUB y, y, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
22 SUB pos, fragment.texcoord[0], sizes.wyww; # texel... umm.. below?
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
23 TEX tmp, pos, texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
24 SUB y, y, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
25 MAD res, y, {2, 2, 2, 0}, {0.5, 0.5, 0.5, 0};
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
26 # now do the normal YUV -> RGB conversion
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
27 MAD res, res, {1.164, 1.164, 1.164, 0}, {-0.87416, 0.53133, -1.08599, 0};
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
28 TEX u, fragment.texcoord[1], texture[1], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
29 MAD res, u, {0, -0.391, 2.018, 0}, res;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
30 TEX v, fragment.texcoord[2], texture[2], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
31 MAD res, v, {1.596, -0.813, 0, 0}, res;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
32 # do gamma texture lookup
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
33 ADD res.a, res.a, 0.125;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
34 TEX res.r, res.raaa, texture[3], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
35 ADD res.a, res.a, 0.25;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
36 TEX res.g, res.gaaa, texture[3], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
37 ADD res.a, res.a, 0.25;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
38 TEX res.b, res.baaa, texture[3], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
39 # move res into result, this allows easily commenting out some parts.
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
40 ADD result.color, res, {0, 0, 0, 0};
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
41 END