summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-01-22 18:24:50 +0100
committerNiklas Haas <git@nand.wakku.to>2015-01-22 19:40:06 +0100
commit27261bea313117b8644d8abda2bc3f9410623154 (patch)
tree4c6af294540d37533defb2cb6bb237b10af991a1
parent1ec77214b19db7aed225375d5f378f58f97ead93 (diff)
downloadmpv-27261bea313117b8644d8abda2bc3f9410623154.tar.bz2
mpv-27261bea313117b8644d8abda2bc3f9410623154.tar.xz
vo_opengl: remove scale-sep and indirect options
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.
-rw-r--r--DOCS/man/vo.rst24
-rw-r--r--video/out/gl_video.c26
-rw-r--r--video/out/gl_video.h2
3 files changed, 13 insertions, 39 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index 48d0e91c38..3f2667668d 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -354,8 +354,7 @@ Available video output drivers are:
``srgb``
Convert and color correct the output to sRGB before displaying it on
- the screen. This option enables linear light scaling. It also forces
- the options ``indirect`` and ``gamma``.
+ the screen. This option enables linear light scaling.
This option is equivalent to using ``icc-profile`` with an sRGB ICC
profile, but it is implemented without a 3DLUT and does not require
@@ -416,18 +415,6 @@ Available video output drivers are:
Interval in displayed frames between two buffer swaps.
1 is equivalent to enable VSYNC, 0 to disable VSYNC.
- ``no-scale-sep``
- When using a separable scale filter for luma, usually two filter
- passes are done, and when using ``cscale`` chroma information is also
- scaled separately from luma. This is often faster and better for
- most image scalers. However, the extra passes and preprocessing logic
- can actually make it slower if used with fast filters on small screen
- resolutions. Using this option will make rendering a single operation
- if possible, often at the cost of performance or image quality.
-
- It's safe to enable this if using ``bilinear`` for both ``scale``
- and ``cscale``.
-
``cscale=<filter>``
As ``scale``, but for interpolating chroma information. If the image
is not subsampled, this option is ignored entirely. Note that the
@@ -500,15 +487,6 @@ Available video output drivers are:
wayland
Wayland/EGL
- ``indirect``
- Do YUV conversion and scaling as separate passes. This will first render
- the video into a video-sized RGB texture, and draw the result on screen.
- The luma scaler is used to scale the RGB image when rendering to screen.
- The chroma scaler is used only on YUV conversion, and only if the video
- is chroma-subsampled (usually the case).
- This mechanism is disabled on RGB input.
- Specifying this option directly is generally useful for debugging only.
-
``fbo-format=<fmt>``
Selects the internal format of textures used for FBOs. The format can
influence performance and quality of the video output. (FBOs are not
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 5c650d1a10..d64833744d 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -321,7 +321,6 @@ const struct gl_video_opts gl_video_opts_def = {
.dither_depth = -1,
.dither_size = 6,
.fbo_format = GL_RGBA,
- .scale_sep = 1,
.sigmoid_center = 0.75,
.sigmoid_slope = 6.5,
.scalers = { "bilinear", "bilinear" },
@@ -336,7 +335,6 @@ const struct gl_video_opts gl_video_opts_hq_def = {
.dither_depth = 0,
.dither_size = 6,
.fbo_format = GL_RGBA16,
- .scale_sep = 1,
.fancy_downscaling = 1,
.sigmoid_center = 0.75,
.sigmoid_slope = 6.5,
@@ -375,8 +373,6 @@ const struct m_sub_options gl_video_conf = {
OPT_FLAG("sigmoid-upscaling", sigmoid_upscaling, 0),
OPT_FLOATRANGE("sigmoid-center", sigmoid_center, 0, 0.0, 1.0),
OPT_FLOATRANGE("sigmoid-slope", sigmoid_slope, 0, 1.0, 20.0),
- OPT_FLAG("indirect", indirect, 0),
- OPT_FLAG("scale-sep", scale_sep, 0),
OPT_CHOICE("fbo-format", fbo_format, 0,
({"rgb", GL_RGB},
{"rgba", GL_RGBA},
@@ -409,6 +405,8 @@ const struct m_sub_options gl_video_conf = {
OPT_REMOVED("approx-gamma", "this is always enabled now"),
OPT_REMOVED("cscale-down", "chroma is never downscaled"),
+ OPT_REMOVED("scale-sep", "this is set automatically whenever sane"),
+ OPT_REMOVED("indirect", "this is set automatically whenever sane"),
OPT_REPLACED("lscale", "scale"),
OPT_REPLACED("lscale-down", "scale-down"),
@@ -1204,7 +1202,7 @@ static void compile_shaders(struct gl_video *p)
shader_def_opt(&header_final, "USE_DITHER", p->dither_texture != 0);
shader_def_opt(&header_final, "USE_TEMPORAL_DITHER", p->opts.temporal_dither);
- if (p->opts.scale_sep && p->scalers[0].kernel && !p->scalers[0].kernel->polar) {
+ if (p->scalers[0].kernel && !p->scalers[0].kernel->polar) {
header_sep = talloc_strdup(tmp, "");
shader_def_opt(&header_sep, "FIXED_SCALE", true);
shader_setup_scaler(&header_sep, &p->scalers[0], 0);
@@ -1214,18 +1212,24 @@ static void compile_shaders(struct gl_video *p)
}
// The indirect pass is used to preprocess the image before scaling.
- bool use_indirect = p->opts.indirect;
+ bool use_indirect = false;
// Don't sample from input video textures before converting the input to
// its proper gamma.
if (use_input_gamma || use_conv_gamma || use_linear_light || use_const_luma)
use_indirect = true;
+ // Trivial scalers are implemented directly and efficiently by the GPU.
+ // This only includes bilinear and nearest neighbour in OpenGL, but we
+ // don't support nearest neighbour upsampling.
+ bool trivial_scaling = strcmp(p->scalers[0].name, "bilinear") == 0 &&
+ strcmp(p->scalers[1].name, "bilinear") == 0;
+
// If the video is subsampled, chroma information needs to be pulled up to
// the input size before scaling can be done. Even for 4:4:4 or planar RGB
// this is also faster because it means the scalers can operate on all
- // channels simultaneously. Disabling scale_sep overrides this behavior.
- if (p->opts.scale_sep && p->plane_count > 1)
+ // channels simultaneously. This is unnecessary for trivial scaling.
+ if (p->plane_count > 1 && !trivial_scaling)
use_indirect = true;
if (input_is_subsampled(p)) {
@@ -2199,8 +2203,6 @@ static void check_gl_features(struct gl_video *p)
have_fbo = test_fbo(p, p->opts.fbo_format);
}
- // Disable these only if the user didn't disable scale-sep on the command
- // line, so convolution filter can still be forced to be run.
// Normally, we want to disable them by default if FBOs are unavailable,
// because they will be slow (not critically slow, but still slower).
// Without FP textures, we must always disable them.
@@ -2265,10 +2267,6 @@ static void check_gl_features(struct gl_video *p)
disabled[n_disabled++] = "color management (GLSL version)";
}
}
- if (!have_fbo) {
- p->opts.scale_sep = false;
- p->opts.indirect = false;
- }
if (gl->es && p->opts.pbo) {
p->opts.pbo = 0;
disabled[n_disabled++] = "PBOs (GLES unsupported)";
diff --git a/video/out/gl_video.h b/video/out/gl_video.h
index 980f237a15..b287658bef 100644
--- a/video/out/gl_video.h
+++ b/video/out/gl_video.h
@@ -34,11 +34,9 @@ struct gl_video_opts {
float scaler_params[2][2];
float scaler_radius[2];
float scaler_antiring[2];
- int indirect;
float gamma;
int srgb;
int approx_gamma;
- int scale_sep;
int fancy_downscaling;
int sigmoid_upscaling;
float sigmoid_center;