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