Skip to content

Commit

Permalink
vo_gpu: remove --scaler-lut-size
Browse files Browse the repository at this point in the history
Pointless bloat option, hard-coded as 256 now in libplacebo and no
reason not to also hard-code in mpv.

See-Also: haasn/libplacebo@64d7c5a
  • Loading branch information
haasn committed Sep 25, 2023
1 parent 57fad2d commit 44cf628
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 23 deletions.
1 change: 1 addition & 0 deletions DOCS/interface-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 0 additions & 8 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion etc/builtin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
14 changes: 6 additions & 8 deletions video/out/gpu/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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)},
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions video/out/gpu/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions video/out/gpu/video_shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand 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;)

Expand Down
1 change: 0 additions & 1 deletion video/out/vo_gpu_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 44cf628

Please sign in to comment.