summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--DOCS/man/en/mplayer.110
-rw-r--r--libvo/vo_vdpau.c15
2 files changed, 23 insertions, 2 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 844c52d696..9d1a92207b 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -3509,7 +3509,7 @@ Use nochroma\-deint to solely use luma and speed up advanced deinterlacing.
Useful with slow video memory.
.IPs pullup
Try to apply inverse telecine, needs motion adaptive temporal deinterlacing.
-.IPs colorspace
+.IPs colorspace=<0-3>
Select the color space for YUV to RGB conversion.
In general BT.601 should be used for standard definition (SD) content and
BT.709 for high definition (HD) content.
@@ -3527,13 +3527,19 @@ Use ITU-R BT.709 color space.
.IPs 3
Use SMPTE-240M color space.
.RE
-.IPs hqscaling
+.IPs hqscaling=<0-9>
.RSss
.IPs 0
Use default VDPAU scaling (default).
.IPs 1\-9
Apply high quality VDPAU scaling (needs capable hardware).
.RE
+.IPs studio
+Output video in studio level RGB (16-235).
+This is what TVs and video monitors generally expect.
+By default PC level RGB (0-255) suitable for PC monitors is used.
+Providing studio level output to a device expecting PC level input results in
+grey blacks and dim whites, the reverse in crushed blacks and whites.
.IPs fps=<number>
Override autodetected display refresh rate value (the value is needed for framedrop to allow video playback rates higher than display refresh rate, and for vsync-aware frame timing adjustments).
Default 0 means use autodetected value.
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},