summaryrefslogtreecommitdiffstats
path: root/video/out
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: do not use vaapi-over-GLXwm42017-07-073-5/+4
| | | | | | | | | | | | | | | This backend is selected if vaapi is available, but vaapi-over-EGL is not. This causes various issues around the forced RGB conversion, which is done with fixed, usually incorrect parameters. It seems the existing auto probing check is too weak, and doesn't really prevent it from getting loaded. Fix this by adding a flag to not ever load this during auto probing. I'm still not deleting it, because it's useful for testing on nvidia machines. See #4555.
* vo_opengl: prevent desat from blowing up for negativeNiklas Haas2017-07-071-1/+1
| | | | | | | The current algorithm blew up when the color was negative, such as the case when downscaling with dscale=mitchell or other algorithms that introduce negative ringing. The simplest solution is to just slightly change the calculation to force both parameters to be in-range.
* vo_opengl: also expose NAME_mul for user shadersNiklas Haas2017-07-061-2/+3
| | | | | | | | | This is exposed so that bjin/mpv-prescalers can use textureGatherOffset for performance. Since there are now quite a lot of parameters where it isn't quite clear why they're all defined, add a paragraph to the man page that explains them a bit.
* vo_opengl: prevent division by zero in shaderNiklas Haas2017-07-061-1/+1
| | | | | In theory the max() should clamp it away anyway but I believe division by zero is UB so just avoid it altogether.
* vo_opengl: add --tone-mapping-desaturateNiklas Haas2017-07-064-6/+19
| | | | | | | This helps prevent unnaturally, weirdly colorized blown out highlights for direct images of the sunlit sky and other way-too-bright HDR content. I was debating whether to set the default at 1.0 or 2.0, but went with the more conservative option that preserves more detail/color.
* vo_opengl: get rid of weird double-bind in pass_read_fboNiklas Haas2017-07-051-4/+2
| | | | | | | | This logic doesn't really make sense. copy_img_tex already binds the texture, so why would we bind it a second time? Furthermore, nothing actually uses this return value. Must have been some left-over artifact of a previous iteration of this function. Anyway, it's harmless, just nonsensical. So remove it.
* vo_opengl: remove redundant left-over lineNiklas Haas2017-07-051-1/+0
| | | | The pass_read_fbo immediately below replaces it
* vo_opengl: use textureGatherOffset for polar filtersNiklas Haas2017-07-055-44/+90
| | | | | | | | | | | | | | | | | | This is more efficient on my machine (nvidia), but only when applied to groups of exactly 4 texels. So we switch to the more efficient textureGather for groups of 4. Some notes: - textureGatherOffset seems to be faster than textureGather by a non-negligible amount, but for some reason, textureOffset is still slower than a straight-up texture - textureGather* requires GLSL 400; and at least on nvidia, this requires actually allocating a GL 4.0 context. - the code in opengl/common.c that clamped the GLSL version to 330 is deprecated, because the old user shader style has been removed completely in the meantime - To combat the growing complexity of the polar sampling code, we drop the antiringing functionality from EWA shaders completely, since it never really worked well for EWA to begin with. (Horrific artifacting)
* w32_common: use sent messages to wake up the Win32 threadJames Ross-Gowan2017-07-041-5/+12
| | | | | | | | | | | | | | | | | Instead of PostMessage, use SendNotifyMessage from the SendMessage family of functions to wake up the Win32 thread from the VO thread. When a message is sent rather than posted between threads, it ends up in a different queue which is processed before posted messages and can be processed in more places. This prevents a playback glitch when clicking on the titlebar, but not moving the window. With PostMessage-based wakeups, VOCTRLs could be delayed for up to 500ms after the user clicks on the titlebar, but with SendNotifyMessage, they still complete in under a millisecond. Also, instead of handling WM_USER, process the dispatch queue before every message. This ensures the dispatch queue is processed as soon as possible. WM_NULL is used to wake up the window procedure in case there are no other messages being processed.
* vo_opengl: make the pass info mechanism more robustNiklas Haas2017-07-031-17/+26
| | | | | | | | | | - change asserts to silent exits - check all pointers before use - move the p->pass initialization code to the right place This should hopefully cut down on the amount of crashing by making the code fundamentally more robust, while also fixing a concrete issue where opengl-cb failed to initialize p->pass.
* w32_common: use SWP_NOSENDCHANGING when resizing childJames Ross-Gowan2017-07-031-1/+1
| | | | | | This seems to reduce glitches when resizing a --wid program (or it could be a placebo.) Since we don't need the WM_WINDOWPOSCHANGING handler in --wid mode, it should be fine.
* filter_kernels: add radius cutoff functionalityNiklas Haas2017-07-035-9/+24
| | | | | | | | This allows filter functions to be prematurely cut off once their contributions start becoming insignificant. This effectively prevents wasted GPU time sampling from parts of the function that are essentially reduced to zero by the window function, providing anywhere from a 10% to 20% speedup. (5700μs -> 4700μs for me)
* options: change everything againwm42017-07-022-7/+2
| | | | Fucking bullshit.
* x11: add 128x128 sized icon supportXu Zhao2017-07-021-0/+5
|
* x11: load icon differentlywm42017-07-012-83/+40
| | | | | | | | Now it's sourced from the etc/ PNG files directly, instead of preprocessing them with imagemagick. Add some ad-hoc code to decode PNG files with libavcodec. At least we can drop the zlib code in exchange.
* vo_opengl: describe vdpau reinterleaving passNiklas Haas2017-07-011-0/+1
| | | | This shows up as (unknown pass) otherwise.
* vo_opengl: fix some more pass_info_reset issuesNiklas Haas2017-07-011-1/+10
| | | | | | | | | | | | 2f41c4e8 exposed some other edge cases as well. Globally resetting the pass info was not the right way to go about it, because we don't know in advance what the frame type is going to be - at least not with the current code structure. (In principle, we could separately indicate the frame type and the pass type and then only reset it on the first actual pass_describe call, but that's annoying as well) Also fixes a latent issue where p->pass was never initialized, which broke the MP_DBG debugging code in some cases.
* vo_opengl: call pass_info_reset earlierNiklas Haas2017-07-011-1/+1
| | | | | Omitting this call resulted in a crash when has_frame was false. But we can just call it way earlier, because there's really no reason not to.
* vo_opengl: merge uploading and renderingNiklas Haas2017-07-011-14/+14
| | | | | | Since all existing code does gl_video_upload immediately followed by pass_render_frame, we can just move the upload into pass_render_frame itself, which arguably makes more sense anyway.
* vo_opengl: refactor vo performance subsystemNiklas Haas2017-07-019-100/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces `vo-performance` by `vo-passes`, bringing with it a number of changes and improvements: 1. mpv users can now introspect the vo_opengl passes, which is something that has been requested multiple times. 2. performance data is now measured per-pass, which helps both development and debugging. 3. since adding more passes is cheap, we can now report information for more passes (e.g. the blit pass, and the osd pass). Note: we also switch to nanosecond scale, to be able to measure these passes better. 4. `--user-shaders` authors can now describe their own passes, helping users both identify which user shaders are active at any given time as well as helping shader authors identify performance issues. 5. the timing data per pass is now exported as a full list of samples, so projects like Argon-/mpv-stats can immediately read out all of the samples and render a graph without having to manually poll this option constantly. Due to gl_timer's design being complicated (directly reading performance data would block, so we delay the actual read-back until the next _start command), it's vital not to conflate different passes that might be doing different things from one frame to another. To accomplish this, the actual timers are stored as part of the gl_shader_cache's sc_entry, which makes them unique for that exact shader. Starting and stopping the time measurement is easy to unify with the gl_sc architecture, because the existing API already relies on a "generate, render, reset" flow, so we can just put timer_start and timer_stop in sc_generate and sc_reset, respectively. The ugliest thing about this code is that due to the need to keep pass information relatively stable in between frames, we need to distinguish between "new" and "redrawn" frames, which bloats the code somewhat and also feels hacky and vo_opengl-specific. (But then again, this entire thing is vo_opengl-specific)
* d3d: UWP support for D3D11VAwm42017-06-301-9/+4
| | | | | | | For some braindead reason, Microsoft decided to prevent you from dynamically loading system libraries. This makes portability harder. And we're talking about portability between Microsoft OSes!
* d3d: make DXVA2 support optionalwm42017-06-302-4/+4
| | | | | | | | | | | | This partially reverts the change from a longer time ago to always build DXVA2 and D3D11VA together. To make it simpler, we change the following: - building with ANGLE headers is now required to build D3D hwaccels - if DXVA2 is enabled, D3D11VA is still forcibly built - the CLI vo_opengl ANGLE backend is now under --egl-angle-win32 This is done to reduce the dependency mess slightly.
* vo_direct3d: remove non-working nv12 shader supportwm42017-06-302-134/+0
| | | | | | | | | It never worked. It relied on some obscure texture format to provide the equivalent of GL_RG or GL_LUMINANCE_ALPHA, but no hardware seemed to report support for it ever. No idea what's the correct way to do this. On D3D11 it exists, of course. (Actually I'd like to remove the whole VO.)
* video: get rid of swapped packed YUVwm42017-06-304-10/+2
| | | | | | Another legacy annoyance. The only place where packed YUV is still important is slightly older Apple hardware or drivers, which require it for efficient hardware decoding.
* vo_opengl: remove mp_imgfmt_desc and IMGFLAG_ usagewm42017-06-303-35/+48
| | | | | These were weird due to their past, and often undefined or ill-defined. Time to get rid of them.
* vo_opengl: restructure format setupwm42017-06-307-131/+105
| | | | | | | | | | | | Instead of setting up a weird swizzle (which is linked to how the internal renderer code works, rather than the generic format code), add per-component mapping to gl_imgfmt_desc. The renderer still computes the weird swizzle, but at least it's confined to itself. Also, it appears the hwdec backends don't need this anymore. It's really nice that the messy init_format() goes away too.
* options: change path list options, and document list optionswm42017-06-302-1/+7
| | | | | | | | | | | | | | | | | | | | | | | The changes to path list options is basically getting rid of the need to pass multiple paths to a single option. Instead, you can use the option multiple times. The old behavior can be used by using the -set suffix with the option. Change some options to path lists. For example --script is now append by default, and if you use --script-set, you need to use ":"/";" as separator instead of ",". --sub-paths/--audio-file-paths is a deprecated alias now, and will break if the user tries to pass multiple paths to it. I'm assuming that if these are used, most users will pass only 1 path anyway. --opengl-shaders has more compatibility handling, since it's probably rather common that users pass multiple options to it. Also document all that in the manpage. I'll probably regret this later, as it somewhat increases the complexity of the option parser, rather than increasing it.
* vo_direct3d: fix buildwm42017-06-291-1/+0
| | | | That format is worthless anyway.
* video: drop some unused IMGFMT aliaseswm42017-06-291-1/+0
| | | | | | These formats are supported in a generic way. To get rid of IMGFMT_NV21, remove support from vo_direct3d.c completely.
* vo_opengl: rely on FFmpeg pixdesc a bit morewm42017-06-291-80/+27
| | | | | | | | | | | | | Add something that allows is to extract the component order from various RGBA formats. In fact, also handle YUV, GBRP, and XYZ formats with this. It introduces a new struct mp_regular_imgfmt, that hopefully will eventually replace struct mp_imgfmt_desc. The latter is still needed by a lot of code though, especially generic code. Also vo_opengl still uses the old one, so this commit is sort of incomplete. Due to its genericness, it's also possible that this commit introduces rendering bugs, or accepts formats it shouldn't accept.
* Avoid calling close(-1)wm42017-06-291-2/+4
| | | | | | | | | | While this is perfectly OK on Unix, it causes annoying valgrind warnings, and might be otherwise confusing to others. On Windows, the runtime can actually abort the process if this is called. push.c part taken from a patch by Pedro Pombeiro.
* vo_opengl: unify user_shaders constantsNiklas Haas2017-06-282-13/+10
| | | | | | | | | | | | | | | Commit 3fb6380 was supposed to increase MAX_TEXTURE_HOOKS but instead increased SHADER_MAX_HOOKS, since I forgot that they were separate (for whatever reason). To prevent this mistake from happening again, and to unify the location in which user_shader-specific #defines are placed, get rid of the two constants in opengl/video.c and move/reuse them from user_shaders.h instead. Also bump up MAX_SAVED_TEXTURES (now SHADER_MAX_SAVED) slightly as a precaution against adding more passes to vo_opengl. I think we're already flirting with the limit.
* vo_opengl: tone map using only luminance informationNiklas Haas2017-06-271-33/+24
| | | | | | | | | | | | | | | | | | | This is even better at preventing discoloration than tone mapping on the XYZ image. Partly inspired by the HLG OOTF. Also simplifies the way we tone map, and moves this logic to the pass_tone_map function where it belongs. This also fixes what could arguably be considered a bug in the HLG implementation when using HLG for non-BT.2020 colorspaces, which is not permitted by spec but thinkable in theory. Although in this case, I guess it will be arbitrary whether people use the BT.2020-normalized luma coefficients or change it to fit the colorspace, so I guess either way could be considered "right", depending on what people end up doing. Either way, in lieue of standard practice, we do what makes the most sense (to me), and hopefully others will follow. The downside is that we upload an extra vec3 uniform even if we don't use it, but eliminating that would be ugly.
* vo_opengl: silence -Wmaybe-uninitialized false positiveNiklas Haas2017-06-241-3/+3
| | | | | | | | | These can never be uninitialized because the enum cases are exhaustive and the fallback is in the correct order, but GCC is too dumb to understand this. Also explicitly initialize tex_type, because while GCC doesn't warn about it (for some reason), maybe it will in the future.
* osx: change license header on some more cocoa fileswm42017-06-247-49/+49
| | | | Changing the headers was actually forgotten in the previous commit.
* osx: change license of OSX and cocoa files to LGPLwm42017-06-242-15/+15
| | | | All authors of the current code have agreed.
* w32_common, w32_keyboard: change license to LGPLwm42017-06-242-14/+14
| | | | All authors agreed.
* vo_opengl: bump up SHADER_MAX_HOOKSNiklas Haas2017-06-241-1/+1
| | | | | Apparently people are running into the current limit. 64 ought to be enough for everybody.
* context_dxinterop: lock rendertarget after present when swapping buffersquilloss2017-06-181-7/+6
| | | | | | | | Moves the DXLockObjectsNV call to after PresentEx. This fixes an issue where the presented image is a single frame late. This may be due to DXLockObjectsNV locking the render target before StretchRect is done. The spec indicates that the lock call should provide synchronization for the resource, so this may be due to a driver bug.
* vo_drm: nake drm mode help output also output refresh rateAnton Kindestam2017-06-181-3/+9
| | | | | | | | | The printout of available modes that you can get with --drm-mode=-1 (with -vo drm or --opengl-backend=drm) does not include the refresh rate in the printout, which is quite useful to know, if one is to choose for instance 23.98, or 24 Hz for film material. Signed-off-by: wm4 <wm4@nowhere>
* vo_opengl: implement sony s-log2 trcNiklas Haas2017-06-181-1/+18
| | | | | | | | Apparently this is virtually identical to Panasonic's V-Log, but using the constants from S-Log1 and an extra scaling coefficient to make the S-Log1 curve less limited. Whatever floats their NIH boat, I guess. Source: https://pro.sony.com/bbsccms/assets/files/micro/dmpc/training/S-Log2_Technical_PaperV1_0.pdf
* vo_opengl: implement sony s-log1 trcNiklas Haas2017-06-181-0/+14
| | | | | | | | Source: https://pro.sony.com/bbsccms/assets/files/mkt/cinema/solutions/slog_manual.pdf Not 100% confident in the implementation since the values from the spec seem to be very subtly off (~1%), but it should be close enough for practical purposes.
* vo_opengl: tone map in linear XYZ instead of RGBNiklas Haas2017-06-181-1/+19
| | | | | | | | | | | | | This preserves channel balance better and helps reduce discoloration due to nonlinear tone mapping. I wasn't sure whether to stuff this inside pass_color_manage or pass_tone_map but decided for the former because adding the extra mp_csp_prim would have made the signature of the latter longer than 80col, and also because the `mp_get_cms_matrix` below it basically does the same thing anyway, so it doesn't look that out of place. Also why is this justification longer than the actual description of the algorithm and what it's good for?
* vo_opengl: implement support for OOTFs and non-display referred contentNiklas Haas2017-06-183-8/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces (yet another..) mp_colorspace members, an enum `light` (for lack of a better name) which basically tells us whether we're dealing with scene-referred or display-referred light, but also a bit more metadata (in which way is the scene-referred light expected to be mapped to the display?). The addition of this parameter accomplishes two goals: 1. Allows us to actually support HLG more-or-less correctly[1] 2. Allows people playing back direct “camera” content (e.g. v-log or s-log2) to treat it as scene-referred instead of display-referred [1] Even better would be to use the display-referred OOTF instead of the idealized OOTF, but this would require either native HLG support in LittleCMS (unlikely) or more communication between lcms.c and video_shaders.c than I'm remotely comfortable with That being said, in principle we could switch our usage of the BT.1886 EOTF to the BT.709 OETF instead and treat BT.709 content as being scene-referred under application of the 709+1886 OOTF; which moves that particular conversion from the 3dlut to the shader code; but also allows a) users like UliZappe to turn it off and b) supporting the full HLG OOTF in the same framework. But I think I prefer things as they are right now.
* csputils: rename HDR curvesNiklas Haas2017-06-182-26/+22
| | | | | | | | | | st2084 and std-b67 are really weird names for PQ and HLG, which is what everybody else (including e.g. the ITU-R) calls them. Follow their example. I decided against naming them bt2020-pq and bt2020-hlg because it's not necessary in this case. The standard name is only used for the other colorspaces etc. because those literally have no other names.
* video: refactor HDR implementationNiklas Haas2017-06-183-73/+54
| | | | | | | | | | | | | | | List of changes: 1. Kill nom_peak, since it's a pointless non-field that stores nothing of value and is _always_ derived from ref_white anyway. 2. Kill ref_white/--target-brightness, because the only case it really existed for (PQ) actually doesn't need to be this general: According to ITU-R BT.2100, PQ *always* assumes a reference monitor with a white point of 100 cd/m². 3. Improve documentation and comments surrounding this stuff. 4. Clean up some of the code in general. Move stuff where it belongs.
* image_writer, vo_image: change license to LGPLwm42017-06-181-7/+7
| | | | | | | | | | | | | | | | | | image_writer.c has code originating from vf_screenshot.c, vo_jpeg.c, and potentially others. vo_image.c is based on a bunch of those VOs as well, and the intention was to replace them with a single codebase. vo_tga.c was written by someone who was not or not could be contacted, but it doesn't matter anyway, as no code from that initial patch was used. One rather old patch (57f77bb41a9) reordered by libjpeg patch API calls, and the author of the patch was not contacted. But at least with the smoothing_factor override removed, this pretty much exactly corresponds to the official libjpeg API example (and might even reflect a change to those - didn't dig deeper). This removes the -jpeg-smooth option. While we're at it, remove all the other dropped jpeg options from the manpage (which was forgotten in past changes).
* Drop/move img_fourcc.hwm42017-06-182-6/+13
| | | | | | | | | | | | | | | This file is an leftover from when img_format.h was changed from using the ancient FourCCs (based on Microsoft multimedia conventions) for pixel formats to a simple enum. The remaining cases still inherently used FourCCs for whatever reasons. Instead of worrying about residual copyrights in this file, just move it into code we don't want to relicense (the ancient Linux TV code). We have to fix some other code depending on it. For the most part, we just replace the MP_FOURCC macro with libavutil's MKTAG (although the macro definition is exactly the same). In demux_raw, we drop some pre-defined FourCCs, but it's not like it matters. (Instead of --demuxer-rawvideo-format use --demuxer-rawvideo-mp-format.)
* win_state: change license to LGPLwm42017-06-171-7/+7
| | | | | | All relevant authors have agreed. Also correct an unrelated entry in the "Copyright" file.
* aspect: change license to LGPLwm42017-06-172-14/+14
| | | | | | | | | | | | | | | Quite chaotic history, which code being moved, refactored, duplicated, unified a bunch of times. But I think everything is covered by LGPL agreements. In one case, cehoyos (who didn't agree) applied a patch by someone who agreed, but didn't change anything (except weirdly adding German translations). In another case, cehoyos moved code covered by LGPL agreements (without changing it), which was later used for some other code. We consider both cases not relevant for copyright. win_state.c/.h is similar, but pending for reply by the author of 2ab259e68 (I guess).
* vo_opengl: fall back to ordered dither instead of blowing upwm42017-06-171-4/+9
| | | | | | | | | | | | | In GLES 2 mode, we can do dither, but "fruit" dithering is still out of the question, because it does not support any high depth textures. (Actually w