diff options
-rw-r--r-- | src/video_dec/libvdpau/alterh264_decode.c | 21 | ||||
-rw-r--r-- | src/video_dec/libvdpau/alterh264_decode.h | 2 | ||||
-rw-r--r-- | src/video_dec/libvdpau/vdpau_mpeg12.c | 5 | ||||
-rw-r--r-- | src/video_dec/libvdpau/vdpau_mpeg4.c | 17 | ||||
-rw-r--r-- | src/video_dec/libvdpau/vdpau_vc1.c | 14 |
5 files changed, 29 insertions, 30 deletions
diff --git a/src/video_dec/libvdpau/alterh264_decode.c b/src/video_dec/libvdpau/alterh264_decode.c index 77a4d3057..1f5c6904b 100644 --- a/src/video_dec/libvdpau/alterh264_decode.c +++ b/src/video_dec/libvdpau/alterh264_decode.c @@ -601,6 +601,7 @@ static void vui_parameters (sequence_t * seq, vui_param_t * vui) { bits_reader_t *br = &seq->br; + int xine_color_matrix = 4; /* undefined, mpeg range */ vui->aspect_ratio_info = read_bits (br, 1); lprintf ("aspect_ratio_info_present_flag = %d\n", vui->aspect_ratio_info); @@ -621,27 +622,17 @@ vui_parameters (sequence_t * seq, vui_param_t * vui) if (read_bits (br, 1)) { /* video_signal_type_present_flag */ skip_bits (br, 3); /*video_format */ - skip_bits (br, 1); /*video_full_range_flag */ + xine_color_matrix |= read_bits (br, 1); /*video_full_range_flag */ vui->colour_desc = read_bits (br, 1); lprintf ("colour_desc = %d\n", vui->colour_desc); if (vui->colour_desc) { - vui->colour_primaries = read_bits (br, 8); - lprintf ("colour_primaries = %d\n", vui->colour_primaries); + skip_bits (br, 8); /* colour_primaries */ skip_bits (br, 8); /* transfer_characteristics */ - skip_bits (br, 8); /* matrix_coefficients */ - switch (vui->colour_primaries) - { - case 1: - seq->color_standard = VDP_COLOR_STANDARD_ITUR_BT_709; - break; - case 6: - case 7: - seq->color_standard = VDP_COLOR_STANDARD_SMPTE_240M; - break; - } + xine_color_matrix = (xine_color_matrix & 1) | (read_bits (br, 8) << 1); /* matrix_coefficients */ } } + VO_SET_FLAGS_CM (xine_color_matrix, seq->color_matrix); if (read_bits (br, 1)) { /* chroma_loc_info_present_flag */ read_exp_ue (br); /* chroma_sample_loc_type_top_field */ @@ -1669,7 +1660,7 @@ decode_render (vdpau_h264_alter_decoder_t * vd, int bad_frame) seq->coded_width, seq->coded_height, seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS | seq->chroma | seq-> - reset); + reset | seq->color_matrix); seq->reset = 0; img->drawn = 0; } diff --git a/src/video_dec/libvdpau/alterh264_decode.h b/src/video_dec/libvdpau/alterh264_decode.h index a756baba5..8aefeb21c 100644 --- a/src/video_dec/libvdpau/alterh264_decode.h +++ b/src/video_dec/libvdpau/alterh264_decode.h @@ -330,6 +330,8 @@ typedef struct uint8_t flag_header; uint32_t frame_header_size; + int color_matrix; + } sequence_t; diff --git a/src/video_dec/libvdpau/vdpau_mpeg12.c b/src/video_dec/libvdpau/vdpau_mpeg12.c index 4121cfb06..1f4ba3caa 100644 --- a/src/video_dec/libvdpau/vdpau_mpeg12.c +++ b/src/video_dec/libvdpau/vdpau_mpeg12.c @@ -785,8 +785,11 @@ static void decode_picture( vdpau_mpeg12_decoder_t *vd, uint8_t end_of_sequence } int still_image = (end_of_sequence) ? VO_STILL_IMAGE : 0; + /* no sequence display extension parser yet so at least enable autoselection */ + int color_matrix = 0; + VO_SET_FLAGS_CM (4, color_matrix); vo_frame_t *img = vd->stream->video_out->get_frame( vd->stream->video_out, seq->coded_width, seq->coded_height, - seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS | seq->chroma | seq->reset | still_image ); + seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS | seq->chroma | seq->reset | still_image | color_matrix ); seq->reset = 0; vdpau_accel_t *accel = (vdpau_accel_t*)img->accel_data; if ( !seq->accel_vdpau ) diff --git a/src/video_dec/libvdpau/vdpau_mpeg4.c b/src/video_dec/libvdpau/vdpau_mpeg4.c index 70c0ed4bc..6748fb6b6 100644 --- a/src/video_dec/libvdpau/vdpau_mpeg4.c +++ b/src/video_dec/libvdpau/vdpau_mpeg4.c @@ -196,6 +196,8 @@ typedef struct { int last_non_b_time; int t_frame; + int color_matrix; + } sequence_t; @@ -332,6 +334,7 @@ static void visual_object( vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int le { sequence_t *sequence = (sequence_t*)&this_gen->sequence; picture_t *picture = (picture_t*)&sequence->picture; + int xine_color_matrix = 4; /* undefined, mpeg range */ bits_reader_set( &sequence->br, buf, len ); if ( read_bits( &sequence->br, 1 ) ) { @@ -341,16 +344,16 @@ static void visual_object( vdpau_mpeg4_decoder_t *this_gen, uint8_t *buf, int le } if ( read_bits( &sequence->br, 4 ) == 1 ) { if ( read_bits( &sequence->br, 1 ) ) { - skip_bits( &sequence->br, 4 ); + skip_bits (&sequence->br, 3); /* video_format */ + xine_color_matrix |= read_bits (&sequence->br, 1); /* full range */ if ( read_bits( &sequence->br, 1 ) ) { - if ( read_bits( &sequence->br, 8 ) == 7 ) { - lprintf("color_standard: smpte_240M\n"); - sequence->color_standard = VDP_COLOR_STANDARD_SMPTE_240M; - } - skip_bits( &sequence->br, 16 ); + skip_bits (&sequence->br, 16); + xine_color_matrix = (xine_color_matrix & 1) + | (read_bits (&sequence->br, 8) << 1); /* matrix_coefficients */ } } } + VO_SET_FLAGS_CM (xine_color_matrix, sequence->color_matrix); } @@ -899,7 +902,7 @@ static void decode_picture( vdpau_mpeg4_decoder_t *vd ) } } - vo_frame_t *img = vd->stream->video_out->get_frame( vd->stream->video_out, seq->coded_width, seq->coded_height, seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS ); + vo_frame_t *img = vd->stream->video_out->get_frame( vd->stream->video_out, seq->coded_width, seq->coded_height, seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS | seq->color_matrix ); vdpau_accel_t *accel = (vdpau_accel_t*)img->accel_data; if ( !seq->accel_vdpau ) seq->accel_vdpau = accel; diff --git a/src/video_dec/libvdpau/vdpau_vc1.c b/src/video_dec/libvdpau/vdpau_vc1.c index 67e908c47..525f2185b 100644 --- a/src/video_dec/libvdpau/vdpau_vc1.c +++ b/src/video_dec/libvdpau/vdpau_vc1.c @@ -146,6 +146,7 @@ typedef struct { int vdp_runtime_nr; + int color_matrix; } sequence_t; @@ -249,6 +250,7 @@ static void sequence_header_advanced( vdpau_vc1_decoder_t *this_gen, uint8_t *bu { lprintf( "sequence_header_advanced\n" ); sequence_t *sequence = (sequence_t*)&this_gen->sequence; + int xine_color_matrix = 4; /* undefined, mpeg range */ if ( len < 5 ) return; @@ -315,15 +317,11 @@ static void sequence_header_advanced( vdpau_vc1_decoder_t *this_gen, uint8_t *bu } } if ( read_bits( &sequence->br, 1 ) ) { -#ifdef LOG - int col = read_bits( &sequence->br, 8 ); - lprintf("color_standard = %d\n", col); skip_bits( &sequence->br, 16 ); -#else - skip_bits( &sequence->br, 24 ); -#endif + xine_color_matrix = read_bits (&sequence->br, 8) << 1; /* VC1 is always mpeg range?? */ } } + VO_SET_FLAGS_CM (xine_color_matrix, sequence->color_matrix); sequence->picture.hrd_param_flag = read_bits( &sequence->br, 1 ); if ( sequence->picture.hrd_param_flag ) sequence->picture.hrd_num_leaky_buckets = read_bits( &sequence->br, 5 ); @@ -366,6 +364,8 @@ static void sequence_header( vdpau_vc1_decoder_t *this_gen, uint8_t *buf, int le sequence->picture.vdp_infos.quantizer = read_bits( &sequence->br, 2 ); sequence->picture.vdp_infos.finterpflag = read_bits( &sequence->br, 1 ); + VO_SET_FLAGS_CM (4, sequence->color_matrix); + update_metadata( this_gen ); } @@ -825,7 +825,7 @@ static void decode_picture( vdpau_vc1_decoder_t *vd ) } vo_frame_t *img = vd->stream->video_out->get_frame( vd->stream->video_out, seq->coded_width, seq->coded_height, - seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS ); + seq->ratio, XINE_IMGFMT_VDPAU, VO_BOTH_FIELDS | seq->color_matrix ); vdpau_accel_t *accel = (vdpau_accel_t*)img->accel_data; if ( !seq->accel_vdpau ) seq->accel_vdpau = accel; |