summaryrefslogtreecommitdiffstats
path: root/video
Commit message (Collapse)AuthorAgeFilesLines
* 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: remove this filterwm42015-01-272-310/+0
| | | | If you really want it, it's in libavfilter and can be used via vf_lavfi.
* vf_swapuv: remove this filterwm42015-01-272-66/+0
| | | | | | It's entirely useless. I left it in for a while, because the analog TV code had a transitional bug that could switch chroma planes, but it was fixed long ago. It's also available in libavfilter.
* vf_softpulldown: remove this filterwm42015-01-273-194/+0
| | | | | | | | Apparently it was completely broken and essentially did nothing. This was broken sometime in early mpv or mplayer2 times. Get rid of it. If you _really_ need it, wait until FFmpeg ports it from MPlayer, which will happen very soon.
* vf_pullup: remove builtin implementationwm42015-01-273-920/+10
| | | | | Now it requires libavfilter. The wrapper is left in place, so FFmpeg users will not notice any change. On Libav, the filter stops working.
* ta: rename MP_TALLOC_ELEMS to MP_TALLOC_AVAILBen Boeckel2015-01-271-2/+2
| | | | | The macro actually returns the *available* space in the array, not how much is actually filled in.
* vo_opengl: change the way unaligned chroma size is handledwm42015-01-274-11/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This deals with subsampled YUV video that has odd sizes, for example a 5x5 image with 4:2:0 subsampling. It would be easy to handle if we actually passed separate texture coordinates for each plane to the shader, but as of now the luma coordinates are implicitly rescaled to chroma one. If luma and chroma sizes don't match up, and this is not handled, you'd get a chroma shift by 1 pixel. The existing hack worked, but broke separable scaling. This was exposed by a recent commit which switched to GL_NEAREST sampling for FBOs. The rendering was accidentally scaled by 1 pixel, because the FBO size used the original video size, while textures_sizes[0] was set to the padded texture size (i.e. one pixel larger). It could be fixed by setting the padded texture size only on the first shader. But somehow that is annoying, so do something else. Don't pad textures anymore, and rescale the chroma coordinates in the shader instead. Seems like this somehow doesn't work with rectangle textures (and introduces a chroma shift), but since it's only used when doing VDA hardware decoding, and the bug occurs only with unaligned video sizes, I don't care much. Fixes #1523.
* vo: handle very long frame durations with smoothmotion enabledwm42015-01-261-1/+1
| | | | | | | | | | | | | | | With mf://, rather long frame durations are common. By default, one frame takes 1 second. This causes the if branch changed with this commit to always being taken, which in turn leads to the player not being woken up correctly. (As a consequence, it "freezes" by waiting for events that never come, and moving the mouse cursor over the window will wake it up again and advance video.) Obviously, the code should account for how long the video frame takes. The code is probably still not fully correct, but for now this fixes the issue at hand. Fixes #1521.
* vo_opengl: drop sRGB framebuffer detectionwm42015-01-262-9/+1
| | | | | We've stopped using them some time ago (we're doing things manually instead).
* video/out: cosmetics: rename VO_EVENT_ICC_PROFILE_PATH_CHANGEDwm42015-01-264-7/+7
| | | | | Remove the "PATH" bit, because VOCTRL_GET_ICC_PROFILE returns an in- memory profile, and not a path. (This was changed a while ago.)
* vo_opengl, x11: implement icc-profile-autowm42015-01-262-4/+36
| | | | | | | | | | | | | | | | | This queries the _ICC_PROFILE property on the root window. It also tries to reload the ICC when it changes, or if the mpv window changes the monitor. (If multiple monitors are covered, mpv will randomly select one of them.) The official spec is a dead link on freedesktop.org, so don't blame me for any bugs. Note that this assumes that Xinerama screen numbers match the way mpv enumerates the xrandr monitors. Although there is some chance that this matches, it most likely doesn't, and we actually have to do complicated things to map the screen numbers. If it turns out that this is required, I will fix it as soon as someone with a suitable setup for testing the fix reports it.
* vo_opengl: minor changes to ICC update codewm42015-01-262-19/+20
| | | | | | | | | | | | | | | Merge update_icc_profile() into get_and_update_icc_profile() - there's no reason anymore to keep them separate. The former is only called by the latter, and the separation of responsibilities between them is blurry a best. Query the ICC profile only if the corresponding feature is actually enabled. Additionally, change the error behavior of this code. Make loading failure non-fatal, and distinguish between runtime error and unimplemented functionality. Fix a memory leak in gl_lcms.c (although the changes in vo_opengl.c already take care of this, it's just logical and cleaner).
* vo_opengl: update a commentwm42015-01-261-2/+3
| | | | We don't use the hwdec-provided video texture for screenshots anymore.
* vo_opengl: make "mitchell" the hq default filter for downscalingwm42015-01-261-1/+2
| | | | | | | | | | | | | Seems like several people agree that it's a good filter for downscaling. Setting this option by default may also prevent people from accidentally using an unsuitable filter for downscaling by setting "scale" and without being aware of the impliciations (maybe). On the other hand, this change is not strictly backwards compatible for the same reasons. Also, allow disabling this option with scale-down="" (before this, not setting it was the only way to do this - not possible anymore if it's set by default). This is what the change in handle_scaler_opt() does.
* vo_opengl: simplify radius initializationwm42015-01-262-18/+6
| | | | | | | | | | | | | | | Somehow, the default radius for filters with variable radius was set in mp_init_filter(). gl_video.c used NAN as default value for the radius, which would make the filter use the default radius. Simplify this, and set the default radius directly in the gl_video options. It also makes the options easier to understand, because the default value listed in --vo=opengl:help actually shows the default value. Remove the function can_use_filter_kernel(), because it doesn't set a radius if none is set. The function is worthless anyway (something about making filter_kernels.c reusable to other VOs, and trying to deal with the possibility that it could provide filters not supported by vo_opengl.)
* vo_opengl: fancy-downscale affects luma-scaler onlywm42015-01-251-1/+1
|
* vo: fix redraw logicwm42015-01-251-4/+2
| | | | | | | | It actually can and does happen that you want to redraw, even if no image was queued yet. Broken by commit 28582322. Fixes #1510.
* vo_opengl: remove remnants of dropped stereo buffer supportwm42015-01-243-15/+0
|
* vo: generic redraw supportwm42015-01-242-7/+5
| | | | | | | | | | | | | | | | | | | | Usually, a VO must react to VOCTRL_REDRAW_FRAME in order to redraw the current screen correctly if video is paused (this is done to update OSD). But if it's not supported, we can just draw the current image again in the generic vo.c code. Unfortunately, this turned out pretty useless, because the VOs which would benefit from this need to redraw even if there is no image, in order to draw a black screen in --idle --force-window mode. The way redrawing is handled in the X11 common code and in vo_x11 and vo_xv is in the way, and I'm not sure what exactly vo_wayland requires. Other VOs have a non-trivial implementation of VOCTRL_REDRAW_FRAME, which (probably) makes redrawing slightly more efficient, e.g. by skipping texture upload. So for now, no VO uses this new functionality, but since it's trivial, commit it anyway. The vo_driver->untimed case is for forcibly disabling redraw for vo_lavc and vo_image always.
* vo: simplify VOs by adding generic screenshot supportwm42015-01-2414-134/+38
| | | | | | | | | | | At the time screenshot support was added, images weren't refcounted yet, so screenshots required specialized implementations in the VOs. But now we can handle these things much simpler. Also see commit 5bb24980. If there are VOs in the future which can't do this (e.g. they need to write to the image passed to vo_driver->draw_image), this still could be disabled on a per-VO basis etc., so we lose no potential performance advantages.
* cocoa: fix fallback for OpenGL 2.1 hardware [2]Stefano Pigozzi2015-01-241-7/+13
| | | | Looks like it fails on context creation, not pixfmt creation.
* cocoa: fix fallback for OpenGL 2.1 hardwareStefano Pigozzi2015-01-241-25/+25
| | | | | | This was previously done in common code but now it's left to backends. Also remove the GL4 stuff since requesting a 3_2_Core context creates a 4.1 context here (wtf).
* video: separate screenshot modeswm42015-01-2312-68/+38
| | | | | | | | | Use different VOCTRLs for "window" and normal screenshot modes. The normal one will probably be removed, and replaced by generic code in vo.c, and this commit is preparation for this. (Doing it the other way around would be slightly simpler, but I haven't decided yet about the second one, and touching every VO is needed anyway in order to remove the unneeded crap. E.g. has_osd has been unused for a long time.)
* vo: fix disabling/enabling smoothmotion at runtimewm42015-01-234-12/+10
| | | | | | | | | | | | | vo.c queried the VO at initialization whether it wants to be updated on every display frame, or every video frame. If the smoothmotion option was changed at runtime, the rendering mode in vo.c wasn't updated. Just let vo_opengl set the mode directly. Abuse the existing vo_set_flip_queue_offset() function for this. Also add a comment suggesting the use of --display-fps to the manpage, which doesn't have anything to do with the rest of this commit, but is important to make smoothmotion run well.
* vf_vavpp: add more deinterlacing algorithmswm42015-01-231-7/+22
| | | | | | These are untested due to lack of hardware. From what I've heard, the drivers are pretty buggy, so it's not clear how well this works, if at all.
* x11: remove unnecessary codewm42015-01-231-3/+0
|
* vo: allow dropping additional frames with smoothmotionwm42015-01-231-6/+6
| | | | | | | | | | | | | The logic disabled framedropping if the frame was interpolated (i.e. the render call is only done to interpolate between the previous frame, and the frame before that). It seems doing this wasn't even necessary, and broke framedrop in smoothmotion mode. In fact, this code did nothing for display with video fps below display fps. It did prevent the framedrop counter from going up, though. So change it so that dropped interpolated frames are never reported. (Doing so can give confusing results, such as dropping 1000s of frames on slow operations like video start or changing filters.)
* vo: cosmeticswm42015-01-231-22/+24
|
* vo: fix framedrop in normal casewm42015-01-231-1/+2
| | | | | vsync_timed is true if smoothmotion is used. That would mean framedrop is always disabled in the normal case.
* vo_opengl: add smoothmotion frame blendingStefano Pigozzi2015-01-237-20/+230
| | | | | | | | | | | | | | | | | | | SmoothMotion is a way to time and blend frames made popular by MadVR. It's intended behaviour is to remove stuttering caused by mismatches between the display refresh rate and the video fps, while preserving the video's original artistic qualities (no soap opera effect). It's supposed to make 24fps video playback on 60hz monitors as close as possible to a 24hz monitor. Instead of drawing a frame once once it's pts has passed the vsync time, we redraw at the display refresh rate, and if we detect the vsync is between two frames we interpolated them (depending on their position relative to the vsync). We actually interpolate as few frames as possible to avoid a blur effect as much as possible. For example, if we were to play back a 1fps video on a 60hz monitor, we would blend at most on 1 vsync for each frame (while the other 59 vsyncs would be rendered as is). Frame interpolation is always done before scaling and in linear light when possible (an ICC profile is used, or :srgb is used).
* filter_kernels: improve a commentwm42015-01-221-3/+2
| | | | It's not true anymore that the size necessarily depends on the radius.
* vo_opengl: improve terminal messages with lscale suboption errorswm42015-01-221-5/+13
| | | | Make it more apparent what the hell the user did wrong.
* vo_opengl: remove scale-sep and indirect optionsNiklas Haas2015-01-222-16/+12
| | | | | | | | | | | | These are now auto-detected sanely; and enabled whenever it would be a performance or quality gain (which is pretty much everything except bilinear/bilinear scaling). Perhaps notably, with the absence of scale_sep, there's no more way to use convolution filters on hardware without FBOs, but I don't think there's hardware in existence that doesn't have FBOs but is still fast enough to run the fallback (slow) 2D convolution filters, so I don't think it's a net loss.
* filter_kernels: get rid of sinc/lanczos aliasesNiklas Haas2015-01-221-12/+0
| | | | Just set the radius with scale-radius if it's really needed
* vo_opengl: rename all scale options to make more senseNiklas Haas2015-01-222-20/+32
| | | | | This emphasizes the fact that scale is used for *all* image upscaling, with cscale only serving a minor role for subsampled material.
* vo_opengl: switch to nearest neighbour for trivial resamplingNiklas Haas2015-01-222-3/+12
| | | | | | | | | | This is significantly faster for FBOs on most modern GPUs, although it did not result in a huge difference for the video source texture on the sizes I tested. It might be more significant for 1080p or 4K content, so it's worth revisiting this in the future. It also renames SAMPLE_BILINEAR to SAMPLE_TRIVIAL to match the semantics.
* vo_opengl: always prefer indirect scalingNiklas Haas2015-01-221-14/+5
| | | | | | This is better even for non-separable. The only exception is when using bilinear for both lscale and cscale. I've fixed the documentation/comments to make more sense.
* vo_opengl: implement naive anti-ringingNiklas Haas2015-01-223-10/+32
| | | | | | | | This is not quite the same thing as madVR's antiringing algorithm, but it essentially does something similar. Porting madVR's approach to elliptic coordinates will take some amount of thought.
* vo_opengl: unroll ewa_lanczos to avoid looping and unnecessary samplesNiklas Haas2015-01-222-10/+29
| | | | | | | This speeds up performance by a factor of something like 10%, since it omits unnecessary checks. This will also make adding anti-ringing easier.
* vo_opengl: clean up ewa_lanczos codeNiklas Haas2015-01-226-32/+60
| | | | | | This fixes compatibility with GLES 2.0 and makes the code a bit neater in gener