Created
February 8, 2014 08:33
-
-
Save rossy/8878567 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [vo/opengl-hq] win32: running at 1600x900 | |
| [vo/opengl-hq] Detected OpenGL 3.0. | |
| [vo/opengl-hq] GL_VENDOR='Intel' | |
| [vo/opengl-hq] GL_RENDERER='Intel(R) HD Graphics 4400' | |
| [vo/opengl-hq] GL_VERSION='3.0.0 - Build 10.18.10.3345' | |
| [vo/opengl-hq] GL_SHADING_LANGUAGE_VERSION='1.30 - Build 10.18.10.3345' | |
| [vo/opengl-hq] OpenGL legacy compat. found. | |
| [vo/opengl-hq] Combined OpenGL extensions string: | |
| [vo/opengl-hq] GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_blend_color GL_EXT_abgr GL_EXT_texture3D GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_SGIS_texture_edge_clamp GL_SGIS_generate_mipmap GL_EXT_draw_range_elements GL_SGIS_texture_lod GL_EXT_rescale_normal GL_EXT_packed_pixels GL_EXT_texture_edge_clamp GL_EXT_separate_specular_color GL_ARB_multitexture GL_ARB_map_buffer_alignment GL_ARB_conservative_depth GL_EXT_texture_env_combine GL_EXT_bgra GL_EXT_blend_func_separate GL_EXT_secondary_color GL_EXT_fog_coord GL_EXT_texture_env_add GL_ARB_texture_cube_map GL_ARB_transpose_matrix GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_texture_env_add GL_IBM_texture_mirrored_repeat GL_EXT_multi_draw_arrays GL_SUN_multi_draw_arrays GL_NV_blend_square GL_ARB_texture_compression GL_3DFX_texture_compression_FXT1 GL_EXT_texture_filter_anisotropic GL_ARB_texture_border_clamp GL_ARB_point_parameters GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_env_crossbar GL_EXT_texture_compression_s3tc GL_ARB_shadow GL_ARB_window_pos GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_ARB_vertex_program GL_EXT_texture_rectangle GL_ARB_fragment_program GL_EXT_stencil_two_side GL_ATI_separate_stencil GL_ARB_vertex_buffer_object GL_EXT_texture_lod_bias GL_ARB_occlusion_query GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_texture_non_power_of_two GL_ARB_vertex_shader GL_NV_texgen_reflection GL_ARB_point_sprite GL_ARB_fragment_program_shadow GL_EXT_blend_equation_separate GL_ARB_depth_texture GL_ARB_texture_rectangle GL_ARB_draw_buffers GL_ARB_color_buffer_float GL_ARB_half_float_pixel GL_ARB_texture_float GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_ARB_occlusion_query2 GL_EXT_draw_buffers2 GL_WIN_swap_hint GL_EXT_texture_sRGB GL_ARB_multisample GL_EXT_packed_float GL_EXT_texture_shared_exponent GL_ARB_texture_rg GL_ARB_texture_compression_rgtc GL_NV_conditional_render GL_ARB_texture_swizzle GL_EXT_texture_swizzle GL_ARB_texture_gather GL_ARB_sync GL_ARB_framebuffer_sRGB GL_EXT_packed_depth_stencil GL_ARB_depth_buffer_float GL_EXT_transform_feedback GL_ARB_transform_feedback2 GL_ARB_draw_indirect GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_ARB_framebuffer_object GL_EXT_texture_array GL_EXT_texture_integer GL_ARB_map_buffer_range GL_ARB_texture_buffer_range GL_EXT_texture_snorm GL_ARB_blend_func_extended GL_INTEL_performance_queries GL_ARB_copy_buffer GL_ARB_sampler_objects GL_NV_primitive_restart GL_ARB_seamless_cube_map GL_ARB_uniform_buffer_object GL_ARB_depth_clamp GL_ARB_vertex_array_bgra GL_ARB_shader_bit_encoding GL_ARB_draw_buffers_blend GL_ARB_geometry_shader4 GL_EXT_geometry_shader4 GL_ARB_texture_query_lod GL_ARB_explicit_attrib_location GL_ARB_draw_elements_base_vertex GL_ARB_instanced_arrays GL_ARB_base_instance GL_ARB_fragment_coord_conventions GL_EXT_gpu_program_parameters GL_ARB_texture_buffer_object_rgb32 GL_ARB_compatibility GL_ARB_texture_rgb10_a2ui GL_ARB_texture_multisample GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_timer_query GL_ARB_tessellation_shader GL_ARB_vertex_array_object GL_ARB_provoking_vertex GL_ARB_sample_shading GL_ARB_texture_cube_map_array GL_EXT_gpu_shader4 GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_INTEL_fragment_shader_ordering GL_ARB_shader_subroutine GL_ARB_transform_feedback3 GL_ARB_get_program_binary GL_ARB_separate_shader_objects GL_ARB_shader_precision GL_ARB_vertex_attrib_64bit GL_ARB_viewport_array GL_ARB_transform_feedback_instanced GL_ARB_compressed_texture_pixel_storage GL_ARB_shader_atomic_counters GL_ARB_shading_language_packing GL_ARB_shader_image_load_store GL_ARB_shading_language_420pack GL_ARB_texture_storage GL_EXT_texture_storage GL_ARB_compute_shader GL_ARB_multi_draw_indirect GL_ARB_program_interface_query GL_ARB_shader_storage_buffer_object GL_ARB_debug_output GL_KHR_debug GL_ARB_arrays_of_arrays GL_INTEL_map_texture GL_ARB_texture_compression_bptc GL_ARB_ES2_compatibility GL_ARB_robustness GL_EXT_texture_sRGB_decode WGL_EXT_depth_float WGL_ARB_buffer_region WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_pixel_format WGL_ARB_pbuffer WGL_EXT_extensions_string WGL_EXT_swap_control WGL_EXT_swap_control_tear WGL_ARB_multisample WGL_ARB_pixel_format_float WGL_ARB_framebuffer_sRGB WGL_ARB_create_context WGL_ARB_create_context_profile WGL_EXT_pixel_format_packed_float WGL_EXT_create_context_es_profile WGL_EXT_create_context_es2_profile WGL_NV_DX_interop WGL_ARB_create_context_robustness | |
| [vo/opengl-hq] Detected OpenGL features: [Basic OpenGL] [Legacy OpenGL] [OpenGL 2.0] [OpenGL 2.1] [OpenGL 3.0] [Framebuffers] [VAOs] [sRGB textures] [sRGB framebuffers] [Float textures] [RG textures] [NO_SW] | |
| [vo/opengl-hq] Testing user-set FBO format | |
| [vo/opengl-hq] Create FBO: 16x16 | |
| [vo/opengl-hq] 8-bit precision: 0x0p+0 | |
| [vo/opengl-hq] 16-bit precision: 0x0p-72 | |
| [vo/opengl-hq] full float: 0x0p-72 | |
| [vo/opengl-hq] out of range value (2): 0x0p-63 | |
| [vo/opengl-hq] Display depth: R=8, G=8, B=8 | |
| [vo/opengl-hq] Testing user-set FBO format | |
| [vo/opengl-hq] Create FBO: 16x16 | |
| [vo/opengl-hq] 8-bit precision: 0x0p+0 | |
| [vo/opengl-hq] 16-bit precision: 0x0p+0 | |
| [vo/opengl-hq] full float: 0x0p-81 | |
| [vo/opengl-hq] out of range value (2): 0x0p-63 | |
| [vo/opengl-hq] Testing GL_R16 FBO (dithering/LUT) | |
| [vo/opengl-hq] Create FBO: 16x16 | |
| [vo/opengl-hq] 8-bit precision: 0x0p+0 | |
| [vo/opengl-hq] 16-bit precision: 0x0p+0 | |
| [vo/opengl-hq] full float: 0x0p-81 | |
| [vo/opengl-hq] out of range value (2): 0x0p-63 | |
| [vo/opengl-hq] Reinit rendering. | |
| Playing: [Underwater] KILL la KILL - 17 (720p) [F8059CB2].mkv | |
| Detected file format: Matroska | |
| Clip info: | |
| TITLE: KILL la KILL - 17 - Why Do You | |
| [stream] Video (+) --vid=1 'H.264 (10-bit)' (h264) | |
| [stream] Audio (+) --aid=1 --alang=jpn (*) 'Japanese 2.0 AAC' (aac) | |
| [stream] Subs (+) --sid=1 --slang=eng (*) 'English subtitles' (ass) | |
| Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [lavc:h264] | |
| Selected audio codec: AAC (Advanced Audio Coding) [lavc:aac] | |
| AO: [wasapi] 96000Hz stereo 2ch float | |
| VO: [opengl-hq] 1280x720 => 1280x720 420p10 | |
| [vo/opengl-hq] screen size: 1600x900 | |
| [vo/opengl-hq] reset window bounds: 152:59:1296:759 | |
| [vo/opengl-hq] move window: 160:90 | |
| [vo/opengl-hq] resize window: 1280:720 | |
| [vo/opengl-hq] Testing user-set FBO format | |
| [vo/opengl-hq] Create FBO: 16x16 | |
| [vo/opengl-hq] 8-bit precision: 0x0p+0 | |
| [vo/opengl-hq] 16-bit precision: 0x0p+0 | |
| [vo/opengl-hq] full float: 0x0p-81 | |
| [vo/opengl-hq] out of range value (2): 0x0p-63 | |
| [vo/opengl-hq] Testing GL_R16 FBO (dithering/LUT) | |
| [vo/opengl-hq] Create FBO: 16x16 | |
| [vo/opengl-hq] 8-bit precision: 0x0p+0 | |
| [vo/opengl-hq] 16-bit precision: 0x0p+0 | |
| [vo/opengl-hq] full float: 0x0p-81 | |
| [vo/opengl-hq] out of range value (2): 0x0p-63 | |
| [vo/opengl-hq] Texture for plane 0: 1280x720 | |
| [vo/opengl-hq] Texture for plane 1: 640x360 | |
| [vo/opengl-hq] Texture for plane 2: 640x360 | |
| [vo/opengl-hq] Reinit rendering. | |
| [vo/opengl-hq] Dither to 8. | |
| [vo/opengl-hq] compiling shader program 'frag_osd_libass', header: | |
| [vo/opengl-hq] [ 1] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] vertex shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] | |
| [vo/opengl-hq] [ 29] #if __VERSION__ < 130 | |
| [vo/opengl-hq] [ 30] # undef in | |
| [vo/opengl-hq] [ 31] # define in attribute | |
| [vo/opengl-hq] [ 32] # define out varying | |
| [vo/opengl-hq] [ 33] #endif | |
| [vo/opengl-hq] [ 34] | |
| [vo/opengl-hq] [ 35] uniform mat3 transform; | |
| [vo/opengl-hq] [ 36] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 37] | |
| [vo/opengl-hq] [ 38] in vec2 vertex_position; | |
| [vo/opengl-hq] [ 39] in vec4 vertex_color; | |
| [vo/opengl-hq] [ 40] out vec4 color; | |
| [vo/opengl-hq] [ 41] in vec2 vertex_texcoord; | |
| [vo/opengl-hq] [ 42] out vec2 texcoord; | |
| [vo/opengl-hq] [ 43] | |
| [vo/opengl-hq] [ 44] void main() { | |
| [vo/opengl-hq] [ 45] vec3 position = vec3(vertex_position, 1); | |
| [vo/opengl-hq] [ 46] #ifndef FIXED_SCALE | |
| [vo/opengl-hq] [ 47] position = transform * position; | |
| [vo/opengl-hq] [ 48] #endif | |
| [vo/opengl-hq] [ 49] gl_Position = vec4(position, 1); | |
| [vo/opengl-hq] [ 50] color = vertex_color; | |
| [vo/opengl-hq] [ 51] | |
| [vo/opengl-hq] [ 52] #ifdef USE_OSD_LINEAR_CONV | |
| [vo/opengl-hq] [ 53] // If no 3dlut is being used, we need to pull up to linear light for | |
| [vo/opengl-hq] [ 54] // the sRGB function. *IF* 3dlut is used, we do not. | |
| [vo/opengl-hq] [ 55] color.rgb = pow(color.rgb, vec3(1.0/0.45)); | |
| [vo/opengl-hq] [ 56] #endif | |
| [vo/opengl-hq] [ 57] #ifdef USE_OSD_3DLUT | |
| [vo/opengl-hq] [ 58] color = vec4(texture3D(lut_3d, color.rgb).rgb, color.a); | |
| [vo/opengl-hq] [ 59] #endif | |
| [vo/opengl-hq] [ 60] #ifdef USE_OSD_SRGB | |
| [vo/opengl-hq] [ 61] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [ 62] #endif | |
| [vo/opengl-hq] [ 63] | |
| [vo/opengl-hq] [ 64] texcoord = vertex_texcoord; | |
| [vo/opengl-hq] [ 65] } | |
| [vo/opengl-hq] [ 66] | |
| [vo/opengl-hq] fragment shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] uniform sampler2D texture0; | |
| [vo/opengl-hq] [ 29] | |
| [vo/opengl-hq] [ 30] in vec2 texcoord; | |
| [vo/opengl-hq] [ 31] in vec4 color; | |
| [vo/opengl-hq] [ 32] DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 33] | |
| [vo/opengl-hq] [ 34] void main() { | |
| [vo/opengl-hq] [ 35] out_color = vec4(color.rgb, color.a * texture(texture0, texcoord).r); | |
| [vo/opengl-hq] [ 36] } | |
| [vo/opengl-hq] [ 37] | |
| [vo/opengl-hq] shader link log (status=1): | |
| [vo/opengl-hq] compiling shader program 'frag_osd_rgba', header: | |
| [vo/opengl-hq] [ 1] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] vertex shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] | |
| [vo/opengl-hq] [ 29] #if __VERSION__ < 130 | |
| [vo/opengl-hq] [ 30] # undef in | |
| [vo/opengl-hq] [ 31] # define in attribute | |
| [vo/opengl-hq] [ 32] # define out varying | |
| [vo/opengl-hq] [ 33] #endif | |
| [vo/opengl-hq] [ 34] | |
| [vo/opengl-hq] [ 35] uniform mat3 transform; | |
| [vo/opengl-hq] [ 36] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 37] | |
| [vo/opengl-hq] [ 38] in vec2 vertex_position; | |
| [vo/opengl-hq] [ 39] in vec4 vertex_color; | |
| [vo/opengl-hq] [ 40] out vec4 color; | |
| [vo/opengl-hq] [ 41] in vec2 vertex_texcoord; | |
| [vo/opengl-hq] [ 42] out vec2 texcoord; | |
| [vo/opengl-hq] [ 43] | |
| [vo/opengl-hq] [ 44] void main() { | |
| [vo/opengl-hq] [ 45] vec3 position = vec3(vertex_position, 1); | |
| [vo/opengl-hq] [ 46] #ifndef FIXED_SCALE | |
| [vo/opengl-hq] [ 47] position = transform * position; | |
| [vo/opengl-hq] [ 48] #endif | |
| [vo/opengl-hq] [ 49] gl_Position = vec4(position, 1); | |
| [vo/opengl-hq] [ 50] color = vertex_color; | |
| [vo/opengl-hq] [ 51] | |
| [vo/opengl-hq] [ 52] #ifdef USE_OSD_LINEAR_CONV | |
| [vo/opengl-hq] [ 53] // If no 3dlut is being used, we need to pull up to linear light for | |
| [vo/opengl-hq] [ 54] // the sRGB function. *IF* 3dlut is used, we do not. | |
| [vo/opengl-hq] [ 55] color.rgb = pow(color.rgb, vec3(1.0/0.45)); | |
| [vo/opengl-hq] [ 56] #endif | |
| [vo/opengl-hq] [ 57] #ifdef USE_OSD_3DLUT | |
| [vo/opengl-hq] [ 58] color = vec4(texture3D(lut_3d, color.rgb).rgb, color.a); | |
| [vo/opengl-hq] [ 59] #endif | |
| [vo/opengl-hq] [ 60] #ifdef USE_OSD_SRGB | |
| [vo/opengl-hq] [ 61] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [ 62] #endif | |
| [vo/opengl-hq] [ 63] | |
| [vo/opengl-hq] [ 64] texcoord = vertex_texcoord; | |
| [vo/opengl-hq] [ 65] } | |
| [vo/opengl-hq] [ 66] | |
| [vo/opengl-hq] fragment shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] uniform sampler2D texture0; | |
| [vo/opengl-hq] [ 29] | |
| [vo/opengl-hq] [ 30] in vec2 texcoord; | |
| [vo/opengl-hq] [ 31] DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 32] | |
| [vo/opengl-hq] [ 33] void main() { | |
| [vo/opengl-hq] [ 34] out_color = texture(texture0, texcoord); | |
| [vo/opengl-hq] [ 35] } | |
| [vo/opengl-hq] [ 36] | |
| [vo/opengl-hq] shader link log (status=1): | |
| [vo/opengl-hq] compiling shader program 'indirect', header: | |
| [vo/opengl-hq] [ 1] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 2] #define USE_CONV CONV_PLANAR | |
| [vo/opengl-hq] [ 3] #define USE_COLORMATRIX 1 | |
| [vo/opengl-hq] [ 4] #define SAMPLE_C sample_bilinear | |
| [vo/opengl-hq] [ 5] #define SAMPLE_L sample_bilinear | |
| [vo/opengl-hq] [ 6] #define FIXED_SCALE 1 | |
| [vo/opengl-hq] vertex shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] #define USE_CONV CONV_PLANAR | |
| [vo/opengl-hq] [ 29] #define USE_COLORMATRIX 1 | |
| [vo/opengl-hq] [ 30] #define SAMPLE_C sample_bilinear | |
| [vo/opengl-hq] [ 31] #define SAMPLE_L sample_bilinear | |
| [vo/opengl-hq] [ 32] #define FIXED_SCALE 1 | |
| [vo/opengl-hq] [ 33] | |
| [vo/opengl-hq] [ 34] #if __VERSION__ < 130 | |
| [vo/opengl-hq] [ 35] # undef in | |
| [vo/opengl-hq] [ 36] # define in attribute | |
| [vo/opengl-hq] [ 37] # define out varying | |
| [vo/opengl-hq] [ 38] #endif | |
| [vo/opengl-hq] [ 39] | |
| [vo/opengl-hq] [ 40] uniform mat3 transform; | |
| [vo/opengl-hq] [ 41] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 42] | |
| [vo/opengl-hq] [ 43] in vec2 vertex_position; | |
| [vo/opengl-hq] [ 44] in vec4 vertex_color; | |
| [vo/opengl-hq] [ 45] out vec4 color; | |
| [vo/opengl-hq] [ 46] in vec2 vertex_texcoord; | |
| [vo/opengl-hq] [ 47] out vec2 texcoord; | |
| [vo/opengl-hq] [ 48] | |
| [vo/opengl-hq] [ 49] void main() { | |
| [vo/opengl-hq] [ 50] vec3 position = vec3(vertex_position, 1); | |
| [vo/opengl-hq] [ 51] #ifndef FIXED_SCALE | |
| [vo/opengl-hq] [ 52] position = transform * position; | |
| [vo/opengl-hq] [ 53] #endif | |
| [vo/opengl-hq] [ 54] gl_Position = vec4(position, 1); | |
| [vo/opengl-hq] [ 55] color = vertex_color; | |
| [vo/opengl-hq] [ 56] | |
| [vo/opengl-hq] [ 57] #ifdef USE_OSD_LINEAR_CONV | |
| [vo/opengl-hq] [ 58] // If no 3dlut is being used, we need to pull up to linear light for | |
| [vo/opengl-hq] [ 59] // the sRGB function. *IF* 3dlut is used, we do not. | |
| [vo/opengl-hq] [ 60] color.rgb = pow(color.rgb, vec3(1.0/0.45)); | |
| [vo/opengl-hq] [ 61] #endif | |
| [vo/opengl-hq] [ 62] #ifdef USE_OSD_3DLUT | |
| [vo/opengl-hq] [ 63] color = vec4(texture3D(lut_3d, color.rgb).rgb, color.a); | |
| [vo/opengl-hq] [ 64] #endif | |
| [vo/opengl-hq] [ 65] #ifdef USE_OSD_SRGB | |
| [vo/opengl-hq] [ 66] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [ 67] #endif | |
| [vo/opengl-hq] [ 68] | |
| [vo/opengl-hq] [ 69] texcoord = vertex_texcoord; | |
| [vo/opengl-hq] [ 70] } | |
| [vo/opengl-hq] [ 71] | |
| [vo/opengl-hq] fragment shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] #define USE_CONV CONV_PLANAR | |
| [vo/opengl-hq] [ 29] #define USE_COLORMATRIX 1 | |
| [vo/opengl-hq] [ 30] #define SAMPLE_C sample_bilinear | |
| [vo/opengl-hq] [ 31] #define SAMPLE_L sample_bilinear | |
| [vo/opengl-hq] [ 32] #define FIXED_SCALE 1 | |
| [vo/opengl-hq] [ 33] uniform VIDEO_SAMPLER texture0; | |
| [vo/opengl-hq] [ 34] uniform VIDEO_SAMPLER texture1; | |
| [vo/opengl-hq] [ 35] uniform VIDEO_SAMPLER texture2; | |
| [vo/opengl-hq] [ 36] uniform VIDEO_SAMPLER texture3; | |
| [vo/opengl-hq] [ 37] uniform vec2 textures_size[4]; | |
| [vo/opengl-hq] [ 38] uniform vec2 chroma_center_offset; | |
| [vo/opengl-hq] [ 39] uniform vec2 chroma_div; | |
| [vo/opengl-hq] [ 40] uniform sampler1D lut_c_1d; | |
| [vo/opengl-hq] [ 41] uniform sampler1D lut_l_1d; | |
| [vo/opengl-hq] [ 42] uniform sampler2D lut_c_2d; | |
| [vo/opengl-hq] [ 43] uniform sampler2D lut_l_2d; | |
| [vo/opengl-hq] [ 44] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 45] uniform sampler2D dither; | |
| [vo/opengl-hq] [ 46] uniform mat4x3 colormatrix; | |
| [vo/opengl-hq] [ 47] uniform mat2 dither_trafo; | |
| [vo/opengl-hq] [ 48] uniform vec3 inv_gamma; | |
| [vo/opengl-hq] [ 49] uniform float input_gamma; | |
| [vo/opengl-hq] [ 50] uniform float conv_gamma; | |
| [vo/opengl-hq] [ 51] uniform float dither_quantization; | |
| [vo/opengl-hq] [ 52] uniform float dither_center; | |
| [vo/opengl-hq] [ 53] uniform float filter_param1; | |
| [vo/opengl-hq] [ 54] uniform vec2 dither_size; | |
| [vo/opengl-hq] [ 55] | |
| [vo/opengl-hq] [ 56] in vec2 texcoord; | |
| [vo/opengl-hq] [ 57] DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 58] | |
| [vo/opengl-hq] [ 59] #define CONV_NV12 1 | |
| [vo/opengl-hq] [ 60] #define CONV_PLANAR 2 | |
| [vo/opengl-hq] [ 61] | |
| [vo/opengl-hq] [ 62] vec4 sample_bilinear(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [ 63] return texture(tex, texcoord); | |
| [vo/opengl-hq] [ 64] } | |
| [vo/opengl-hq] [ 65] | |
| [vo/opengl-hq] [ 66] // Explanation how bicubic scaling with only 4 texel fetches is done: | |
| [vo/opengl-hq] [ 67] // http://www.mate.tue.nl/mate/pdfs/10318.pdf | |
| [vo/opengl-hq] [ 68] // 'Efficient GPU-Based Texture Interpolation using Uniform B-Splines' | |
| [vo/opengl-hq] [ 69] // Explanation why this algorithm normally always blurs, even with unit scaling: | |
| [vo/opengl-hq] [ 70] // http://bigwww.epfl.ch/preprints/ruijters1001p.pdf | |
| [vo/opengl-hq] [ 71] // 'GPU Prefilter for Accurate Cubic B-spline Interpolation' | |
| [vo/opengl-hq] [ 72] vec4 calcweights(float s) { | |
| [vo/opengl-hq] [ 73] vec4 t = vec4(-0.5, 0.1666, 0.3333, -0.3333) * s + vec4(1, 0, -0.5, 0.5); | |
| [vo/opengl-hq] [ 74] t = t * s + vec4(0, 0, -0.5, 0.5); | |
| [vo/opengl-hq] [ 75] t = t * s + vec4(-0.6666, 0, 0.8333, 0.1666); | |
| [vo/opengl-hq] [ 76] vec2 a = vec2(1, 1) / vec2(t.z, t.w); | |
| [vo/opengl-hq] [ 77] t.xy = t.xy * a + vec2(1, 1); | |
| [vo/opengl-hq] [ 78] t.x = t.x + s; | |
| [vo/opengl-hq] [ 79] t.y = t.y - s; | |
| [vo/opengl-hq] [ 80] return t; | |
| [vo/opengl-hq] [ 81] } | |
| [vo/opengl-hq] [ 82] | |
| [vo/opengl-hq] [ 83] vec4 sample_bicubic_fast(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [ 84] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [ 85] vec2 fcoord = fract(texcoord * texsize + vec2(0.5, 0.5)); | |
| [vo/opengl-hq] [ 86] vec4 parmx = calcweights(fcoord.x); | |
| [vo/opengl-hq] [ 87] vec4 parmy = calcweights(fcoord.y); | |
| [vo/opengl-hq] [ 88] vec4 cdelta; | |
| [vo/opengl-hq] [ 89] cdelta.xz = parmx.rg * vec2(-pt.x, pt.x); | |
| [vo/opengl-hq] [ 90] cdelta.yw = parmy.rg * vec2(-pt.y, pt.y); | |
| [vo/opengl-hq] [ 91] // first y-interpolation | |
| [vo/opengl-hq] [ 92] vec4 ar = texture(tex, texcoord + cdelta.xy); | |
| [vo/opengl-hq] [ 93] vec4 ag = texture(tex, texcoord + cdelta.xw); | |
| [vo/opengl-hq] [ 94] vec4 ab = mix(ag, ar, parmy.b); | |
| [vo/opengl-hq] [ 95] // second y-interpolation | |
| [vo/opengl-hq] [ 96] vec4 br = texture(tex, texcoord + cdelta.zy); | |
| [vo/opengl-hq] [ 97] vec4 bg = texture(tex, texcoord + cdelta.zw); | |
| [vo/opengl-hq] [ 98] vec4 aa = mix(bg, br, parmy.b); | |
| [vo/opengl-hq] [ 99] // x-interpolation | |
| [vo/opengl-hq] [100] return mix(aa, ab, parmx.b); | |
| [vo/opengl-hq] [101] } | |
| [vo/opengl-hq] [102] | |
| [vo/opengl-hq] [103] float[2] weights2(sampler1D lookup, float f) { | |
| [vo/opengl-hq] [104] vec4 c = texture1D(lookup, f); | |
| [vo/opengl-hq] [105] return float[2](c.r, c.g); | |
| [vo/opengl-hq] [106] } | |
| [vo/opengl-hq] [107] | |
| [vo/opengl-hq] [108] float[4] weights4(sampler1D lookup, float f) { | |
| [vo/opengl-hq] [109] vec4 c = texture1D(lookup, f); | |
| [vo/opengl-hq] [110] return float[4](c.r, c.g, c.b, c.a); | |
| [vo/opengl-hq] [111] } | |
| [vo/opengl-hq] [112] | |
| [vo/opengl-hq] [113] float[6] weights6(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [114] vec4 c1 = texture(lookup, vec2(0.25, f)); | |
| [vo/opengl-hq] [115] vec4 c2 = texture(lookup, vec2(0.75, f)); | |
| [vo/opengl-hq] [116] return float[6](c1.r, c1.g, c1.b, c2.r, c2.g, c2.b); | |
| [vo/opengl-hq] [117] } | |
| [vo/opengl-hq] [118] | |
| [vo/opengl-hq] [119] float[8] weights8(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [120] vec4 c1 = texture(lookup, vec2(0.25, f)); | |
| [vo/opengl-hq] [121] vec4 c2 = texture(lookup, vec2(0.75, f)); | |
| [vo/opengl-hq] [122] return float[8](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a); | |
| [vo/opengl-hq] [123] } | |
| [vo/opengl-hq] [124] | |
| [vo/opengl-hq] [125] float[12] weights12(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [126] vec4 c1 = texture(lookup, vec2(1.0/6.0, f)); | |
| [vo/opengl-hq] [127] vec4 c2 = texture(lookup, vec2(0.5, f)); | |
| [vo/opengl-hq] [128] vec4 c3 = texture(lookup, vec2(5.0/6.0, f)); | |
| [vo/opengl-hq] [129] return float[12](c1.r, c1.g, c1.b, c1.a, | |
| [vo/opengl-hq] [130] c2.r, c2.g, c2.b, c2.a, | |
| [vo/opengl-hq] [131] c3.r, c3.g, c3.b, c3.a); | |
| [vo/opengl-hq] [132] } | |
| [vo/opengl-hq] [133] | |
| [vo/opengl-hq] [134] float[16] weights16(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [135] vec4 c1 = texture(lookup, vec2(0.125, f)); | |
| [vo/opengl-hq] [136] vec4 c2 = texture(lookup, vec2(0.375, f)); | |
| [vo/opengl-hq] [137] vec4 c3 = texture(lookup, vec2(0.625, f)); | |
| [vo/opengl-hq] [138] vec4 c4 = texture(lookup, vec2(0.875, f)); | |
| [vo/opengl-hq] [139] return float[16](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a, | |
| [vo/opengl-hq] [140] c3.r, c3.g, c3.b, c3.a, c4.r, c4.g, c4.b, c4.a); | |
| [vo/opengl-hq] [141] } | |
| [vo/opengl-hq] [142] | |
| [vo/opengl-hq] [143] #define CONVOLUTION_SEP_N(NAME, N) \ | |
| [vo/opengl-hq] [144] vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float weights[N]) {\ | |
| [vo/opengl-hq] [145] vec4 res = vec4(0); \ | |
| [vo/opengl-hq] [146] for (int n = 0; n < N; n++) { \ | |
| [vo/opengl-hq] [147] res += weights[n] * texture(tex, texcoord + pt * n); \ | |
| [vo/opengl-hq] [148] } \ | |
| [vo/opengl-hq] [149] return res; \ | |
| [vo/opengl-hq] [150] } | |
| [vo/opengl-hq] [151] | |
| [vo/opengl-hq] [152] CONVOLUTION_SEP_N(convolution_sep2, 2) | |
| [vo/opengl-hq] [153] CONVOLUTION_SEP_N(convolution_sep4, 4) | |
| [vo/opengl-hq] [154] CONVOLUTION_SEP_N(convolution_sep6, 6) | |
| [vo/opengl-hq] [155] CONVOLUTION_SEP_N(convolution_sep8, 8) | |
| [vo/opengl-hq] [156] CONVOLUTION_SEP_N(convolution_sep12, 12) | |
| [vo/opengl-hq] [157] CONVOLUTION_SEP_N(convolution_sep16, 16) | |
| [vo/opengl-hq] [158] | |
| [vo/opengl-hq] [159] // The dir parameter is (0, 1) or (1, 0), and we expect the shader compiler to | |
| [vo/opengl-hq] [160] // remove all the redundant multiplications and additions. | |
| [vo/opengl-hq] [161] #define SAMPLE_CONVOLUTION_SEP_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC)\ | |
| [vo/opengl-hq] [162] vec4 NAME(vec2 dir, SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, \ | |
| [vo/opengl-hq] [163] vec2 texcoord) { \ | |
| [vo/opengl-hq] [164] vec2 pt = (1 / texsize) * dir; \ | |
| [vo/opengl-hq] [165] float fcoord = dot(fract(texcoord * texsize - 0.5), dir); \ | |
| [vo/opengl-hq] [166] vec2 base = texcoord - fcoord * pt; \ | |
| [vo/opengl-hq] [167] return CONV_FUNC(tex, base - pt * (N / 2 - 1), pt, \ | |
| [vo/opengl-hq] [168] WEIGHTS_FUNC(lookup, fcoord)); \ | |
| [vo/opengl-hq] [169] } | |
| [vo/opengl-hq] [170] | |
| [vo/opengl-hq] [171] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep2, 2, sampler1D, convolution_sep2, weights2) | |
| [vo/opengl-hq] [172] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep4, 4, sampler1D, convolution_sep4, weights4) | |
| [vo/opengl-hq] [173] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep6, 6, sampler2D, convolution_sep6, weights6) | |
| [vo/opengl-hq] [174] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep8, 8, sampler2D, convolution_sep8, weights8) | |
| [vo/opengl-hq] [175] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep12, 12, sampler2D, convolution_sep12, weights12) | |
| [vo/opengl-hq] [176] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep16, 16, sampler2D, convolution_sep16, weights16) | |
| [vo/opengl-hq] [177] | |
| [vo/opengl-hq] [178] | |
| [vo/opengl-hq] [179] #define CONVOLUTION_N(NAME, N) \ | |
| [vo/opengl-hq] [180] vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float taps_x[N], \ | |
| [vo/opengl-hq] [181] float taps_y[N]) { \ | |
| [vo/opengl-hq] [182] vec4 res = vec4(0); \ | |
| [vo/opengl-hq] [183] for (int y = 0; y < N; y++) { \ | |
| [vo/opengl-hq] [184] vec4 line = vec4(0); \ | |
| [vo/opengl-hq] [185] for (int x = 0; x < N; x++) \ | |
| [vo/opengl-hq] [186] line += taps_x[x] * texture(tex, texcoord + pt * vec2(x, y));\ | |
| [vo/opengl-hq] [187] res += taps_y[y] * line; \ | |
| [vo/opengl-hq] [188] } \ | |
| [vo/opengl-hq] [189] return res; \ | |
| [vo/opengl-hq] [190] } | |
| [vo/opengl-hq] [191] | |
| [vo/opengl-hq] [192] CONVOLUTION_N(convolution2, 2) | |
| [vo/opengl-hq] [193] CONVOLUTION_N(convolution4, 4) | |
| [vo/opengl-hq] [194] CONVOLUTION_N(convolution6, 6) | |
| [vo/opengl-hq] [195] CONVOLUTION_N(convolution8, 8) | |
| [vo/opengl-hq] [196] CONVOLUTION_N(convolution12, 12) | |
| [vo/opengl-hq] [197] CONVOLUTION_N(convolution16, 16) | |
| [vo/opengl-hq] [198] | |
| [vo/opengl-hq] [199] #define SAMPLE_CONVOLUTION_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC) \ | |
| [vo/opengl-hq] [200] vec4 NAME(SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) {\ | |
| [vo/opengl-hq] [201] vec2 pt = 1 / texsize; \ | |
| [vo/opengl-hq] [202] vec2 fcoord = fract(texcoord * texsize - 0.5); \ | |
| [vo/opengl-hq] [203] vec2 base = texcoord - fcoord * pt; \ | |
| [vo/opengl-hq] [204] return CONV_FUNC(tex, base - pt * (N / 2 - 1), pt, \ | |
| [vo/opengl-hq] [205] WEIGHTS_FUNC(lookup, fcoord.x), \ | |
| [vo/opengl-hq] [206] WEIGHTS_FUNC(lookup, fcoord.y)); \ | |
| [vo/opengl-hq] [207] } | |
| [vo/opengl-hq] [208] | |
| [vo/opengl-hq] [209] SAMPLE_CONVOLUTION_N(sample_convolution2, 2, sampler1D, convolution2, weights2) | |
| [vo/opengl-hq] [210] SAMPLE_CONVOLUTION_N(sample_convolution4, 4, sampler1D, convolution4, weights4) | |
| [vo/opengl-hq] [211] SAMPLE_CONVOLUTION_N(sample_convolution6, 6, sampler2D, convolution6, weights6) | |
| [vo/opengl-hq] [212] SAMPLE_CONVOLUTION_N(sample_convolution8, 8, sampler2D, convolution8, weights8) | |
| [vo/opengl-hq] [213] SAMPLE_CONVOLUTION_N(sample_convolution12, 12, sampler2D, convolution12, weights12) | |
| [vo/opengl-hq] [214] SAMPLE_CONVOLUTION_N(sample_convolution16, 16, sampler2D, convolution16, weights16) | |
| [vo/opengl-hq] [215] | |
| [vo/opengl-hq] [216] | |
| [vo/opengl-hq] [217] // Unsharp masking | |
| [vo/opengl-hq] [218] vec4 sample_sharpen3(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [219] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [220] vec2 st = pt * 0.5; | |
| [vo/opengl-hq] [221] vec4 p = texture(tex, texcoord); | |
| [vo/opengl-hq] [222] vec4 sum = texture(tex, texcoord + st * vec2(+1, +1)) | |
| [vo/opengl-hq] [223] + texture(tex, texcoord + st * vec2(+1, -1)) | |
| [vo/opengl-hq] [224] + texture(tex, texcoord + st * vec2(-1, +1)) | |
| [vo/opengl-hq] [225] + texture(tex, texcoord + st * vec2(-1, -1)); | |
| [vo/opengl-hq] [226] return p + (p - 0.25 * sum) * filter_param1; | |
| [vo/opengl-hq] [227] } | |
| [vo/opengl-hq] [228] | |
| [vo/opengl-hq] [229] vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [230] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [231] vec2 st1 = pt * 1.2; | |
| [vo/opengl-hq] [232] vec4 p = texture(tex, texcoord); | |
| [vo/opengl-hq] [233] vec4 sum1 = texture(tex, texcoord + st1 * vec2(+1, +1)) | |
| [vo/opengl-hq] [234] + texture(tex, texcoord + st1 * vec2(+1, -1)) | |
| [vo/opengl-hq] [235] + texture(tex, texcoord + st1 * vec2(-1, +1)) | |
| [vo/opengl-hq] [236] + texture(tex, texcoord + st1 * vec2(-1, -1)); | |
| [vo/opengl-hq] [237] vec2 st2 = pt * 1.5; | |
| [vo/opengl-hq] [238] vec4 sum2 = texture(tex, texcoord + st2 * vec2(+1, 0)) | |
| [vo/opengl-hq] [239] + texture(tex, texcoord + st2 * vec2( 0, +1)) | |
| [vo/opengl-hq] [240] + texture(tex, texcoord + st2 * vec2(-1, 0)) | |
| [vo/opengl-hq] [241] + texture(tex, texcoord + st2 * vec2( 0, -1)); | |
| [vo/opengl-hq] [242] vec4 t = p * 0.859375 + sum2 * -0.1171875 + sum1 * -0.09765625; | |
| [vo/opengl-hq] [243] return p + t * filter_param1; | |
| [vo/opengl-hq] [244] } | |
| [vo/opengl-hq] [245] | |
| [vo/opengl-hq] [246] void main() { | |
| [vo/opengl-hq] [247] vec2 chr_texcoord = texcoord; | |
| [vo/opengl-hq] [248] #ifdef USE_RECTANGLE | |
| [vo/opengl-hq] [249] chr_texcoord = chr_texcoord * chroma_div; | |
| [vo/opengl-hq] [250] #else | |
| [vo/opengl-hq] [251] // Texture coordinates are [0,1], and chroma plane coordinates are | |
| [vo/opengl-hq] [252] // magically rescaled. | |
| [vo/opengl-hq] [253] #endif | |
| [vo/opengl-hq] [254] chr_texcoord = chr_texcoord + chroma_center_offset; | |
| [vo/opengl-hq] [255] #ifndef USE_CONV | |
| [vo/opengl-hq] [256] #define USE_CONV 0 | |
| [vo/opengl-hq] [257] #endif | |
| [vo/opengl-hq] [258] #if USE_CONV == CONV_PLANAR | |
| [vo/opengl-hq] [259] vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, | |
| [vo/opengl-hq] [260] SAMPLE_C(texture1, textures_size[1], chr_texcoord).r, | |
| [vo/opengl-hq] [261] SAMPLE_C(texture2, textures_size[2], chr_texcoord).r, | |
| [vo/opengl-hq] [262] 1.0); | |
| [vo/opengl-hq] [263] #elif USE_CONV == CONV_NV12 | |
| [vo/opengl-hq] [264] vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, | |
| [vo/opengl-hq] [265] SAMPLE_C(texture1, textures_size[1], chr_texcoord).rg, | |
| [vo/opengl-hq] [266] 1.0); | |
| [vo/opengl-hq] [267] #else | |
| [vo/opengl-hq] [268] vec4 acolor = SAMPLE_L(texture0, textures_size[0], texcoord); | |
| [vo/opengl-hq] [269] #endif | |
| [vo/opengl-hq] [270] #ifdef USE_ALPHA_PLANE | |
| [vo/opengl-hq] [271] acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).r; | |
| [vo/opengl-hq] [272] #endif | |
| [vo/opengl-hq] [273] #ifdef USE_COLOR_SWIZZLE | |
| [vo/opengl-hq] [274] acolor = acolor. USE_COLOR_SWIZZLE ; | |
| [vo/opengl-hq] [275] #endif | |
| [vo/opengl-hq] [276] vec3 color = acolor.rgb; | |
| [vo/opengl-hq] [277] float alpha = acolor.a; | |
| [vo/opengl-hq] [278] #ifdef USE_YGRAY | |
| [vo/opengl-hq] [279] // NOTE: actually slightly wrong for 16 bit input video, and completely | |
| [vo/opengl-hq] [280] // wrong for 9/10 bit input | |
| [vo/opengl-hq] [281] color.gb = vec2(128.0/255.0); | |
| [vo/opengl-hq] [282] #endif | |
| [vo/opengl-hq] [283] #ifdef USE_INPUT_GAMMA | |
| [vo/opengl-hq] [284] color = pow(color, vec3(input_gamma)); | |
| [vo/opengl-hq] [285] #endif | |
| [vo/opengl-hq] [286] #ifdef USE_COLORMATRIX | |
| [vo/opengl-hq] [287] color = mat3(colormatrix) * color + colormatrix[3]; | |
| [vo/opengl-hq] [288] color = clamp(color, 0, 1); | |
| [vo/opengl-hq] [289] #endif | |
| [vo/opengl-hq] [290] #ifdef USE_CONV_GAMMA | |
| [vo/opengl-hq] [291] color = pow(color, vec3(conv_gamma)); | |
| [vo/opengl-hq] [292] #endif | |
| [vo/opengl-hq] [293] #ifdef USE_LINEAR_CONV_INV | |
| [vo/opengl-hq] [294] // Convert from linear RGB to gamma RGB before putting it through the 3D-LUT | |
| [vo/opengl-hq] [295] // in the final stage. | |
| [vo/opengl-hq] [296] color = pow(color, vec3(0.45)); | |
| [vo/opengl-hq] [297] #endif | |
| [vo/opengl-hq] [298] #ifdef USE_GAMMA_POW | |
| [vo/opengl-hq] [299] color = pow(color, inv_gamma); | |
| [vo/opengl-hq] [300] #endif | |
| [vo/opengl-hq] [301] #ifdef USE_3DLUT | |
| [vo/opengl-hq] [302] color = texture3D(lut_3d, color).rgb; | |
| [vo/opengl-hq] [303] #endif | |
| [vo/opengl-hq] [304] #ifdef USE_SRGB | |
| [vo/opengl-hq] [305] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [306] #endif | |
| [vo/opengl-hq] [307] #ifdef USE_DITHER | |
| [vo/opengl-hq] [308] vec2 dither_pos = gl_FragCoord.xy / dither_size; | |
| [vo/opengl-hq] [309] #ifdef USE_TEMPORAL_DITHER | |
| [vo/opengl-hq] [310] dither_pos = dither_trafo * dither_pos; | |
| [vo/opengl-hq] [311] #endif | |
| [vo/opengl-hq] [312] float dither_value = texture(dither, dither_pos).r; | |
| [vo/opengl-hq] [313] color = floor(color * dither_quantization + dither_value + dither_center) / | |
| [vo/opengl-hq] [314] dither_quantization; | |
| [vo/opengl-hq] [315] #endif | |
| [vo/opengl-hq] [316] #ifdef USE_ALPHA_BLEND | |
| [vo/opengl-hq] [317] color = color * alpha; | |
| [vo/opengl-hq] [318] #endif | |
| [vo/opengl-hq] [319] #ifdef USE_ALPHA | |
| [vo/opengl-hq] [320] out_color = vec4(color, alpha); | |
| [vo/opengl-hq] [321] #else | |
| [vo/opengl-hq] [322] out_color = vec4(color, 1.0); | |
| [vo/opengl-hq] [323] #endif | |
| [vo/opengl-hq] [324] } | |
| [vo/opengl-hq] shader link log (status=1): | |
| [vo/opengl-hq] compiling shader program 'scale_sep', header: | |
| [vo/opengl-hq] [ 1] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 2] #define FIXED_SCALE 1 | |
| [vo/opengl-hq] [ 3] #define SAMPLE_L(p0, p1, p2) sample_convolution_sep4(vec2(0, 1), lut_l_1d, p0, p1, p2) | |
| [vo/opengl-hq] vertex shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] #define FIXED_SCALE 1 | |
| [vo/opengl-hq] [ 29] #define SAMPLE_L(p0, p1, p2) sample_convolution_sep4(vec2(0, 1), lut_l_1d, p0, p1, p2) | |
| [vo/opengl-hq] [ 30] | |
| [vo/opengl-hq] [ 31] #if __VERSION__ < 130 | |
| [vo/opengl-hq] [ 32] # undef in | |
| [vo/opengl-hq] [ 33] # define in attribute | |
| [vo/opengl-hq] [ 34] # define out varying | |
| [vo/opengl-hq] [ 35] #endif | |
| [vo/opengl-hq] [ 36] | |
| [vo/opengl-hq] [ 37] uniform mat3 transform; | |
| [vo/opengl-hq] [ 38] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 39] | |
| [vo/opengl-hq] [ 40] in vec2 vertex_position; | |
| [vo/opengl-hq] [ 41] in vec4 vertex_color; | |
| [vo/opengl-hq] [ 42] out vec4 color; | |
| [vo/opengl-hq] [ 43] in vec2 vertex_texcoord; | |
| [vo/opengl-hq] [ 44] out vec2 texcoord; | |
| [vo/opengl-hq] [ 45] | |
| [vo/opengl-hq] [ 46] void main() { | |
| [vo/opengl-hq] [ 47] vec3 position = vec3(vertex_position, 1); | |
| [vo/opengl-hq] [ 48] #ifndef FIXED_SCALE | |
| [vo/opengl-hq] [ 49] position = transform * position; | |
| [vo/opengl-hq] [ 50] #endif | |
| [vo/opengl-hq] [ 51] gl_Position = vec4(position, 1); | |
| [vo/opengl-hq] [ 52] color = vertex_color; | |
| [vo/opengl-hq] [ 53] | |
| [vo/opengl-hq] [ 54] #ifdef USE_OSD_LINEAR_CONV | |
| [vo/opengl-hq] [ 55] // If no 3dlut is being used, we need to pull up to linear light for | |
| [vo/opengl-hq] [ 56] // the sRGB function. *IF* 3dlut is used, we do not. | |
| [vo/opengl-hq] [ 57] color.rgb = pow(color.rgb, vec3(1.0/0.45)); | |
| [vo/opengl-hq] [ 58] #endif | |
| [vo/opengl-hq] [ 59] #ifdef USE_OSD_3DLUT | |
| [vo/opengl-hq] [ 60] color = vec4(texture3D(lut_3d, color.rgb).rgb, color.a); | |
| [vo/opengl-hq] [ 61] #endif | |
| [vo/opengl-hq] [ 62] #ifdef USE_OSD_SRGB | |
| [vo/opengl-hq] [ 63] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [ 64] #endif | |
| [vo/opengl-hq] [ 65] | |
| [vo/opengl-hq] [ 66] texcoord = vertex_texcoord; | |
| [vo/opengl-hq] [ 67] } | |
| [vo/opengl-hq] [ 68] | |
| [vo/opengl-hq] fragment shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] #define FIXED_SCALE 1 | |
| [vo/opengl-hq] [ 29] #define SAMPLE_L(p0, p1, p2) sample_convolution_sep4(vec2(0, 1), lut_l_1d, p0, p1, p2) | |
| [vo/opengl-hq] [ 30] uniform VIDEO_SAMPLER texture0; | |
| [vo/opengl-hq] [ 31] uniform VIDEO_SAMPLER texture1; | |
| [vo/opengl-hq] [ 32] uniform VIDEO_SAMPLER texture2; | |
| [vo/opengl-hq] [ 33] uniform VIDEO_SAMPLER texture3; | |
| [vo/opengl-hq] [ 34] uniform vec2 textures_size[4]; | |
| [vo/opengl-hq] [ 35] uniform vec2 chroma_center_offset; | |
| [vo/opengl-hq] [ 36] uniform vec2 chroma_div; | |
| [vo/opengl-hq] [ 37] uniform sampler1D lut_c_1d; | |
| [vo/opengl-hq] [ 38] uniform sampler1D lut_l_1d; | |
| [vo/opengl-hq] [ 39] uniform sampler2D lut_c_2d; | |
| [vo/opengl-hq] [ 40] uniform sampler2D lut_l_2d; | |
| [vo/opengl-hq] [ 41] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 42] uniform sampler2D dither; | |
| [vo/opengl-hq] [ 43] uniform mat4x3 colormatrix; | |
| [vo/opengl-hq] [ 44] uniform mat2 dither_trafo; | |
| [vo/opengl-hq] [ 45] uniform vec3 inv_gamma; | |
| [vo/opengl-hq] [ 46] uniform float input_gamma; | |
| [vo/opengl-hq] [ 47] uniform float conv_gamma; | |
| [vo/opengl-hq] [ 48] uniform float dither_quantization; | |
| [vo/opengl-hq] [ 49] uniform float dither_center; | |
| [vo/opengl-hq] [ 50] uniform float filter_param1; | |
| [vo/opengl-hq] [ 51] uniform vec2 dither_size; | |
| [vo/opengl-hq] [ 52] | |
| [vo/opengl-hq] [ 53] in vec2 texcoord; | |
| [vo/opengl-hq] [ 54] DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 55] | |
| [vo/opengl-hq] [ 56] #define CONV_NV12 1 | |
| [vo/opengl-hq] [ 57] #define CONV_PLANAR 2 | |
| [vo/opengl-hq] [ 58] | |
| [vo/opengl-hq] [ 59] vec4 sample_bilinear(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [ 60] return texture(tex, texcoord); | |
| [vo/opengl-hq] [ 61] } | |
| [vo/opengl-hq] [ 62] | |
| [vo/opengl-hq] [ 63] // Explanation how bicubic scaling with only 4 texel fetches is done: | |
| [vo/opengl-hq] [ 64] // http://www.mate.tue.nl/mate/pdfs/10318.pdf | |
| [vo/opengl-hq] [ 65] // 'Efficient GPU-Based Texture Interpolation using Uniform B-Splines' | |
| [vo/opengl-hq] [ 66] // Explanation why this algorithm normally always blurs, even with unit scaling: | |
| [vo/opengl-hq] [ 67] // http://bigwww.epfl.ch/preprints/ruijters1001p.pdf | |
| [vo/opengl-hq] [ 68] // 'GPU Prefilter for Accurate Cubic B-spline Interpolation' | |
| [vo/opengl-hq] [ 69] vec4 calcweights(float s) { | |
| [vo/opengl-hq] [ 70] vec4 t = vec4(-0.5, 0.1666, 0.3333, -0.3333) * s + vec4(1, 0, -0.5, 0.5); | |
| [vo/opengl-hq] [ 71] t = t * s + vec4(0, 0, -0.5, 0.5); | |
| [vo/opengl-hq] [ 72] t = t * s + vec4(-0.6666, 0, 0.8333, 0.1666); | |
| [vo/opengl-hq] [ 73] vec2 a = vec2(1, 1) / vec2(t.z, t.w); | |
| [vo/opengl-hq] [ 74] t.xy = t.xy * a + vec2(1, 1); | |
| [vo/opengl-hq] [ 75] t.x = t.x + s; | |
| [vo/opengl-hq] [ 76] t.y = t.y - s; | |
| [vo/opengl-hq] [ 77] return t; | |
| [vo/opengl-hq] [ 78] } | |
| [vo/opengl-hq] [ 79] | |
| [vo/opengl-hq] [ 80] vec4 sample_bicubic_fast(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [ 81] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [ 82] vec2 fcoord = fract(texcoord * texsize + vec2(0.5, 0.5)); | |
| [vo/opengl-hq] [ 83] vec4 parmx = calcweights(fcoord.x); | |
| [vo/opengl-hq] [ 84] vec4 parmy = calcweights(fcoord.y); | |
| [vo/opengl-hq] [ 85] vec4 cdelta; | |
| [vo/opengl-hq] [ 86] cdelta.xz = parmx.rg * vec2(-pt.x, pt.x); | |
| [vo/opengl-hq] [ 87] cdelta.yw = parmy.rg * vec2(-pt.y, pt.y); | |
| [vo/opengl-hq] [ 88] // first y-interpolation | |
| [vo/opengl-hq] [ 89] vec4 ar = texture(tex, texcoord + cdelta.xy); | |
| [vo/opengl-hq] [ 90] vec4 ag = texture(tex, texcoord + cdelta.xw); | |
| [vo/opengl-hq] [ 91] vec4 ab = mix(ag, ar, parmy.b); | |
| [vo/opengl-hq] [ 92] // second y-interpolation | |
| [vo/opengl-hq] [ 93] vec4 br = texture(tex, texcoord + cdelta.zy); | |
| [vo/opengl-hq] [ 94] vec4 bg = texture(tex, texcoord + cdelta.zw); | |
| [vo/opengl-hq] [ 95] vec4 aa = mix(bg, br, parmy.b); | |
| [vo/opengl-hq] [ 96] // x-interpolation | |
| [vo/opengl-hq] [ 97] return mix(aa, ab, parmx.b); | |
| [vo/opengl-hq] [ 98] } | |
| [vo/opengl-hq] [ 99] | |
| [vo/opengl-hq] [100] float[2] weights2(sampler1D lookup, float f) { | |
| [vo/opengl-hq] [101] vec4 c = texture1D(lookup, f); | |
| [vo/opengl-hq] [102] return float[2](c.r, c.g); | |
| [vo/opengl-hq] [103] } | |
| [vo/opengl-hq] [104] | |
| [vo/opengl-hq] [105] float[4] weights4(sampler1D lookup, float f) { | |
| [vo/opengl-hq] [106] vec4 c = texture1D(lookup, f); | |
| [vo/opengl-hq] [107] return float[4](c.r, c.g, c.b, c.a); | |
| [vo/opengl-hq] [108] } | |
| [vo/opengl-hq] [109] | |
| [vo/opengl-hq] [110] float[6] weights6(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [111] vec4 c1 = texture(lookup, vec2(0.25, f)); | |
| [vo/opengl-hq] [112] vec4 c2 = texture(lookup, vec2(0.75, f)); | |
| [vo/opengl-hq] [113] return float[6](c1.r, c1.g, c1.b, c2.r, c2.g, c2.b); | |
| [vo/opengl-hq] [114] } | |
| [vo/opengl-hq] [115] | |
| [vo/opengl-hq] [116] float[8] weights8(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [117] vec4 c1 = texture(lookup, vec2(0.25, f)); | |
| [vo/opengl-hq] [118] vec4 c2 = texture(lookup, vec2(0.75, f)); | |
| [vo/opengl-hq] [119] return float[8](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a); | |
| [vo/opengl-hq] [120] } | |
| [vo/opengl-hq] [121] | |
| [vo/opengl-hq] [122] float[12] weights12(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [123] vec4 c1 = texture(lookup, vec2(1.0/6.0, f)); | |
| [vo/opengl-hq] [124] vec4 c2 = texture(lookup, vec2(0.5, f)); | |
| [vo/opengl-hq] [125] vec4 c3 = texture(lookup, vec2(5.0/6.0, f)); | |
| [vo/opengl-hq] [126] return float[12](c1.r, c1.g, c1.b, c1.a, | |
| [vo/opengl-hq] [127] c2.r, c2.g, c2.b, c2.a, | |
| [vo/opengl-hq] [128] c3.r, c3.g, c3.b, c3.a); | |
| [vo/opengl-hq] [129] } | |
| [vo/opengl-hq] [130] | |
| [vo/opengl-hq] [131] float[16] weights16(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [132] vec4 c1 = texture(lookup, vec2(0.125, f)); | |
| [vo/opengl-hq] [133] vec4 c2 = texture(lookup, vec2(0.375, f)); | |
| [vo/opengl-hq] [134] vec4 c3 = texture(lookup, vec2(0.625, f)); | |
| [vo/opengl-hq] [135] vec4 c4 = texture(lookup, vec2(0.875, f)); | |
| [vo/opengl-hq] [136] return float[16](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a, | |
| [vo/opengl-hq] [137] c3.r, c3.g, c3.b, c3.a, c4.r, c4.g, c4.b, c4.a); | |
| [vo/opengl-hq] [138] } | |
| [vo/opengl-hq] [139] | |
| [vo/opengl-hq] [140] #define CONVOLUTION_SEP_N(NAME, N) \ | |
| [vo/opengl-hq] [141] vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float weights[N]) {\ | |
| [vo/opengl-hq] [142] vec4 res = vec4(0); \ | |
| [vo/opengl-hq] [143] for (int n = 0; n < N; n++) { \ | |
| [vo/opengl-hq] [144] res += weights[n] * texture(tex, texcoord + pt * n); \ | |
| [vo/opengl-hq] [145] } \ | |
| [vo/opengl-hq] [146] return res; \ | |
| [vo/opengl-hq] [147] } | |
| [vo/opengl-hq] [148] | |
| [vo/opengl-hq] [149] CONVOLUTION_SEP_N(convolution_sep2, 2) | |
| [vo/opengl-hq] [150] CONVOLUTION_SEP_N(convolution_sep4, 4) | |
| [vo/opengl-hq] [151] CONVOLUTION_SEP_N(convolution_sep6, 6) | |
| [vo/opengl-hq] [152] CONVOLUTION_SEP_N(convolution_sep8, 8) | |
| [vo/opengl-hq] [153] CONVOLUTION_SEP_N(convolution_sep12, 12) | |
| [vo/opengl-hq] [154] CONVOLUTION_SEP_N(convolution_sep16, 16) | |
| [vo/opengl-hq] [155] | |
| [vo/opengl-hq] [156] // The dir parameter is (0, 1) or (1, 0), and we expect the shader compiler to | |
| [vo/opengl-hq] [157] // remove all the redundant multiplications and additions. | |
| [vo/opengl-hq] [158] #define SAMPLE_CONVOLUTION_SEP_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC)\ | |
| [vo/opengl-hq] [159] vec4 NAME(vec2 dir, SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, \ | |
| [vo/opengl-hq] [160] vec2 texcoord) { \ | |
| [vo/opengl-hq] [161] vec2 pt = (1 / texsize) * dir; \ | |
| [vo/opengl-hq] [162] float fcoord = dot(fract(texcoord * texsize - 0.5), dir); \ | |
| [vo/opengl-hq] [163] vec2 base = texcoord - fcoord * pt; \ | |
| [vo/opengl-hq] [164] return CONV_FUNC(tex, base - pt * (N / 2 - 1), pt, \ | |
| [vo/opengl-hq] [165] WEIGHTS_FUNC(lookup, fcoord)); \ | |
| [vo/opengl-hq] [166] } | |
| [vo/opengl-hq] [167] | |
| [vo/opengl-hq] [168] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep2, 2, sampler1D, convolution_sep2, weights2) | |
| [vo/opengl-hq] [169] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep4, 4, sampler1D, convolution_sep4, weights4) | |
| [vo/opengl-hq] [170] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep6, 6, sampler2D, convolution_sep6, weights6) | |
| [vo/opengl-hq] [171] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep8, 8, sampler2D, convolution_sep8, weights8) | |
| [vo/opengl-hq] [172] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep12, 12, sampler2D, convolution_sep12, weights12) | |
| [vo/opengl-hq] [173] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep16, 16, sampler2D, convolution_sep16, weights16) | |
| [vo/opengl-hq] [174] | |
| [vo/opengl-hq] [175] | |
| [vo/opengl-hq] [176] #define CONVOLUTION_N(NAME, N) \ | |
| [vo/opengl-hq] [177] vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float taps_x[N], \ | |
| [vo/opengl-hq] [178] float taps_y[N]) { \ | |
| [vo/opengl-hq] [179] vec4 res = vec4(0); \ | |
| [vo/opengl-hq] [180] for (int y = 0; y < N; y++) { \ | |
| [vo/opengl-hq] [181] vec4 line = vec4(0); \ | |
| [vo/opengl-hq] [182] for (int x = 0; x < N; x++) \ | |
| [vo/opengl-hq] [183] line += taps_x[x] * texture(tex, texcoord + pt * vec2(x, y));\ | |
| [vo/opengl-hq] [184] res += taps_y[y] * line; \ | |
| [vo/opengl-hq] [185] } \ | |
| [vo/opengl-hq] [186] return res; \ | |
| [vo/opengl-hq] [187] } | |
| [vo/opengl-hq] [188] | |
| [vo/opengl-hq] [189] CONVOLUTION_N(convolution2, 2) | |
| [vo/opengl-hq] [190] CONVOLUTION_N(convolution4, 4) | |
| [vo/opengl-hq] [191] CONVOLUTION_N(convolution6, 6) | |
| [vo/opengl-hq] [192] CONVOLUTION_N(convolution8, 8) | |
| [vo/opengl-hq] [193] CONVOLUTION_N(convolution12, 12) | |
| [vo/opengl-hq] [194] CONVOLUTION_N(convolution16, 16) | |
| [vo/opengl-hq] [195] | |
| [vo/opengl-hq] [196] #define SAMPLE_CONVOLUTION_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC) \ | |
| [vo/opengl-hq] [197] vec4 NAME(SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) {\ | |
| [vo/opengl-hq] [198] vec2 pt = 1 / texsize; \ | |
| [vo/opengl-hq] [199] vec2 fcoord = fract(texcoord * texsize - 0.5); \ | |
| [vo/opengl-hq] [200] vec2 base = texcoord - fcoord * pt; \ | |
| [vo/opengl-hq] [201] return CONV_FUNC(tex, base - pt * (N / 2 - 1), pt, \ | |
| [vo/opengl-hq] [202] WEIGHTS_FUNC(lookup, fcoord.x), \ | |
| [vo/opengl-hq] [203] WEIGHTS_FUNC(lookup, fcoord.y)); \ | |
| [vo/opengl-hq] [204] } | |
| [vo/opengl-hq] [205] | |
| [vo/opengl-hq] [206] SAMPLE_CONVOLUTION_N(sample_convolution2, 2, sampler1D, convolution2, weights2) | |
| [vo/opengl-hq] [207] SAMPLE_CONVOLUTION_N(sample_convolution4, 4, sampler1D, convolution4, weights4) | |
| [vo/opengl-hq] [208] SAMPLE_CONVOLUTION_N(sample_convolution6, 6, sampler2D, convolution6, weights6) | |
| [vo/opengl-hq] [209] SAMPLE_CONVOLUTION_N(sample_convolution8, 8, sampler2D, convolution8, weights8) | |
| [vo/opengl-hq] [210] SAMPLE_CONVOLUTION_N(sample_convolution12, 12, sampler2D, convolution12, weights12) | |
| [vo/opengl-hq] [211] SAMPLE_CONVOLUTION_N(sample_convolution16, 16, sampler2D, convolution16, weights16) | |
| [vo/opengl-hq] [212] | |
| [vo/opengl-hq] [213] | |
| [vo/opengl-hq] [214] // Unsharp masking | |
| [vo/opengl-hq] [215] vec4 sample_sharpen3(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [216] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [217] vec2 st = pt * 0.5; | |
| [vo/opengl-hq] [218] vec4 p = texture(tex, texcoord); | |
| [vo/opengl-hq] [219] vec4 sum = texture(tex, texcoord + st * vec2(+1, +1)) | |
| [vo/opengl-hq] [220] + texture(tex, texcoord + st * vec2(+1, -1)) | |
| [vo/opengl-hq] [221] + texture(tex, texcoord + st * vec2(-1, +1)) | |
| [vo/opengl-hq] [222] + texture(tex, texcoord + st * vec2(-1, -1)); | |
| [vo/opengl-hq] [223] return p + (p - 0.25 * sum) * filter_param1; | |
| [vo/opengl-hq] [224] } | |
| [vo/opengl-hq] [225] | |
| [vo/opengl-hq] [226] vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [227] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [228] vec2 st1 = pt * 1.2; | |
| [vo/opengl-hq] [229] vec4 p = texture(tex, texcoord); | |
| [vo/opengl-hq] [230] vec4 sum1 = texture(tex, texcoord + st1 * vec2(+1, +1)) | |
| [vo/opengl-hq] [231] + texture(tex, texcoord + st1 * vec2(+1, -1)) | |
| [vo/opengl-hq] [232] + texture(tex, texcoord + st1 * vec2(-1, +1)) | |
| [vo/opengl-hq] [233] + texture(tex, texcoord + st1 * vec2(-1, -1)); | |
| [vo/opengl-hq] [234] vec2 st2 = pt * 1.5; | |
| [vo/opengl-hq] [235] vec4 sum2 = texture(tex, texcoord + st2 * vec2(+1, 0)) | |
| [vo/opengl-hq] [236] + texture(tex, texcoord + st2 * vec2( 0, +1)) | |
| [vo/opengl-hq] [237] + texture(tex, texcoord + st2 * vec2(-1, 0)) | |
| [vo/opengl-hq] [238] + texture(tex, texcoord + st2 * vec2( 0, -1)); | |
| [vo/opengl-hq] [239] vec4 t = p * 0.859375 + sum2 * -0.1171875 + sum1 * -0.09765625; | |
| [vo/opengl-hq] [240] return p + t * filter_param1; | |
| [vo/opengl-hq] [241] } | |
| [vo/opengl-hq] [242] | |
| [vo/opengl-hq] [243] void main() { | |
| [vo/opengl-hq] [244] vec2 chr_texcoord = texcoord; | |
| [vo/opengl-hq] [245] #ifdef USE_RECTANGLE | |
| [vo/opengl-hq] [246] chr_texcoord = chr_texcoord * chroma_div; | |
| [vo/opengl-hq] [247] #else | |
| [vo/opengl-hq] [248] // Texture coordinates are [0,1], and chroma plane coordinates are | |
| [vo/opengl-hq] [249] // magically rescaled. | |
| [vo/opengl-hq] [250] #endif | |
| [vo/opengl-hq] [251] chr_texcoord = chr_texcoord + chroma_center_offset; | |
| [vo/opengl-hq] [252] #ifndef USE_CONV | |
| [vo/opengl-hq] [253] #define USE_CONV 0 | |
| [vo/opengl-hq] [254] #endif | |
| [vo/opengl-hq] [255] #if USE_CONV == CONV_PLANAR | |
| [vo/opengl-hq] [256] vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, | |
| [vo/opengl-hq] [257] SAMPLE_C(texture1, textures_size[1], chr_texcoord).r, | |
| [vo/opengl-hq] [258] SAMPLE_C(texture2, textures_size[2], chr_texcoord).r, | |
| [vo/opengl-hq] [259] 1.0); | |
| [vo/opengl-hq] [260] #elif USE_CONV == CONV_NV12 | |
| [vo/opengl-hq] [261] vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, | |
| [vo/opengl-hq] [262] SAMPLE_C(texture1, textures_size[1], chr_texcoord).rg, | |
| [vo/opengl-hq] [263] 1.0); | |
| [vo/opengl-hq] [264] #else | |
| [vo/opengl-hq] [265] vec4 acolor = SAMPLE_L(texture0, textures_size[0], texcoord); | |
| [vo/opengl-hq] [266] #endif | |
| [vo/opengl-hq] [267] #ifdef USE_ALPHA_PLANE | |
| [vo/opengl-hq] [268] acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).r; | |
| [vo/opengl-hq] [269] #endif | |
| [vo/opengl-hq] [270] #ifdef USE_COLOR_SWIZZLE | |
| [vo/opengl-hq] [271] acolor = acolor. USE_COLOR_SWIZZLE ; | |
| [vo/opengl-hq] [272] #endif | |
| [vo/opengl-hq] [273] vec3 color = acolor.rgb; | |
| [vo/opengl-hq] [274] float alpha = acolor.a; | |
| [vo/opengl-hq] [275] #ifdef USE_YGRAY | |
| [vo/opengl-hq] [276] // NOTE: actually slightly wrong for 16 bit input video, and completely | |
| [vo/opengl-hq] [277] // wrong for 9/10 bit input | |
| [vo/opengl-hq] [278] color.gb = vec2(128.0/255.0); | |
| [vo/opengl-hq] [279] #endif | |
| [vo/opengl-hq] [280] #ifdef USE_INPUT_GAMMA | |
| [vo/opengl-hq] [281] color = pow(color, vec3(input_gamma)); | |
| [vo/opengl-hq] [282] #endif | |
| [vo/opengl-hq] [283] #ifdef USE_COLORMATRIX | |
| [vo/opengl-hq] [284] color = mat3(colormatrix) * color + colormatrix[3]; | |
| [vo/opengl-hq] [285] color = clamp(color, 0, 1); | |
| [vo/opengl-hq] [286] #endif | |
| [vo/opengl-hq] [287] #ifdef USE_CONV_GAMMA | |
| [vo/opengl-hq] [288] color = pow(color, vec3(conv_gamma)); | |
| [vo/opengl-hq] [289] #endif | |
| [vo/opengl-hq] [290] #ifdef USE_LINEAR_CONV_INV | |
| [vo/opengl-hq] [291] // Convert from linear RGB to gamma RGB before putting it through the 3D-LUT | |
| [vo/opengl-hq] [292] // in the final stage. | |
| [vo/opengl-hq] [293] color = pow(color, vec3(0.45)); | |
| [vo/opengl-hq] [294] #endif | |
| [vo/opengl-hq] [295] #ifdef USE_GAMMA_POW | |
| [vo/opengl-hq] [296] color = pow(color, inv_gamma); | |
| [vo/opengl-hq] [297] #endif | |
| [vo/opengl-hq] [298] #ifdef USE_3DLUT | |
| [vo/opengl-hq] [299] color = texture3D(lut_3d, color).rgb; | |
| [vo/opengl-hq] [300] #endif | |
| [vo/opengl-hq] [301] #ifdef USE_SRGB | |
| [vo/opengl-hq] [302] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [303] #endif | |
| [vo/opengl-hq] [304] #ifdef USE_DITHER | |
| [vo/opengl-hq] [305] vec2 dither_pos = gl_FragCoord.xy / dither_size; | |
| [vo/opengl-hq] [306] #ifdef USE_TEMPORAL_DITHER | |
| [vo/opengl-hq] [307] dither_pos = dither_trafo * dither_pos; | |
| [vo/opengl-hq] [308] #endif | |
| [vo/opengl-hq] [309] float dither_value = texture(dither, dither_pos).r; | |
| [vo/opengl-hq] [310] color = floor(color * dither_quantization + dither_value + dither_center) / | |
| [vo/opengl-hq] [311] dither_quantization; | |
| [vo/opengl-hq] [312] #endif | |
| [vo/opengl-hq] [313] #ifdef USE_ALPHA_BLEND | |
| [vo/opengl-hq] [314] color = color * alpha; | |
| [vo/opengl-hq] [315] #endif | |
| [vo/opengl-hq] [316] #ifdef USE_ALPHA | |
| [vo/opengl-hq] [317] out_color = vec4(color, alpha); | |
| [vo/opengl-hq] [318] #else | |
| [vo/opengl-hq] [319] out_color = vec4(color, 1.0); | |
| [vo/opengl-hq] [320] #endif | |
| [vo/opengl-hq] [321] } | |
| [vo/opengl-hq] shader link log (status=1): | |
| [vo/opengl-hq] compiling shader program 'final', header: | |
| [vo/opengl-hq] [ 1] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 2] #define USE_DITHER 1 | |
| [vo/opengl-hq] [ 3] #define SAMPLE_L(p0, p1, p2) sample_convolution_sep4(vec2(1, 0), lut_l_1d, p0, p1, p2) | |
| [vo/opengl-hq] vertex shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] #define USE_DITHER 1 | |
| [vo/opengl-hq] [ 29] #define SAMPLE_L(p0, p1, p2) sample_convolution_sep4(vec2(1, 0), lut_l_1d, p0, p1, p2) | |
| [vo/opengl-hq] [ 30] | |
| [vo/opengl-hq] [ 31] #if __VERSION__ < 130 | |
| [vo/opengl-hq] [ 32] # undef in | |
| [vo/opengl-hq] [ 33] # define in attribute | |
| [vo/opengl-hq] [ 34] # define out varying | |
| [vo/opengl-hq] [ 35] #endif | |
| [vo/opengl-hq] [ 36] | |
| [vo/opengl-hq] [ 37] uniform mat3 transform; | |
| [vo/opengl-hq] [ 38] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 39] | |
| [vo/opengl-hq] [ 40] in vec2 vertex_position; | |
| [vo/opengl-hq] [ 41] in vec4 vertex_color; | |
| [vo/opengl-hq] [ 42] out vec4 color; | |
| [vo/opengl-hq] [ 43] in vec2 vertex_texcoord; | |
| [vo/opengl-hq] [ 44] out vec2 texcoord; | |
| [vo/opengl-hq] [ 45] | |
| [vo/opengl-hq] [ 46] void main() { | |
| [vo/opengl-hq] [ 47] vec3 position = vec3(vertex_position, 1); | |
| [vo/opengl-hq] [ 48] #ifndef FIXED_SCALE | |
| [vo/opengl-hq] [ 49] position = transform * position; | |
| [vo/opengl-hq] [ 50] #endif | |
| [vo/opengl-hq] [ 51] gl_Position = vec4(position, 1); | |
| [vo/opengl-hq] [ 52] color = vertex_color; | |
| [vo/opengl-hq] [ 53] | |
| [vo/opengl-hq] [ 54] #ifdef USE_OSD_LINEAR_CONV | |
| [vo/opengl-hq] [ 55] // If no 3dlut is being used, we need to pull up to linear light for | |
| [vo/opengl-hq] [ 56] // the sRGB function. *IF* 3dlut is used, we do not. | |
| [vo/opengl-hq] [ 57] color.rgb = pow(color.rgb, vec3(1.0/0.45)); | |
| [vo/opengl-hq] [ 58] #endif | |
| [vo/opengl-hq] [ 59] #ifdef USE_OSD_3DLUT | |
| [vo/opengl-hq] [ 60] color = vec4(texture3D(lut_3d, color.rgb).rgb, color.a); | |
| [vo/opengl-hq] [ 61] #endif | |
| [vo/opengl-hq] [ 62] #ifdef USE_OSD_SRGB | |
| [vo/opengl-hq] [ 63] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [ 64] #endif | |
| [vo/opengl-hq] [ 65] | |
| [vo/opengl-hq] [ 66] texcoord = vertex_texcoord; | |
| [vo/opengl-hq] [ 67] } | |
| [vo/opengl-hq] [ 68] | |
| [vo/opengl-hq] fragment shader source: | |
| [vo/opengl-hq] [ 1] #version 130 | |
| [vo/opengl-hq] [ 2] | |
| [vo/opengl-hq] [ 3] // GLSL 1.20 compatibility layer | |
| [vo/opengl-hq] [ 4] // texture() should be assumed to always map to texture2D() | |
| [vo/opengl-hq] [ 5] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 6] # define texture1D texture | |
| [vo/opengl-hq] [ 7] # define texture3D texture | |
| [vo/opengl-hq] [ 8] # define DECLARE_FRAGPARMS \ | |
| [vo/opengl-hq] [ 9] out vec4 out_color; | |
| [vo/opengl-hq] [ 10] #else | |
| [vo/opengl-hq] [ 11] # define texture texture2D | |
| [vo/opengl-hq] [ 12] # define DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 13] # define out_color gl_FragColor | |
| [vo/opengl-hq] [ 14] # define in varying | |
| [vo/opengl-hq] [ 15] #endif | |
| [vo/opengl-hq] [ 16] | |
| [vo/opengl-hq] [ 17] // Earlier GLSL doesn't support mix() with bvec | |
| [vo/opengl-hq] [ 18] #if __VERSION__ >= 130 | |
| [vo/opengl-hq] [ 19] vec3 srgb_compand(vec3 v) | |
| [vo/opengl-hq] [ 20] { | |
| [vo/opengl-hq] [ 21] return mix(1.055 * pow(v, vec3(1.0/2.4)) - vec3(0.055), v * 12.92, | |
| [vo/opengl-hq] [ 22] lessThanEqual(v, vec3(0.0031308))); | |
| [vo/opengl-hq] [ 23] } | |
| [vo/opengl-hq] [ 24] #endif | |
| [vo/opengl-hq] [ 25] | |
| [vo/opengl-hq] [ 26] // -- prelude end | |
| [vo/opengl-hq] [ 27] #define VIDEO_SAMPLER sampler2D | |
| [vo/opengl-hq] [ 28] #define USE_DITHER 1 | |
| [vo/opengl-hq] [ 29] #define SAMPLE_L(p0, p1, p2) sample_convolution_sep4(vec2(1, 0), lut_l_1d, p0, p1, p2) | |
| [vo/opengl-hq] [ 30] uniform VIDEO_SAMPLER texture0; | |
| [vo/opengl-hq] [ 31] uniform VIDEO_SAMPLER texture1; | |
| [vo/opengl-hq] [ 32] uniform VIDEO_SAMPLER texture2; | |
| [vo/opengl-hq] [ 33] uniform VIDEO_SAMPLER texture3; | |
| [vo/opengl-hq] [ 34] uniform vec2 textures_size[4]; | |
| [vo/opengl-hq] [ 35] uniform vec2 chroma_center_offset; | |
| [vo/opengl-hq] [ 36] uniform vec2 chroma_div; | |
| [vo/opengl-hq] [ 37] uniform sampler1D lut_c_1d; | |
| [vo/opengl-hq] [ 38] uniform sampler1D lut_l_1d; | |
| [vo/opengl-hq] [ 39] uniform sampler2D lut_c_2d; | |
| [vo/opengl-hq] [ 40] uniform sampler2D lut_l_2d; | |
| [vo/opengl-hq] [ 41] uniform sampler3D lut_3d; | |
| [vo/opengl-hq] [ 42] uniform sampler2D dither; | |
| [vo/opengl-hq] [ 43] uniform mat4x3 colormatrix; | |
| [vo/opengl-hq] [ 44] uniform mat2 dither_trafo; | |
| [vo/opengl-hq] [ 45] uniform vec3 inv_gamma; | |
| [vo/opengl-hq] [ 46] uniform float input_gamma; | |
| [vo/opengl-hq] [ 47] uniform float conv_gamma; | |
| [vo/opengl-hq] [ 48] uniform float dither_quantization; | |
| [vo/opengl-hq] [ 49] uniform float dither_center; | |
| [vo/opengl-hq] [ 50] uniform float filter_param1; | |
| [vo/opengl-hq] [ 51] uniform vec2 dither_size; | |
| [vo/opengl-hq] [ 52] | |
| [vo/opengl-hq] [ 53] in vec2 texcoord; | |
| [vo/opengl-hq] [ 54] DECLARE_FRAGPARMS | |
| [vo/opengl-hq] [ 55] | |
| [vo/opengl-hq] [ 56] #define CONV_NV12 1 | |
| [vo/opengl-hq] [ 57] #define CONV_PLANAR 2 | |
| [vo/opengl-hq] [ 58] | |
| [vo/opengl-hq] [ 59] vec4 sample_bilinear(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [ 60] return texture(tex, texcoord); | |
| [vo/opengl-hq] [ 61] } | |
| [vo/opengl-hq] [ 62] | |
| [vo/opengl-hq] [ 63] // Explanation how bicubic scaling with only 4 texel fetches is done: | |
| [vo/opengl-hq] [ 64] // http://www.mate.tue.nl/mate/pdfs/10318.pdf | |
| [vo/opengl-hq] [ 65] // 'Efficient GPU-Based Texture Interpolation using Uniform B-Splines' | |
| [vo/opengl-hq] [ 66] // Explanation why this algorithm normally always blurs, even with unit scaling: | |
| [vo/opengl-hq] [ 67] // http://bigwww.epfl.ch/preprints/ruijters1001p.pdf | |
| [vo/opengl-hq] [ 68] // 'GPU Prefilter for Accurate Cubic B-spline Interpolation' | |
| [vo/opengl-hq] [ 69] vec4 calcweights(float s) { | |
| [vo/opengl-hq] [ 70] vec4 t = vec4(-0.5, 0.1666, 0.3333, -0.3333) * s + vec4(1, 0, -0.5, 0.5); | |
| [vo/opengl-hq] [ 71] t = t * s + vec4(0, 0, -0.5, 0.5); | |
| [vo/opengl-hq] [ 72] t = t * s + vec4(-0.6666, 0, 0.8333, 0.1666); | |
| [vo/opengl-hq] [ 73] vec2 a = vec2(1, 1) / vec2(t.z, t.w); | |
| [vo/opengl-hq] [ 74] t.xy = t.xy * a + vec2(1, 1); | |
| [vo/opengl-hq] [ 75] t.x = t.x + s; | |
| [vo/opengl-hq] [ 76] t.y = t.y - s; | |
| [vo/opengl-hq] [ 77] return t; | |
| [vo/opengl-hq] [ 78] } | |
| [vo/opengl-hq] [ 79] | |
| [vo/opengl-hq] [ 80] vec4 sample_bicubic_fast(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [ 81] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [ 82] vec2 fcoord = fract(texcoord * texsize + vec2(0.5, 0.5)); | |
| [vo/opengl-hq] [ 83] vec4 parmx = calcweights(fcoord.x); | |
| [vo/opengl-hq] [ 84] vec4 parmy = calcweights(fcoord.y); | |
| [vo/opengl-hq] [ 85] vec4 cdelta; | |
| [vo/opengl-hq] [ 86] cdelta.xz = parmx.rg * vec2(-pt.x, pt.x); | |
| [vo/opengl-hq] [ 87] cdelta.yw = parmy.rg * vec2(-pt.y, pt.y); | |
| [vo/opengl-hq] [ 88] // first y-interpolation | |
| [vo/opengl-hq] [ 89] vec4 ar = texture(tex, texcoord + cdelta.xy); | |
| [vo/opengl-hq] [ 90] vec4 ag = texture(tex, texcoord + cdelta.xw); | |
| [vo/opengl-hq] [ 91] vec4 ab = mix(ag, ar, parmy.b); | |
| [vo/opengl-hq] [ 92] // second y-interpolation | |
| [vo/opengl-hq] [ 93] vec4 br = texture(tex, texcoord + cdelta.zy); | |
| [vo/opengl-hq] [ 94] vec4 bg = texture(tex, texcoord + cdelta.zw); | |
| [vo/opengl-hq] [ 95] vec4 aa = mix(bg, br, parmy.b); | |
| [vo/opengl-hq] [ 96] // x-interpolation | |
| [vo/opengl-hq] [ 97] return mix(aa, ab, parmx.b); | |
| [vo/opengl-hq] [ 98] } | |
| [vo/opengl-hq] [ 99] | |
| [vo/opengl-hq] [100] float[2] weights2(sampler1D lookup, float f) { | |
| [vo/opengl-hq] [101] vec4 c = texture1D(lookup, f); | |
| [vo/opengl-hq] [102] return float[2](c.r, c.g); | |
| [vo/opengl-hq] [103] } | |
| [vo/opengl-hq] [104] | |
| [vo/opengl-hq] [105] float[4] weights4(sampler1D lookup, float f) { | |
| [vo/opengl-hq] [106] vec4 c = texture1D(lookup, f); | |
| [vo/opengl-hq] [107] return float[4](c.r, c.g, c.b, c.a); | |
| [vo/opengl-hq] [108] } | |
| [vo/opengl-hq] [109] | |
| [vo/opengl-hq] [110] float[6] weights6(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [111] vec4 c1 = texture(lookup, vec2(0.25, f)); | |
| [vo/opengl-hq] [112] vec4 c2 = texture(lookup, vec2(0.75, f)); | |
| [vo/opengl-hq] [113] return float[6](c1.r, c1.g, c1.b, c2.r, c2.g, c2.b); | |
| [vo/opengl-hq] [114] } | |
| [vo/opengl-hq] [115] | |
| [vo/opengl-hq] [116] float[8] weights8(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [117] vec4 c1 = texture(lookup, vec2(0.25, f)); | |
| [vo/opengl-hq] [118] vec4 c2 = texture(lookup, vec2(0.75, f)); | |
| [vo/opengl-hq] [119] return float[8](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a); | |
| [vo/opengl-hq] [120] } | |
| [vo/opengl-hq] [121] | |
| [vo/opengl-hq] [122] float[12] weights12(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [123] vec4 c1 = texture(lookup, vec2(1.0/6.0, f)); | |
| [vo/opengl-hq] [124] vec4 c2 = texture(lookup, vec2(0.5, f)); | |
| [vo/opengl-hq] [125] vec4 c3 = texture(lookup, vec2(5.0/6.0, f)); | |
| [vo/opengl-hq] [126] return float[12](c1.r, c1.g, c1.b, c1.a, | |
| [vo/opengl-hq] [127] c2.r, c2.g, c2.b, c2.a, | |
| [vo/opengl-hq] [128] c3.r, c3.g, c3.b, c3.a); | |
| [vo/opengl-hq] [129] } | |
| [vo/opengl-hq] [130] | |
| [vo/opengl-hq] [131] float[16] weights16(sampler2D lookup, float f) { | |
| [vo/opengl-hq] [132] vec4 c1 = texture(lookup, vec2(0.125, f)); | |
| [vo/opengl-hq] [133] vec4 c2 = texture(lookup, vec2(0.375, f)); | |
| [vo/opengl-hq] [134] vec4 c3 = texture(lookup, vec2(0.625, f)); | |
| [vo/opengl-hq] [135] vec4 c4 = texture(lookup, vec2(0.875, f)); | |
| [vo/opengl-hq] [136] return float[16](c1.r, c1.g, c1.b, c1.a, c2.r, c2.g, c2.b, c2.a, | |
| [vo/opengl-hq] [137] c3.r, c3.g, c3.b, c3.a, c4.r, c4.g, c4.b, c4.a); | |
| [vo/opengl-hq] [138] } | |
| [vo/opengl-hq] [139] | |
| [vo/opengl-hq] [140] #define CONVOLUTION_SEP_N(NAME, N) \ | |
| [vo/opengl-hq] [141] vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float weights[N]) {\ | |
| [vo/opengl-hq] [142] vec4 res = vec4(0); \ | |
| [vo/opengl-hq] [143] for (int n = 0; n < N; n++) { \ | |
| [vo/opengl-hq] [144] res += weights[n] * texture(tex, texcoord + pt * n); \ | |
| [vo/opengl-hq] [145] } \ | |
| [vo/opengl-hq] [146] return res; \ | |
| [vo/opengl-hq] [147] } | |
| [vo/opengl-hq] [148] | |
| [vo/opengl-hq] [149] CONVOLUTION_SEP_N(convolution_sep2, 2) | |
| [vo/opengl-hq] [150] CONVOLUTION_SEP_N(convolution_sep4, 4) | |
| [vo/opengl-hq] [151] CONVOLUTION_SEP_N(convolution_sep6, 6) | |
| [vo/opengl-hq] [152] CONVOLUTION_SEP_N(convolution_sep8, 8) | |
| [vo/opengl-hq] [153] CONVOLUTION_SEP_N(convolution_sep12, 12) | |
| [vo/opengl-hq] [154] CONVOLUTION_SEP_N(convolution_sep16, 16) | |
| [vo/opengl-hq] [155] | |
| [vo/opengl-hq] [156] // The dir parameter is (0, 1) or (1, 0), and we expect the shader compiler to | |
| [vo/opengl-hq] [157] // remove all the redundant multiplications and additions. | |
| [vo/opengl-hq] [158] #define SAMPLE_CONVOLUTION_SEP_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC)\ | |
| [vo/opengl-hq] [159] vec4 NAME(vec2 dir, SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, \ | |
| [vo/opengl-hq] [160] vec2 texcoord) { \ | |
| [vo/opengl-hq] [161] vec2 pt = (1 / texsize) * dir; \ | |
| [vo/opengl-hq] [162] float fcoord = dot(fract(texcoord * texsize - 0.5), dir); \ | |
| [vo/opengl-hq] [163] vec2 base = texcoord - fcoord * pt; \ | |
| [vo/opengl-hq] [164] return CONV_FUNC(tex, base - pt * (N / 2 - 1), pt, \ | |
| [vo/opengl-hq] [165] WEIGHTS_FUNC(lookup, fcoord)); \ | |
| [vo/opengl-hq] [166] } | |
| [vo/opengl-hq] [167] | |
| [vo/opengl-hq] [168] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep2, 2, sampler1D, convolution_sep2, weights2) | |
| [vo/opengl-hq] [169] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep4, 4, sampler1D, convolution_sep4, weights4) | |
| [vo/opengl-hq] [170] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep6, 6, sampler2D, convolution_sep6, weights6) | |
| [vo/opengl-hq] [171] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep8, 8, sampler2D, convolution_sep8, weights8) | |
| [vo/opengl-hq] [172] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep12, 12, sampler2D, convolution_sep12, weights12) | |
| [vo/opengl-hq] [173] SAMPLE_CONVOLUTION_SEP_N(sample_convolution_sep16, 16, sampler2D, convolution_sep16, weights16) | |
| [vo/opengl-hq] [174] | |
| [vo/opengl-hq] [175] | |
| [vo/opengl-hq] [176] #define CONVOLUTION_N(NAME, N) \ | |
| [vo/opengl-hq] [177] vec4 NAME(VIDEO_SAMPLER tex, vec2 texcoord, vec2 pt, float taps_x[N], \ | |
| [vo/opengl-hq] [178] float taps_y[N]) { \ | |
| [vo/opengl-hq] [179] vec4 res = vec4(0); \ | |
| [vo/opengl-hq] [180] for (int y = 0; y < N; y++) { \ | |
| [vo/opengl-hq] [181] vec4 line = vec4(0); \ | |
| [vo/opengl-hq] [182] for (int x = 0; x < N; x++) \ | |
| [vo/opengl-hq] [183] line += taps_x[x] * texture(tex, texcoord + pt * vec2(x, y));\ | |
| [vo/opengl-hq] [184] res += taps_y[y] * line; \ | |
| [vo/opengl-hq] [185] } \ | |
| [vo/opengl-hq] [186] return res; \ | |
| [vo/opengl-hq] [187] } | |
| [vo/opengl-hq] [188] | |
| [vo/opengl-hq] [189] CONVOLUTION_N(convolution2, 2) | |
| [vo/opengl-hq] [190] CONVOLUTION_N(convolution4, 4) | |
| [vo/opengl-hq] [191] CONVOLUTION_N(convolution6, 6) | |
| [vo/opengl-hq] [192] CONVOLUTION_N(convolution8, 8) | |
| [vo/opengl-hq] [193] CONVOLUTION_N(convolution12, 12) | |
| [vo/opengl-hq] [194] CONVOLUTION_N(convolution16, 16) | |
| [vo/opengl-hq] [195] | |
| [vo/opengl-hq] [196] #define SAMPLE_CONVOLUTION_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC) \ | |
| [vo/opengl-hq] [197] vec4 NAME(SAMPLERT lookup, VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) {\ | |
| [vo/opengl-hq] [198] vec2 pt = 1 / texsize; \ | |
| [vo/opengl-hq] [199] vec2 fcoord = fract(texcoord * texsize - 0.5); \ | |
| [vo/opengl-hq] [200] vec2 base = texcoord - fcoord * pt; \ | |
| [vo/opengl-hq] [201] return CONV_FUNC(tex, base - pt * (N / 2 - 1), pt, \ | |
| [vo/opengl-hq] [202] WEIGHTS_FUNC(lookup, fcoord.x), \ | |
| [vo/opengl-hq] [203] WEIGHTS_FUNC(lookup, fcoord.y)); \ | |
| [vo/opengl-hq] [204] } | |
| [vo/opengl-hq] [205] | |
| [vo/opengl-hq] [206] SAMPLE_CONVOLUTION_N(sample_convolution2, 2, sampler1D, convolution2, weights2) | |
| [vo/opengl-hq] [207] SAMPLE_CONVOLUTION_N(sample_convolution4, 4, sampler1D, convolution4, weights4) | |
| [vo/opengl-hq] [208] SAMPLE_CONVOLUTION_N(sample_convolution6, 6, sampler2D, convolution6, weights6) | |
| [vo/opengl-hq] [209] SAMPLE_CONVOLUTION_N(sample_convolution8, 8, sampler2D, convolution8, weights8) | |
| [vo/opengl-hq] [210] SAMPLE_CONVOLUTION_N(sample_convolution12, 12, sampler2D, convolution12, weights12) | |
| [vo/opengl-hq] [211] SAMPLE_CONVOLUTION_N(sample_convolution16, 16, sampler2D, convolution16, weights16) | |
| [vo/opengl-hq] [212] | |
| [vo/opengl-hq] [213] | |
| [vo/opengl-hq] [214] // Unsharp masking | |
| [vo/opengl-hq] [215] vec4 sample_sharpen3(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [216] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [217] vec2 st = pt * 0.5; | |
| [vo/opengl-hq] [218] vec4 p = texture(tex, texcoord); | |
| [vo/opengl-hq] [219] vec4 sum = texture(tex, texcoord + st * vec2(+1, +1)) | |
| [vo/opengl-hq] [220] + texture(tex, texcoord + st * vec2(+1, -1)) | |
| [vo/opengl-hq] [221] + texture(tex, texcoord + st * vec2(-1, +1)) | |
| [vo/opengl-hq] [222] + texture(tex, texcoord + st * vec2(-1, -1)); | |
| [vo/opengl-hq] [223] return p + (p - 0.25 * sum) * filter_param1; | |
| [vo/opengl-hq] [224] } | |
| [vo/opengl-hq] [225] | |
| [vo/opengl-hq] [226] vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { | |
| [vo/opengl-hq] [227] vec2 pt = 1 / texsize; | |
| [vo/opengl-hq] [228] vec2 st1 = pt * 1.2; | |
| [vo/opengl-hq] [229] vec4 p = texture(tex, texcoord); | |
| [vo/opengl-hq] [230] vec4 sum1 = texture(tex, texcoord + st1 * vec2(+1, +1)) | |
| [vo/opengl-hq] [231] + texture(tex, texcoord + st1 * vec2(+1, -1)) | |
| [vo/opengl-hq] [232] + texture(tex, texcoord + st1 * vec2(-1, +1)) | |
| [vo/opengl-hq] [233] + texture(tex, texcoord + st1 * vec2(-1, -1)); | |
| [vo/opengl-hq] [234] vec2 st2 = pt * 1.5; | |
| [vo/opengl-hq] [235] vec4 sum2 = texture(tex, texcoord + st2 * vec2(+1, 0)) | |
| [vo/opengl-hq] [236] + texture(tex, texcoord + st2 * vec2( 0, +1)) | |
| [vo/opengl-hq] [237] + texture(tex, texcoord + st2 * vec2(-1, 0)) | |
| [vo/opengl-hq] [238] + texture(tex, texcoord + st2 * vec2( 0, -1)); | |
| [vo/opengl-hq] [239] vec4 t = p * 0.859375 + sum2 * -0.1171875 + sum1 * -0.09765625; | |
| [vo/opengl-hq] [240] return p + t * filter_param1; | |
| [vo/opengl-hq] [241] } | |
| [vo/opengl-hq] [242] | |
| [vo/opengl-hq] [243] void main() { | |
| [vo/opengl-hq] [244] vec2 chr_texcoord = texcoord; | |
| [vo/opengl-hq] [245] #ifdef USE_RECTANGLE | |
| [vo/opengl-hq] [246] chr_texcoord = chr_texcoord * chroma_div; | |
| [vo/opengl-hq] [247] #else | |
| [vo/opengl-hq] [248] // Texture coordinates are [0,1], and chroma plane coordinates are | |
| [vo/opengl-hq] [249] // magically rescaled. | |
| [vo/opengl-hq] [250] #endif | |
| [vo/opengl-hq] [251] chr_texcoord = chr_texcoord + chroma_center_offset; | |
| [vo/opengl-hq] [252] #ifndef USE_CONV | |
| [vo/opengl-hq] [253] #define USE_CONV 0 | |
| [vo/opengl-hq] [254] #endif | |
| [vo/opengl-hq] [255] #if USE_CONV == CONV_PLANAR | |
| [vo/opengl-hq] [256] vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, | |
| [vo/opengl-hq] [257] SAMPLE_C(texture1, textures_size[1], chr_texcoord).r, | |
| [vo/opengl-hq] [258] SAMPLE_C(texture2, textures_size[2], chr_texcoord).r, | |
| [vo/opengl-hq] [259] 1.0); | |
| [vo/opengl-hq] [260] #elif USE_CONV == CONV_NV12 | |
| [vo/opengl-hq] [261] vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r, | |
| [vo/opengl-hq] [262] SAMPLE_C(texture1, textures_size[1], chr_texcoord).rg, | |
| [vo/opengl-hq] [263] 1.0); | |
| [vo/opengl-hq] [264] #else | |
| [vo/opengl-hq] [265] vec4 acolor = SAMPLE_L(texture0, textures_size[0], texcoord); | |
| [vo/opengl-hq] [266] #endif | |
| [vo/opengl-hq] [267] #ifdef USE_ALPHA_PLANE | |
| [vo/opengl-hq] [268] acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).r; | |
| [vo/opengl-hq] [269] #endif | |
| [vo/opengl-hq] [270] #ifdef USE_COLOR_SWIZZLE | |
| [vo/opengl-hq] [271] acolor = acolor. USE_COLOR_SWIZZLE ; | |
| [vo/opengl-hq] [272] #endif | |
| [vo/opengl-hq] [273] vec3 color = acolor.rgb; | |
| [vo/opengl-hq] [274] float alpha = acolor.a; | |
| [vo/opengl-hq] [275] #ifdef USE_YGRAY | |
| [vo/opengl-hq] [276] // NOTE: actually slightly wrong for 16 bit input video, and completely | |
| [vo/opengl-hq] [277] // wrong for 9/10 bit input | |
| [vo/opengl-hq] [278] color.gb = vec2(128.0/255.0); | |
| [vo/opengl-hq] [279] #endif | |
| [vo/opengl-hq] [280] #ifdef USE_INPUT_GAMMA | |
| [vo/opengl-hq] [281] color = pow(color, vec3(input_gamma)); | |
| [vo/opengl-hq] [282] #endif | |
| [vo/opengl-hq] [283] #ifdef USE_COLORMATRIX | |
| [vo/opengl-hq] [284] color = mat3(colormatrix) * color + colormatrix[3]; | |
| [vo/opengl-hq] [285] color = clamp(color, 0, 1); | |
| [vo/opengl-hq] [286] #endif | |
| [vo/opengl-hq] [287] #ifdef USE_CONV_GAMMA | |
| [vo/opengl-hq] [288] color = pow(color, vec3(conv_gamma)); | |
| [vo/opengl-hq] [289] #endif | |
| [vo/opengl-hq] [290] #ifdef USE_LINEAR_CONV_INV | |
| [vo/opengl-hq] [291] // Convert from linear RGB to gamma RGB before putting it through the 3D-LUT | |
| [vo/opengl-hq] [292] // in the final stage. | |
| [vo/opengl-hq] [293] color = pow(color, vec3(0.45)); | |
| [vo/opengl-hq] [294] #endif | |
| [vo/opengl-hq] [295] #ifdef USE_GAMMA_POW | |
| [vo/opengl-hq] [296] color = pow(color, inv_gamma); | |
| [vo/opengl-hq] [297] #endif | |
| [vo/opengl-hq] [298] #ifdef USE_3DLUT | |
| [vo/opengl-hq] [299] color = texture3D(lut_3d, color).rgb; | |
| [vo/opengl-hq] [300] #endif | |
| [vo/opengl-hq] [301] #ifdef USE_SRGB | |
| [vo/opengl-hq] [302] color.rgb = srgb_compand(color.rgb); | |
| [vo/opengl-hq] [303] #endif | |
| [vo/opengl-hq] [304] #ifdef USE_DITHER | |
| [vo/opengl-hq] [305] vec2 dither_pos = gl_FragCoord.xy / dither_size; | |
| [vo/opengl-hq] [306] #ifdef USE_TEMPORAL_DITHER | |
| [vo/opengl-hq] [307] dither_pos = dither_trafo * dither_pos; | |
| [vo/opengl-hq] [308] #endif | |
| [vo/opengl-hq] [309] float dither_value = texture(dither, dither_pos).r; | |
| [vo/opengl-hq] [310] color = floor(color * dither_quantization + dither_value + dither_center) / | |
| [vo/opengl-hq] [311] dither_quantization; | |
| [vo/opengl-hq] [312] #endif | |
| [vo/opengl-hq] [313] #ifdef USE_ALPHA_BLEND | |
| [vo/opengl-hq] [314] color = color * alpha; | |
| [vo/opengl-hq] [315] #endif | |
| [vo/opengl-hq] [316] #ifdef USE_ALPHA | |
| [vo/opengl-hq] [317] out_color = vec4(color, alpha); | |
| [vo/opengl-hq] [318] #else | |
| [vo/opengl-hq] [319] out_color = vec4(color, 1.0); | |
| [vo/opengl-hq] [320] #endif | |
| [vo/opengl-hq] [321] } | |
| [vo/opengl-hq] shader link log (status=1): | |
| [vo/opengl-hq] Create FBO: 1280x720 | |
| [vo/opengl-hq] Resize: 1280x720 | |
| [vo/opengl-hq] aspect(0) fitin: 1280x720 monitor_par: 1.00 | |
| [vo/opengl-hq] aspect(1) wh: 1280x720 (org: 1280x720) | |
| [vo/opengl-hq] aspect(2) wh: 1280x720 (org: 1280x720) | |
| [vo/opengl-hq] Window size: 1280x720 | |
| [vo/opengl-hq] Video source: 1280x720 (1280x720) | |
| [vo/opengl-hq] Video display: (0, 0) 1280x720 -> (0, 0) 1280x720 | |
| [vo/opengl-hq] Video scale: 1.000000/1.000000 | |
| [vo/opengl-hq] OSD borders: l=0 t=0 r=0 b=0 | |
| [vo/opengl-hq] Video borders: l=0 t=0 r=0 b=0 | |
| [vo/opengl-hq] Create FBO: 1280x768 | |
| [vo/opengl-hq] win32: uninit | |
| Exiting... (Quit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment