| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/output/shader.h" | 5 #include "cc/output/shader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 void main() { | 2080 void main() { |
| 2081 vec2 ya_clamped = | 2081 vec2 ya_clamped = |
| 2082 max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord)); | 2082 max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord)); |
| 2083 float y_raw = TextureLookup(y_texture, ya_clamped).x; | 2083 float y_raw = TextureLookup(y_texture, ya_clamped).x; |
| 2084 vec2 uv_clamped = | 2084 vec2 uv_clamped = |
| 2085 max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord)); | 2085 max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord)); |
| 2086 float u_unsigned = TextureLookup(u_texture, uv_clamped).x; | 2086 float u_unsigned = TextureLookup(u_texture, uv_clamped).x; |
| 2087 float v_unsigned = TextureLookup(v_texture, uv_clamped).x; | 2087 float v_unsigned = TextureLookup(v_texture, uv_clamped).x; |
| 2088 vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; | 2088 vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; |
| 2089 vec3 rgb = yuv_matrix * yuv; | 2089 vec3 rgb = yuv_matrix * yuv; |
| 2090 rgb = mix(rgb/4.5, |
| 2091 pow((rgb + vec3(0.0999, 0.0999, 0.0999)) / 1.099, |
| 2092 vec3(1.0/0.45, 1.0/0.45, 1.0/0.45)), |
| 2093 step(0.081, rgb)); |
| 2094 rgb = mix(rgb * 12.92, |
| 2095 pow(rgb, vec3(1.0/2.4, 1.0/2.4, 1.0/2.4)) * 1.055 - vec3(0.055,
0.055, 0.055), |
| 2096 step(0.0031308, rgb)); |
| 2090 gl_FragColor = vec4(rgb, 1.0) * alpha; | 2097 gl_FragColor = vec4(rgb, 1.0) * alpha; |
| 2091 } | 2098 } |
| 2092 }); | 2099 }); |
| 2093 } | 2100 } |
| 2094 | 2101 |
| 2095 FragmentShaderYUVAVideo::FragmentShaderYUVAVideo() | 2102 FragmentShaderYUVAVideo::FragmentShaderYUVAVideo() |
| 2096 : y_texture_location_(-1), | 2103 : y_texture_location_(-1), |
| 2097 u_texture_location_(-1), | 2104 u_texture_location_(-1), |
| 2098 v_texture_location_(-1), | 2105 v_texture_location_(-1), |
| 2099 a_texture_location_(-1), | 2106 a_texture_location_(-1), |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 void main() { | 2253 void main() { |
| 2247 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 2254 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
| 2248 vec2 d2 = min(d4.xz, d4.yw); | 2255 vec2 d2 = min(d4.xz, d4.yw); |
| 2249 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 2256 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
| 2250 gl_FragColor = color * aa; | 2257 gl_FragColor = color * aa; |
| 2251 } | 2258 } |
| 2252 }); | 2259 }); |
| 2253 } | 2260 } |
| 2254 | 2261 |
| 2255 } // namespace cc | 2262 } // namespace cc |
| OLD | NEW |