summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* 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-183-1/+21
| | | | | | | | 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-183-0/+17
| | | | | | | | 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.
* csputils: implement sony s-gamutNiklas Haas2017-06-182-0/+10
| | | | The S-Log "matching" colorspace
* vo_opengl: tone map in linear XYZ instead of RGBNiklas Haas2017-06-183-6/+33
| | | | | | | | | | | | | 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?
* vf_format: also reset gamma-related attributes when changing gammaNiklas Haas2017-06-181-1/+9
| | | | | | This prevents nasty surprises like the sig-peak still being left at 1.0 when reinterpreting SDR as HDR, or the OOTF for HLG being left as display-referred.
* vo_opengl: implement support for OOTFs and non-display referred contentNiklas Haas2017-06-187-8/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-184-36/+32
| | | | | | | | | | 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.
* vd: use ST.2086 / HDR10 MaxCLL in addition to mastering metadataNiklas Haas2017-06-183-18/+36
| | | | | | | | | | | | | MaxCLL is the more authoritative source for the metadata we are interested in. The use of mastering metadata is sort of a hack anyway, since there's no clearly-defined relationship between the mastering peak brightness and the actual content. (Unlike MaxCLL, which is an explicit relationship) Also move the parameter fixing to `fix_image_params` I don't know if the avutil check is strictly necessary but I've included it anyway to be on the safe side.
* video: refactor HDR implementationNiklas Haas2017-06-188-109/+82
| | | | | | | | | | | | | | | 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.
* dec_video: change license to LGPL (almost)wm42017-06-182-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Almost" because this might contain copyright by michael, who agreed with LGPL, but only once the core is LGPL. This is preparation for that to happen. Apart from that, the usual remarks apply. In particular, dec_video.c started out quite chaotic with no modularization, but was later basically gutted, and in general rewritten a bunch of times. Not going to give a history lesson. Special attention needs to be given to 3 patches by cehosos, who did not agree to the relicensing: 240b743ebdf: --field-dominance e32cbbf7dc3: reinit VO if aspect ratio changes 306f6243fdf: use container aspect if codec aspect unset (?) The first patch is pretty clearly still in the current code, and needs to be disabled for LGPL. The functionality of the second patch is still active, but implemented completely different, and as part of general frame parameter changes (at the time of the patch, MPlayer already reinitialized the VO on frame size and pixel format changes - all this was merged into a single check for changing image parameters). The third patch makes me a bit more uncomfortable. It appears the code was moved to dec_video.c in de68b8f23c8c, and further changed in 82f0d373, 0a0bb905, and bf13bd0d. You could claim that cehoyos' copyright still sticks. Fortunately, we implement alternative aspect detection, which is simpler and probably preferable, and which arguably contains none of the original code and logic, and thus should be fully safe. While I don't know if cehoyos' copyright actually still applies, I'm more comfortable with making the code GPL-only for now. Also change the default to use the (in future) plain LGPL code, and deprecate the one associated with the GPL code, so we can eventually remove the GPL code. But it's also possible we decide that the copyright doesn't apply, and undo the deprecation and GPL guards. I expect that users won't notice anything. If you ask me, the old aspect method was probably an accidental bug instead of intentional behavior. Although, the new aspect method was broken too, so I had to fix it.
* image_writer, vo_image: change license to LGPLwm42017-06-183-24/+21
| | | | | | | | | | | | | | | | | | 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).
* video/fmt-conversion, img_format: change license to LGPLwm42017-06-184-28/+28
| | | | | | | | | | | | | | | | | | | | | | The problem with fmt-conversion.h is that "lucabe", who disagreed with LGPL, originally wrote it. But it was actually rewritten by "reimar" later. The original switch statement was replaced with a lookup table. No code other than the imgfmt2pixfmt() function signature survives. Neither the format pairs (PIXFMT<->IMGFMT), nor the concept of mapping them, can be copyrighted. So changing the license should be fine, because reimar and all other authors involved with the new code agreed to LGPL. We also don't consider format pairs added later as copyrightable. (The direct-mapping idea mentioned in the "Copyright" file seems attractive, and I might implement in later anyway.) Likewise, there might be some format names added to img_format.h, which are not covered by relicensing agreements. These all affect "later" additions, and they follow either the FFmpeg PIXFMT naming or some other pre-existing logic, so this should be fine.
* img_format: drop unused aliaseswm42017-06-182-9/+0
| | | | vo_opengl uses those automatically via pixdesc.
* Drop/move img_fourcc.hwm42017-06-183-53/+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.)
* img_format: minor simplificationwm42017-06-182-4/+2
|
* vf_dlopen: remove this filterwm42017-06-183-447/+0
| | | | | | | | | | | | | | | | It was an attempt to move some MPlayer filters (which were removed from mpv) to external, loadable filters. That worked well, but then the MPlayer filters were ported to libavfilter (independently), so they're available again. Also there is a more widely supported and more advanced loadable filter system supported by mpv: vapoursynth. In conclusion, vf_dlopen is not useful anymore, confusing, and requires quite a bit of code (and probably wouldn't survive the rewrite of the mpv video filter chain, which has to come at some point). It has some implicit dependencies on internal conventions, like possibly the format names dropped in the previous commit. We also deprecated it last release. Drop it.
* img_format: drop legacy name mappingswm42017-06-181-18/+1
| | | | Not needed anymore.
* 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 we probably could use an 8 bit texture too for this, at least with small matrix sizes, but it's still too much of a pain to convert the data, so why bother.) This is actually a regression; before this, forcibly enabling dumb mode due to low GL caps actually happened to avoid this case. Fixes #4519.
* mp_image: change license to LGPL (almost)wm42017-06-162-6/+5
| | | | | | | | | | | | | | | | | | | | | | Since michael was somewhat involved in it, wait with the actual license change until the core is relicensed. Thus mark it as "Almost LGPL.". The worrisome part about mp_image.c is that it was created by cehoyos (which disagreed with LGPL) in commit f2dee327b2797. But it turns out it was a patch by someone else (who agreed with LGPL). For some reason, the patch was actually slightly modified by cehoyos for no reason (messed with the include statements), so we mess them back, just to be sure. Other than this, there were some commits that added support for new IMGFMTs over the years. Some of these were by people we didn't ask or we didn't get permission from. But since the original mp_image code was replaced by more generic code using FFmpeg pixdesc, none of these changes are left anyway. One additional change by cehoyos (115bfb976270) has been removed as well (when "direct rendering" was dropped from the filter chain).
* vd, vd_lavc: change license to LGPL (almost)wm42017-06-152-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | iive agreed only to LGPL 3.0+ only. All of his relevant changes are for XvMC, for which mpv completely dropped support back in mplayer2 times. But you could claim that the get_format code represents some residual copyright (everything else added by iive was removed, only get_format still is around in some form). While I doubt that this is relly copyright-relevant, consider it is for now. michael is the original author of vd_lavc.c, so this file can become LGPL only after the core becomes LGPL. cehoyos did not agree with the LGPL relicensing, but all of his code is gone. Some others could not be reached, but their code is gone as well. In particular, vdpau support, which was originally done by Nvidia, had larger impact on vd_lavc.c, but vdpau support was first refactored a few times (for the purpose of modularization) and moved to different files, and then decoding was completely moved to libavcodec. Lastly, assigning the "opaque" field was moved by Gwenole Beauchesne in commit 8e5edec13eab. Agreement is pending (due to copyright apparently owned by the author's employer). So just undo the change, so we don't have to think about whether the change is copyrightable.
* encode_lavc: move from GPL 2+ to LGPL 2.1+.Rudolf Polzer2017-06-131-7/+7
|
* vo_opengl: change default tone mapping algorithmNiklas Haas2017-06-101-1/+1
| | | | | d8a3b10f4 was supposed to change this (as reflected in the man page and commit message), I just forgot.
* vo_opengl: add new HDR tone mapping algorithmNiklas Haas2017-06-093-0/+17
| | | | | | | | | | | | | | | | | I call it `mobius` because apparently the form f(x) = (cx+a)/(dx+b) is called a Möbius transform, which is the algorithm this is based on. In the extremes it becomes `reinhard` (param=0.0 and `clip` (param=1.0), smoothly transitioning between the two depending on the parameter. This is a useful tone mapping algorithm since the tunable mobius transform allows the user to decide the trade-off between color accuracy and detail preservation on a continuous scale. The default of 0.3 is already far more accurate than `reinhard` while also being reasonably good at preserving highlights, without suffering from the overall brightness drop and color distortion of `hable`. For these reasons, make this the new default. Also expand and improve the documentation for these tone mapping functions.
* mp_image: refuse to convert frames of unknown format to AVFramewm42017-06-081-0/+2
| | | | | This could happen with some "special" hwaccel formats, that exist in mpv, but not libavutil.
* d3d: add support for new libavcodec hwaccel APIwm42017-06-0811-13/+391
| | | | | | Unfortunately quite a mess, in particular due to the need to have some compatibility with the old API. (The old API will be supported only in short term.)
* vo_drm: fallback to vo_wait_default if VT switcher is not availablerslovers2017-06-081-0/+2
| | | | | | | | | | | | | | | | | | | When the drm video output is used under VT with a terminal multiplexer like screen, the VT_SETMODE ioctl call will fail since the controlling terminal is a pseudoterminal instead of a real one, thus the VT switcher will be unavailable. The problem is, the wait_events function inside vo_drm.c will test for this, and will do nothing if the switcher is not active. Normally, this would not be noticed, however, when you pause a video, or if you're playing multiple image files, mpv will suddenly start busy waiting on a single core. I confirmed this by building mpv with gprof support, in a few seconds, wait_events got called about 90 million times. So I added a fallback, when the VT switcher is not availble, just use the vo_wait_default function. I tested it and it's working well so far.
* vo_opengl: hwdec_cuda: Support separate decode and display devicesPhilip Langdale2017-06-032-12/+47
| | | | | | | | | | | | | | | | | In a multi GPU scenario, it may be desirable to use different GPUs for decode and display responsibilities. For example, if a secondary GPU has better video decoding capabilities. In such a scenario, we need to initialise a separate context for each GPU, and use the display context in hwdec_cuda, while passing the decode context to avcodec. Once that's done, the actually hand-off between the two GPUs is transparent to us (It happens during the cuMemcpy2D operation which copies the decoded frame from a cuda buffer to the OpenGL texture). In the end, the bulk of the work is around introducing a new configuration option to specify the decode device.
* af, vf: improvements to libavfilter bridgewm42017-05-312-1/+8
| | | | | | Add the "lavfi-" prefix (details see manpage additons). Tag the filter name as "(lavfi)" in the verbose filter list output.
* video/out/wayland/buffer.c: Add missing free()Raúl Peñacoba2017-05-261-1/+4
|
* videotoolbox: support new libavcodec APIwm42017-05-244-0/+88
| | | | | | | | | | | The new API has literally no advantages (other than that we can drop mp_vt_download_image and other things later), but it's sort-of uniform with the other hwaccels. "--videotoolbox-format=no" is not supported with the new API, because it doesn't "fit in". Probably could be added later again. The iOS code change is untested (no way to test).
* vd_lavc: check for missing device_ctx refwm42017-05-241-0/+5
| | | | | | It's not really guaranteed that other components always set this (e.g. on subtle errors), so check it explicitly. Although I'm not aware of a failing case.
* hwdec: fix 2 commentswm42017-05-241-2/+1
| | | | The first is outdated, the second was always wrong.
* demux_raw: drop "mp-rawvideo" usewm42017-05-201-5/+0
| | | | | | This is an old pseudo codec to pass through the pixel format. Setup a suitable AVCodecParameter directly instead, so the "rawvideo" codec can be used.
* cocoa: properly unhide Dock when quitting during System fs animationAkemi2017-05-192-0/+64
| | | | | | | | when quitting mpv during the System fullscreen animation cocoa can't reset some flags properly and won't reset the Dock hiding behaviour to it's previous state. Fixes #4400
* vdpau: crappy hack to allow initializing hw decoding after preemptionwm42017-05-193-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If vo_opengl is used, and vo_opengl already created the vdpau interop (for whatever reasons), and then preemption happens, and then you try to enable hw decoding, it failed. The reason was that preemption recovery is not run at any point before libavcodec accesses the vdpau device. The actual impact was that with libmpv + opengl-cb use, hardware decoding was permanently broken after display mode switching (something that caused the display to get preempted at least with older drivers). With mpv CLI, you can for example enable hw decoding during playback, then disable it, VT switch to console, switch back to X, and try to enable hw decoding again. This is mostly because libav* does not deal with preemption, and NVIDIA driver preemption behavior being horrible garbage. In addition to being misdesigned API, the preemption callback is not called before you try to access vdpau API, and then only with _some_ accesses. In summary, the preemption callback was never called, neither before nor after libavcodec tried to init the decoder. So we have to get mp_vdpau_handle_preemption() called before libavcodec accesses it. This in turn will do a dummy API access which usually triggers the preemption callback immediately (with NVIDIA's drivers). In addition, we have to update the AVHWDeviceContext's device. In theory it could change (in practice it usually seems to use handle "0"). Creating a new device would cause chaos, as we don't have a concept of switching the device context on the fly. So we simply update it directly. I'm fairly sure this violates the libav* API, but it's the best we can do.
* context_angle: fix fallback to D3D9 deviceJames Ross-Gowan2017-05-161-30/+56
| | | | | | | | | This was broken in e0250b9604b2. In some cases, device creation will succeed, but creating an EGL context on the device will fail. With --angle-renderer=auto, it should try to create the context again on a D3D9 device. This fixes mpv in Windows Vista on VirtualBox for me.
* w32_common: drop TLS usageJames Ross-Gowan2017-05-161-20/+21
| | | | | | | | | | | This was added in 3f268cc4f2a4 because it wasn't clear whether WM_NCCREATE could be used to send a context pointer from CreateWindowEx to the window procedure. WM_NCCREATE isn't always the first message sent to a window, but this seems to be because of an undocumented but well-known bug where, for top-level overlapped windows, a spurious WM_GETMINMAXINFO arrives first instead. The WM_GETMINMAXINFO can be safely ignored, so it is still okay to pass the context struct in WM_NCCREATE.
* csputils: code clarityNiklas Haas2017-05-131-5/+5
| | | | | `cmax` is more intuitive than `cmin` especially for full-range YUV, and this also explains the behavior of `anyfull` better.
* w32_common: use the proper keycodes for XBUTTON1/2James Ross-Gowan2017-05-121-2/+2
| | | | | | | mpv's mouse button numbering is based on X11, which means XBUTTON1 and 2 on Windows (the "back" and "forward" buttons) should map to MOUSE_BTN7 and 8 in mpv. MOUSE_BTN5 and 6 refer to the horizontal scroll buttons on mouses that have them.
* w32_common: generate MP_AXIS_* keycodes for scrollingJames Ross-Gowan2017-05-121-8/+18