summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: greatly increase smoothmotion performanceNiklas Haas2015-02-252-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. (cherry picked from commit 010cf183fe3133fe6f581f9b25137827c6b26a39)
* vo_opengl: another GLES2 issuewm42015-02-251-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.) (cherry picked from commit cc011415ffb10521260e486a41b56d0080bf2cd9)
* vo_opengl: extend ifdef against shader arrayswm42015-02-251-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.) (cherry picked from commit 2c8d16d89f6f64a587222dd53a3d27b2a218ee01)
* video: remove redundant codec parameterswm42015-02-251-5/+0
| | | | | | | | | Remove coded_width and coded_height. This was originally added in commit fd7dde40, when BITMAPINFOHEADER was killed. The separate fields became redundant in commit e68f4be1. Remove them (nothing passed to the decoders actually changes with _this_ commit). (cherry picked from commit 5baf74fa24493298fc83336da77f400ddac29d55)
* vf: fix indentation level of verbose outputwm42015-02-251-2/+2
| | | | | | | Just so that it has the same indentation as the extremely similar audio filter output. (cherry picked from commit 24e72801788760ac4e3c998517717fd075ecd64c)
* vo_opengl: slightly improve ewa_lanczos windowingNiklas Haas2015-02-251-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. (cherry picked from commit 1ecd9727f0e3df68c6be9955b759547a34a0b79f)
* video: un-discourage "vaapi-copy" hwdec modewm42015-02-211-5/+0
| | | | | | | Maybe I don't know what I'm doing. I'm fairly certain though that Intel does not know what they're doing. (cherry picked from commit d71bbcbc98c1fa8a934ee656b13adda089a11681)
* vo_opengl: minor robustness improvement in function loaderwm42015-02-211-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". (cherry picked from commit 9861abf8ffa4c9e7c4ad9a4f3f667e6f833624a3)
* vo_opengl: fix smoothmotion coefficient calculation, for real this timeNiklas Haas2015-02-211-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. (cherry picked from commit 4356e893a138e24f2d54dee2b96d2720e69d4c18)
* vo_opengl: glsl: remove trailing \wm42015-02-191-2/+2
| | | | | | | This should be no problem... but it _might_ help with #1536, so it's worth a try. (cherry picked from commit 0063d94927a0dfd1ba8f4af1bc59467ba793ef82)
* vd_lavc: uninit the hwdec backend after closing the decoderwm42015-02-161-6/+3
| | | | | | | | | | | | | | | | | | | A recent behavior change in libavcodec's h264 decoder keeps at least 1 surface even after avcodec_flush_buffers() has been called. We used to flush the decoder in order to make sure all surfaces are free'd, so that the hw decoder can be safely uninitialized. This doesn't work anymore. Fix it by closing the AVCodecContext before the hw decoder is uninitialized. This is actually simpler and more robust. It seems to be well-supported too. Fixes invalid read accesses with vaapi-copy and dxva2-copy. These destroyed the hwdec API fully on uninit, and could not deal with surfaces surviving the decoder. Probably fixes #1587. (cherry picked from commit cf073138b289243fb551242f8058a4f8490cc9af)
* x11: fix uninitialized variable readswm42015-02-161-1/+1
| | | | | | This line of code ended up in the wrong block in commit cd6dfcbe. (cherry picked from commit f247294d7346306ef9f42a986d693df4743f9152)
* x11: add XK_Cancel to the list of special keysMartin Herkt2015-02-161-0/+1
| | | | | | | Some IR receivers emit this key by default for remote control buttons. Make it mappable. (cherry picked from commit 9aaec7cffb2fb1543d4c3cabb55165f606c0b87d)
* vf_vapoursynth: add display refresh rate propertyJulian2015-02-162-0/+2
| | | | | | | This value is not necessarily trustworthy (it might change) and can be 0. (cherry picked from commit 349067a6ab2d03024b3e984e80314f303dd14432)
* x11: return a framerate even if no window is mappedwm42015-02-161-8/+11
| | | | | | | Falls back to the first display in the list returned by xrandr. Not entirely correct, but makes some people happy (see #1575). (cherry picked from commit cd6dfcbef4ef15fd7ccd387e2f3438d7e702c567)
* x11: make all XF86 special keys mappablewm42015-02-161-0/+7
| | | | | | | | | | Makes all keys documented in XF86keysym.h mappable. This requires the user to deal with numeric keycodes; no names are queried or exported. This is an easy way to avoid adding all the hundreds of XF86 keys to our X11 lookup table and mpv's keycode/name list. (cherry picked from commit 417869f845d34596d8651fd9c38e6c74d56fecee)
* vo_opengl: fix smoothmotion coefficient calculationStefano Pigozzi2015-02-163-7/+5
| | | | | | | Using prev_pts as the start of the scale was plain wrong. Change it to prev_vsync. (cherry picked from commit 3931544ef33196e1966c416cc0d60d4160cf27fb)
* video/filters: simplify libavfilter bridgewm42015-02-1211-55/+45
| | | | | | | | | | | | Remove the confusing crap that allowed a filter using the libavfilter bridge to be compiled without libavfilter. Instead, compile the wrappers only if libavfilter is enabled at compile time. The only filter which still requires it is vf_stereo3d (unfortunately). Special-case this one. (The whole filter and how it interacts with lavfi is pure braindeath anyway.) (cherry picked from commit 2522bff5657c7566ac956998bcb32a0c9c3d2667)
* vf_noise: remove internal implementationwm42015-02-121-239/+8
| | | | | | | It requires libavfilter now, just like many other filters. Not sure if it even makes sense to keep this wrapper. (cherry picked from commit 73d23a94059e40fd1209912d9365a2fb910eb8b1)
* vo: minor simplificationwm42015-02-071-13/+8
| | | | Whatever.
* vo_vdpau: minor simplificationwm42015-02-071-4/+1
| | | | No change in behavior.
* Revert "vo_opengl: disable alpha by default"wm42015-02-061-2/+2
| | | | | | | | | | This reverts commit a33b46194c3525cb585cc78b449ec275dbfd7f83. It turns out FFmpeg really considers this a bug, and fixed it by making the decoder output the correct pixel format. Fixes #1565. Reverts the fix #1528, though it should work fine with a recent git master FFmpeg.
* video: work around libswscale for PNG pixel formatswm42015-02-064-5/+45
| | | | | | | | The intention is that we can test vo_opengl with high bit depth PNGs better. This throws libswscale completely out of the loop, which before was needed in order to convert from big endian to little endian. Also apply a minimal cleanup to fmt-conversion.c (unrelated).
* vo_opengl: add support for linear scaling without CMSNiklas Haas2015-02-063-18/+31
| | | | | | | | | | This introduces a new option linear-scaling, which is now implied by srgb, icc-profile and sigmoid-upscaling. Notably, this means (sigmoidized) linear upscaling is now enabled by default in opengl-hq mode. The impact should be negligible, and there has been no observation of negative side effects of sigmoidized scaling, so it feels safe to do so.
* vo_opengl: get rid of unused field approx_gammaNiklas Haas2015-02-061-1/+0
| | | | This was left over from 61f5a80.
* vo_vdpau: remove unneeded codewm42015-02-041-4/+0
| | | | This is already done in the common vo.c code.
* vo_opengl: redraw when pausing while showing an interpolated framewm42015-02-043-1/+18
| | | | | If smoothmotion is enabled, and the screen shows an interpolated frame the moment you pause, redraw a non-interpolated frame.
* cocoa: improve refresh rate fallback codeStefano Pigozzi2015-02-031-9/+14
| | | | | | | | Apparently CoreGraphics reports the actual refresh rate. DisplayLink can also query the nominal refresh rate of the display so we use that as fallback instead of the fugly 60fps hardcode added in aeb1fca0d. Props to people on https://github.com/glfw/glfw/issues/137
* cocoa: automatically fetch display-fps from the monitorStefano Pigozzi2015-02-031-0/+26
| | | | | | | | | | | | Comment explains why I have been so doubtful at adding this. The Apple docs say CGDisplayModeGetRefreshRate is supposed to work only for CRTs, but it doesn't, and actually works for LCD TVs connected over HDMI and external displays (at least that's what I'm told, I don't have the hardware to test). Maybe Apple docs are incorrect. Since AFAIK Apple doesn't want to give us a better API – maybe in the fear we might be able to actually write some useful software instead of "apps" – I decided not to care as well and commit this.
* vo_opengl: disable alpha by defaultwm42015-02-031-2/+2
| | | | | | | | | | | | | This reverts the default behavior introduced in commit 93feffad. Way too often libavcodec will return RGB data that has an alpha channel as per pixel format, but actually contains garbage. On the other hand, this will actually render garbage color values in e.g. PNG files (for pixels with alpha==0, the color value should be essentially ignored, which is what the old alpha blend mode did). This "fixes" #1528, which is probably a decoder bug (or far less likely, a broken file).
* vo_opengl: avoid unnecessary shader reinit on fullscreen togglewm42015-02-031-2/+4
| | | | | Makes it unnecessarily slow. It's still needed if the sigmoid crap is actually used.
* vo_opengl: change initialization of gamma optionwm42015-02-032-15/+37
| | | | | | | | | | Make the lazy gamma initialization less weird, and make the default value of the "gamma" sub-option 1.0. This means --vo=opengl:help will list the actual default value. Also change the lower bound to 0.1 - avoids a division by zero (I don't know how shaders handle NaN, but it's probably not a good idea to give them this value).
* csputils, vo_opengl: remove per-component gammawm42015-02-034-15/+7
| | | | | | | | | There was some code accounting for different gamma values for R/G/B. It's inherited from an old, undocumented MPlayer feature, which was at some point disabled for convenience by myself (meaning you couldn't actually set separate gamma because it was removed from the property interface - mp_csp_copy_equalizer_values() just set them to the same value). Get rid of these meaningless leftovers.
* csputils: remove some unused functions, make some privatewm42015-02-032-69/+4
| | | | | | mp_gen_gamma_map() and mp_gen_yuv2rgb_map() were used by vo_opengl_old only. The other functions removed from csputils.h are used by csputils.c only.
* vo_opengl: change upper bound of :gamma to 2.0Niklas Haas2015-02-031-1/+1
| | | | | This allows a spread of 1.0 in either direction, which is already close to absurd. Anything higher than that is pretty pointless.
* vo_opengl: always clamp the video to range 0-1Niklas Haas2015-02-031-5/+4
| | | | | | Before this, enabling :gamma in combination with :sigmoid and probably a few other things results in ugly artifacts because the video isn't clamped until after the :gamma was applied (or at all, if the cms_matrix is unused).
* win32: don't resize when window is minimizedwm42015-02-021-5/+6
| | | | | | | | At least the opengl-hq VO allocates additional resources when downscaling a lot, which is just a waste. Also see #1547 (although I doubt that this is the cause; if it is, a real fix will be required).
* command: add property returning detected hwdec APIwm42015-02-026-14/+16
| | | | | | | | | This is somewhat imperfect, because detection of hw decoding APIs is mostly done on demand, and often avoided if not necessary. (For example, we know very well that there are no hw decoders for certain codecs.) This also requires every hwdec backend to identify itself (see hwdec.h changes).
* vo_opengl: fix breakage with rotated video on initial displaywm42015-02-021-11/+11
| | | | | | | Resizing was happening before reconfig, so src_rect_rot was outdated and didn't include the rotation. This resulted in corrupted rendering on initial display, which fixed itself after the first time the window was somehow resized.
* vo_opengl: use triangle strip for videowm42015-01-302-52/+29
| | | | | | | | | A small simplification. Couldn't be done before, because it was also used by the OSD code, which required disjoint quads in a single draw call. Also mess with the unrelated code in gl_osd.c to simplify it a little as well.
* vo_opengl: don't unnecessarily call glDebugMessageCallback()wm42015-01-301-1/+2
| | | | | | We still do redundant calls to it, but obviously we can avoid calling it if we don't want to set a callback at all. May or may not help with default.
* vo_opengl: fix a castwm42015-01-291-1/+1
| | | | Basically, the OpenGL API is crap (it takes an offset as pointer).
* vf_vapoursynth: load Lua stdlib in Lua modewm42015-01-291-0/+1
| | | | If you can call this a "stdlib".
* vo_opengl: let hwdec driver report the exact image formatwm42015-01-295-24/+31
| | | | | | | | | | | | | | | | | | | | Hardware decoding/displaying with vo_opengl is done by replacing the normal video textures with textures provided by the hardware decoding API OpenGL interop code. Often, this changes the format (vaglx and vdpau return RGBA, vda returns packed YUV). If the format is changed, there was a chance (or at least a higher potential for bugs) that the shader generation code could be confused by the mismatch of formats, and would create incorrect conversions. Simplify this by requiring the hwdec interop driver to set the format it will return to us. This affects all fields, not just some (done by replacing the format with the value of the converted_imgfmt field in init_format), in particular fields like colorlevels. Currently, no hwdec interop driver does anything sophisticated, and the win is mostly from the mp_image_params_guess_csp() function, which will reset fields like colorlevels to expected value if RGBA is used.
* vo_opengl: move remaining OSD rendering parts to gl_osd.cwm42015-01-293-136/+156
| | | | | | | | | | | | Reduces the size of gl_video.c a bit further. This also uses a separate vertex array object for OSD elements, so the video one can be simplified slightly. OSD shader generation is still in gl_video.c, which leads to the strange additional parameter to mpgl_osd_init(). The issue is that video parameters influence the OSD shader (????), and also OSD needs to go through the screen colormanagement.
* vo_opengl: split out a helper for drawing primitiveswm42015-01-293-16/+29
| | | | | | | | Useful if we want to reduce the size of gl_video.c further. To some degree this emulates traditional glDrawArrays() usage. It also leaves a loophole for avoiding a reupload every time by leaving ptr==NULL, although this is unused for now.
* vo_opengl: some minor cleanupswm42015-01-293-99/+74
| | | | | | | | | | | | | | | default_tex_params() and texture_size() are each called only once, so move inline/reimplement them at the caller. image_dw/dh were unused. texture_w/h, image_format, and component_bits were rarely used, and can be replaced. Regroup some other fields. Rename surface_num to surface_idx, because the former sounded like a count, and not an index. Move fbosurface_next() closer to its callers too. Move the DebugMessageCallback() code to gl_utils.c (also simplify it by always setting the callback, instead of only when it changes).
* vo_opengl: force redraw on command line changeswm42015-01-291-0/+1
|
* vo_opengl: move FBO helper to gl_utilswm42015-01-293-118/+122
| | | | | | | | | | | | | This is somewhat messy, because fbotex_init() itself was depending on some gl_video parameters unrelated to FBO creation (like what scaler was in use - what the fuck did this check do in this function?), so this commit does a bit more than moving code around. In particular, the FBO for the separate scaling intermediate step now always uses GL_NEAREST sampling, and all FBOs are destroyed/recreated on renderer reinitialization. This also moves the function matrix_ortho2d() - trivial enough not to put it into a separate commit.
* vo_opengl: fix shader issue with Intel driverswm42015-01-291-2/+2
| | | | | | | | | Windows Intel drivers seem to reject some (AFAIK) valid GLSL. Make them happy. <rossy> GL_RENDERER='Intel(R) HD Graphics 4400' <rossy> GL_VERSION='3.0.0 - Build 10.18.14.4080' <rossy> GL_SHADING_LANGUAGE_VERSION='1.30 - Build 10.18.14.4080'
* vo_opengl: create abstraction for VAOswm42015-01-283-62/+124
| | | | | | Handles stupid boilerplate OpenGL requires you to handle. It's the same code as in gl_video.c, although if no VAOs are available, the fallback code rebinds them on every draw call instead of just once.
* vo_opengl: remove some unused functionswm42015-01-283-33/+11
| | | | | | These were intended for some plans that were never realized. Also move some comments around and fix them.
* vo_opengl: move utility functions from loader to a separate filewm42015-01-288-214/+263
| | | | | | | gl_common.c contained the function loader (which is big) and additional utility functions (not so big, but will grow when moving more out of gl_video.c). Just split them. There are no changes other than some modifications to comments.
* vo_opengl: remove is_linear_rgb and clean up codeNiklas Haas2015-01-282-12/+13
| | | | This opportunity for refactoring was enabled by f3c84a3.
* vo_opengl: fix the fix for fixing odd video sizeswm42015-01-281-16/+15
| | | | | | | Commit acb40644 fixed video with unaligned luma/chroma sizes. It attempted to disable the fix for videos where it effectively does nothing (just some minor performance paranoia), but this check was broken - fix it by not duplicating the logic for this.
* vo_opengl: fix display of ARGB ith color management enabledwm42015-01-283-37/+9
| | | | | | | | | | | | | | | | | | | | PNG uses a different component order from GL_RGBA, so we upload the surface using the "wrong" order, and then fix it in the shader. This breaks if a sRGB texture (GL_SRGB) is used: the hardware will not touch the alpha channel, which means that the B component is not adjusted, leading to incorrect output. Just remove the use of sRGB textures completely. It might lead to a slight slow down when playing RGB with color management enabled, but with this combination of obscure use case with minor performance impact it's not a meaningful disadvantage. Unfortunately this also means that alpha is handled incorrectly with our own color management, but alpha isn't so important and can be fixed later. (0.0 and 1.0 are unchanged by the transfer function, so it "mostly" works.) Fixes #1530.
* vf_ilpack: remove this filterwm42015-01-272-183/+0
| | | | | | | | This was apparently useful for correct interlaced scaling (although I don't know anyone who used this). It was rarely used (if at all), had an inconvenient output format (packed YUV), and now has a better solution in libavfilter (using the libavfilter "scale" filter via vf_lavfi). There is no reason to keep this filter any longer.
* vf_divtc: remove this filterwm42015-01-273-713/+0
| | | | | Better solutions are available in vf_vapoursynth and vf_lavfi. The only user I know who used this is now using vf_vapoursynth.
* vf_phase: rem