Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: client/deps/glbench/src/yuv2rgb_2.glslf

Issue 2757001: Refactored YUV test. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/deps/glbench/src/yuv2rgb_1.glslv ('k') | client/deps/glbench/src/yuv2rgb_2.glslv » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, Google Inc. 2 * Copyright 2010, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 25 matching lines...) Expand all
36 */ 36 */
37 37
38 uniform sampler2D textureSampler; 38 uniform sampler2D textureSampler;
39 uniform sampler2D paritySampler; 39 uniform sampler2D paritySampler;
40 40
41 varying vec2 lineCounter; 41 varying vec2 lineCounter;
42 varying vec2 yPlane; 42 varying vec2 yPlane;
43 varying vec2 uPlane; 43 varying vec2 uPlane;
44 varying vec2 vPlane; 44 varying vec2 vPlane;
45 45
46 #if defined (USE_UNIFORM_MATRIX)
47 uniform mat4 conversion;
48 #endif
49
46 void main() { 50 void main() {
47 /* 51 /*
48 * If the height of the original image is even, offset_odd is not needed. 52 * If the height of the original image is even, offset_odd is not needed.
49 */ 53 */
50 #if defined(I915_WORKAROUND) 54 #if defined(I915_WORKAROUND)
51 vec2 offset_even = vec2(texture2D(paritySampler, gl_TexCoord[0].xy).x * 0.5, 55 vec2 offset_even = vec2(texture2D(paritySampler, gl_TexCoord[0].xy).x * 0.5,
52 0.0); 56 0.0);
53 #else 57 #else
54 vec2 offset_even = vec2(texture2D(paritySampler, lineCounter).x * 0.5, 0.0); 58 vec2 offset_even = vec2(texture2D(paritySampler, lineCounter).x * 0.5, 0.0);
55 #endif 59 #endif
56 vec2 offset_odd = vec2(0.5 - offset_even.x, 0.0); 60 vec2 offset_odd = vec2(0.5 - offset_even.x, 0.0);
57 61
58 #if defined(I915_WORKAROUND) 62 #if defined(I915_WORKAROUND)
59 float yChannel = texture2D(textureSampler, gl_TexCoord[0].zw).x; 63 float yChannel = texture2D(textureSampler, gl_TexCoord[0].zw).x;
60 float uChannel = texture2D(textureSampler, gl_TexCoord[1].xy + offset_even).x; 64 float uChannel = texture2D(textureSampler, gl_TexCoord[1].xy + offset_even).x;
61 float vChannel = texture2D(textureSampler, gl_TexCoord[1].zw + offset_odd).x; 65 float vChannel = texture2D(textureSampler, gl_TexCoord[1].zw + offset_odd).x;
62 #else 66 #else
63 float yChannel = texture2D(textureSampler, yPlane).x; 67 float yChannel = texture2D(textureSampler, yPlane).x;
64 float uChannel = texture2D(textureSampler, uPlane + offset_even).x; 68 float uChannel = texture2D(textureSampler, uPlane + offset_even).x;
65 float vChannel = texture2D(textureSampler, vPlane + offset_odd).x; 69 float vChannel = texture2D(textureSampler, vPlane + offset_odd).x;
66 #endif 70 #endif
67 /* 71 /*
68 * This does the colorspace conversion from Y'UV to RGB as a matrix 72 * This does the colorspace conversion from Y'UV to RGB as a matrix
69 * multiply. It also does the offset of the U and V channels from 73 * multiply. It also does the offset of the U and V channels from
70 * [0,1] to [-.5,.5] as part of the transform. 74 * [0,1] to [-.5,.5] as part of the transform.
71 */ 75 */
72 vec4 channels = vec4(yChannel, uChannel, vChannel, 1.0); 76 vec4 channels = vec4(yChannel, uChannel, vChannel, 1.0);
77 #if !defined(USE_UNIFORM_MATRIX)
73 mat4 conversion = mat4( 1.0, 1.0, 1.0, 0.0, 78 mat4 conversion = mat4( 1.0, 1.0, 1.0, 0.0,
74 0.0, -0.344, 1.772, 0.0, 79 0.0, -0.344, 1.772, 0.0,
75 1.402, -0.714, 0.0, 0.0, 80 1.402, -0.714, 0.0, 0.0,
76 -0.701, 0.529, -0.886, 1.0); 81 -0.701, 0.529, -0.886, 1.0);
82 #endif
77 83
78 gl_FragColor = conversion * channels; 84 gl_FragColor = conversion * channels;
79 } 85 }
OLDNEW
« no previous file with comments | « client/deps/glbench/src/yuv2rgb_1.glslv ('k') | client/deps/glbench/src/yuv2rgb_2.glslv » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698