summaryrefslogtreecommitdiffstats
path: root/video/out/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/gpu')
-rw-r--r--video/out/gpu/lcms.c20
-rw-r--r--video/out/gpu/spirv.c2
-rw-r--r--video/out/gpu/video.c212
-rw-r--r--video/out/gpu/video_shaders.c8
4 files changed, 123 insertions, 119 deletions
diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c
index 1d4e90d7af..0f3a0bf646 100644
--- a/video/out/gpu/lcms.c
+++ b/video/out/gpu/lcms.c
@@ -78,16 +78,16 @@ static int validate_3dlut_size_opt(struct mp_log *log, const m_option_t *opt,
#define OPT_BASE_STRUCT struct mp_icc_opts
const struct m_sub_options mp_icc_conf = {
.opts = (const m_option_t[]) {
- OPT_FLAG("use-embedded-icc-profile", use_embedded, 0),
- OPT_STRING("icc-profile", profile, M_OPT_FILE),
- OPT_FLAG("icc-profile-auto", profile_auto, 0),
- OPT_STRING("icc-cache-dir", cache_dir, M_OPT_FILE),
- OPT_INT("icc-intent", intent, 0),
- OPT_CHOICE_OR_INT("icc-contrast", contrast, 0, 0, 1000000, ({"inf", -1})),
- OPT_STRING_VALIDATE("icc-3dlut-size", size_str, 0, validate_3dlut_size_opt),
-
- OPT_REPLACED("3dlut-size", "icc-3dlut-size"),
- OPT_REMOVED("icc-cache", "see icc-cache-dir"),
+ {"use-embedded-icc-profile", OPT_FLAG(use_embedded)},
+ {"icc-profile", OPT_STRING(profile), .flags = M_OPT_FILE},
+ {"icc-profile-auto", OPT_FLAG(profile_auto)},
+ {"icc-cache-dir", OPT_STRING(cache_dir), .flags = M_OPT_FILE},
+ {"icc-intent", OPT_INT(intent)},
+ {"icc-contrast", OPT_CHOICE(contrast, {"inf", -1}),
+ M_RANGE(0, 1000000)},
+ {"icc-3dlut-size", OPT_STRING_VALIDATE(size_str, validate_3dlut_size_opt)},
+ {"3dlut-size", OPT_REPLACED("icc-3dlut-size")},
+ {"icc-cache", OPT_REMOVED("see icc-cache-dir")},
{0}
},
.size = sizeof(struct mp_icc_opts),
diff --git a/video/out/gpu/spirv.c b/video/out/gpu/spirv.c
index ee11d601a3..67088bc7df 100644
--- a/video/out/gpu/spirv.c
+++ b/video/out/gpu/spirv.c
@@ -33,7 +33,7 @@ struct spirv_opts {
#define OPT_BASE_STRUCT struct spirv_opts
const struct m_sub_options spirv_conf = {
.opts = (const struct m_option[]) {
- OPT_CHOICE_C("spirv-compiler", compiler, 0, compiler_choices),
+ {"spirv-compiler", OPT_CHOICE_C(compiler, compiler_choices)},
{0}
},
.size = sizeof(struct spirv_opts),
diff --git a/video/out/gpu/video.c b/video/out/gpu/video.c
index 539934fe67..9d5df7c739 100644
--- a/video/out/gpu/video.c
+++ b/video/out/gpu/video.c
@@ -346,119 +346,123 @@ static int validate_error_diffusion_opt(struct mp_log *log, const m_option_t *op
#define OPT_BASE_STRUCT struct gl_video_opts
// Use for options which use NAN for defaults.
-#define OPT_FLOATDEF(name, var, flags) \
- OPT_FLOAT(name, var, (flags) | M_OPT_DEFAULT_NAN)
+#define OPT_FLOATDEF(field) \
+ OPT_FLOAT(field), \
+ .flags = M_OPT_DEFAULT_NAN
#define SCALER_OPTS(n, i) \
- OPT_STRING_VALIDATE(n, scaler[i].kernel.name, 0, validate_scaler_opt), \
- OPT_FLOATDEF(n"-param1", scaler[i].kernel.params[0], 0), \
- OPT_FLOATDEF(n"-param2", scaler[i].kernel.params[1], 0), \
- OPT_FLOAT(n"-blur", scaler[i].kernel.blur, 0), \
- OPT_FLOATRANGE(n"-cutoff", scaler[i].cutoff, 0, 0.0, 1.0), \
- OPT_FLOATRANGE(n"-taper", scaler[i].kernel.taper, 0, 0.0, 1.0), \
- OPT_FLOATDEF(n"-wparam", scaler[i].window.params[0], 0), \
- OPT_FLOAT(n"-wblur", scaler[i].window.blur, 0), \
- OPT_FLOATRANGE(n"-wtaper", scaler[i].window.taper, 0, 0.0, 1.0), \
- OPT_FLOATRANGE(n"-clamp", scaler[i].clamp, 0, 0.0, 1.0), \
- OPT_FLOATRANGE(n"-radius", scaler[i].radius, 0, 0.5, 16.0), \
- OPT_FLOATRANGE(n"-antiring", scaler[i].antiring, 0, 0.0, 1.0), \
- OPT_STRING_VALIDATE(n"-window", scaler[i].window.name, 0, validate_window_opt)
+ {n, OPT_STRING_VALIDATE(scaler[i].kernel.name, validate_scaler_opt)}, \
+ {n"-param1", OPT_FLOATDEF(scaler[i].kernel.params[0])}, \
+ {n"-param2", OPT_FLOATDEF(scaler[i].kernel.params[1])}, \
+ {n"-blur", OPT_FLOAT(scaler[i].kernel.blur)}, \
+ {n"-cutoff", OPT_FLOAT(scaler[i].cutoff), M_RANGE(0.0, 1.0)}, \
+ {n"-taper", OPT_FLOAT(scaler[i].kernel.taper), M_RANGE(0.0, 1.0)}, \
+ {n"-wparam", OPT_FLOATDEF(scaler[i].window.params[0])}, \
+ {n"-wblur", OPT_FLOAT(scaler[i].window.blur)}, \
+ {n"-wtaper", OPT_FLOAT(scaler[i].window.taper), M_RANGE(0.0, 1.0)}, \
+ {n"-clamp", OPT_FLOAT(scaler[i].clamp), M_RANGE(0.0, 1.0)}, \
+ {n"-radius", OPT_FLOAT(scaler[i].radius), M_RANGE(0.5, 16.0)}, \
+ {n"-antiring", OPT_FLOAT(scaler[i].antiring), M_RANGE(0.0, 1.0)}, \
+ {n"-window", OPT_STRING_VALIDATE(scaler[i].window.name, validate_window_opt)}
const struct m_sub_options gl_video_conf = {
.opts = (const m_option_t[]) {
- OPT_CHOICE("gpu-dumb-mode", dumb_mode, 0,
- ({"auto", 0}, {"yes", 1}, {"no", -1})),
- OPT_FLOATRANGE("gamma-factor", gamma, 0, 0.1, 2.0),
- OPT_FLAG("gamma-auto", gamma_auto, 0),
- OPT_CHOICE_C("target-prim", target_prim, 0, mp_csp_prim_names),
- OPT_CHOICE_C("target-trc", target_trc, 0, mp_csp_trc_names),
- OPT_CHOICE_OR_INT("target-peak", target_peak, 0, 10, 10000,
- ({"auto", 0})),
- OPT_CHOICE("tone-mapping", tone_map.curve, 0,
- ({"clip", TONE_MAPPING_CLIP},
- {"mobius", TONE_MAPPING_MOBIUS},
- {"reinhard", TONE_MAPPING_REINHARD},
- {"hable", TONE_MAPPING_HABLE},
- {"gamma", TONE_MAPPING_GAMMA},
- {"linear", TONE_MAPPING_LINEAR})),
- OPT_CHOICE("hdr-compute-peak", tone_map.compute_peak, 0,
- ({"auto", 0},
- {"yes", 1},
- {"no", -1})),
- OPT_FLOATRANGE("hdr-peak-decay-rate", tone_map.decay_rate, 0, 1.0, 1000.0),
- OPT_FLOATRANGE("hdr-scene-threshold-low",
- tone_map.scene_threshold_low, 0, 0, 20.0),
- OPT_FLOATRANGE("hdr-scene-threshold-high",
- tone_map.scene_threshold_high, 0, 0, 20.0),
- OPT_FLOATDEF("tone-mapping-param", tone_map.curve_param, 0),
- OPT_FLOATRANGE("tone-mapping-max-boost", tone_map.max_boost, 0, 1.0, 10.0),
- OPT_FLOAT("tone-mapping-desaturate", tone_map.desat, 0),
- OPT_FLOATRANGE("tone-mapping-desaturate-exponent",
- tone_map.desat_exp, 0, 0.0, 20.0),
- OPT_FLAG("gamut-warning", tone_map.gamut_warning, 0),
- OPT_FLAG("opengl-pbo", pbo, 0),
+ {"gpu-dumb-mode", OPT_CHOICE(dumb_mode,
+ {"auto", 0}, {"yes", 1}, {"no", -1})},
+ {"gamma-factor", OPT_FLOAT(gamma), M_RANGE(0.1, 2.0)},
+ {"gamma-auto", OPT_FLAG(gamma_auto)},
+ {"target-prim", OPT_CHOICE_C(target_prim, mp_csp_prim_names)},
+ {"target-trc", OPT_CHOICE_C(target_trc, mp_csp_trc_names)},
+ {"target-peak", OPT_CHOICE(target_peak, {"auto", 0}),
+ M_RANGE(10, 10000)},
+ {"tone-mapping", OPT_CHOICE(tone_map.curve,
+ {"clip", TONE_MAPPING_CLIP},
+ {"mobius", TONE_MAPPING_MOBIUS},
+ {"reinhard", TONE_MAPPING_REINHARD},
+ {"hable", TONE_MAPPING_HABLE},
+ {"gamma", TONE_MAPPING_GAMMA},
+ {"linear", TONE_MAPPING_LINEAR})},
+ {"hdr-compute-peak", OPT_CHOICE(tone_map.compute_peak,
+ {"auto", 0},
+ {"yes", 1},
+ {"no", -1})},
+ {"hdr-peak-decay-rate", OPT_FLOAT(tone_map.decay_rate),
+ M_RANGE(1.0, 1000.0)},
+ {"hdr-scene-threshold-low", OPT_FLOAT(tone_map.scene_threshold_low),
+ M_RANGE(0, 20.0)},
+ {"hdr-scene-threshold-high", OPT_FLOAT(tone_map.scene_threshold_high),
+ M_RANGE(0, 20.0)},
+ {"tone-mapping-param", OPT_FLOATDEF(tone_map.curve_param)},
+ {"tone-mapping-max-boost", OPT_FLOAT(tone_map.max_boost),
+ M_RANGE(1.0, 10.0)},
+ {"tone-mapping-desaturate", OPT_FLOAT(tone_map.desat)},
+ {"tone-mapping-desaturate-exponent", OPT_FLOAT(tone_map.desat_exp),
+ M_RANGE(0.0, 20.0)},
+ {"gamut-warning", OPT_FLAG(tone_map.gamut_warning)},
+ {"opengl-pbo", OPT_FLAG(pbo)},
SCALER_OPTS("scale", SCALER_SCALE),
SCALER_OPTS("dscale", SCALER_DSCALE),
SCALER_OPTS("cscale", SCALER_CSCALE),
SCALER_OPTS("tscale", SCALER_TSCALE),
- OPT_INTRANGE("scaler-lut-size", scaler_lut_size, 0, 4, 10),
- OPT_FLAG("scaler-resizes-only", scaler_resizes_only, 0),
- OPT_FLAG("correct-downscaling", correct_downscaling, 0),
- OPT_FLAG("linear-downscaling", linear_downscaling, 0),
- OPT_FLAG("linear-upscaling", linear_upscaling, 0),
- 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_STRING("fbo-format", fbo_format, 0),
- OPT_CHOICE_OR_INT("dither-depth", dither_depth, 0, -1, 16,
- ({"no", -1}, {"auto", 0})),
- OPT_CHOICE("dither", dither_algo, 0,
- ({"fruit", DITHER_FRUIT},
- {"ordered", DITHER_ORDERED},
- {"error-diffusion", DITHER_ERROR_DIFFUSION},
- {"no", DITHER_NONE})),
- OPT_INTRANGE("dither-size-fruit", dither_size, 0, 2, 8),
- OPT_FLAG("temporal-dither", temporal_dither, 0),
- OPT_INTRANGE("temporal-dither-period", temporal_dither_period, 0, 1, 128),
- OPT_STRING_VALIDATE("error-diffusion", error_diffusion, 0,
- validate_error_diffusion_opt),
- OPT_CHOICE("alpha", alpha_mode, 0,
- ({"no", ALPHA_NO},
- {"yes", ALPHA_YES},
- {"blend", ALPHA_BLEND},
- {"blend-tiles", ALPHA_BLEND_TILES})),
- OPT_FLAG("opengl-rectangle-textures", use_rectangle, 0),
- OPT_COLOR("background", background, 0),
- OPT_FLAG("interpolation", interpolation, 0),
- OPT_FLOAT("interpolation-threshold", interpolation_threshold, 0),
- OPT_CHOICE("blend-subtitles", blend_subs, 0,
- ({"no", BLEND_SUBS_NO},
- {"yes", BLEND_SUBS_YES},
- {"video", BLEND_SUBS_VIDEO})),
- OPT_PATHLIST("glsl-shaders", user_shaders, M_OPT_FILE),
- OPT_CLI_ALIAS("glsl-shader", "glsl-shaders-append"),
- OPT_FLAG("deband", deband, 0),
- OPT_SUBSTRUCT("deband", deband_opts, deband_conf, 0),
- OPT_FLOAT("sharpen", unsharp, 0),
- OPT_INTRANGE("gpu-tex-pad-x", tex_pad_x, 0, 0, 4096),
- OPT_INTRANGE("gpu-tex-pad-y", tex_pad_y, 0, 0, 4096),
- OPT_SUBSTRUCT("", icc_opts, mp_icc_conf, 0),
- OPT_STRING("gpu-shader-cache-dir", shader_cache_dir, M_OPT_FILE),
- OPT_STRING_VALIDATE("gpu-hwdec-interop", hwdec_interop, 0,
- ra_hwdec_validate_opt),
- OPT_REPLACED("opengl-hwdec-interop", "gpu-hwdec-interop"),
- OPT_REPLACED("hwdec-preload", "opengl-hwdec-interop"),
- OPT_REPLACED("hdr-tone-mapping", "tone-mapping"),
- OPT_REPLACED("opengl-shaders", "glsl-shaders"),
- OPT_REPLACED("opengl-shader", "glsl-shader"),
- OPT_REPLACED("opengl-shader-cache-dir", "gpu-shader-cache-dir"),
- OPT_REPLACED("opengl-tex-pad-x", "gpu-tex-pad-x"),
- OPT_REPLACED("opengl-tex-pad-y", "gpu-tex-pad-y"),
- OPT_REPLACED("opengl-fbo-format", "fbo-format"),
- OPT_REPLACED("opengl-dumb-mode", "gpu-dumb-mode"),
- OPT_REPLACED("opengl-gamma", "gamma-factor"),
- OPT_REMOVED("linear-scaling", "Split into --linear-upscaling and "
- "--linear-downscaling"),
+ {"scaler-lut-size", OPT_INT(scaler_lut_size), M_RANGE(4, 10)},
+ {"scaler-resizes-only", OPT_FLAG(scaler_resizes_only)},
+ {"correct-downscaling", OPT_FLAG(correct_downscaling)},
+ {"linear-downscaling", OPT_FLAG(linear_downscaling)},
+ {"linear-upscaling", OPT_FLAG(linear_upscaling)},
+ {"sigmoid-upscaling", OPT_FLAG(sigmoid_upscaling)},
+ {"sigmoid-center", OPT_FLOAT(sigmoid_center), M_RANGE(0.0, 1.0)},
+ {"sigmoid-slope", OPT_FLOAT(sigmoid_slope), M_RANGE(1.0, 20.0)},
+ {"fbo-format", OPT_STRING(fbo_format)},
+ {"dither-depth", OPT_CHOICE(dither_depth, {"no", -1}, {"auto", 0}),
+ M_RANGE(-1, 16)},
+ {"dither", OPT_CHOICE(dither_algo,
+ {"fruit", DITHER_FRUIT},
+ {"ordered", DITHER_ORDERED},
+ {"error-diffusion", DITHER_ERROR_DIFFUSION},
+ {"no", DITHER_NONE})},
+ {"dither-size-fruit", OPT_INT(dither_size), M_RANGE(2, 8)},
+ {"temporal-dither", OPT_FLAG(temporal_dither)},
+ {"temporal-dither-period", OPT_INT(temporal_dither_period),
+ M_RANGE(1, 128)},
+ {"error-diffusion",
+ OPT_STRING_VALIDATE(error_diffusion, validate_error_diffusion_opt)},
+ {"alpha", OPT_CHOICE(alpha_mode,
+ {"no", ALPHA_NO},
+ {"yes", ALPHA_YES},
+ {"blend", ALPHA_BLEND},
+ {"blend-tiles", ALPHA_BLEND_TILES})},
+ {"opengl-rectangle-textures", OPT_FLAG(use_rectangle)},
+ {"background", OPT_COLOR(background)},
+ {"interpolation", OPT_FLAG(interpolation)},
+ {"interpolation-threshold", OPT_FLOAT(interpolation_threshold)},
+ {"blend-subtitles", OPT_CHOICE(blend_subs,
+ {"no", BLEND_SUBS_NO},
+ {"yes", BLEND_SUBS_YES},
+ {"video", BLEND_SUBS_VIDEO})},
+ {"glsl-shaders", OPT_PATHLIST(user_shaders), .flags = M_OPT_FILE},
+ {"glsl-shader", OPT_CLI_ALIAS("glsl-shaders-append")},
+ {"deband", OPT_FLAG(deband)},
+ {"deband", OPT_SUBSTRUCT(deband_opts, deband_conf)},
+ {"sharpen", OPT_FLOAT(unsharp)},
+ {"gpu-tex-pad-x", OPT_INT(tex_pad_x), M_RANGE(0, 4096)},
+ {"gpu-tex-pad-y", OPT_INT(tex_pad_y), M_RANGE(0, 4096)},
+ {"", OPT_SUBSTRUCT(icc_opts, mp_icc_conf)},
+ {"gpu-shader-cache-dir", OPT_STRING(shader_cache_dir), .flags = M_OPT_FILE},
+ {"gpu-hwdec-interop",
+ OPT_STRING_VALIDATE(hwdec_interop, ra_hwdec_validate_opt)},
+ {"opengl-hwdec-interop", OPT_REPLACED("gpu-hwdec-interop")},
+ {"hwdec-preload", OPT_REPLACED("opengl-hwdec-interop")},
+ {"hdr-tone-mapping", OPT_REPLACED("tone-mapping")},
+ {"opengl-shaders", OPT_REPLACED("glsl-shaders")},
+ {"opengl-shader", OPT_REPLACED("glsl-shader")},
+ {"opengl-shader-cache-dir", OPT_REPLACED("gpu-shader-cache-dir")},
+ {"opengl-tex-pad-x", OPT_REPLACED("gpu-tex-pad-x")},
+ {"opengl-tex-pad-y", OPT_REPLACED("gpu-tex-pad-y")},
+ {"opengl-fbo-format", OPT_REPLACED("fbo-format")},
+ {"opengl-dumb-mode", OPT_REPLACED("gpu-dumb-mode")},
+ {"opengl-gamma", OPT_REPLACED("gamma-factor")},
+ {"linear-scaling", OPT_REMOVED("Split into --linear-upscaling and "
+ "--linear-downscaling")},
{0}
},
.size = sizeof(struct gl_video_opts),
diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c
index 51b62ad7db..ff1660c85a 100644
--- a/video/out/gpu/video_shaders.c
+++ b/video/out/gpu/video_shaders.c
@@ -882,10 +882,10 @@ const struct deband_opts deband_opts_def = {
#define OPT_BASE_STRUCT struct deband_opts
const struct m_sub_options deband_conf = {
.opts = (const m_option_t[]) {
- OPT_INTRANGE("iterations", iterations, 0, 1, 16),
- OPT_FLOATRANGE("threshold", threshold, 0, 0.0, 4096.0),
- OPT_FLOATRANGE("range", range, 0, 1.0, 64.0),
- OPT_FLOATRANGE("grain", grain, 0, 0.0, 4096.0),
+ {"iterations", OPT_INT(iterations), M_RANGE(1, 16)},
+ {"threshold", OPT_FLOAT(threshold), M_RANGE(0.0, 4096.0)},
+ {"range", OPT_FLOAT(range), M_RANGE(1.0, 64.0)},
+ {"grain", OPT_FLOAT(grain), M_RANGE(0.0, 4096.0)},
{0}
},
.size = sizeof(struct deband_opts),