vo_vdpau: Add support for high-quality scaling feature

Part of the code is currently under #ifdef to allow compilation with
older VDPAU library versions; that can be removed later.

Partially based on a patch by Carl Eugen Hoyos.
This commit is contained in:
Uoti Urpala 2009-11-15 18:39:48 +02:00
parent 82ee2e217f
commit 14bb3416c7
4 changed files with 33 additions and 2 deletions

View File

@ -3462,6 +3462,13 @@ Use ITU-R BT.709 color space.
.IPs 3 .IPs 3
Use SMPTE-240M color space. Use SMPTE-240M color space.
.RE .RE
IPs hqscaling
.RSss
.IPs 0
Use default VDPAU scaling (default).
.IPs 1\-9
Apply high quality VDPAU scaling (needs capable hardware).
.RE
.IPs fps=<number> .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). 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. Default 0 means use autodetected value.

View File

@ -31,6 +31,7 @@ presentation_queue_target_create_x11
presentation_queue_target_destroy presentation_queue_target_destroy
video_mixer_create video_mixer_create
video_mixer_destroy video_mixer_destroy
video_mixer_query_feature_support
video_mixer_render video_mixer_render
video_mixer_set_attribute_values video_mixer_set_attribute_values
video_mixer_set_feature_enables video_mixer_set_feature_enables

View File

@ -33,6 +33,7 @@ VDP_FUNCTION(VdpPresentationQueueTargetCreateX11, VDP_FUNC_ID_PRESENTATION_QUEUE
VDP_FUNCTION(VdpPresentationQueueTargetDestroy, VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, presentation_queue_target_destroy) VDP_FUNCTION(VdpPresentationQueueTargetDestroy, VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, presentation_queue_target_destroy)
VDP_FUNCTION(VdpVideoMixerCreate, VDP_FUNC_ID_VIDEO_MIXER_CREATE, video_mixer_create) VDP_FUNCTION(VdpVideoMixerCreate, VDP_FUNC_ID_VIDEO_MIXER_CREATE, video_mixer_create)
VDP_FUNCTION(VdpVideoMixerDestroy, VDP_FUNC_ID_VIDEO_MIXER_DESTROY, video_mixer_destroy) VDP_FUNCTION(VdpVideoMixerDestroy, VDP_FUNC_ID_VIDEO_MIXER_DESTROY, video_mixer_destroy)
VDP_FUNCTION(VdpVideoMixerQueryFeatureSupport, VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT, video_mixer_query_feature_support)
VDP_FUNCTION(VdpVideoMixerRender, VDP_FUNC_ID_VIDEO_MIXER_RENDER, video_mixer_render) VDP_FUNCTION(VdpVideoMixerRender, VDP_FUNC_ID_VIDEO_MIXER_RENDER, video_mixer_render)
VDP_FUNCTION(VdpVideoMixerSetAttributeValues, VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, video_mixer_set_attribute_values) VDP_FUNCTION(VdpVideoMixerSetAttributeValues, VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, video_mixer_set_attribute_values)
VDP_FUNCTION(VdpVideoMixerSetFeatureEnables, VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, video_mixer_set_feature_enables) VDP_FUNCTION(VdpVideoMixerSetFeatureEnables, VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, video_mixer_set_feature_enables)

View File

@ -132,6 +132,7 @@ struct vdpctx {
int pullup; int pullup;
float denoise; float denoise;
float sharpen; float sharpen;
int hqscaling;
int chroma_deint; int chroma_deint;
int top_field_first; int top_field_first;
bool flip; bool flip;
@ -576,7 +577,7 @@ static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type)
struct vdpctx *vc = vo->priv; struct vdpctx *vc = vo->priv;
struct vdp_functions *vdp = vc->vdp; struct vdp_functions *vdp = vc->vdp;
#define VDP_NUM_MIXER_PARAMETER 3 #define VDP_NUM_MIXER_PARAMETER 3
#define MAX_NUM_FEATURES 5 #define MAX_NUM_FEATURES 6
int i; int i;
VdpStatus vdp_st; VdpStatus vdp_st;
@ -616,6 +617,25 @@ static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type)
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION; features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
if (vc->sharpen) if (vc->sharpen)
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS; features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
if (vc->hqscaling) {
#ifndef VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] MPlayer was compiled with (old?)"
"libvdpau headers with no support for requested hqscaling.\n");
#else
VdpVideoMixerFeature hqscaling_feature =
VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 + vc->hqscaling-1;
VdpBool hqscaling_available;
vdp_st = vdp->video_mixer_query_feature_support(vc->vdp_device,
hqscaling_feature,
&hqscaling_available);
CHECK_ST_ERROR("Error when calling video_mixer_query_feature_support");
if (hqscaling_available)
features[feature_count++] = hqscaling_feature;
else
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Your hardware or VDPAU "
"library does not support requested hqscaling.\n");
}
#endif
vdp_st = vdp->video_mixer_create(vc->vdp_device, feature_count, features, vdp_st = vdp->video_mixer_create(vc->vdp_device, feature_count, features,
VDP_NUM_MIXER_PARAMETER, VDP_NUM_MIXER_PARAMETER,
@ -1592,10 +1612,12 @@ static int preinit(struct vo *vo, const char *arg)
{"denoise", OPT_ARG_FLOAT, &vc->denoise, NULL}, {"denoise", OPT_ARG_FLOAT, &vc->denoise, NULL},
{"sharpen", OPT_ARG_FLOAT, &vc->sharpen, NULL}, {"sharpen", OPT_ARG_FLOAT, &vc->sharpen, NULL},
{"colorspace", OPT_ARG_INT, &vc->user_colorspace, NULL}, {"colorspace", OPT_ARG_INT, &vc->user_colorspace, NULL},
{"hqscaling", OPT_ARG_INT, &vc->hqscaling, NULL},
{"fps", OPT_ARG_FLOAT, &vc->user_fps, NULL}, {"fps", OPT_ARG_FLOAT, &vc->user_fps, NULL},
{NULL} {NULL}
}; };
if (subopt_parse(arg, subopts) != 0) { if (subopt_parse(arg, subopts) != 0 || vc->hqscaling < 0
|| vc->hqscaling > 9) {
mp_msg(MSGT_VO, MSGL_FATAL, help_msg); mp_msg(MSGT_VO, MSGL_FATAL, help_msg);
return -1; return -1;
} }