summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: fix framestepping/pausing + interpolationNiklas Haas2015-07-011-2/+8
| | | | | | | | This is not the most theoretically perfect solution, ideally we could check to see if the frame in question has already been rendered somewhere in the queue and then avoid re-rendering it, at the cost of a few extra lines of code. But I don't think the performance trade-off is dramatic enough here.
* vo: change internal API for drawing frameswm42015-07-011-18/+22
| | | | | | | | | | | | | | draw_image_timed is renamed to draw_frame. struct frame_timing is renamed to vo_frame. flip_page_timed is merged into draw_frame (the additional parameters are part of struct vo_frame). draw_frame also deprecates VOCTRL_REDRAW_FRAME, and replaces it with a method that works for both VOs which can cache the current frame, and VOs which need to redraw it anyway. This is preparation to making the interpolation and (work in progress) display sync code saner. Lots of other refactoring, and also some simplifications.
* vo_opengl: adjust interpolation code for the new video-sync mechanismNiklas Haas2015-07-011-100/+103
| | | | | | | | | | | | | This should make interpolation work much better in general, although there still might be some side effects for unusual framerates (eg. 35 Hz or 48 Hz). Most of the common framerates are tested and working fine. (24 Hz, 30 Hz, 60 Hz) The new code doesn't have support for oversample yet, so it's been removed (and will most likely be reimplemented in a cleaner way if there's enough demand). I would recommend using something like robidoux or mitchell instead of oversample, though - they're much smoother for the common cases.
* vo_opengl: fix dangling pointers with vo_cmdlinewm42015-06-091-0/+24
| | | | | | | | | | | | gl_video_set_options() does not acquire ownership of the opts parameter or its contents. In case of vo_cmdline, opts will point to temporary memory. This memory will be free'd at a later point, and p->opts will point to free'd memory on the next reinitialization. The fix is pretty ugly, but it's a quick bug fix. This can probably be removed once VO sub-options are exposed as properties. Fixes #2035.
* vo_opengl: avoid broken shader if hwdec fails to provide textureswm42015-05-281-1/+4
| | | | | | | | | | If gl_hwdec_driver.map_image fails, all textures will be set to 0. This in turn makes pass_prepare_src_tex() skip generation of the texture uniforms, which leads to a shader compilation error, as e.g. texture0 is not defined but expected to exist and accessed. Set the textures to an invalid non-0 ID instead. OpenGL can deal with it.
* vo_opengl: rename use_full_range to use_normalized_rangewm42015-05-271-8/+8
| | | | | As suggested by haasn. The term "full range" makes it sound like it has to do with TV vs. PC range, which is not the case at all.
* vo_opengl: fix source-shader + XYZ inputNiklas Haas2015-05-271-2/+5
|
* vo_opengl: CMS no longer implies linear scalingNiklas Haas2015-05-271-4/+1
| | | | | | | | | | | They're completely orthogonal concepts, merged in the past due to convenience and ease of implementing it in the old #ifdef hell renderer. Especially after the CMS stuff was generalized by 634b4a, this was a trivial change to implement and also means color management will be much higher quality when enabled with vo=opengl (which had quantization issues in the past due to the 8 bit FBO format and upscaling), since it can be done in a single pass now.
* vo_opengl: add support for custom shadersNiklas Haas2015-05-271-34/+177
|
* vo_opengl: vda: make it work anywherewm42015-05-211-0/+35
| | | | | | | | A rather dumb hack to copy the problematic rectangle textures (mandated by VDA) into 2D ones. (This isn't done yet for OpenGL 3.0+. We need to make sure the performance isn't reduced too much by it.)
* vo_opengl: remove npot optionwm42015-05-211-16/+0
| | | | Completely useless.
* vo_opengl: remove some more Cocoa resize leftoverswm42015-05-131-12/+0
|
* 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
| | | | | |