MythTV  master
mythopenglvideoshaders.h
Go to the documentation of this file.
1 #ifndef MYTH_OPENGLVIDEOSHADERS_H
2 #define MYTH_OPENGLVIDEOSHADERS_H
3 
4 #include <QString>
5 
6 static const QString DefaultVertexShader =
7 "attribute highp vec2 a_position;\n"
8 "attribute highp vec2 a_texcoord0;\n"
9 "varying highp vec2 v_texcoord0;\n"
10 "uniform highp mat4 u_projection;\n"
11 "void main()\n"
12 "{\n"
13 " gl_Position = u_projection * vec4(a_position, 0.0, 1.0);\n"
14 " v_texcoord0 = a_texcoord0;\n"
15 "}\n";
16 
17 static const QString RGBFragmentShader =
18 "uniform sampler2D s_texture0;\n"
19 "varying highp vec2 v_texcoord0;\n"
20 "void main(void)\n"
21 "{\n"
22 " highp vec4 color = texture2D(s_texture0, v_texcoord0);\n"
23 " gl_FragColor = vec4(color.rgb, 1.0);\n"
24 "}\n";
25 
26 #ifdef USING_MEDIACODEC
27 static const QString MediaCodecVertexShader =
28 "attribute highp vec2 a_position;\n"
29 "attribute highp vec2 a_texcoord0;\n"
30 "varying highp vec2 v_texcoord0;\n"
31 "uniform highp mat4 u_projection;\n"
32 "uniform highp mat4 u_transform;\n"
33 "void main()\n"
34 "{\n"
35 " gl_Position = u_projection * vec4(a_position, 0.0, 1.0);\n"
36 " v_texcoord0 = (u_transform * vec4(a_texcoord0, 0.0, 1.0)).xy;\n"
37 "}\n";
38 #endif
39 
40 // these need to come first but obviously after the defines...
41 static const QString YUVFragmentExtensions =
42 "#define LINEHEIGHT m_frameData.x\n"
43 "#define COLUMN m_frameData.y\n"
44 "#define MAXHEIGHT m_frameData.z\n"
45 "#define FIELDSIZE m_frameData.w\n"
46 "#ifdef MYTHTV_RECTS\n"
47 "#extension GL_ARB_texture_rectangle : enable\n"
48 "#define texture2D texture2DRect\n"
49 "#define sampler2D sampler2DRect\n"
50 "#endif\n"
51 "#ifdef MYTHTV_EXTOES\n"
52 "#extension GL_OES_EGL_image_external : require\n"
53 "#define sampler2D samplerExternalOES\n"
54 "#endif\n";
55 
56 static const QString YUVFragmentShader =
57 "uniform highp mat4 m_colourMatrix;\n"
58 "uniform highp vec4 m_frameData;\n"
59 "varying highp vec2 v_texcoord0;\n"
60 "#ifdef MYTHTV_COLOURMAPPING\n"
61 "uniform highp mat4 m_primaryMatrix;\n"
62 "uniform highp float m_colourGamma;\n"
63 "uniform highp float m_displayGamma;\n"
64 "highp vec4 ColourMap(highp vec4 color)\n"
65 "{\n"
66 " highp vec4 res = clamp(color, 0.0, 1.0);\n"
67 " res.rgb = pow(res.rgb, vec3(m_colourGamma));\n"
68 " res = m_primaryMatrix * res;\n"
69 " return vec4(pow(res.rgb, vec3(m_displayGamma)), res.a);\n"
70 "}\n"
71 "#endif\n"
72 
73 // Chrom upsampling error filter
74 // Chroma for lines 1 and 3 comes from line 1-2
75 // Chroma for lines 2 and 4 comes from line 3-4
76 // This is a simple resample that ensures temporal consistency. A more advanced
77 // multitap filter would smooth the chroma - but at significant cost and potentially
78 // undesirable loss in detail.
79 
80 "highp vec2 chromaLocation(highp vec2 xy)\n"
81 "{\n"
82 "#ifdef MYTHTV_CUE\n"
83 " highp float temp = xy.y * FIELDSIZE;\n"
84 " highp float onetwo = min((floor(temp / 2.0) / (FIELDSIZE / 2.0)) + LINEHEIGHT, MAXHEIGHT);\n"
85 "#ifdef MYTHTV_CHROMALEFT\n"
86 " return vec2(xy.x + (0.5 / COLUMN), mix(onetwo, min(onetwo + (2.0 * LINEHEIGHT), MAXHEIGHT), step(0.5, fract(temp))));\n"
87 "#else\n"
88 " return vec2(xy.x, mix(onetwo, min(onetwo + (2.0 * LINEHEIGHT), MAXHEIGHT), step(0.5, fract(temp))));\n"
89 "#endif\n"
90 "#else\n"
91 "#ifdef MYTHTV_CHROMALEFT\n"
92 " return vec2(xy.x + (0.5 / COLUMN), xy.y);\n"
93 "#else\n"
94 " return xy;\n"
95 "#endif\n"
96 "#endif\n"
97 "}\n"
98 
99 "#ifdef MYTHTV_NV12\n"
100 "highp vec4 sampleYUV(in sampler2D texture1, in sampler2D texture2, highp vec2 texcoord)\n"
101 "{\n"
102 "#ifdef MYTHTV_RECTS\n"
103 " return vec4(texture2D(texture1, texcoord).r, texture2D(texture2, chromaLocation(texcoord) * vec2(0.5, 0.5)).rg, 1.0);\n"
104 "#else\n"
105 " return vec4(texture2D(texture1, texcoord).r, texture2D(texture2, chromaLocation(texcoord)).rg, 1.0);\n"
106 "#endif\n"
107 "}\n"
108 "#endif\n"
109 
110 "#ifdef MYTHTV_YV12\n"
111 "highp vec4 sampleYUV(in sampler2D texture1, in sampler2D texture2, in sampler2D texture3, highp vec2 texcoord)\n"
112 "{\n"
113 " highp vec2 chroma = chromaLocation(texcoord);\n"
114 " return vec4(texture2D(texture1, texcoord).r,\n"
115 " texture2D(texture2, chroma).r,\n"
116 " texture2D(texture3, chroma).r,\n"
117 " 1.0);\n"
118 "}\n"
119 "#endif\n"
120 
121 "#ifdef MYTHTV_YUY2\n"
122 "highp vec4 sampleYUV(in sampler2D texture1, highp vec2 texcoord)\n"
123 "{\n"
124 " return texture2D(texture1, texcoord);\n"
125 "}\n"
126 "#endif\n"
127 
128 "#ifdef MYTHTV_KERNEL\n"
129 "highp vec4 kernel(in highp vec4 yuv, sampler2D kernelTex0, sampler2D kernelTex1)\n"
130 "{\n"
131 " highp vec2 twoup = vec2(v_texcoord0.x, max(v_texcoord0.y - (2.0 * LINEHEIGHT), LINEHEIGHT));\n"
132 " highp vec2 twodown = vec2(v_texcoord0.x, min(v_texcoord0.y + (2.0 * LINEHEIGHT), MAXHEIGHT));\n"
133 " yuv *= 0.125;\n"
134 " yuv += 0.125 * sampleYUV(kernelTex1, v_texcoord0);\n"
135 " yuv += 0.5 * sampleYUV(kernelTex0, vec2(v_texcoord0.x, max(v_texcoord0.y - LINEHEIGHT, LINEHEIGHT)));\n"
136 " yuv += 0.5 * sampleYUV(kernelTex0, vec2(v_texcoord0.x, min(v_texcoord0.y + LINEHEIGHT, MAXHEIGHT)));\n"
137 " yuv += -0.0625 * sampleYUV(kernelTex0, twoup);\n"
138 " yuv += -0.0625 * sampleYUV(kernelTex0, twodown);\n"
139 " yuv += -0.0625 * sampleYUV(kernelTex1, twoup);\n"
140 " yuv += -0.0625 * sampleYUV(kernelTex1, twodown);\n"
141 " return yuv;\n"
142 "}\n"
143 "#endif\n"
144 
145 "void main(void)\n"
146 "{\n"
147 "#ifdef MYTHTV_ONEFIELD\n"
148 "#ifdef MYTHTV_TOPFIELD\n"
149 " highp float field = min(v_texcoord0.y + (step(0.5, fract(v_texcoord0.y * FIELDSIZE))) * LINEHEIGHT, MAXHEIGHT);\n"
150 "#else\n"
151 " highp float field = max(v_texcoord0.y + (step(0.5, 1.0 - fract(v_texcoord0.y * FIELDSIZE))) * LINEHEIGHT, 0.0);\n"
152 "#endif\n"
153 " highp vec4 yuv = sampleYUV(s_texture0, vec2(v_texcoord0.x, field));\n"
154 "#else\n"
155 "#ifdef MYTHTV_KERNEL\n"
156 " highp vec4 yuv = sampleYUV(s_texture1, v_texcoord0);\n"
157 "#else\n"
158 " highp vec4 yuv = sampleYUV(s_texture0, v_texcoord0);\n"
159 "#endif\n"
160 "#endif\n"
161 
162 "#ifdef MYTHTV_KERNEL\n"
163 "#ifdef MYTHTV_TOPFIELD\n"
164 " yuv = mix(kernel(yuv, s_texture1, s_texture2), yuv, step(fract(v_texcoord0.y * FIELDSIZE), 0.5));\n"
165 "#else\n"
166 " yuv = mix(yuv, kernel(yuv, s_texture1, s_texture0), step(fract(v_texcoord0.y * FIELDSIZE), 0.5));\n"
167 "#endif\n"
168 "#endif\n"
169 
170 "#ifdef MYTHTV_LINEARBLEND\n"
171 " highp vec4 above = sampleYUV(s_texture0, vec2(v_texcoord0.x, min(v_texcoord0.y + LINEHEIGHT, MAXHEIGHT)));\n"
172 " highp vec4 below = sampleYUV(s_texture0, vec2(v_texcoord0.x, max(v_texcoord0.y - LINEHEIGHT, 0.0)));\n"
173 "#ifdef MYTHTV_TOPFIELD\n"
174 " yuv = mix(mix(above, below, 0.5), yuv, step(fract(v_texcoord0.y * FIELDSIZE), 0.5));\n"
175 "#else\n"
176 " yuv = mix(yuv, mix(above, below, 0.5), step(fract(v_texcoord0.y * FIELDSIZE), 0.5));\n"
177 "#endif\n"
178 "#endif\n"
179 
180 "#ifdef MYTHTV_YUY2\n"
181 " gl_FragColor = vec4(mix(yuv.arb, yuv.grb, step(fract(v_texcoord0.x * COLUMN), 0.5)), 1.0) * m_colourMatrix;\n"
182 "#else\n"
183 " gl_FragColor = yuv * m_colourMatrix;\n"
184 "#ifdef MYTHTV_COLOURMAPPING\n"
185 " gl_FragColor = ColourMap(gl_FragColor);\n"
186 "#endif\n"
187 "#endif\n"
188 "}\n";
189 
190 static const QString BicubicShader =
191 "uniform sampler2D s_texture0;\n"
192 "uniform highp vec2 m_textureSize;\n"
193 "varying highp vec2 v_texcoord0;\n"
194 "highp vec4 Cubic(highp float Pos) {\n"
195 " highp vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - Pos;\n"
196 " highp vec4 s = n * n * n;\n"
197 " highp float x = s.x;\n"
198 " highp float y = s.y - 4.0 * s.x;\n"
199 " highp float z = s.z - 4.0 * s.y + 6.0 * s.x;\n"
200 " highp float w = 6.0 - x - y - z;\n"
201 " return vec4(x, y, z, w) * (1.0/6.0);\n"
202 "}\n"
203 "void main(void)\n"
204 "{\n"
205 " highp vec2 pos = (v_texcoord0 * m_textureSize) - 0.5;\n"
206 " highp vec2 fxy = fract(pos);\n"
207 " pos -= fxy;\n"
208 " highp vec4 xcubic = Cubic(fxy.x);\n"
209 " highp vec4 ycubic = Cubic(fxy.y);\n"
210 " highp vec4 c = pos.xxyy + vec2(-0.5, +1.5).xyxy;\n"
211 " highp vec4 s = vec4(xcubic.xz + xcubic.yw, ycubic.xz + ycubic.yw);\n"
212 " highp vec4 offset = c + vec4 (xcubic.yw, ycubic.yw) / s;\n"
213 " offset *= (1.0 / m_textureSize).xxyy;\n"
214 " highp vec4 sample0 = texture2D(s_texture0, offset.xz);\n"
215 " highp vec4 sample1 = texture2D(s_texture0, offset.yz);\n"
216 " highp vec4 sample2 = texture2D(s_texture0, offset.xw);\n"
217 " highp vec4 sample3 = texture2D(s_texture0, offset.yw);\n"
218 " highp float sx = s.x / (s.x + s.y);\n"
219 " highp float sy = s.z / (s.z + s.w);\n"
220 " gl_FragColor = mix(mix(sample3, sample2, sx), mix(sample1, sample0, sx), sy);\n"
221 "}\n";
222 
223 // Adapted from the version in libplacebo (https://code.videolan.org/videolan/libplacebo)
224 // with all due credit to the original author(S) (Niklas Haas)
225 static const QString DebandFragmentShader =
226 "uniform sampler2D s_texture0;\n"
227 "uniform highp float u_random;\n" // 0.0 to 1.0
228 "uniform highp vec2 m_textureSize;\n" // e.g. 1920x1080
229 "uniform highp float m_depth;\n" // e.g. 0.0 - 255.0
230 "varying highp vec2 v_texcoord0;\n"
231 "highp float Random(highp float Val)\n"
232 "{\n"
233 " return fract(Val * 1.0 / 41.0);\n"
234 "}\n"
235 "highp float Mod289(highp float Val)\n"
236 "{\n"
237 " return Val - floor(Val * 1.0 / 289.0) * 289.0;\n"
238 "}\n"
239 "highp float Permute(highp float Val)\n"
240 "{\n"
241 " return Mod289(Mod289(34.0 * Val + 1.0) * (fract(Val) + 1.0));\n"
242 "}\n"
243 "highp vec4 Average(in sampler2D texture, in highp vec2 pos, in highp float range, inout highp float pseud)\n"
244 "{\n"
245 " highp float dist = Random(pseud) * range; pseud = Permute(pseud);\n"
246 " highp float dir = Random(pseud) * 6.2831853; pseud = Permute(pseud);\n"
247 " highp vec2 off = dist * vec2(cos(dir), sin(dir));\n"
248 " highp vec2 adj = 1.0 / m_textureSize;\n"
249 " highp vec4 ref = texture2D(texture, pos + (adj * vec2( off.x, off.y)));\n"
250 " ref += texture2D(texture, pos + (adj * vec2(-off.y, off.x)));\n"
251 " ref += texture2D(texture, pos + (adj * vec2(-off.x, -off.y)));\n"
252 " ref += texture2D(texture, pos + (adj * vec2( off.y, -off.x)));\n"
253 " return ref * 0.25;\n"
254 "}\n"
255 "void main(void)\n"
256 "{\n"
257 " highp vec4 color = texture2D(s_texture0, v_texcoord0);\n"
258 " highp vec3 pseudo = vec3(v_texcoord0, u_random) + 1.0;\n"
259 " highp float pseud = Permute(Permute(Permute(pseudo.x) + pseudo.y) + pseudo.z);\n"
260 " highp vec4 avg = Average(s_texture0, v_texcoord0, 16.0, pseud);\n"
261 " highp vec4 diff = abs(color - avg);\n"
262 " color = mix(color, avg, step(diff, vec4(1.0 / m_depth)));\n"
263 " vec3 noise;\n"
264 " noise.x = Random(pseud); pseud = Permute(pseud);\n"
265 " noise.y = Random(pseud); pseud = Permute(pseud);\n"
266 " noise.z = Random(pseud); pseud = Permute(pseud);\n"
267 " color.rgb += (1.0 / m_depth) * (noise - 0.5);\n"
268 " gl_FragColor = color;\n"
269 "}\n";
270 
271 /* These are updated versions of the video shaders that use GLSL 3.30 / GLSL ES 3.00.
272  * Used because OpenGL ES3.X requires unsigned integer texture formats for 16bit
273  * software video textures - and unsigned samplers need GLSL ES 3.00.
274  *
275  * Notable differences due to shader language changes:-
276  * - use of in/out instead of varying/attribute
277  * - gl_FragColor replaced with user defined 'out highp vec4 fragmentColor'
278  * - texture2D replaced with texture
279  * - no mix method for uint/uvec - so must be handled 'manually'
280  *
281  * Changes for unsigned integer sampling:-
282  * - sampler2D replaced with usampler2D (note - via define to ensure compatibility
283  * with texture sampling customisation in MythOpenGLVideo).
284  * - vec4 replaced with uvec4 as needed
285  * - kernel calculation forces intermediate conversion to float to maintain accuracy
286  *
287  * There is no support here for:-
288  * - rectangular textures (only currently required for VideoToolBox on OSX - no GLES)
289  * - MediaCodec vertex transforms (hardware textures only)
290  * - External OES textures (hardware textures only)
291  * - YUY2 textures (8bit only currently)
292  *
293  * Other usage considerations:-
294  * - the correct version define added as the FIRST line.
295  * - texture filtering must be GL_NEAREST.
296 */
297 
298 static const QString GLSL300VertexShader =
299 "in highp vec2 a_position;\n"
300 "in highp vec2 a_texcoord0;\n"
301 "out highp vec2 v_texcoord0;\n"
302 "uniform highp mat4 u_projection;\n"
303 "void main()\n"
304 "{\n"
305 " gl_Position = u_projection * vec4(a_position, 0.0, 1.0);\n"
306 " v_texcoord0 = a_texcoord0;\n"
307 "}\n";
308 
309 static const QString GLSL300YUVFragmentExtensions =
310 "#define LINEHEIGHT m_frameData.x\n"
311 "#define COLUMN m_frameData.y\n"
312 "#define MAXHEIGHT m_frameData.z\n"
313 "#define FIELDSIZE m_frameData.w\n"
314 "#define sampler2D highp usampler2D\n";
315 
316 static const QString GLSL300YUVFragmentShader =
317 "uniform highp mat4 m_colourMatrix;\n"
318 "uniform highp vec4 m_frameData;\n"
319 "in highp vec2 v_texcoord0;\n"
320 "out highp vec4 fragmentColor;\n"
321 "#ifdef MYTHTV_COLOURMAPPING\n"
322 "uniform highp mat4 m_primaryMatrix;\n"
323 "uniform highp float m_colourGamma;\n"
324 "uniform highp float m_displayGamma;\n"
325 "highp vec4 ColourMap(highp vec4 color)\n"
326 "{\n"
327 " highp vec4 res = clamp(color, 0.0, 1.0);\n"
328 " res.rgb = pow(res.rgb, vec3(m_colourGamma));\n"
329 " res = m_primaryMatrix * res;\n"
330 " return vec4(pow(res.rgb, vec3(m_displayGamma)), res.a);\n"
331 "}\n"
332 "#endif\n"
333 
334 // Chroma for lines 1 and 3 comes from line 1-2
335 // Chroma for lines 2 and 4 comes from line 3-4
336 // This is a simple resample that ensures temporal consistency. A more advanced
337 // multitap filter would smooth the chroma - but at significant cost and potentially
338 // undesirable loss in detail.
339 
340 "highp vec2 chromaLocation(highp vec2 xy)\n"
341 "{\n"
342 "#ifdef MYTHTV_CUE\n"
343 " highp float temp = xy.y * FIELDSIZE;\n"
344 " highp float onetwo = min((floor(temp / 2.0) / (FIELDSIZE / 2.0)) + LINEHEIGHT, MAXHEIGHT);\n"
345 "#ifdef MYTHTV_CHROMALEFT\n"
346 " return vec2(xy.x + (0.5 / COLUMN), mix(onetwo, min(onetwo + (2.0 * LINEHEIGHT), MAXHEIGHT), step(0.5, fract(temp))));\n"
347 "#else\n"
348 " return vec2(xy.x, mix(onetwo, min(onetwo + (2.0 * LINEHEIGHT), MAXHEIGHT), step(0.5, fract(temp))));\n"
349 "#endif\n"
350 "#else\n"
351 "#ifdef MYTHTV_CHROMALEFT\n"
352 " return vec2(xy.x + (0.5 / COLUMN), xy.y);\n"
353 "#else\n"
354 " return xy;\n"
355 "#endif\n"
356 "#endif\n"
357 "}\n"
358 
359 "#ifdef MYTHTV_NV12\n"
360 "highp uvec4 sampleYUV(in sampler2D texture1, in sampler2D texture2, highp vec2 texcoord)\n"
361 "{\n"
362 " return uvec4(texture(texture1, texcoord).r, texture(texture2, chromaLocation(texcoord)).rg, 1.0);\n"
363 "}\n"
364 "#endif\n"
365 
366 "#ifdef MYTHTV_YV12\n"
367 "highp uvec4 sampleYUV(in sampler2D texture1, in sampler2D texture2, in sampler2D texture3, highp vec2 texcoord)\n"
368 "{\n"
369 " highp vec2 chroma = chromaLocation(texcoord);\n"
370 " return uvec4(texture(texture1, texcoord).r,\n"
371 " texture(texture2, chroma).r,\n"
372 " texture(texture3, chroma).r,\n"
373 " 1.0);\n"
374 "}\n"
375 "#endif\n"
376 
377 "#ifdef MYTHTV_KERNEL\n"
378 "highp uvec4 kernel(in highp uvec4 yuv, sampler2D kernelTex0, sampler2D kernelTex1)\n"
379 "{\n"
380 " highp vec2 twoup = vec2(v_texcoord0.x, max(v_texcoord0.y - (2.0 * LINEHEIGHT), LINEHEIGHT));\n"
381 " highp vec2 twodown = vec2(v_texcoord0.x, min(v_texcoord0.y + (2.0 * LINEHEIGHT), MAXHEIGHT));\n"
382 " highp vec4 yuvf = 0.125 * vec4(yuv);\n"
383 " yuvf += 0.125 * vec4(sampleYUV(kernelTex1, v_texcoord0));\n"
384 " yuvf += 0.5 * vec4(sampleYUV(kernelTex0, vec2(v_texcoord0.x, max(v_texcoord0.y - LINEHEIGHT, LINEHEIGHT))));\n"
385 " yuvf += 0.5 * vec4(sampleYUV(kernelTex0, vec2(v_texcoord0.x, min(v_texcoord0.y + LINEHEIGHT, MAXHEIGHT))));\n"
386 " yuvf += -0.0625 * vec4(sampleYUV(kernelTex0, twoup));\n"
387 " yuvf += -0.0625 * vec4(sampleYUV(kernelTex0, twodown));\n"
388 " yuvf += -0.0625 * vec4(sampleYUV(kernelTex1, twoup));\n"
389 " yuvf += -0.0625 * vec4(sampleYUV(kernelTex1, twodown));\n"
390 " return uvec4(yuv);\n"
391 "}\n"
392 "#endif\n"
393 
394 "void main(void)\n"
395 "{\n"
396 "#ifdef MYTHTV_ONEFIELD\n"
397 "#ifdef MYTHTV_TOPFIELD\n"
398 " highp float field = min(v_texcoord0.y + (step(0.5, fract(v_texcoord0.y * FIELDSIZE))) * LINEHEIGHT, MAXHEIGHT);\n"
399 "#else\n"
400 " highp float field = max(v_texcoord0.y + (step(0.5, 1.0 - fract(v_texcoord0.y * FIELDSIZE))) * LINEHEIGHT, 0.0);\n"
401 "#endif\n"
402 " highp uvec4 yuv = sampleYUV(s_texture0, vec2(v_texcoord0.x, field));\n"
403 "#else\n"
404 "#ifdef MYTHTV_KERNEL\n"
405 " highp uvec4 yuv = sampleYUV(s_texture1, v_texcoord0);\n"
406 "#else\n"
407 " highp uvec4 yuv = sampleYUV(s_texture0, v_texcoord0);\n"
408 "#endif\n"
409 "#endif\n"
410 
411 "#ifdef MYTHTV_KERNEL\n"
412 " highp uint field = uint(step(fract(v_texcoord0.y * FIELDSIZE), 0.5));\n"
413 "#ifdef MYTHTV_TOPFIELD\n"
414 " yuv = (kernel(yuv, s_texture1, s_texture2) * uvec4(field)) + (yuv * uvec4(1u - field));\n"
415 "#else\n"
416 " yuv = (yuv * uvec4(field)) + (kernel(yuv, s_texture1, s_texture0) * uvec4(1u - field));\n"
417 "#endif\n"
418 "#endif\n"
419 
420 "#ifdef MYTHTV_LINEARBLEND\n"
421 " highp uvec4 mixed = (sampleYUV(s_texture0, vec2(v_texcoord0.x, min(v_texcoord0.y + LINEHEIGHT, MAXHEIGHT))) +\n"
422 " sampleYUV(s_texture0, vec2(v_texcoord0.x, max(v_texcoord0.y - LINEHEIGHT, 0.0)))) / uvec4(2.0);\n"
423 " highp uint field = uint(step(fract(v_texcoord0.y * FIELDSIZE), 0.5));\n"
424 "#ifdef MYTHTV_TOPFIELD\n"
425 " yuv = (mixed * uvec4(field)) + (yuv * uvec4(1u - field));\n"
426 "#else\n"
427 " yuv = (yuv * uvec4(field)) + (mixed * uvec4(1u - field));\n"
428 "#endif\n"
429 "#endif\n"
430 
431 " fragmentColor = (vec4(yuv) / vec4(65535.0, 65535.0, 65535.0, 1.0)) * m_colourMatrix;\n"
432 "#ifdef MYTHTV_COLOURMAPPING\n"
433 " fragmentColor = ColourMap(fragmentColor);\n"
434 "#endif\n"
435 "}\n";
436 
437 #endif // MYTH_OPENGLVIDEOSHADERS_H
BicubicShader
static const QString BicubicShader
Definition: mythopenglvideoshaders.h:190
GLSL300VertexShader
static const QString GLSL300VertexShader
Definition: mythopenglvideoshaders.h:298
GLSL300YUVFragmentExtensions
static const QString GLSL300YUVFragmentExtensions
Definition: mythopenglvideoshaders.h:309
DebandFragmentShader
static const QString DebandFragmentShader
Definition: mythopenglvideoshaders.h:225
YUVFragmentExtensions
static const QString YUVFragmentExtensions
Definition: mythopenglvideoshaders.h:41
DefaultVertexShader
static const QString DefaultVertexShader
Definition: mythopenglvideoshaders.h:6
YUVFragmentShader
static const QString YUVFragmentShader
Definition: mythopenglvideoshaders.h:56
RGBFragmentShader
static const QString RGBFragmentShader
Definition: mythopenglvideoshaders.h:17
GLSL300YUVFragmentShader
static const QString GLSL300YUVFragmentShader
Definition: mythopenglvideoshaders.h:316