From 44cf6288c73b71d22a98870cb08b1daf9da5e048 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 20 Sep 2023 18:18:59 +0200 Subject: vo_gpu: remove --scaler-lut-size Pointless bloat option, hard-coded as 256 now in libplacebo and no reason not to also hard-code in mpv. See-Also: haasn/libplacebo@64d7c5aab06766a9492d3cfffd35333792052cd9 --- DOCS/interface-changes.rst | 1 + DOCS/man/options.rst | 8 -------- etc/builtin.conf | 1 - video/out/gpu/video.c | 14 ++++++-------- video/out/gpu/video.h | 2 -- video/out/gpu/video_shaders.c | 6 +++--- video/out/vo_gpu_next.c | 1 - 7 files changed, 10 insertions(+), 23 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index e556402353..fc91db404c 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -91,6 +91,7 @@ Interface changes - add `--window-corners` option - rename `--cdrom-device` to `--cdda-device` - remove `--scale-cutoff`, `--cscale-cutoff`, `--dscale-cutoff`, `--tscale-cutoff` + - remove `--scaler-lut-size` --- mpv 0.36.0 --- - add `--target-contrast` - Target luminance value is now also applied when ICC profile is used. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e397d7b988..ee78a21e13 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -5391,14 +5391,6 @@ them. Scale parameter (t). Increasing this makes the window wider. Defaults to 1. -``--scaler-lut-size=<4..10>`` - Set the size of the lookup texture for scaler kernels (default: 6). The - actual size of the texture is ``2^N`` for an option value of ``N``. So the - lookup texture with the default setting uses 64 samples. - - All weights are linearly interpolated from those samples, so increasing - the size of lookup table might improve the accuracy of scaler. - ``--scaler-resizes-only`` Disable the scaler if the video image is not resized. In that case, ``bilinear`` is used instead of whatever is set with ``--scale``. Bilinear diff --git a/etc/builtin.conf b/etc/builtin.conf index a72508a64a..5cd184f42d 100644 --- a/etc/builtin.conf +++ b/etc/builtin.conf @@ -55,7 +55,6 @@ hdr-peak-percentile=99.995 hdr-contrast-recovery=0.30 allow-delayed-peak-detect=no deband=yes -scaler-lut-size=8 # Deprecated alias [gpu-hq] diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c index 4e226486d5..69be403933 100644 --- a/video/out/gpu/video.c +++ b/video/out/gpu/video.c @@ -311,7 +311,6 @@ static const struct gl_video_opts gl_video_opts_def = { .correct_downscaling = true, .linear_downscaling = true, .sigmoid_upscaling = true, - .scaler_lut_size = 6, .interpolation_threshold = 0.01, .alpha_mode = ALPHA_BLEND_TILES, .background = {0, 0, 0, 255}, @@ -425,7 +424,7 @@ const struct m_sub_options gl_video_conf = { SCALER_OPTS("dscale", SCALER_DSCALE), SCALER_OPTS("cscale", SCALER_CSCALE), SCALER_OPTS("tscale", SCALER_TSCALE), - {"scaler-lut-size", OPT_INT(scaler_lut_size), M_RANGE(4, 10)}, + {"scaler-lut-size", OPT_REMOVED("hard-coded as 8")}, {"scaler-resizes-only", OPT_BOOL(scaler_resizes_only)}, {"correct-downscaling", OPT_BOOL(correct_downscaling)}, {"linear-downscaling", OPT_BOOL(linear_downscaling)}, @@ -1784,17 +1783,16 @@ static void reinit_scaler(struct gl_video *p, struct scaler *scaler, int stride = width * num_components; assert(size <= stride); - scaler->lut_size = 1 << p->opts.scaler_lut_size; - - float *weights = talloc_array(NULL, float, scaler->lut_size * stride); - mp_compute_lut(scaler->kernel, scaler->lut_size, stride, weights); + static const int lut_size = 256; + float *weights = talloc_array(NULL, float, lut_size * stride); + mp_compute_lut(scaler->kernel, lut_size, stride, weights); bool use_1d = scaler->kernel->polar && (p->ra->caps & RA_CAP_TEX_1D); struct ra_tex_params lut_params = { .dimensions = use_1d ? 1 : 2, - .w = use_1d ? scaler->lut_size : width, - .h = use_1d ? 1 : scaler->lut_size, + .w = use_1d ? lut_size : width, + .h = use_1d ? 1 : lut_size, .d = 1, .format = fmt, .render_src = true, diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h index f9061fd7aa..890b76367c 100644 --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h @@ -52,7 +52,6 @@ struct scaler { struct ra_tex *lut; struct ra_tex *sep_fbo; bool insufficient; - int lut_size; // kernel points here struct filter_kernel kernel_storage; @@ -133,7 +132,6 @@ struct gl_tone_map_opts { struct gl_video_opts { int dumb_mode; struct scaler_config scaler[4]; - int scaler_lut_size; float gamma; bool gamma_auto; int target_prim; diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index 3a33d3cfc8..6c49967238 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -41,7 +41,7 @@ static void pass_sample_separated_get_weights(struct gl_shader_cache *sc, struct scaler *scaler) { gl_sc_uniform_texture(sc, "lut", scaler->lut); - GLSLF("float ypos = LUT_POS(fcoord, %d.0);\n", scaler->lut_size); + GLSLF("float ypos = LUT_POS(fcoord, %d.0);\n", scaler->lut->params.h); int N = scaler->kernel->size; int width = (N + 3) / 4; // round up @@ -123,10 +123,10 @@ static void polar_sample(struct gl_shader_cache *sc, struct scaler *scaler, // get the weight for this pixel if (scaler->lut->params.dimensions == 1) { GLSLF("w = tex1D(lut, LUT_POS(d * 1.0/%f, %d.0)).r;\n", - radius, scaler->lut_size); + radius, scaler->lut->params.w); } else { GLSLF("w = texture(lut, vec2(0.5, LUT_POS(d * 1.0/%f, %d.0))).r;\n", - radius, scaler->lut_size); + radius, scaler->lut->params.h); } GLSL(wsum += w;) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index b357d8a268..229a268b15 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -2063,7 +2063,6 @@ static void update_render_options(struct vo *vo) struct priv *p = vo->priv; pl_options pars = p->pars; const struct gl_video_opts *opts = p->opts_cache->opts; - pars->params.lut_entries = 1 << opts->scaler_lut_size; pars->params.antiringing_strength = opts->scaler[0].antiring; pars->params.background_color[0] = opts->background.r / 255.0; pars->params.background_color[1] = opts->background.g / 255.0; -- cgit v1.2.3