summaryrefslogtreecommitdiffstats
path: root/video/out
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: refactor shader generation (part 1)wm42015-03-129-1990/+1280
| | | | | | | | | | | | | | | | | | | The basic idea is to use dynamically generated shaders instead of a single monolithic file + a ton of ifdefs. Instead of having to setup every aspect of it separately (like compiling shaders, setting uniforms, perfoming the actual rendering steps, the GLSL parts), we generate the GLSL on the fly, and perform the rendering at the same time. The GLSL is regenerated every frame, but the actual compiled OpenGL-level shaders are cached, which makes it fast again. Almost all logic can be in a single place. The new code is significantly more flexible, which allows us to improve the code clarity, performance and add more features easily. This commit is incomplete. It drops almost all previous code, and readds only the most important things (some of them actually buggy). The next commit will complete it - it's separate to preserve authorship information.
* x11: ignore mouse enter/leave events due to pointer grabwm42015-03-111-0/+4
| | | | | | | | | | | If you click on a window that doesn't have a focus, a LeaveNotify followed by a EnterNotify event can be generated. The former will have mode set to NotifyGrab, the latter to NotifyUngrab. This will make the player think the mouse left the window, even though this is not the case. Ignore these and only react to those with mode set to NotifyNormal. Probably fixes #1672, and some other strange issues on some WMs.
* vo: hide opengl-cb in --vo=helpwm42015-03-101-1/+1
| | | | Avoids stupid questions.
* vo_opengl_cb: clear last video frame on uninit()wm42015-03-101-8/+9
| | | | | | | | | | | | mpv_opengl_cb_render() is supposed to clear the screen with the background color if there's no video... I think. It didn't do this, because although uninit() requested gl_video_config() to be called, this didn't happen, because this function checks whether the VO is set - and it's unsert after uninit() releases the lock. Also call the user wakeup callback in this situation, so the user actually redraws immediately.
* vo_opengl: move minor helper to common codewm42015-03-091-10/+1
| | | | | The generic image format code should cary most of the "knowledge" about image formats.
* w32_common: remove redundant is_maximized functionJames Ross-Gowan2015-03-091-8/+1
| | | | This already exists as IsMaximized in the Windows API.
* cocoa: fix minimized state getterStefano Pigozzi2015-03-091-5/+2
|
* x11: fix VOCTRL_GET_WIN_STATEwm42015-03-091-0/+1
| | | | | | | | | | Do not rely on the pointed-to argument to be initialized; VOCTRLs are supposed to completely overwrite them on success (or not to touch them on failure). The currently only caller of VOCTRL_GET_WIN_STATE initializes the value before calling this, so this is merely about correctness and didn't lead to any actual bugs.
* w32_common: support the "window-minimized" propertyJames Ross-Gowan2015-03-091-0/+6
|
* cocoa: support the "window-minimized" propertyJaime Marquínez Ferrándiz2015-03-082-0/+32
| | | | Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
* cocoa: fix autohide in fullscreenStefano Pigozzi2015-03-084-5/+26
|
* cocoa: fix mouse hiding with launchpad and dock foldersStefano Pigozzi2015-03-083-1/+18
| | | | | | | | | | | | Some UI elements in OS X – like Launchpad and Dock folders – are implemented using borderless windows in background demonized applications. When we use these elements, mpv doesn't stop to be the active application, but the mpv window leaves keyWindow state while we use the OS controls. This commit just keeps track of window state to update the cursor visibility accordingly. Fixes #513
* cocoa: clamp mouse position to window.torque2015-03-071-0/+2
| | | | | Prevents out-of-window coordinates being reported for mouse coordinates. Previously they could be out-of-window coordinates on init or on resize.
* cocoa: update mouse coordinates when window is initialized.torque2015-03-073-2/+4
| | | | | | Make MpvEventsView -signalMousePosition a public method so it can be called without a compiler warning. Previously, the mouse position would be reported as (0,0) until the cursor was moved.
* cocoa: don't uninit light sensor if not presentStefano Pigozzi2015-03-071-2/+4
|
* vo_opengl/x11: fix automatic ICC profile loadingMartin Herkt2015-03-072-6/+11
| | | | | | | | | | | | mpv would attempt to load ICC profiles several times during VO init even if no window is displayed. This potentially causes it to load a profile for a different screen than it is going to be displayed on, thereby invalidating the profile cache and rebuilding the LUT every single time. It would not unload a previously loaded profile when the video window is moved to a display without an installed profile. Fix these issues and tweak the log messages a little.
* cocoa: remove possible use after freeStefano Pigozzi2015-03-071-5/+5
|
* cocoa: fix some crashes caused by async uninitStefano Pigozzi2015-03-071-31/+15
| | | | | | | Always keep around our private state and destroy it when we are really done in the async uninit callback. Fixes #1657
* vo_vaapi: fix video equalizer (second try)wm42015-03-061-12/+36
| | | | | | | | | | | | The vaapi equalizer have a custom range, and can have a smaller range than mpv's normalized video equalizer values. The result is that a vaapi equalizer value can map to multiple mpv values, so changing a mpv value by 1 can get "stuck". Fix by remember the mpv value, and returning it if it still corresponds to the vaapi value. Really fixes #1647. (Why am I even bothering with this irredeemable crap?)
* vo_opengl: make smoothmotion-threshold inclusiveNiklas Haas2015-03-051-2/+2
| | | | | This behavior makes more sense near the borders, eg. smoothmotion-threshold=0 and smoothmotion-threshold=0.5.
* vo_vaapi: round equalizer valueswm42015-03-051-2/+5
| | | | | Probably fixes #1647 (if it's correct at all). I couldn't reproduce with the vdpau libva driver, but a driver can use different ranges.
* vo_opengl: increase ambient light changes log levelStefano Pigozzi2015-03-041-1/+1
| | | | info is a quite too annoying. increase it to verbose.
* win32: fix some more -Wparentheses warningswm42015-03-042-2/+2
| | | | | | | Stupid compiler. For decode_surrogate_pair(), I changed the order of evaluation; it shouldn't matter, but this order is more readable in my opinion.
* vo_opengl: add gamma-auto optionStefano Pigozzi2015-03-043-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | This automatically sets the gamma option depending on lighting conditions measured from the computer's ambient light sensor. sRGB – arguably the “sibling” to BT.709 for still images – has a reference viewing environment defined in its specification (IEC 61966-2-1:1999, see http://www.color.org/chardata/rgb/srgb.xalter). According to this data, the assumed ambient illuminance is 64 lux. This is the illuminance where the gamma that results from ICC color management is correct. On the other hand, BT.1886 formalizes that the gamma level for dim environments to be 2.40, and Apple resources (WWDC12: 2012 Session 523: Best practices for color management) define the BT.1886 dim at 16 lux. So the logic we apply is: * >= 64lux -> 1.961 gamma * =< 16lux -> 2.400 gamma * 16lux < x < 64lux -> logaritmic rescale of lux to gamma. The human perception of illuminance roughly follows a logaritmic scale of lux [1]. [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd319008%28v=vs.85%29.aspx
* cocoa: add support for querying ambient lightingStefano Pigozzi2015-03-042-0/+97
| | | | | | | | | This will be pretty useful to let mpv automatically change VO parameters based on ambient lighting conditions. The conversion code and polinomial equation from Apple LMU values to Lux is taken from Firefox: their license, MPL is GPL compatible and allows relicensing to GPL (MPL is more liberal).
* buid: readd -Wparentheseswm42015-03-024-4/+4
| | | | | | | | | This warning wasn't overly helpful in the past, and warned against perfectly fine code. But at least with recent gcc versions, this is the warning that complains about assignments in if expressions (why???), so we want to enable it. Also change all the code this warning complains about for no reason.
* vo_direct3d: support NV12 with shaderswm42015-03-024-196/+359
| | | | | | | | | | | | | Semi-important, because --hwdec=dxva2 outputs NV12, and we really don't want people to end up with the "old" StretchRect method. Unfortunately, I couldn't actually get it to work. It seems most D3D drivers (including the wine D3D implementation) reject D3DFMT_A8L8, and I could not find any other 2-channel 8 bit Direct3D 9 format. It seems newer D3D APIs have DXGI_FORMAT_R8G8_UNORM, but there's no way to get it in D3D9. Still pushing this; maybe it actually works on some drivers.
* Revert "Revert recent vo_opengl related commits"Niklas Haas2015-02-281-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | Omitted a simple, but devastasting check. Fixed the relevant commits now. This reverts commit 8d24e9d9b8ad1b5d82139980eca148dc0f4a1eab. diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 9c8a643..f1ea03e 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1034,9 +1034,9 @@ static void compile_shaders(struct gl_video *p) shader_def_opt(&header_conv, "USE_CONV_GAMMA", use_conv_gamma); shader_def_opt(&header_conv, "USE_CONST_LUMA", use_const_luma); shader_def_opt(&header_conv, "USE_LINEAR_LIGHT_BT1886", - gamma_fun == MP_CSP_TRC_BT_1886); + use_linear_light && gamma_fun == MP_CSP_TRC_BT_1886); shader_def_opt(&header_conv, "USE_LINEAR_LIGHT_SRGB", - gamma_fun == MP_CSP_TRC_SRGB); + use_linear_light && gamma_fun == MP_CSP_TRC_SRGB); shader_def_opt(&header_conv, "USE_SIGMOID", use_sigmoid); if (p->opts.alpha_mode > 0 && p->has_alpha && p->plane_count > 3) shader_def(&header_conv, "USE_ALPHA_PLANE", "3");
* Revert recent vo_opengl related commitswm42015-02-281-1/+16
| | | | | | | | | | | | | | | Breaks vo_opengl by default. I'm hot able to fix this myself, because I have no clue about the overcomplicated color management logic. Also, whilethis is apparently caused by commit fbacd5, the following commits all depend on it, so revert them too. This reverts the following commits: e141caa97dade07f4d7e0d6c208bcd3493e712ed 653b0dd5295453d9661f673b4ebd02c5ceacf645 729c8b3f641e633474be612e66388c131a1b5c92 fbacd5de31de964f7cd562304ab1c9b4a0d76015 Fixes #1636.
* cocoa: remove the setNextKeyView hackStefano Pigozzi2015-02-281-4/+0
| | | | | | Just use makeFirstResponder on the mpv events view from client code if you need the built in keyboard events (this is easier for dealing with view nesting).
* csputils: add missing gamma supportNiklas Haas2015-02-281-16/+1
| | | | | | | | | | | We have MP_CSP_TRC defined, but it wasn't being used by practically anything. This commit adds missing conversion logic, adds it to mp_image, and moves the auto-guessing logic to where it should be, in mp_image_params_guess_csp (and out of vo_opengl). Note that this also fixes a minor bug: csp_prim was not being copied between mp_image structs if the format was not YUV in both cases, but this is wrong - the primaries are always relevant.
* vo_opengl: delete 16 bit test texturewm42015-02-271-0/+1
| | | | | Essentially a leak, but not that bad since it's small and allocated only once.
* vo_opengl: fix some commentswm42015-02-271-3/+3
|
* options: handle choice -> flag fallback automaticallywm42015-02-271-2/+2
| | | | | | | | | | | | | | | In the past it happened quite often that flag options (yes/no) were changed to choice options (yes/no/some more). The problem with this was that while flag options don't need a parameter, this wasn't the case with choice options. A hack was introduced to compensate for this: setting M_OPT_OPTIONAL_PARAM on the option, and an empty string ("") was added as choice, so that the choice could be used like a flag. So, for example, "--mute" would set the choice "". Fix this by 1. not requiring a parameter if there's a "yes" choice, and 2. redirect an empty parameter to "yes". The effect is that a choice option with the choices ["yes", "no"] is pretty much equivalent to a flag option.
* vo_opengl: implement antiringing for tensor scalersNiklas Haas2015-02-272-7/+15
| | | | | | | | | | | | This is based on pretty much the same (somewhat naive) logic right now. I'm not convinced that the extra logic that eg. madVR includes is worth enough to warrant heavily confusing the logic for it. This shouldn't slow down the logic at all in any sane shader compiler, and indeed it doesn't on any shader compiler that I tested. Note that this currently doesn't affect cscale at all, due to the weird implementation details of that.
* vo_opengl: test FBOs only if they're going to be usedwm42015-02-261-30/+28
| | | | | | | | | | Change test_fbo() so that it checks the FBO lazily, and restructure check_gl_features() to invoke it only if we know that a FBO will be needed for a certain enabled feature. This can avoid strange error messages when using --vo=opengl and the FBO format does not work. It's also less confusing when reading the verbose log (users might think that the FBO is actually used, etc.).
* vo_xv: don't attempt to clear window before mappedwm42015-02-261-0/+2
| | | | | | | | This can happen with the "no-colorkey" suboption. Then the code in xv_draw_colorkey() can be run before vo_x11_config_vo_window(), when vo_gc is not allocated yet. Fixes #1629.
* vo_opengl: greatly increase smoothmotion performanceNiklas Haas2015-02-242-74/+105
| | | | | | | | | | | | | | | | | | | | Instead of rendering and upscaling each video frame on every vsync, this version of the algorithm only draws them once and caches the result, so the only operation that has to run on every vsync is a cheap linear interpolation, plus CMS/dithering. On my machine, this is a huge speedup for 24 Hz content (on a 60 Hz monitor), up to 120% faster. (The speedup is not quite 250% because of the overhead that the larger FBOs and CMS provides) In terms of the implementation, this commit basically swaps interpolation and upscaling - upscaling is moved to inter_program, and interpolation is moved to the final_program. Furthermore, the main bulk of the frame rendering logic (upscaling etc.) was moved to a separete function, which is called from gl_video_interpolate_frame only if it's actually necessarily, and skipped otherwise.
* vo_opengl: another GLES2 issuewm42015-02-241-1/+9
| | | | | | | | | | GLES2 randomly does not support the transpose parameter in matrix uniform calls. So we have to do this manually. Sure it was worth to mutilate the standard just so all these shitty SoC vendors can safe 3 lines of code. (Obviously trying to handle all of GLES2 to GL 4.x in a single codebase was a mistake.)
* vo_opengl: extend ifdef against shader arrayswm42015-02-241-1/+2
| | | | | | | GLES2 shaders do not have line continuation characters. Abuse the HAVE_ARRAYS define to exclude code which uses arrays, and which also happens to cover all code that defines multi-line macros. (So yes, this is a hack.)
* filter_kernels: rename bilinear_slow to triangleNiklas Haas2015-02-241-3/+5
| | | | | | | | This is essentially what it is, and it's a useful for windowing or downscaling. For upscaling we already have bilinear, no need to cause extra confusion between biliner and bilinear_slow. Also made it a bit more well-behaved.
* filter_kernels: add robidoux and robidouxsharpNiklas Haas2015-02-241-0/+2
| | | | | | | | These are EWA-based versions of the keys B/C splines, of which mitchell is already a member. They are slightly softer and slightly sharper than mitchell, respectively. Very easy to define in terms of things we already have.
* filter_kernels: redefine redundant filtersNiklas Haas2015-02-241-20/+6
| | | | | | mitchell, hermite and catmull_rom are all B/C splines and can share the code which was already written for mitchell. This just redefines them in terms of that.
* filter_kernels: add ewa_lanczossharp aliasNiklas Haas2015-02-241-0/+4
| | | | | This is essentially a preconfigured version of ewa_lanczos, with the "best" parameters for general purpose usage.
* vo_opengl: support polar filters of any radiusNiklas Haas2015-02-241-6/+7
| | | | | We can now truly pass a radius of 3.2383154841662362 or another real zero of the jinc function to get a better result.
* vo_opengl: explicitly check potential candidates for polar filtersNiklas Haas2015-02-242-2/+11
| | | | | | | This adds a small check for candidates that could potentially be inside the radius, but aren't necessarily. This speeds up performance by a negligible amount on my hardware, but it's mainly a prerequisite for a further change (using a larger true radius).
* filter_kernels: add blur parameter to jincNiklas Haas2015-02-231-4/+4
| | | | | This affects all filters that use it, eg. ewa_lanczos. Setting it to something like 0.95 can be done to make the filter a bit less blurry.
* filter_kernels: gaussian: redefine the parameterNiklas Haas2015-02-231-6/+2
| | | | | | | | | Previously, this was based on some arbitrary range 1-100, cut off for no particular reason, and also defined in such a way that higher values = *less* smoothness. Since it wasn't multiplied by e in the code, the default had to be 10*e = 28.8539... Now, it's sane: 1.0 = default, higher = blurrier.
* filter_kernels: remove second parameter from kaiserNiklas Haas2015-02-231-3/+2
| | | | | | | | This filter isn't supposed to have a second parameter in the first place, all literature only uses a single parameter alpha in both places. The second parameter doesn't even do anything other than adding a constant factor, which is normalized by the LUT calculation either way.
* filter_kernels: rename ginseng to ewa_ginsengNiklas Haas2015-02-231-2/+2
| | | | | | This is done mainly for consistency, since all of the EWA filters share similar properties and it's important to distinguish them for documentation purposes.
* filter_kernels: add ewa_hanningNiklas Haas2015-02-231-0/+10
| | | | | This is suggested in a thesis by Andreas Gustafsson, and seems to produce very a bit less ringing than lanczos at high radius.
* filter_kernels: minor code cleanup of jinc stuffNiklas Haas2015-02-231-5/+1
| | | | | | No point in duplicating this check all over the place. No point in really having it in the first place, to be perfectly honest, j1 should not be THAT badly behaved.
* vo_opengl: slightly improve ewa_lanczos windowingNiklas Haas2015-02-231-33/+4
| | | | | | | | | | | The original filter window was design for a radius based on the true zero, but we always cut it off at our selection of radius either way (by necessity, due to the square matrix we sample from). This window is tweaked from the original (true radius) to our actual cut-off radius, and hence improves the result in a few edge cases. The main win is the reduction of code complexity, since we no longer need to know what the true radius actually is.
* x11egl: minor cleanupwm42015-02-201-4/+6
| | | | Not like it matters, and is probably still not entirely correct.
* vo_opengl: minor robustness improvement in function loaderwm42015-02-201-2/+5
| | | | | | Check the scanf() return value, and don't continue if it doesn't find both numbers (can happen with GLES 1.0). Also, some implementations can return NULL from glGetString() if something is "broken".
* vo_opengl: add ginseng upscalerNiklas Haas2015-02-201-0/+11
| | | | | | | | | This is a variation of ewa_lanczos that is sinc-windowed instead of jinc-windowed. Results are pretty similar, but the logic is simpler. This could potentially replace the ugly ewa_lanczos code. It's hard to tell, but from comparing stills I think this one has slightly less ringing than regular ewa_lanczos.
* vo_opengl: fix smoothmotion coefficient calculation, for real this timeNiklas Haas2015-02-201-24/+31
| | | | | | I've reworked pretty much all the logic to correspond to what the theory actually describes. With this commit, playback is wonderfully smooth on my machine.
* input: add MOUSE_ENTER keybinding.torque2015-02-184-2/+11
| | | | Signed-off-by: wm4 <wm4@nowhere>
* vo_opengl: glsl: remove trailing \wm42015-02-161-2/+2
| | | | | This should be no problem... but it _might_ help with #1536, so it's worth a try.
* x11: fix uninitialized variable readswm42015-02-141-1/+1
| | | | This line of code ended up in the wrong block in commit cd6dfcbe.
* x11: add XK_Cancel to the list of special keysMartin Herkt2015-02-141-0/+1
| | | | |