Mercurial > libavcodec.hg
comparison h264.c @ 9128:793cf8c68c4f libavcodec
Add support for ct_type to correctly detect interlaced flag
author | schreter |
---|---|
date | Wed, 04 Mar 2009 19:37:19 +0000 |
parents | 65141aec8b05 |
children | 53123c63f82a |
comparison
equal
deleted
inserted
replaced
9127:5d2f8632d417 | 9128:793cf8c68c4f |
---|---|
6793 h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length); | 6793 h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length); |
6794 } | 6794 } |
6795 if(h->sps.pic_struct_present_flag){ | 6795 if(h->sps.pic_struct_present_flag){ |
6796 unsigned int i, num_clock_ts; | 6796 unsigned int i, num_clock_ts; |
6797 h->sei_pic_struct = get_bits(&s->gb, 4); | 6797 h->sei_pic_struct = get_bits(&s->gb, 4); |
6798 h->sei_ct_type = 0; | |
6798 | 6799 |
6799 if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING) | 6800 if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING) |
6800 return -1; | 6801 return -1; |
6801 | 6802 |
6802 num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct]; | 6803 num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct]; |
6803 | 6804 |
6804 for (i = 0 ; i < num_clock_ts ; i++){ | 6805 for (i = 0 ; i < num_clock_ts ; i++){ |
6805 if(get_bits(&s->gb, 1)){ /* clock_timestamp_flag */ | 6806 if(get_bits(&s->gb, 1)){ /* clock_timestamp_flag */ |
6806 unsigned int full_timestamp_flag; | 6807 unsigned int full_timestamp_flag; |
6807 skip_bits(&s->gb, 2); /* ct_type */ | 6808 h->sei_ct_type |= 1<<get_bits(&s->gb, 2); |
6808 skip_bits(&s->gb, 1); /* nuit_field_based_flag */ | 6809 skip_bits(&s->gb, 1); /* nuit_field_based_flag */ |
6809 skip_bits(&s->gb, 5); /* counting_type */ | 6810 skip_bits(&s->gb, 5); /* counting_type */ |
6810 full_timestamp_flag = get_bits(&s->gb, 1); | 6811 full_timestamp_flag = get_bits(&s->gb, 1); |
6811 skip_bits(&s->gb, 1); /* discontinuity_flag */ | 6812 skip_bits(&s->gb, 1); /* discontinuity_flag */ |
6812 skip_bits(&s->gb, 1); /* cnt_dropped_flag */ | 6813 skip_bits(&s->gb, 1); /* cnt_dropped_flag */ |
7760 } else { | 7761 } else { |
7761 cur->repeat_pict = 0; | 7762 cur->repeat_pict = 0; |
7762 | 7763 |
7763 /* Signal interlacing information externally. */ | 7764 /* Signal interlacing information externally. */ |
7764 /* Prioritize picture timing SEI information over used decoding process if it exists. */ | 7765 /* Prioritize picture timing SEI information over used decoding process if it exists. */ |
7766 if (h->sei_ct_type) | |
7767 cur->interlaced_frame = (h->sei_ct_type & (1<<1)) != 0; | |
7768 else | |
7769 cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE; | |
7770 | |
7765 if(h->sps.pic_struct_present_flag){ | 7771 if(h->sps.pic_struct_present_flag){ |
7766 switch (h->sei_pic_struct) | 7772 switch (h->sei_pic_struct) |
7767 { | 7773 { |
7768 case SEI_PIC_STRUCT_FRAME: | |
7769 cur->interlaced_frame = 0; | |
7770 break; | |
7771 case SEI_PIC_STRUCT_TOP_FIELD: | |
7772 case SEI_PIC_STRUCT_BOTTOM_FIELD: | |
7773 case SEI_PIC_STRUCT_TOP_BOTTOM: | |
7774 case SEI_PIC_STRUCT_BOTTOM_TOP: | |
7775 cur->interlaced_frame = 1; | |
7776 break; | |
7777 case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: | 7774 case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: |
7778 case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: | 7775 case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: |
7779 // Signal the possibility of telecined film externally (pic_struct 5,6) | 7776 // Signal the possibility of telecined film externally (pic_struct 5,6) |
7780 // From these hints, let the applications decide if they apply deinterlacing. | 7777 // From these hints, let the applications decide if they apply deinterlacing. |
7781 cur->repeat_pict = 1; | 7778 cur->repeat_pict = 1; |
7782 cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE; | |
7783 break; | 7779 break; |
7784 case SEI_PIC_STRUCT_FRAME_DOUBLING: | 7780 case SEI_PIC_STRUCT_FRAME_DOUBLING: |
7785 // Force progressive here, as doubling interlaced frame is a bad idea. | 7781 // Force progressive here, as doubling interlaced frame is a bad idea. |
7786 cur->interlaced_frame = 0; | 7782 cur->interlaced_frame = 0; |
7787 cur->repeat_pict = 2; | 7783 cur->repeat_pict = 2; |