diff options
-rw-r--r-- | src/libvdpau/vdpau_h264.c | 14 | ||||
-rw-r--r-- | src/video_out/video_out_vdpau.c | 12 | ||||
-rw-r--r-- | src/xine-engine/accel_vdpau.h | 2 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/libvdpau/vdpau_h264.c b/src/libvdpau/vdpau_h264.c index 516b279bb..de3cf5d81 100644 --- a/src/libvdpau/vdpau_h264.c +++ b/src/libvdpau/vdpau_h264.c @@ -485,6 +485,20 @@ static int vdpau_decoder_render(video_decoder_t *this_gen, VdpBitstreamBuffer *v //else if(img->progressive_frame && this->nal_parser->current_nal->repeat_pic) // img->duration *= this->nal_parser->current_nal->repeat_pic; + /* only bt601 and bt701 handled so far. others seem to be rarely used */ + if(sps->vui_parameters.colour_description_present) { + switch (sps->vui_parameters.colour_primaries) { + case 1: + this->vdpau_accel->color_standard = VDP_COLOR_STANDARD_ITUR_BT_709; + break; + case 5: + case 6: + default: + this->vdpau_accel->color_standard = VDP_COLOR_STANDARD_ITUR_BT_601; + break; + } + } + struct decoded_picture *decoded_pic = NULL; if(pic.is_reference) { if(!slc->field_pic_flag || !this->wait_for_bottom_field) { diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c index 14779db7e..fe387e02f 100644 --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -251,6 +251,7 @@ typedef struct { VdpChromaType video_mixer_chroma; uint32_t video_mixer_width; uint32_t video_mixer_height; + VdpColorStandard color_standard; VdpColor back_color; @@ -687,6 +688,7 @@ static vo_frame_t *vdpau_alloc_frame (vo_driver_t *this_gen) frame->vdpau_accel_data.vdp_device = vdp_device; frame->vdpau_accel_data.surface = VDP_INVALID_HANDLE; frame->vdpau_accel_data.chroma = VDP_CHROMA_TYPE_420; + frame->vdpau_accel_data.color_standard = this->color_standard; frame->vdpau_accel_data.vdp_decoder_create = vdp_decoder_create; frame->vdpau_accel_data.vdp_decoder_destroy = vdp_decoder_destroy; frame->vdpau_accel_data.vdp_decoder_render = vdp_decoder_render; @@ -1081,12 +1083,12 @@ static void vdpau_update_csc( vdpau_driver_t *this_gen ) float contrast = this_gen->contrast/100.0; float brightness = this_gen->brightness/100.0; - printf( "vo_vdpau: vdpau_update_csc: hue=%f, saturation=%f, contrast=%f, brightness=%f\n", hue, saturation, contrast, brightness ); + printf( "vo_vdpau: vdpau_update_csc: hue=%f, saturation=%f, contrast=%f, brightness=%f, color_standard=%d\n", hue, saturation, contrast, brightness, this_gen->color_standard ); VdpCSCMatrix matrix; VdpProcamp procamp = { VDP_PROCAMP_VERSION, brightness, contrast, saturation, hue }; - VdpStatus st = vdp_generate_csc_matrix( &procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &matrix ); + VdpStatus st = vdp_generate_csc_matrix( &procamp, this_gen->color_standard, &matrix ); if ( st != VDP_STATUS_OK ) { printf( "vo_vdpau: error, can't generate csc matrix !!\n" ); return; @@ -1107,6 +1109,7 @@ static void vdpau_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) VdpStatus st; VdpVideoSurface surface; VdpChromaType chroma = this->video_mixer_chroma; + VdpColorStandard color_standard = this->color_standard; uint32_t mix_w = this->video_mixer_width; uint32_t mix_h = this->video_mixer_height; VdpTime stream_speed; @@ -1164,6 +1167,7 @@ static void vdpau_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) mix_w = frame->width; mix_h = frame->height; chroma = (frame->vo_frame.flags & VO_CHROMA_422) ? VDP_CHROMA_TYPE_422 : VDP_CHROMA_TYPE_420; + color_standard = frame->vdpau_accel_data.color_standard; } else { /* unknown format */ @@ -1172,7 +1176,7 @@ static void vdpau_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) return; } - if ( (mix_w != this->video_mixer_width) || (mix_h != this->video_mixer_height) || (chroma != this->video_mixer_chroma) ) { + if ( (mix_w != this->video_mixer_width) || (mix_h != this->video_mixer_height) || (chroma != this->video_mixer_chroma) || (color_standard != this->color_standard)) { vdpau_release_back_frames( this_gen ); /* empty past frames array */ printf("vo_vdpau: recreate mixer to match frames: width=%d, height=%d, chroma=%d\n", mix_w, mix_h, chroma); vdp_video_mixer_destroy( this->video_mixer ); @@ -1186,6 +1190,7 @@ static void vdpau_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->video_mixer_chroma = chroma; this->video_mixer_width = mix_w; this->video_mixer_height = mix_h; + this->color_standard = color_standard; vdpau_set_deinterlace( this_gen ); vdpau_set_inverse_telecine( this_gen ); vdpau_update_noise( this ); @@ -1907,6 +1912,7 @@ static vo_driver_t *vdpau_open_plugin (video_driver_class_t *class_gen, const vo return NULL; } + this->color_standard = VDP_COLOR_STANDARD_ITUR_BT_601; this->video_mixer_chroma = chroma; this->video_mixer_width = this->soft_surface_width; this->video_mixer_height = this->soft_surface_height; diff --git a/src/xine-engine/accel_vdpau.h b/src/xine-engine/accel_vdpau.h index 99cea4568..92a46e46f 100644 --- a/src/xine-engine/accel_vdpau.h +++ b/src/xine-engine/accel_vdpau.h @@ -49,6 +49,8 @@ typedef struct { VdpVideoSurface surface; VdpChromaType chroma; + VdpColorStandard color_standard; + int vdp_runtime_nr; /* this is used to keep in sync on preemptions */ int *current_vdp_runtime_nr; |