mirror of
https://github.com/mpv-player/mpv
synced 2025-02-27 19:01:07 +00:00
vo_opengl: rename all scale options to make more sense
This emphasizes the fact that scale is used for *all* image upscaling, with cscale only serving a minor role for subsampled material.
This commit is contained in:
parent
02df9886ea
commit
8eb9ddd868
@ -288,7 +288,7 @@ Available video output drivers are:
|
||||
color space conversion and chroma upsampling is generally in the hand of
|
||||
the hardware decoder APIs.
|
||||
|
||||
``lscale=<filter>``
|
||||
``scale=<filter>``
|
||||
|
||||
``bilinear``
|
||||
Bilinear hardware texture filtering (fastest, very low quality).
|
||||
@ -301,34 +301,34 @@ Available video output drivers are:
|
||||
Lanczos scaling. Provides mid quality and speed. Generally worse
|
||||
than ``spline36``, but it results in a slightly sharper image
|
||||
which is good for some content types. The number of taps can be
|
||||
controlled with ``lradius``, but is best left unchanged.
|
||||
controlled with ``scale-radius``, but is best left unchanged.
|
||||
|
||||
``ewa_lanczos``
|
||||
Elliptic weighted average Lanczos scaling. Also known as Jinc.
|
||||
Relatively slow, but very good quality. The number of taps can
|
||||
be controlled with ``lradius``. Adding extra taps makes the filter
|
||||
sharper but adds more ringing.
|
||||
be controlled with ``scale-radius``. Adding extra taps makes the
|
||||
filter sharper but adds more ringing.
|
||||
|
||||
This filter supports antiringing (see ``lantiring``).
|
||||
This filter supports antiringing (see ``scale-antiring``).
|
||||
|
||||
``mitchell``
|
||||
Mitchell-Netravali. The ``b`` and ``c`` parameters can be set with
|
||||
``lparam1`` and ``lparam2``. Both are set to 1/3 by default.
|
||||
This filter is very good at downscaling (see ``lscale-down``).
|
||||
``scale-param1`` and ``scale-param2``. Both are set to 1/3 by default.
|
||||
This filter is very good at downscaling (see ``scale-down``).
|
||||
|
||||
There are some more filters, but most are not as useful. For a complete
|
||||
list, pass ``help`` as value, e.g.::
|
||||
|
||||
mpv --vo=opengl:lscale=help
|
||||
mpv --vo=opengl:scale=help
|
||||
|
||||
``lparam1=<value>``
|
||||
``scale-param1=<value>``
|
||||
Set filter parameters. Ignored if the filter is not tunable. These are
|
||||
unset by default, and use the filter specific default if applicable.
|
||||
|
||||
``lparam2=<value>``
|
||||
See ``lparam1``.
|
||||
``scale-param2=<value>``
|
||||
See ``scale-param1``.
|
||||
|
||||
``lradius=<r>``
|
||||
``scale-radius=<r>``
|
||||
Set radius for filters listed below, must be a float number between 1.0
|
||||
and 16.0. Defaults to be 3.0 if not specified.
|
||||
|
||||
@ -338,7 +338,7 @@ Available video output drivers are:
|
||||
ratio, the radius that actually being used might be different
|
||||
(most likely being increased a bit).
|
||||
|
||||
``lantiring=<value>``
|
||||
``scale-antiring=<value>``
|
||||
Set the antiringing strength. This tries to eliminate ringing, but can
|
||||
introduce other artifacts in the process. Must be a float number
|
||||
between 0.0 and 1.0. The default value of 0.0 disables antiringing
|
||||
@ -348,11 +348,9 @@ Available video output drivers are:
|
||||
|
||||
``scaler-resizes-only``
|
||||
Disable the scaler if the video image is not resized. In that case,
|
||||
``bilinear`` is used instead whatever is set with ``lscale``. Bilinear
|
||||
``bilinear`` is used instead whatever is set with ``scale``. Bilinear
|
||||
will reproduce the source image perfectly if no scaling is performed.
|
||||
Note that this option never affects ``cscale``, although the different
|
||||
processing chain might do chroma scaling differently if ``lscale`` is
|
||||
disabled.
|
||||
Note that this option never affects ``cscale``.
|
||||
|
||||
``srgb``
|
||||
Convert and color correct the output to sRGB before displaying it on
|
||||
@ -427,31 +425,26 @@ Available video output drivers are:
|
||||
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 ``lscale``
|
||||
It's safe to enable this if using ``bilinear`` for both ``scale``
|
||||
and ``cscale``.
|
||||
|
||||
``cscale=<filter>``
|
||||
As ``lscale``, but for interpolating chroma information. If the image
|
||||
As ``scale``, but for interpolating chroma information. If the image
|
||||
is not subsampled, this option is ignored entirely. Note that the
|
||||
implementation is currently always done as a single pass, so using
|
||||
it with separable filters will result in slow performance for very
|
||||
little visible benefit.
|
||||
|
||||
``lscale-down=<filter>``
|
||||
Like ``lscale``, but apply these filters on downscaling
|
||||
instead. If these options are unset, the filter implied by ``lscale``
|
||||
``scale-down=<filter>``
|
||||
Like ``scale``, but apply these filters on downscaling
|
||||
instead. If this option is unset, the filter implied by ``scale``
|
||||
will be applied.
|
||||
|
||||
There used to be a ``cscale-down`` option. This was removed, because
|
||||
chroma scaling is usually only used for upscaling. The only case where
|
||||
this was actually used for downscaling was when the video was scaled
|
||||
down by more than twice (or other factors, depending on image formats),
|
||||
and ``lscale`` did not use a separable scaler.
|
||||
|
||||
``cparam1``, ``cparam2``, ``cradius``, ``cantiring``
|
||||
``cscale-param1``, ``cscale-param2``, ``cscale-radius``, ``cscale-antiring``
|
||||
Set filter parameters and radius for ``cscale``.
|
||||
|
||||
See ``lparam1``, ``lparam2``, ``lradius`` and ``lantiring``.
|
||||
See ``scale-param1``, ``scale-param2``, ``scale-radius`` and
|
||||
``scale-antiring``.
|
||||
|
||||
``fancy-downscaling``
|
||||
When using convolution based filters, extend the filter size
|
||||
@ -603,7 +596,7 @@ Available video output drivers are:
|
||||
|
||||
This is equivalent to::
|
||||
|
||||
--vo=opengl:lscale=spline36:dither-depth=auto:fbo-format=rgba16:fancy-downscaling:sigmoid-upscaling
|
||||
--vo=opengl:scale=spline36:dither-depth=auto:fbo-format=rgba16:fancy-downscaling:sigmoid-upscaling
|
||||
|
||||
Note that some cheaper LCDs do dithering that gravely interferes with
|
||||
``opengl``'s dithering. Disabling dithering with ``dither-depth=no`` helps.
|
||||
|
@ -54,7 +54,7 @@ static const char vo_opengl_shaders[] =
|
||||
#define TEXUNIT_3DLUT 6
|
||||
#define TEXUNIT_DITHER 7
|
||||
|
||||
// lscale/cscale arguments that map directly to shader filter routines.
|
||||
// scale/cscale arguments that map directly to shader filter routines.
|
||||
// Note that the convolution filters are not included in this list.
|
||||
static const char *const fixed_scale_filters[] = {
|
||||
"bilinear",
|
||||
@ -359,17 +359,17 @@ const struct m_sub_options gl_video_conf = {
|
||||
OPT_FLAG("srgb", srgb, 0),
|
||||
OPT_FLAG("npot", npot, 0),
|
||||
OPT_FLAG("pbo", pbo, 0),
|
||||
OPT_STRING_VALIDATE("lscale", scalers[0], 0, validate_scaler_opt),
|
||||
OPT_STRING_VALIDATE("scale", scalers[0], 0, validate_scaler_opt),
|
||||
OPT_STRING_VALIDATE("cscale", scalers[1], 0, validate_scaler_opt),
|
||||
OPT_STRING_VALIDATE("lscale-down", dscaler, 0, validate_scaler_opt),
|
||||
OPT_FLOAT("lparam1", scaler_params[0][0], 0),
|
||||
OPT_FLOAT("lparam2", scaler_params[0][1], 0),
|
||||
OPT_FLOAT("cparam1", scaler_params[1][0], 0),
|
||||
OPT_FLOAT("cparam2", scaler_params[1][1], 0),
|
||||
OPT_FLOATRANGE("lradius", scaler_radius[0], 0, 1.0, 16.0),
|
||||
OPT_FLOATRANGE("cradius", scaler_radius[1], 0, 1.0, 16.0),
|
||||
OPT_FLOATRANGE("lantiring", scaler_antiring[0], 0, 0.0, 1.0),
|
||||
OPT_FLOATRANGE("cantiring", scaler_antiring[1], 0, 0.0, 1.0),
|
||||
OPT_STRING_VALIDATE("scale-down", dscaler, 0, validate_scaler_opt),
|
||||
OPT_FLOAT("scale-param1", scaler_params[0][0], 0),
|
||||
OPT_FLOAT("scale-param2", scaler_params[0][1], 0),
|
||||
OPT_FLOAT("cscale-param1", scaler_params[1][0], 0),
|
||||
OPT_FLOAT("cscale-param2", scaler_params[1][1], 0),
|
||||
OPT_FLOATRANGE("scale-radius", scaler_radius[0], 0, 1.0, 16.0),
|
||||
OPT_FLOATRANGE("cscale-radius", scaler_radius[1], 0, 1.0, 16.0),
|
||||
OPT_FLOATRANGE("scale-antiring", scaler_antiring[0], 0, 0.0, 1.0),
|
||||
OPT_FLOATRANGE("cscale-antiring", scaler_antiring[1], 0, 0.0, 1.0),
|
||||
OPT_FLAG("scaler-resizes-only", scaler_resizes_only, 0),
|
||||
OPT_FLAG("fancy-downscaling", fancy_downscaling, 0),
|
||||
OPT_FLAG("sigmoid-upscaling", sigmoid_upscaling, 0),
|
||||
@ -408,7 +408,19 @@ const struct m_sub_options gl_video_conf = {
|
||||
OPT_COLOR("background", background, 0),
|
||||
|
||||
OPT_REMOVED("approx-gamma", "this is always enabled now"),
|
||||
OPT_REMOVED("cscale-down", "use 'indirect' and lscale-down"),
|
||||
OPT_REMOVED("cscale-down", "chroma is never downscaled"),
|
||||
|
||||
OPT_REPLACED("lscale", "scale"),
|
||||
OPT_REPLACED("lscale-down", "scale-down"),
|
||||
OPT_REPLACED("lparam1", "scale-param1"),
|
||||
OPT_REPLACED("lparam2", "scale-param2"),
|
||||
OPT_REPLACED("lradius", "scale-radius"),
|
||||
OPT_REPLACED("lantiring", "scale-antiring"),
|
||||
OPT_REPLACED("cparam1", "cscale-param1"),
|
||||
OPT_REPLACED("cparam2", "cscale-param2"),
|
||||
OPT_REPLACED("cradius", "cscale-radius"),
|
||||
OPT_REPLACED("cantiring", "cscale-antiring"),
|
||||
|
||||
{0}
|
||||
},
|
||||
.size = sizeof(struct gl_video_opts),
|
||||
@ -951,7 +963,7 @@ static void shader_def_opt(char **shader, const char *name, bool b)
|
||||
static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
|
||||
{
|
||||
int unit = scaler->index;
|
||||
const char *target = unit == 0 ? "SAMPLE_L" : "SAMPLE_C";
|
||||
const char *target = unit == 0 ? "SAMPLE" : "SAMPLE_C";
|
||||
if (!scaler->kernel) {
|
||||
APPENDF(shader, "#define %s(p0, p1, p2) "
|
||||
"sample_%s(p0, p1, p2, filter_param1_%c)\n",
|
||||
@ -1219,16 +1231,16 @@ static void compile_shaders(struct gl_video *p)
|
||||
if (input_is_subsampled(p)) {
|
||||
shader_setup_scaler(&header_conv, &p->scalers[1], -1);
|
||||
} else {
|
||||
// Force using the luma scaler on chroma. If the "indirect" stage is
|
||||
// Force using the normal scaler on chroma. If the "indirect" stage is
|
||||
// used, the actual scaling will happen in the next stage.
|
||||
shader_def(&header_conv, "SAMPLE_C",
|
||||
use_indirect ? "SAMPLE_TRIVIAL" : "SAMPLE_L");
|
||||
use_indirect ? "SAMPLE_TRIVIAL" : "SAMPLE");
|
||||
}
|
||||
|
||||
if (use_indirect) {
|
||||
// We don't use filtering for the Y-plane (luma), because it's never
|
||||
// scaled in this scenario.
|
||||
shader_def(&header_conv, "SAMPLE_L", "SAMPLE_TRIVIAL");
|
||||
shader_def(&header_conv, "SAMPLE", "SAMPLE_TRIVIAL");
|
||||
shader_def_opt(&header_conv, "FIXED_SCALE", true);
|
||||
header_conv = t_concat(tmp, header, header_conv);
|
||||
p->indirect_program =
|
||||
|
@ -375,22 +375,22 @@ void main() {
|
||||
#define USE_CONV 0
|
||||
#endif
|
||||
#if USE_CONV == CONV_PLANAR
|
||||
vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r,
|
||||
vec4 acolor = vec4(SAMPLE(texture0, textures_size[0], texcoord).r,
|
||||
SAMPLE_C(texture1, textures_size[1], chr_texcoord).r,
|
||||
SAMPLE_C(texture2, textures_size[2], chr_texcoord).r,
|
||||
1.0);
|
||||
#elif USE_CONV == CONV_NV12
|
||||
vec4 acolor = vec4(SAMPLE_L(texture0, textures_size[0], texcoord).r,
|
||||
vec4 acolor = vec4(SAMPLE(texture0, textures_size[0], texcoord).r,
|
||||
SAMPLE_C(texture1, textures_size[1], chr_texcoord).RG,
|
||||
1.0);
|
||||
#else
|
||||
vec4 acolor = SAMPLE_L(texture0, textures_size[0], texcoord);
|
||||
vec4 acolor = SAMPLE(texture0, textures_size[0], texcoord);
|
||||
#endif
|
||||
#ifdef USE_COLOR_SWIZZLE
|
||||
acolor = acolor. USE_COLOR_SWIZZLE ;
|
||||
#endif
|
||||
#ifdef USE_ALPHA_PLANE
|
||||
acolor.a = SAMPLE_L(texture3, textures_size[3], texcoord).r;
|
||||
acolor.a = SAMPLE(texture3, textures_size[3], texcoord).r;
|
||||
#endif
|
||||
vec3 color = acolor.rgb;
|
||||
float alpha = acolor.a;
|
||||
|
Loading…
Reference in New Issue
Block a user