1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 17:42:17 +00:00

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.
This commit is contained in:
Uoti Urpala 2010-05-12 03:52:43 +03:00
parent 0ae292fbcb
commit 67482de5a7
2 changed files with 23 additions and 2 deletions

View File

@ -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.

View File

@ -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},