summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: remove prescaling framework with superxbr prescalerBin Jin2016-06-184-351/+2
| | | | Signed-off-by: wm4 <wm4@nowhere>
* vo_opengl: remove uniform buffer object routinesBin Jin2016-06-184-44/+2
|
* vo_opengl: remove nnedi3 prescalerBin Jin2016-06-185-367/+0
|
* cocoa: fix display refresh rate retrieval on multi monitor setupsAkemi2016-06-182-4/+17
| | | | | | | | | | | | | | | | | | 1. this basically reverts commit de4c74e5a4a996e8ff431c8f33a32c4b580be203. even with CVDisplayLinkCreateWithActiveCGDisplays and CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext we still have to explicitly set the current display ID, otherwise it will just always choose the display with the lowest refresh rate. another weird thing is, we still have to set the display ID another time with CVDisplayLinkSetCurrentCGDisplay after the link was started. otherwise the display period is 0 and the fallback will be used. if we ever use the callback method for something useful it's probably better to use CVDisplayLinkCreateWithActiveCGDisplays since we will need to keep the display link around instead of releasing it at the end. in that case we have to call CVDisplayLinkSetCurrentCGDisplay two times, once before and once after LinkStart. 2. add windowDidChangeScreen delegate to update the display refresh rate when mpv is moved to a different screen.
* cocoa: fix actual display refresh rate retrievalAkemi2016-06-181-3/+18
| | | | | | | | | | | | | We have two problems here. 1. CVDisplayLinkGetActualOutputVideoRefreshPeriod, like the name suggests, returns a frame period and not a refresh rate. using this as screen_fps just leads to a slideshow. why didn't this break video playback on OS X completely? the answer to this leads us to the second problem. 2. it seems that CVDisplayLinkGetActualOutputVideoRefreshPeriod always returns 0 if used without CVDisplayLinkSetOutputCallback and hence always fell back to CVDisplayLinkGetNominalOutputVideoRefreshPeriod. adding a callback to CVDisplayLink solves this problem. the callback function at this moment doesn't do anything but could possibly used in the future.
* vo_opengl: dxinterop: render to gl->main_fbJames Ross-Gowan2016-06-181-54/+5
| | | | | | | This can also remove all the stuff for lazily attaching the texture. It doesn't matter if the dxinterop backend changes the bound framebuffer during a VOCTRL, since the renderer does not rely on the GL state being preserved.
* vo_opengl: add ability to render to an arbitrary backing framebufferwm42016-06-183-1/+9
| | | | | | | Most of the functionality already exists for the sake of vo_opengl_cb. We only have to use it. This will be used by dxinterop in the following commit.
* sub, vo_opengl: use packed sub-bitmaps directly if availablewm42016-06-171-28/+80
| | | | | | | | | | | | | | | | | | The previous few commits changed sd_lavc.c's output to packed RGB sub- images. In particular, this means all sub-bitmaps are part of a larger, single bitmap. Change the vo_opengl OSD code such that it can make use of this, and upload the pre-packed image, instead of packing and copying them again. This complicates the upload code a bit (4 code paths due to messy PBO handling). The plan is to make sub-bitmaps always packed, but some more work is required to reach this point. The plan is to pack libass images as well. Since this implies a copy, this will make it easy to refcount the result. (This is all targeted towards vo_opengl. Other VOs, vo_xv, vo_x11, and vo_wayland in particular, will become less efficient. Although at least vo_vdpau and vo_direct3d could be switched to the new method as well.)
* sub: move paletted image handling completely to sd_lavc.cwm42016-06-171-1/+2
| | | | | | | | | | | | | | | | | | | Until now, subtitle renderers could export SUBBITMAP_INDEXED, which is a 8 bit per pixel with palette format. sd_lavc.c was the only renderer doing this, and the result was converted to RGBA in every use-case (except maybe when the subtitles were hidden.) Change it so that sd_lavc.c converts to RGBA on its own. This simplifies everything a bit, and the palette handling can be removed from the common code. This is also preparation for making subtitle images refcounted. The "caching" in img_convert.c is a PITA in this respect, and needs to be redone. So getting rid of some img_convert.c code is a positive side- effect. Also related to refcounted subtitles is packing them into a single mp_image. Fewer objects to refcount is easier, and for the libass format the same will be done. The plan is to remove manual packing from the VOs which need single images entirely.
* bitmap_packer: make manual use slightly more convenientwm42016-06-171-12/+14
| | | | | | | | | | | | | | | | | Apply the padding internally to each input bitmap, instead of requiring this for the semi-public API. Right now, everything still uses packer_pack_from_subbitmaps() to fill the input bitmap sizes, but that's going to change with the following commit. Since bitmap_packer.in is mutated during packing anyway, it's more convenient to add the padding automatically. Also, guarantee that every sub-bitmap has a padding border around it. Don't let the padding overlap. Add padding even on the containing borders. This is simpler, doesn't cost much in memory usage, and is convenient for one of the following commits.
* d3d11va: remove unused d3d11va_surface.subindex fieldwm42016-06-161-3/+1
| | | | This is now stored within the AVFrame/mp_image.
* vf_d3d11vpp: flush device context only when using shared textureswm42016-06-161-1/+2
| | | | Reduces interference with pass-through case, where this is not needed.
* vf_d3d11vpp: make missing deinterlacing caps non-fatalwm42016-06-161-3/+2
| | | | Instead, warn.
* vf_d3d11vpp: log some video processor creation parameterswm42016-06-161-2/+7
|
* vo_opengl: use EXT_disjoint_timer_query for timersJames Ross-Gowan2016-06-151-0/+16
| | | | | | This is the ES equivalent to ARB_timer_query. It enables the performance timers on ANGLE. All the added functions should be identical in semantics to their desktop GL equivalents.
* vo_opengl: fix framebuffer object namewm42016-06-151-3/+4
| | | | | | | | | The OpenGL 3.0+ and ES specs are quite clear on what values are accepted for the attachment object name parameter. And there's no overlap for the default framebuffer. Sigh. Probably fixes Mesa raising an error in this case and might fix #3251. Regression by the previous vo_opengl change.
* vo_opengl: use standard functions to retrieve display depthwm42016-06-1410-59/+21
| | | | | | | | | | | | | Until now, we've used system-specific API (GLX, EGL, etc.) to retrieve the depth of the default framebuffer. (We equal this to display depth and use the determined depth for dithering.) We can actually retrieve this value through standard GL API, and it works everywhere (except GLES 2 of course). This simplifies everything a great deal. egl_helpers.c is empty now. But I expect that some EGL boilerplate will be moved to it, so don't remove it yet.
* vo_opengl: hwdec_d3d11egl: remove ES2 swizzle special-casewm42016-06-131-2/+2
| | | | | | | | This was somehow done under the assumption that ANGLE would somehow always use RG in ES2 mode. But there's no basis for this. Even if ANGLE supports NV12 textures with drivers that do not allow for texture_rg, this cas eis too obscure to worry about. So do the robust and correct thing instead, and disable this code if texture_rg is not available.
* vo_rpi: fix destroying overlaysGusar3212016-06-131-0/+3
| | | | | | | Commit 74e3d11 resulted in the background overlay not getting destroyed when mpv quits. Add back a piece of code that was removed in that commit to restore correct functionality. Fixes issue #3100
* vo_opengl: make size of OUTPUT available to user shadersBin Jin2016-06-121-0/+9
|
* win32: use HINST_THISCOMPONENTJames Ross-Gowan2016-06-112-9/+13
| | | | | | | | | | | | | | | This is a common idiom used in MSDN docs and Raymond Chen's example programs to get a HINSTANCE for the current module, regardless of whether it's an .exe or a .dll. Using GetModuleHandle(NULL) for this is technically incorrect, since it always gets a handle to the .exe, even when the executing code (in libmpv) is running in a .dll. In this case, using the wrong HINSTANCE could cause namespace issues with window classes, since CreateWindowEx uses the HINSTANCE to search for the matching window class name. See: https://blogs.msdn.microsoft.com/oldnewthing/20050418-59/?p=35873 https://blogs.msdn.microsoft.com/oldnewthing/20041025-00/?p=37483
* cocoa: use displaylink without manually tracking the display idStefano Pigozzi2016-06-111-5/+6
| | | | | Maybe it partially helps with #2392 (on dual display setups). Either way, it makes the code simpler.
* vo_sdl: fix pixel formats.Rudolf Polzer2016-06-101-12/+9
| | | | | | | | | | | There were two mistakes: - SDL's RGB565 is always equivalent to ffmpeg's RGB565 (both are packed 16bit native-endian integers in RGB=565 form) - this was wrongly reversed on big endian platforms. - SDL's RGB888 doesn't actually mean RGB24, but XRGB8888 (i.e. 32bit packed integer, top 8 bits unused). - Use RGB0 not RGBA when there is no alpha.
* vo_opengl: request core profile on X11/EGL toowm42016-06-101-0/+11
| | | | Avoids that some OpenGL implementation will pin it to 3.0.
* vo_opengl: increase the size limit for cached fileBin Jin2016-06-101-1/+1
| | | | | | This is mainly for the nnedi3 user shader. With all whose NN weights hardcoded into the shader source code, the shader file could be as large as 300 kB.
* vo_opengl: hwdec_d3d11eglrgb: remove some more unused fieldswm42016-06-091-30/+0
| | | | Not sure what/if I was thinking there.
* vo_opengl: fix d3d11 hardware decoding probing on Windows 7wm42016-06-094-0/+38
| | | | | | | | | | | | | | | Although D3D11 video decoding is unuspported on Windows 7, the associated APIs almost work. Where they fail is texture creation, where we try to create D3D11_BIND_DECODER surfaces. So specifically try to detect this situation. One issue is that once the hwdec interop is created, the damage is done, and it can't use another backend (because currently only 1 hwdec backend is supported). So that's where we prevent attempts to use it. It still can fail when trying to use d3d11va-copy (since that doesn't require an interop backend), but at that point we don't care anymore - dxva2(-copy) is tried before that anyway.
* vo_opengl: hwdec_d3d11eglrgb: remove unused fieldswm42016-06-091-3/+0
| | | | Leftovers.
* vo_opengl: hwdec_vdpau: remove minor code duplicationwm42016-06-081-13/+11
| | | | | Move unmap() to the top of the function, and replace some duplicated code with a call to it.
* vo_opengl: make user hook passes optionalNiklas Haas2016-06-083-16/+72
| | | | | | | | | | | | | | | | User hooks can now use an extra WHEN expression to specify when the shader should be run. For example, this can be used to only run a chroma scaling shader `WHEN CHROMA.w LUMA.w <`. There's a slight semantics change to user shaders: When trying to bind a texture that does not exist, a shader will now be silently skipped (similar to when the condition is false) instead of generating an error. This allows shader stages to depend on an optional earlier stage without having to copy/paste the same condition everywhere. (In other words: there's an implicit condition on all of the bound textures existing)
* vo_opengl: do not leak previous FBO when reallocating itwm42016-06-081-0/+2
| | | | WTF of the day.
* hwdec_d3d11eglrgb: reduce log level when probingJames Ross-Gowan2016-06-091-3/+5
| | | | | | | | | | When using --hwdec=auto, systems that don't provide D3D11_CREATE_DEVICE_VIDEO_SUPPORT, which probably includes all Windows Vista and 7 systems, will print an error message. Reduce the log level to verbose when probing and skip the error message entirely if d3d11.dll is not present. This commit is in a similar spirit to 991af7d.
* vo_opengl: hwdec_d3d11egl: remove broken code on error pathwm42016-06-081-1/+0
| | | | | If ID3D11Device_QueryInterface fails, "multithread" will be set to NULL. The _Release would just make it crash with a null pointer deref.
* build: silence -Wunused-resultNiklas Haas2016-06-072-4/+4
| | | | | | | | For clang, it's enough to just put (void) around usages we are intentionally ignoring the result of. Since GCC does not seem to want to respect this decision, we are forced to disable the warning globally.
* vo_opengl: avoid outputting ultra-wide-gamut by defaultNiklas Haas2016-06-071-1/+13
| | | | | | | | | | | | The default behavior of vo_opengl has pretty much always been 'show the source colors as-is, without caring to adapt it to the target device'. This decision is mostly based on the fact that if we do anything else, lots of people will complain. With the rise of content like BT.2020, however, it turns out more people complain about this content being very desaturated than people complain about this content not matching VLC - so let's just map ultra-wide gamut content back down to standard gamut by default.
* vo_opengl: also collect upload perfdata for hwdecNiklas Haas2016-06-071-0/+4
| | | | | | Instead of measuring the actual upload time, this instead measures the time needed to render + map the texture via vdpau. These numbers are still useful, since they're part of the critical path.
* vo_opengl: expose performance timers as propertiesNiklas Haas2016-06-074-0/+34
| | | | | | | | | | | This is plumbed through a new VOCTRL, VOCTRL_PERFORMANCE_DATA, and exposed as properties render-time-last, render-time-avg etc. All of these numbers are in microseconds, which gives a good precision range when just outputting them via show-text. (Lua scripts can obviously still do their own formatting etc.) Signed-off-by: wm4 <wm4@nowhere>
* vo_opengl: add time queriesNiklas Haas2016-06-075-0/+208
| | | | | | | | | | | | | | | | | | To avoid blocking the CPU, we use 8 time objects and rotate through them, only blocking until the last possible moment (before we need access to them on the next iteration through the ring buffer). I tested it out on my machine and 4 query objects were enough to guarantee block-free querying, but the extra margin shouldn't hurt. Frame render times are just output at the end of each frame, via MP_DBG. This might be improved in the future. (In particular, I want to expose these numbers as properties so that users get some more visible feedback about render times) Currently, we measure pass_render_frame and pass_draw_to_screen separately because the former might be called multiple times due to interpolation. Doing it this way gives more faithful numbers. Same goes for frame upload times.
* dxva2: remove dead code in failure caseJames Ross-Gowan2016-06-071-3/+0
| | | | | This was made unnecessary by a02d77b, since the only way the function could fail was by failing to add a reference to the DirectX DLLs.
* vo_opengl: angle: prevent DXGI hooking Alt+EnterJames Ross-Gowan2016-06-071-0/+73
| | | | | | | | | | When ANGLE is using D3D11 and not running in DirectComposition mode, DXGI will hook the video window's message loop and override Alt+Enter to trigger a transition to exclusive fullscreen mode (which doesn't even work with mpv's renderer for some reason.) This behaviour can be disabled by getting a pointer to the IDXGIFactory associated with the D3D11 device and calling MakeWindowAssociation with the appropriate flags.
* vo_opengl: apply vo-cmdline command incrementallywm42016-06-053-27/+26
| | | | | | | | | | Instead of implicitly resetting the options to defaults and then applying the options, they're always applied on top of the current options (in the same way adding new options to the CLI command line will). This does not apply to vo_opengl_cb, because that has an even worse mess which I refuse to deal with.
* vo_opengl_cb: icc-profile-auto does not and will not workwm42016-06-051-0/+2
| | | | | In theory we could probably make icc-profile-auto a vo_opengl-specific option, but I won't bother with this. Logging an error is simpler.
* vo_opengl: possibly update icc profile after changing optionswm42016-06-051-7/+12
| | | | | Changing the options can enable icc-profile-auto, and in this case the profile has to be reteieved again from the system.
* vo_opengl: somewhat simplify suboption handling messwm42016-06-041-64/+16
| | | | | | | | | | | | | | | Enable m_sub_options_copy() to copy nested sub-options, and also enable it to create an option struct from defaults. We can get rid of most of the crap in assign_options() now. Calling handle_scaler_opt() to get a static allocation for scaler name is still needed. It's moved to reinit_scaler(), which seems to be a better place for it. Without it, dangling pointers could be created when options are changed. (And in fact, this fixes possible dangling pointers for window.name.) In theory we could create a dynamic copy, but that seemed even more messy. Chance of regressions.
* vo_opengl: cleanup icc + runtime option changing behaviorwm42016-06-043-43/+72
| | | | | | | | | | | | | | Commit 026b75e7 actually enabled changing icc options at runtime (via vo_cmdline), but it didn't quite work. In particular, changing the icc- profile option just kept the old profile, because it was cached accordingly. As part of this, change gl_lcms.opts from a struct to a pointer to a struct. We properly copy it, instead of allowing possibly dangling strings, like it was done in a working but unclean way before. Also, reinit the whole rendering chain when the auto icc profile changes, just like it's done when icc options are changed.
* vo_opengl: minor simplification to gl_lcms_set_memory_profile()wm42016-06-043-11/+11
| | | | | | Passing the bstr thing as pointer makes no sense. Everywhere else bstr structs are passed by value because they're so small. Only when it's supposed to receive a return value they're not.
* vo_opengl: remove pointless NULL-checkwm42016-06-041-1/+1
| | | | It's never NULL.
* vo_opengl: move all icc handling from vo_opengl.c to video.cwm42016-06-035-26/+35
| | | | | | | | | | | | | | | Originally, video.c did not access any CMS things (other than lut3d being set on it), but this has changed. In practice, almost all accesses to it have moved to video.c. vo_opengl only created it, and set the auto icc profile path. Complete the move. Some things wrt. option handling are a bit fishy. (But when is this not the case.) icc-profile-auto was not tested, but the distributed human CI will take care of it.
* vo_opengl: move struct lut3d definitionwm42016-06-033-8/+6
| | | | | This was dumb. Also, lcms.h has actually no need to include video.h besides this and csputils.h (makes it slightly less entangled).
* vo_opengl: fix giant memory leaks with icc profileswm42016-06-031-0/+2
| | | | Well this was dumb.
* wayland: mark existing dnd entry print as debug rather than an errorRostislav Pehlivanov2016-05-311-1/+1
| | | | | | | | It gets printed on every alt+tab or desktop switch under mutter and weston, and offers no useful information since it's handled by destroying the previous entry. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* wayland: correctly report display refresh rateRostislav Pehlivanov2016-05-311-4/+6
| | | | | | | | | | | | This commit will cause the wayland backend and vo to correctly report the display frame rate. This didn't work as VOCTRL_GET_DISPLAY_FPS was received way too early, before the window was created (and thus current_output set). The VO will now signal VO_EVENT_WIN_STATE after window initialization and upon a resize. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* vo_opengl: default hdr-tone-mapping to hableNiklas Haas2016-05-301-0/+2
| | | | | | | | | This algorithm works really well. Setting it is a much better "out-of-the-box" experience than just clipping, which will always look ugly. In other words, with this default, users of mpv will just be able to play HDR content without even realizing it's HDR (pretty much).
* vo_opengl: refactor HDR mechanismNiklas Haas2016-05-306-27/+54
| | | | | | | | | | | | | | | | | | | | Instead of doing HDR tone mapping on an ad-hoc basis inside pass_colormanage, the reference peak of an image is now part of the image params (alongside colorspace, gamma, etc.) and tone mapping is done whenever peak_src != peak_dst. To get sensible behavior when mixing HDR and SDR content and displays, target-brightness is a generic filler for "the assumed brightness of SDR content". This gets rid of the weird display_scaled hack, sets the framework for multiple HDR functions with difference reference peaks, and allows us to (in a future commit) autodetect the right source peak from the HDR metadata. (Apart from metadata, the source peak can also be controlled via vf_format. For HDR content this adjusts the overall image brightness, for SDR content it's like simulating a different exposure)
* wayland: implement HIDPI supportRostislav Pehlivanov2016-05-304-12/+50
| | | | | | | | | | | | | | | | | | | | | | | | | The wayland protocol exposes scaling done by the compositor to compensate for small window sizes on small high DPI displays. If the program ignores the scaling done, what'll happen is the compositor is going to ask the program to be scaled down by N times the window size and then it'll upscale the program's surface by N times. The scaling algorithm seems to be bilinear so the scaling is quite obvious. This commit sets up callbacks to listen for the scaling factor of each output and, on rescale events, notifies the compositor that the surface's scale is what the compositor asked for and changes the player's surface to the appropriate size, causing no scaling to be done by the compositor. Compositors not supporting this interface will ignore the callbacks and do nothing, keeping program behaviour the same. For compositors supporting and using this interface (mutter), this will fix the rendering to be pixel precise as it should be. Both the opengl wayland backend and the wayland vo have been fixed to support this. Verified to not break either on weston and mutter. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
* vf: fix filter auto-insertionwm42016-05-301-3/+13
| | | | | | | | | | | | | Commit 0348cd08 was too naive/simple, and always inserted the d3d11