VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c@ 35473

Last change on this file since 35473 was 35473, checked in by vboxsync, 14 years ago

FE/Qt: OSE headers for shaders

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/* $Id: cconvYV12.c 35473 2011-01-11 09:02:07Z vboxsync $ */
2/** @file
3 *
4 * VBox frontends: Qt4 GUI ("VirtualBox"):
5 * Shader programming for VBoxFBOverlay.
6 */
7
8/*
9 * Copyright (C) 2009-2011 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.215389.xyz. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#extension GL_ARB_texture_rectangle : enable
21uniform sampler2DRect uSrcTex;
22uniform sampler2DRect uVTex;
23uniform sampler2DRect uUTex;
24void vboxCConvApplyAYUV(vec4 color);
25void vboxCConv()
26{
27 vec2 clrCoordY = vec2(gl_TexCoord[0]);
28 vec2 clrCoordV = vec2(gl_TexCoord[1]);
29 int ixY = int(clrCoordY.x);
30 vec2 coordY = vec2(float(ixY), clrCoordY.y);
31 int ixV = int(clrCoordV.x);
32 vec2 coordV = vec2(float(ixV), clrCoordV.y);
33 vec4 clrY = texture2DRect(uSrcTex, coordY);
34 vec4 clrV = texture2DRect(uVTex, coordV);
35 vec4 clrU = texture2DRect(uUTex, coordV);
36 float partY = clrCoordY.x - float(ixY);
37 float partVU = clrCoordV.x - float(ixV);
38 float y;
39 float v;
40 float u;
41 if(partY < 0.25)
42 {
43 y = clrY.b;
44 }
45 else if(partY < 0.5)
46 {
47 y = clrY.g;
48 }
49 else if(partY < 0.75)
50 {
51 y = clrY.r;
52 }
53 else
54 {
55 y = clrY.a;
56 }
57
58 if(partVU < 0.25)
59 {
60 v = clrV.b;
61 u = clrU.b;
62 }
63 else if(partVU < 0.5)
64 {
65 v = clrV.g;
66 u = clrU.g;
67 }
68 else if(partVU < 0.75)
69 {
70 v = clrV.r;
71 u = clrU.r;
72 }
73 else
74 {
75 v = clrV.a;
76 u = clrU.a;
77 }
78 vboxCConvApplyAYUV(vec4(u, y, 0.0, v));
79}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette