annotate TOOLS/emboss.fp @ 17218:cffd0ec5d01a

fix crash with invalid -vid and no audio stream
author reimar
date Sun, 18 Dec 2005 11:55:47 +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=emboss.fp
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
6 # This is an emboss effect.
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
7 PARAM sizes = program.env[0];
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
8 TEMP res, y, u, v, xdiff, ydiff, pos, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
9 TEX y, fragment.texcoord[0], texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
10 SUB pos, fragment.texcoord[0], sizes.xwww;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
11 TEX tmp, pos, texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
12 SUB xdiff, y, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
13 MAD xdiff, xdiff, {0.5, 0.5, 0.5, 0}, {0.5, 0.5, 0.5, 0};
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
14 SUB pos, fragment.texcoord[0], sizes.wyww;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
15 TEX tmp, pos, texture[0], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
16 SUB ydiff, y, tmp;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
17 MAD res, ydiff, {0.8660, 0.8660, 0.8660, 0}, xdiff;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
18 # now do the normal YUV -> RGB conversion
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
19 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
20 TEX u, fragment.texcoord[1], texture[1], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
21 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
22 TEX v, fragment.texcoord[2], texture[2], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
23 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
24 # do gamma texture lookup
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
25 ADD res.a, res.a, 0.125;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
26 TEX res.r, res.raaa, texture[3], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
27 ADD res.a, res.a, 0.25;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
28 TEX res.g, res.gaaa, texture[3], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
29 ADD res.a, res.a, 0.25;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
30 TEX res.b, res.baaa, texture[3], 2D;
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
31 # 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
32 ADD result.color, res, {0, 0, 0, 0};
3191dcb27a12 hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
diff changeset
33 END