From a1b2e519be60481831eaad8280427ac1115b15c3 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Sun, 25 Jan 2009 17:09:23 +0000 Subject: Switch back to default color standard when necessary. --- src/libvdpau/vdpau_h264.c | 20 +++++++++++++------- src/video_out/video_out_vdpau.c | 9 +++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/libvdpau/vdpau_h264.c b/src/libvdpau/vdpau_h264.c index 906c65f4c..988c6c676 100644 --- a/src/libvdpau/vdpau_h264.c +++ b/src/libvdpau/vdpau_h264.c @@ -67,6 +67,7 @@ typedef struct vdpau_h264_decoder_s { VdpDecoder decoder; int decoder_started; + VdpColorStandard color_standard; VdpDecoderProfile profile; vdpau_accel_t *vdpau_accel; @@ -490,16 +491,18 @@ static int vdpau_decoder_render(video_decoder_t *this_gen, VdpBitstreamBuffer *v 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; + this->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; + this->color_standard = VDP_COLOR_STANDARD_ITUR_BT_601; break; } } + this->vdpau_accel->color_standard = this->color_standard; + struct decoded_picture *decoded_pic = NULL; if(pic.is_reference) { if(!slc->field_pic_flag || !this->wait_for_bottom_field) { @@ -672,6 +675,13 @@ static void vdpau_h264_reset (video_decoder_t *this_gen) { } free_parser(this->nal_parser); + + this->color_standard = VDP_COLOR_STANDARD_ITUR_BT_601; + this->wait_for_bottom_field = 0; + this->video_step = 0; + this->curr_pts = 0; + this->next_pts = 0; + this->nal_parser = init_parser(); if(this->codec_private_len > 0) { parse_codec_private(this->nal_parser, this->codec_private, this->codec_private_len); @@ -683,11 +693,6 @@ static void vdpau_h264_reset (video_decoder_t *this_gen) { this->wait_for_frame_start = this->have_frame_boundary_marks; } - this->wait_for_bottom_field = 0; - this->video_step = 0; - this->curr_pts = 0; - this->next_pts = 0; - if (this->dangling_img) { this->dangling_img->free(this->dangling_img); this->dangling_img = NULL; @@ -757,6 +762,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre this->decoder = VDP_INVALID_HANDLE; this->vdp_runtime_nr = 1; + this->color_standard = VDP_COLOR_STANDARD_ITUR_BT_601; this->nal_parser = init_parser(); diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c index fe387e02f..780a308e9 100644 --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -898,6 +898,7 @@ static void vdpau_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ //printf("vo_vdpau: allocated_surfaces=%d\n", this->allocated_surfaces ); + frame->vdpau_accel_data.color_standard = VDP_COLOR_STANDARD_ITUR_BT_601; frame->ratio = ratio; frame->vo_frame.future_frame = NULL; } @@ -1176,7 +1177,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) || (color_standard != this->color_standard)) { + if ( (mix_w != this->video_mixer_width) || (mix_h != this->video_mixer_height) || (chroma != this->video_mixer_chroma)) { 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 ); @@ -1190,11 +1191,15 @@ 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 ); vdpau_update_sharpness( this ); + } + + if (color_standard != this->color_standard) { + printf("vo_vdpau: update color_standard: %d\n", color_standard); + this->color_standard = color_standard; vdpau_update_csc( this ); } -- cgit v1.2.3