summaryrefslogtreecommitdiffstats
path: root/video/out/gl_video.c
diff options
context:
space:
mode:
authorBin Jin <bjin1990@gmail.com>2014-08-25 22:36:48 +0200
committerwm4 <wm4@nowhere>2014-08-26 22:19:27 +0200
commitf14722a40f46366e4333881ec5d540bca1400280 (patch)
tree05872c144c973ba14ef29ba881954123c7228df6 /video/out/gl_video.c
parenta8b67c66f24700205923959b005b2547490e6c8e (diff)
downloadmpv-f14722a40f46366e4333881ec5d540bca1400280.tar.bz2
mpv-f14722a40f46366e4333881ec5d540bca1400280.tar.xz
vo_opengl: add cparam1 and cparam2 options
Although cscale is rarely used, it's possible that params of cscale are accidentally set to lparam1 and lparam2, which might cause unexpected results.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r--video/out/gl_video.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 9b075baf8a..3478c8afcc 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -288,7 +288,7 @@ static const struct gl_video_opts gl_video_opts_def = {
.fbo_format = GL_RGB,
.scale_sep = 1,
.scalers = { "bilinear", "bilinear" },
- .scaler_params = {NAN, NAN},
+ .scaler_params = {{NAN, NAN}, {NAN, NAN}},
.alpha_mode = 2,
};
@@ -299,7 +299,7 @@ const struct gl_video_opts gl_video_opts_hq_def = {
.fbo_format = GL_RGBA16,
.scale_sep = 1,
.scalers = { "spline36", "bilinear" },
- .scaler_params = {NAN, NAN},
+ .scaler_params = {{NAN, NAN}, {NAN, NAN}},
.alpha_mode = 2,
};
@@ -322,8 +322,10 @@ const struct m_sub_options gl_video_conf = {
{"quadbuffer", GL_3D_QUADBUFFER})),
OPT_STRING_VALIDATE("lscale", scalers[0], 0, validate_scaler_opt),
OPT_STRING_VALIDATE("cscale", scalers[1], 0, validate_scaler_opt),
- OPT_FLOAT("lparam1", scaler_params[0], 0),
- OPT_FLOAT("lparam2", scaler_params[1], 0),
+ 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_FLAG("scaler-resizes-only", scaler_resizes_only, 0),
OPT_FLAG("fancy-downscaling", fancy_downscaling, 0),
OPT_FLAG("indirect", indirect, 0),
@@ -673,9 +675,12 @@ static void update_uniforms(struct gl_video *p, GLuint program)
gl->Uniform1f(gl->GetUniformLocation(program, "dither_center"),
p->dither_center);
- float sparam1 = p->opts.scaler_params[0];
- gl->Uniform1f(gl->GetUniformLocation(program, "filter_param1"),
- isnan(sparam1) ? 0.5f : sparam1);
+ float sparam1_l = p->opts.scaler_params[0][0];
+ float sparam1_c = p->opts.scaler_params[1][0];
+ gl->Uniform1f(gl->GetUniformLocation(program, "filter_param1_l"),
+ isnan(sparam1_l) ? 0.5f : sparam1_l);
+ gl->Uniform1f(gl->GetUniformLocation(program, "filter_param1_c"),
+ isnan(sparam1_c) ? 0.5f : sparam1_c);
gl->UseProgram(0);
@@ -817,8 +822,9 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
{
const char *target = scaler->index == 0 ? "SAMPLE_L" : "SAMPLE_C";
if (!scaler->kernel) {
- *shader = talloc_asprintf_append(*shader, "#define %s sample_%s\n",
- target, scaler->name);
+ *shader = talloc_asprintf_append(*shader, "#define %s sample_%s_%c\n",
+ target, scaler->name,
+ "lc"[scaler->index]);
} else {
int size = scaler->kernel->size;
if (pass != -1) {
@@ -1023,13 +1029,13 @@ static void compile_shaders(struct gl_video *p)
// Force using the luma 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_bilinear" : "SAMPLE_L");
+ use_indirect ? "sample_bilinear_l" : "SAMPLE_L");
}
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_bilinear");
+ shader_def(&header_conv, "SAMPLE_L", "sample_bilinear_l");
shader_def_opt(&header_conv, "FIXED_SCALE", true);
header_conv = t_concat(tmp, header, header_conv);
p->indirect_program =
@@ -1107,8 +1113,8 @@ static void init_scaler(struct gl_video *p, struct scaler *scaler)
scaler->kernel = &scaler->kernel_storage;
for (int n = 0; n < 2; n++) {
- if (!isnan(p->opts.scaler_params[n]))
- scaler->kernel->params[n] = p->opts.scaler_params[n];
+ if (!isnan(p->opts.scaler_params[scaler->index][n]))
+ scaler->kernel->params[n] = p->opts.scaler_params[scaler->index][n];
}
update_scale_factor(p, scaler->kernel);