summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-12 03:52:43 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-12 03:55:32 +0300
commit67482de5a7872e63f90c0ec7ac880131638585b8 (patch)
treef0630b46a655939ba49612f35e42f0361fea7b26 /libvo
parent0ae292fbcb03fadd57501b831603783c5a5a5754 (diff)
downloadmpv-67482de5a7872e63f90c0ec7ac880131638585b8.tar.bz2
mpv-67482de5a7872e63f90c0ec7ac880131638585b8.tar.xz
vo_vdpau: add option for studio level output
Add -vo vdpau suboption "studio" to produce output in RGB range 16-235. Man page description mostly taken from a patch by Lauri Mylläri (but not code). Also slightly tweak the description of two other suboptions on the man page.
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_vdpau.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index e6c21663e8..7f0e222b56 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -126,6 +126,7 @@ struct vdpctx {
VdpVideoMixer video_mixer;
int user_colorspace;
int colorspace;
+ int studio_levels;
int deint;
int deint_type;
int deint_counter;
@@ -583,6 +584,19 @@ static void update_csc_matrix(struct vo *vo)
vdp_st = vdp->generate_csc_matrix(&vc->procamp, vdp_colors[csp], &matrix);
CHECK_ST_WARNING("Error when generating CSC matrix");
+ if (vc->studio_levels) {
+ /* Modify matrix to change output range from 0..255 to 16..235.
+ * Clipping limits can't be changed, so out-of-range results that
+ * would have been clipped to 0 or 255 before can still go below
+ * 16 or above 235.
+ */
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 4; j++)
+ matrix[i][j] *= 220. / 256;
+ matrix[i][3] += 16. / 256;
+ }
+ }
+
set_video_attribute(vc, VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX,
&matrix, "CSC matrix");
}
@@ -1598,6 +1612,7 @@ static int preinit(struct vo *vo, const char *arg)
{"denoise", OPT_ARG_FLOAT, &vc->denoise, NULL},
{"sharpen", OPT_ARG_FLOAT, &vc->sharpen, NULL},
{"colorspace", OPT_ARG_INT, &vc->user_colorspace, NULL},
+ {"studio", OPT_ARG_BOOL, &vc->studio_levels, NULL},
{"hqscaling", OPT_ARG_INT, &vc->hqscaling, NULL},
{"fps", OPT_ARG_FLOAT, &vc->user_fps, NULL},
{"queuetime_windowed", OPT_ARG_INT, &vc->flip_offset_window, NULL},