summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-29 21:12:26 +0200
committerwm4 <wm4@nowhere>2015-09-29 21:12:26 +0200
commitee63c9c210683df9cbf17f7bbc5f4de8725260f3 (patch)
tree4079022e388fb4ff4bf0dfefe03f0f4d3cffbe0c /video
parentb4491c00c4b514e925b6bbf501e26de801f28a39 (diff)
downloadmpv-ee63c9c210683df9cbf17f7bbc5f4de8725260f3.tar.bz2
mpv-ee63c9c210683df9cbf17f7bbc5f4de8725260f3.tar.xz
video: replace vf_format outputlevels option with global option
The vf_format suboption is replaced with --video-output-levels (a global option and property). In particular, the parameter is removed from mp_image_params. The mechanism is moved to the "video equalizer", which also handles common video output customization like brightness and contrast controls. The new code is slightly cleaner, and the top-level option is slightly more user-friendly than as vf_format sub-option.
Diffstat (limited to 'video')
-rw-r--r--video/csputils.c3
-rw-r--r--video/csputils.h4
-rw-r--r--video/filter/vf_format.c5
-rw-r--r--video/mp_image.c6
-rw-r--r--video/mp_image.h4
-rw-r--r--video/out/vo_vdpau.c4
-rw-r--r--video/sws_utils.c1
7 files changed, 6 insertions, 21 deletions
diff --git a/video/csputils.c b/video/csputils.c
index ede6cd136f..60cdc54746 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -90,6 +90,7 @@ const char *const mp_csp_equalizer_names[MP_CSP_EQ_COUNT] = {
"hue",
"saturation",
"gamma",
+ "output-levels",
};
const struct m_opt_choice_alternatives mp_chroma_names[] = {
@@ -709,7 +710,6 @@ void mp_csp_set_image_params(struct mp_csp_params *params,
mp_image_params_guess_csp(&p); // ensure consistency
params->colorspace = p.colorspace;
params->levels_in = p.colorlevels;
- params->levels_out = p.outputlevels;
}
// Copy settings from eq into params.
@@ -721,6 +721,7 @@ void mp_csp_copy_equalizer_values(struct mp_csp_params *params,
params->hue = eq->values[MP_CSP_EQ_HUE] / 100.0 * M_PI;
params->saturation = (eq->values[MP_CSP_EQ_SATURATION] + 100) / 100.0;
params->gamma = exp(log(8.0) * eq->values[MP_CSP_EQ_GAMMA] / 100.0);
+ params->levels_out = eq->values[MP_CSP_EQ_OUTPUT_LEVELS];
}
static int find_eq(int capabilities, const char *name)
diff --git a/video/csputils.h b/video/csputils.h
index 85a97c263b..df5da4a1c6 100644
--- a/video/csputils.h
+++ b/video/csputils.h
@@ -161,6 +161,7 @@ enum mp_csp_equalizer_param {
MP_CSP_EQ_HUE,
MP_CSP_EQ_SATURATION,
MP_CSP_EQ_GAMMA,
+ MP_CSP_EQ_OUTPUT_LEVELS,
MP_CSP_EQ_COUNT,
};
@@ -168,7 +169,8 @@ enum mp_csp_equalizer_param {
( (1 << MP_CSP_EQ_BRIGHTNESS) \
| (1 << MP_CSP_EQ_CONTRAST) \
| (1 << MP_CSP_EQ_HUE) \
- | (1 << MP_CSP_EQ_SATURATION) )
+ | (1 << MP_CSP_EQ_SATURATION) \
+ | (1 << MP_CSP_EQ_OUTPUT_LEVELS) )
#define MP_CSP_EQ_CAPS_GAMMA (1 << MP_CSP_EQ_GAMMA)
#define MP_CSP_EQ_CAPS_BRIGHTNESS (1 << MP_CSP_EQ_BRIGHTNESS)
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c
index 881f1026d2..83d697b412 100644
--- a/video/filter/vf_format.c
+++ b/video/filter/vf_format.c
@@ -34,7 +34,6 @@ struct vf_priv_s {
int outfmt;
int colormatrix;
int colorlevels;
- int outputlevels;
int primaries;
int gamma;
int chroma_location;
@@ -89,8 +88,6 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
out->colorspace = p->colormatrix;
if (p->colorlevels)
out->colorlevels = p->colorlevels;
- if (p->outputlevels)
- out->outputlevels = p->outputlevels;
if (p->primaries)
out->primaries = p->primaries;
if (p->gamma)
@@ -137,7 +134,6 @@ static const m_option_t vf_opts_fields[] = {
OPT_IMAGEFORMAT("outfmt", outfmt, 0),
OPT_CHOICE_C("colormatrix", colormatrix, 0, mp_csp_names),
OPT_CHOICE_C("colorlevels", colorlevels, 0, mp_csp_levels_names),
- OPT_CHOICE_C("outputlevels", outputlevels, 0, mp_csp_levels_names),
OPT_CHOICE_C("primaries", primaries, 0, mp_csp_prim_names),
OPT_CHOICE_C("gamma", gamma, 0, mp_csp_trc_names),
OPT_CHOICE_C("chroma-location", chroma_location, 0, mp_chroma_names),
@@ -147,6 +143,7 @@ static const m_option_t vf_opts_fields[] = {
OPT_INT("dw", dw, 0),
OPT_INT("dh", dh, 0),
OPT_DOUBLE("dar", dar, 0),
+ OPT_REMOVED("outputlevels", "use the --video-output-levels global option"),
{0}
};
diff --git a/video/mp_image.c b/video/mp_image.c
index 57650eea0d..a3472baf3f 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -394,7 +394,6 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
dst->params.colorspace = src->params.colorspace;
dst->params.colorlevels = src->params.colorlevels;
dst->params.chroma_location = src->params.chroma_location;
- dst->params.outputlevels = src->params.outputlevels;
}
mp_image_params_guess_csp(&dst->params); // ensure colorspace consistency
if ((dst->fmt.flags & MP_IMGFLAG_PAL) && (src->fmt.flags & MP_IMGFLAG_PAL)) {
@@ -491,10 +490,6 @@ char *mp_image_params_to_str_buf(char *b, size_t bs,
m_opt_choice_str(mp_csp_levels_names, p->colorlevels));
mp_snprintf_cat(b, bs, " CL=%s",
m_opt_choice_str(mp_chroma_names, p->chroma_location));
- if (p->outputlevels) {
- mp_snprintf_cat(b, bs, " out=%s",
- m_opt_choice_str(mp_csp_levels_names, p->outputlevels));
- }
if (p->rotate)
mp_snprintf_cat(b, bs, " rot=%d", p->rotate);
if (p->stereo_in > 0 || p->stereo_out > 0) {
@@ -541,7 +536,6 @@ bool mp_image_params_equal(const struct mp_image_params *p1,
p1->d_w == p2->d_w && p1->d_h == p2->d_h &&
p1->colorspace == p2->colorspace &&
p1->colorlevels == p2->colorlevels &&
- p1->outputlevels == p2->outputlevels &&
p1->primaries == p2->primaries &&
p1->gamma == p2->gamma &&
p1->chroma_location == p2->chroma_location &&
diff --git a/video/mp_image.h b/video/mp_image.h
index 25eb42c050..f71f7b3652 100644
--- a/video/mp_image.h
+++ b/video/mp_image.h
@@ -46,10 +46,6 @@ struct mp_image_params {
enum mp_csp_prim primaries;
enum mp_csp_trc gamma;
enum mp_chroma_location chroma_location;
- // The image should be converted to these levels. Unlike colorlevels, it
- // does not describe the current state of the image. (Somewhat similar to
- // d_w/d_h vs. w/h.)
- enum mp_csp_levels outputlevels;
// The image should be rotated clockwise (0-359 degrees).
int rotate;
enum mp_stereo3d_mode stereo_in; // image is encoded with this mode
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 20457b602e..5eaa23cc77 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -948,10 +948,6 @@ static struct mp_image *read_output_surface(struct vo *vo,
if (!image)
return NULL;
- image->params.colorspace = MP_CSP_RGB;
- // hardcoded with conv. matrix
- image->params.colorlevels = vo->params->outputlevels;
-
void *dst_planes[] = { image->planes[0] };
uint32_t dst_pitches[] = { image->stride[0] };
vdp_st = vdp->output_surface_get_bits_native(surface, NULL, dst_planes,
diff --git a/video/sws_utils.c b/video/sws_utils.c
index bf5ad8f1a4..00b00513bc 100644
--- a/video/sws_utils.c
+++ b/video/sws_utils.c
@@ -161,7 +161,6 @@ int mp_sws_reinit(struct mp_sws_context *ctx)
// Neutralize unsupported or ignored parameters.
src->d_w = dst->d_w = 0;
src->d_h = dst->d_h = 0;
- src->outputlevels = dst->outputlevels = MP_CSP_LEVELS_AUTO;
if (cache_valid(ctx))
return 0;