0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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.
This commit is contained in:
Niklas Haas 2015-01-22 18:24:50 +01:00
parent 1ec77214b1
commit 27261bea31
No known key found for this signature in database
GPG Key ID: 3BA77D4BFDB10BCE
3 changed files with 13 additions and 39 deletions

View File

@ -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

View File

@ -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)";

View File

@ -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;