File: EXPDeinterlaceShaderLineDouble.frag.txt

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (28 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download | duplicates (7)
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
/* Shader for video deinterlacing - Extracts either the even- or odd- field
 * (even or odd rows) of an interlaced image texture and replicates them.
 * This is the most simple form of deinterlacing.
 *
 * This code is beta quality. It doesn't work yet with filtered texture
 * drawing, and could be more optimized.
 *
 * Written 2007 by Mario Kleiner, part of the Psychtoolbox-3, licensed under
 * MIT license.
 *
 */ 

#extension GL_ARB_texture_rectangle : enable

/* UseOddField: To be set by usercode - 0 = Extract even lines, 1 = Extract odd lines. */
uniform float UseOddField;
/* Input image rectangle texture: */
uniform sampler2DRect Image1;

void main()
{
    /* Get default texel read position (s,t): s is column, t is row of image. */
    vec2 readpos = gl_TexCoord[0].st;
    /* Update the t (==row) component to only read even or odd lines, replicating them. */
    readpos.t = readpos.t - mod(readpos.t, 2.0) + UseOddField;
    /* Read the image pixel from the modified readpos, output it to framebuffer. */
    gl_FragColor = texture2DRect(Image1, readpos);
}