summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: change default FBO formatwm42015-05-051-1/+1
| | | | | | | | Reduces (but likely does not remove) the danger of rounding intermediate values down to 8 bit. This is important for cscale, or any other processing that might store raw YUV values in framebuffers. Fixes #1918.
* vo_opengl: refactor wayland frame skippingwm42015-05-011-8/+15
| | | | | | | | | | | Currently, the wayland backend needs extra work to avoid drawing more often than the wayland frame callback allows. (This is not ideal, but will be fixed at a later time.) Unify this with the start_frame callback added for cocoa. Some details change for the better. For example, if a frame is dropped, and a redraw is done afterwards, the actually correct frame is redrawn, instead whatever was in the textures from before the dropped frame.
* vo_opengl: slightly simplify check_gl_features()wm42015-04-111-25/+12
| | | | | | | | | | Not sure why this was so roundabout; probably to keep spam down if the user's OpenGL drivers are crap (but then just don't enable extended features), or because the "Disabling..." text was so repetitious. But there doesn't seem to be a good reason after all. Also, this could already overflow the fixed size disabled[] array. Just print the messages directly.
* vo_opengl: unify blend-subtitles-res and blend-subtitleswm42015-04-111-7/+7
|
* vo_opengl: fix blend-subtitles-res=video & anamorphic videowm42015-04-111-1/+6
| | | | | Since scaling the video changes the aspect ratio, we have to compensate for this when rendering subtitles.
* vo_opengl: add blend-subtitles-resNiklas Haas2015-04-101-4/+18
| | | | | This can be used to draw the subtitles at the video's native res, which can make them look more natural and increases performance.
* mp_image: remove redundant plane_w/h fieldswm42015-04-101-4/+5
| | | | Seems relatively painful in this case, but they are morally wrong.
* vo_opengl: use correct texture coordinates for nv12wm42015-04-101-1/+1
|
* vo_opengl: remove unused functionwm42015-04-091-5/+0
|
* vo_opengl: make csp options consistent with vf_formatNiklas Haas2015-04-041-20/+2
|
* csputils: add some missing colorspacesNiklas Haas2015-04-041-2/+31
| | | | | With target-prim and target-trc it makes sense to include some common colorspaces that aren't strictly speaking used for video.
* vo_opengl: minor cleanup of gamma-related functionsNiklas Haas2015-04-041-5/+4
|
* vo_opengl: blend-subtitles in non-linear lightNiklas Haas2015-04-041-35/+42
|
* vo_opengl: add scale-wparam optionNiklas Haas2015-04-041-8/+12
| | | | This lets us tune the window parameter
* vo_opengl: refactor scaler configurationNiklas Haas2015-04-041-108/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This merges all of the scaler-related options into a single configuration struct, and also cleans up the way they're passed through the code. (For example, the scaler index is no longer threaded through pass_sample, just the scaler configuration itself, and there's no longer duplication of the params etc.) In addition, this commit makes scale-down more principled, and turns it into a scaler in its own right - so there's no longer an ugly separation between scale and scale-down in the code. Finally, the radius stuff has been made more proper - filters always have a radius now (there's no more radius -1), and get a new .resizable attribute instead for when it's tunable. User-visible changes: 1. scale-down has been renamed dscale and now has its own set of config options (dscale-param1, dscale-radius) etc., instead of reusing scale-param1 (which was arguably a bug). 2. The default radius is no longer fixed at 3, but instead uses that filter's preferred radius by default. (Scalers with a default radius other than 3 include sinc, gaussian, box and triangle) 3. scale-radius etc. now goes down to 0.5, rather than 1.0. 0.5 is the smallest radius that theoretically makes sense, and indeed it's used by at least one filter (nearest). Apart from that, it should just be internal changes only. Note that this sets up for the refactor discussed in #1720, which would be to merge scaler and window configurations (include parameters etc.) into a single, simplified string. In the code, this would now basically just mean getting rid of all the OPT_FLOATRANGE etc. lines related to scalers and replacing them by a single function that parses a string and updates the struct scaler_config as appropriate.
* vo_opengl: separate kernel and windowNiklas Haas2015-04-041-9/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the core much more elegant, reusable, reconfigurable and also allows us to more easily add aliases for specific configurations. Furthermore, this lets us apply a generic blur factor / window function to arbitrary filters, so we can finally "mix and match" in order to fine-tune windowing functions. A few notes are in order: 1. The current system for configuring scalers is ugly and rapidly getting unwieldy. I modified the man page to make it a bit more bearable, but long-term we have to do something about it; especially since.. 2. There's currently no way to affect the blur factor or parameters of the window functions themselves. For example, I can't actually fine-tune the kaiser window's param1, since there's simply no way to do so in the current API - even though filter_kernels.c supports it just fine! 3. This removes some lesser used filters (especially those which are purely window functions to begin with). If anybody asks, you can get eg. the old behavior of scale=hanning by using scale=box:scale-window=hanning:scale-radius=1 (and yes, the result is just as terrible as that sounds - which is why nobody should have been using them in the first place). 4. This changes the semantics of the "triangle" scaler slightly - it now has an arbitrary radius. This can possibly produce weird results for people who were previously using scale-down=triangle, especially if in combination with scale-radius (for the usual upscaling). The correct fix for this is to use scale-down=bilinear_slow instead, which is an alias for triangle at radius 1. In regards to the last point, in future I want to make it so that filters have a filter-specific "preferred radius" (for the ones that are arbitrarily tunable), once the configuration system for filters has been redesigned (in particular in a way that will let us separate scale and scale-down cleanly). That way, "triangle" can simply have the preferred radius of 1 by default, while still being tunable. (Rather than the default radius being hard-coded to 3 always)
* vo_opengl: remove chroma-location suboptionwm42015-04-031-9/+2
| | | | Terribly obscure, and vf_format can do this for all VOs.
* vo_opengl: treat non-blended subtitles as sRGBNiklas Haas2015-03-271-32/+44
| | | | | | | | Currently, the code just skipped CMS completely. This commit treats them as sRGB by default, instead. This also refactors much of the color management code to make it more generalized and re-usable.
* vo_opengl: add FBOTEX_FUZZY aliasNiklas Haas2015-03-261-6/+4
| | | | Minor reusability factor
* vo_opengl: simplify sampler preludeNiklas Haas2015-03-261-46/+44
| | | | | This moves common re-definitions to a custom function and also shortens the names to make stuff less verbose in general.
* vo_opengl: reset surfaces on equalizer updatesNiklas Haas2015-03-261-0/+1
| | | | | This makes the VO more responsive to equalizer changes (eg. brightness) when interpolation is used.
* vo_opengl: draw subtitles directly onto the videoNiklas Haas2015-03-261-57/+85
| | | | | | | | | | | | | | | | This has a number of user-visible changes: 1. A new flag blend-subtitles (default on for opengl-hq) to control this behavior. 2. The OSD itself will not be color managed or affected by gamma controls. To get subtitle CMS/gamma, blend-subtitles must be used. 3. When enabled, this will make subtitles be cleanly interpolated by :interpolation, and also dithered etc. (just like the normal output). Signed-off-by: wm4 <wm4@nowhere>
* vo_opengl: set cscale=spline36 as default for opengl-hqNiklas Haas2015-03-251-1/+1
| | | | | | | Bilinear scaling is not a suitable default for something named "hq"; the whole reason this was done in the past was because cscale used to be obscenely slow. This is no longer the case, with cscale being nearly free.
* vo_opengl: correct OSD PTS when using interpolationNiklas Haas2015-03-251-1/+22
|
* vo_opengl: do not block on waylandJari Vetoniemi2015-03-231-0/+7
| | | | | | | | | When not receiving frame callbacks, we should not draw anything to avoid blocking the OpenGL renderer. We do this by extending gl context api, by introducing new optional function 'is_active', that indicates whether OpenGL renderers should draw or not. This fixes issue #249.
* vo_opengl: fix XYZ input gammaNiklas Haas2015-03-231-1/+1
| | | | | This seems to have been a mistranslation from the original code, which multiplied the gamma by 2.6 (*not* the color itself).
* vo_opengl: remove dead assignmentwm42015-03-231-3/+3
|
* vo_opengl_cb: don't render OSD while VO is not createdwm42015-03-231-7/+17
| | | | | | | | | | | Unlike other VOs, this rendered OSD even while no VO was created (because the renderer lives as long as the API user wants). Change this, and refactor the code so that the OSD object is accessible only while the VO is created. (There is a short time where the OSD can still be accessed even after VO destruction - this is not a race condition, though it's inelegant and unfortunately unavoidable.)
* vo_opengl: move OSD rendering to separate functionwm42015-03-231-39/+41
| | | | | Also reindent the few lines that call into the actual renderer to remove the "draw_osd" goto.
* vo_opengl: fix video equalizer gamma controlswm42015-03-221-1/+4
| | | | It was ignored.
* vo_opengl: fix background color optionwm42015-03-211-7/+5
| | | | | | gl_video_set_options() didn't update it, so the default value set on initialization was used. Fix by always setting the clear color before the clear command; it's slightly easier to follow too.
* vo_opengl: fix bicubic_fast scalerwm42015-03-211-1/+1
|
* video: uninline memcpy_pic functionswm42015-03-201-1/+0
| | | | | | | | | There's literally no reason why these functions have to be inline (they might be performance critical, but then the function call overhead isn't going to matter at all). Uninline them and move them to mp_image.c. Drop the header file and fix all uses of it.
* vo_opengl: reduce number of uniforms in dithering passwm42015-03-161-8/+5
| | | | | | | We now update uniforms every time, so we should try to reduce the number of uniforms to avoid performance penalties. (Originally, some caching was planned, but it looks like it would be too complicated to implement compared to the expected gains.)
* vo_opengl: move glViewport call closer to draw callwm42015-03-161-2/+1
|
* vo_opengl: fix srgb replacement optionsJames Ross-Gowan2015-03-161-1/+1
| | | | | | OPT_REPLACED can't specify option values or multiple options. Change to OPT_REMOVED. Also, target-prim doesn't have an srgb option. BT.709 uses sRGB primaries, so use it instead.
* vo_opengl: fix incorrectly drawn OSD in idle modewm42015-03-161-2/+2
| | | | | | Trade one bug for another, I don't even care anymore. Fixes #1691.
* vo_opengl: apply OSD color managementNiklas Haas2015-03-161-24/+39
|
* vo_opengl: improve queue size heuristicNiklas Haas2015-03-161-1/+1
| | | | | | | | The default scaling was a slight bit too low, which could cause buffer underruns in some cases. This should improve the result when using tscale filters other than oversample. The oversample case should be unaffected.
* vo_opengl: improve interpolation diagnosticsNiklas Haas2015-03-161-6/+9
| | | | | | This adds extra debugging output for buffer underruns, to help track down possible queueing issues. It also inverts the numberic output for tscale=oversample to make more sense, without changing the logic.
* vo_opengl: color manage after interpolationNiklas Haas2015-03-161-13/+18
| | | | | | | | | | | | This moves the color management code out of pass_render_main (which is now dedicated solely to up/downscaling and hence renamed pass_scale_main) and into a new function, which gets called from pass_draw_to_screen instead. This makes more sense from a logical standpoint, and also means that we interpolate in linear RGB, before color management - rather than after it, which is significantly better for color accuracy and probably also interpolation quality.
* vo_opengl: add oversample support for tscaleNiklas Haas2015-03-151-24/+45
| | | | | This is interesting mainly because it's essentially equivalent to the old smoothmotion algorithm. As such, it is now the default for tscale.
* vo_opengl: add oversample scalerNiklas Haas2015-03-151-0/+38
| | | | | | This is like nearest neighbour, but the edges between pixels are linearly interpolating if needed, as if they had been (naively) oversampled.
* vo_opengl: refactor smoothmotion -> interpolationNiklas Haas2015-03-151-76/+145
| | | | | | | | | | | | | This replaces the old smoothmotion code by a more flexible tscale option, which essentially allows any scaler to be used for interpolating frames. (The actual "smoothmotion" scaler which behaves identical to the old code does not currently exist, but it will be re-added in a later commit) The only odd thing is that larger filters require a larger queue size offset, which is currently set dynamically as it introduces some issues when pausing or framestepping. Filters with a lower radius are not affected as much, so this is identical to the old smoothmotion if the smoothmotion interpolator is used.
* vo_opengl: increase the number of video buffersNiklas Haas2015-03-151-12/+16
| | | | | | Also the size is now a simple #define that can easily be changed later. This is done for smoothmotion, which might want to blend more than 4 frames at once, depending on the setting.
* vo_opengl: remove hwdec unmap_image callbackwm42015-03-141-3/+0
| | | | Not needed anymore; see previous commit.
* vo_opengl: only clamp when necessaryNiklas Haas2015-03-141-2/+2
| | | | | This essentially makes it so that every gamma function that crops up somewhere has a corresponding clamp in front of it.
* vo_opengl: fix incorrect wording in commentNiklas Haas2015-03-141-1/+1
| | | | | "compand" was used where the actual operation was "compress". Change to avoid confusion.
* vo_opengl: fix uninitialization logicNiklas Haas2015-03-141-1/+8
| | | | | The FBOs we use never actually got cleaned up anywhere, and the vimg planes were hard-coded to only clean up 3.
* vo_opengl: apply alpha after conversion to rgbNiklas Haas2015-03-131-12/+7
| | | | | Currently this was done before conversion, which could fuck up a hypothetical YUVA stream.
* vo_opengl: replace float array with a structwm42015-03-131-29/+27
| | | | Slightly less painful, because C arrays suck.
* vo_opengl: remove unused declarationwm42015-03-131-5/+0
| | | | Stupid compiler.
* vo_opengl: don't test for arrayswm42015-03-131-3/+0
| | | | | | Even the lowest supported GL versions have arrays. This test was for returning arrays from functions, which didn't work in lower GL versions, but we don't need it anymore.
* vo_opengl: minor fix to a commentwm42015-03-131-2/+2
|
* vo_opengl: sample from the right tex for separated scalersNiklas Haas2015-03-131-8/+8
| | | | | These were still hard-coded to texture0, rather than respecting src_tex like they should. A simple oversight.
* vo_opengl: refactor shader generation (part 2)Niklas Haas2015-03-121-187/+677
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds stuff related to gamma, linear light, sigmoid, BT.2020-CL, etc, as well as color management. Also adds a new gamma function (gamma22). This adds new parameters to configure the CMS settings, in particular letting us target simple colorspaces without requiring usage of a 3DLUT. This adds smoothmotion. Mostly working, but it's still sensitive to timing issues. It's based on an actual queue now, but the queue size is kept small to avoid larger amounts of latency. Also makes “upscale before blending” the default strategy. This is justified because the "render after blending" thing doesn't seme to work consistently any way (introduces stutter due to the way vsync timing works, or something), so this behavior is a bit closer to master and makes pausing/unpausing less weird/jumpy. This adds the remaining scalers, including bicubic_fast, sharpen3, sharpen5, polar filters and antiringing. Apparently, sharpen3/5 also consult scale-param1, which was undocumented in master. This also implements cropping and chroma transformation, plus rotation/flipping. These are inherently part of the same logic, although it's a bit rough around the edges in some case, mainly due to the fallback code paths (for bilinear scaling without indirection).
* vo_opengl: refactor shader generation (part 1)wm42015-03-121-1297/+628
| | | | | | | | | | | | | | | | | | | The basic idea is to use dynamically generated shaders instead of a single monolithic file + a ton of ifdefs. Instead of having to setup every aspect of it separately (like compiling shaders, setting uniforms, perfoming the actual rendering steps, the GLSL parts), we generate the GLSL on the fly, and perform the rendering at the same time. The GLSL is regenerated every frame, but the actual compiled OpenGL-level shaders are cached, which makes it fast again. Almost all logic can be in a single place. The new code is significantly more flexible, which allows us to improve the code clarity, performance and add more features easily. This commit is incomplete. It drops almost all previous code, and readds only the most important things (some of them actually buggy). The next commit will complete it - it's separate to preserve authorship information.
* vo_opengl: move minor helper to common codewm42015-03-091-10/+1
| | | | | The generic image format code should cary most of the "knowledge" about image formats.
* vo_opengl: make smoothmotion-threshold inclusiveNiklas Haas2015-03-051-2/+2
| | | | | This behavior makes more sense near the borders, eg. smoothmotion-threshold=0 and smoothmotion-threshold=0.5.
* vo_opengl: increase ambient light changes log levelStefano Pigozzi2015-03-041-1/+1
| | | | info is a quite too annoying. increase it to verbose.
* vo_opengl: add gamma-auto optionStefano Pigozzi2015-03-041-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | This automatically sets the gamma option depending on lighting conditions measured from the computer's ambient light sensor. sRGB – arguably the “sibling” to BT.709 for still images – has a reference viewing environment defined in its specification (IEC 61966-2-1:1999, see http://www.color.org/chardata/rgb/srgb.xalter). According to this data, the assumed ambient illuminance is 64 lux. This is the illuminance where the gamma that results from ICC color management is correct. On the other hand, BT.1886 formalizes that the gamma level for dim environments to be 2.40, and Apple resources (WWDC12: 2012 Session 523: Best practices for color management) define the BT.1886 dim at 16 lux. So the logic we apply is: * >= 64lux -> 1.961 gamma * =< 16lux -> 2.400 gamma * 16lux < x < 64lux -> logaritmic rescale of lux to gamma. The human perception of illuminance roughly follows a logaritmic scale of lux [1]. [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd319008%28v=vs.85%29.aspx
* Revert "Revert recent vo_opengl related commits"Niklas Haas2015-02-281-18/+3
| | | | | | | | | | | | | | | | | | | | |