comparison h264.c @ 10837:e5905bfa625d libavcodec

Export fullrange flag and color information for h.264
author conrad
date Mon, 11 Jan 2010 00:31:39 +0000
parents 46a247e54d6e
children 86d7ab878805
comparison
equal deleted inserted replaced
10836:f20f9b76f4c8 10837:e5905bfa625d
3811 avcodec_set_dimensions(s->avctx, s->width, s->height); 3811 avcodec_set_dimensions(s->avctx, s->width, s->height);
3812 s->avctx->sample_aspect_ratio= h->sps.sar; 3812 s->avctx->sample_aspect_ratio= h->sps.sar;
3813 if(!s->avctx->sample_aspect_ratio.den) 3813 if(!s->avctx->sample_aspect_ratio.den)
3814 s->avctx->sample_aspect_ratio.den = 1; 3814 s->avctx->sample_aspect_ratio.den = 1;
3815 3815
3816 if(h->sps.video_signal_type_present_flag){
3817 s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
3818 if(h->sps.colour_description_present_flag){
3819 s->avctx->color_primaries = h->sps.color_primaries;
3820 s->avctx->color_trc = h->sps.color_trc;
3821 s->avctx->colorspace = h->sps.colorspace;
3822 }
3823 }
3824
3816 if(h->sps.timing_info_present_flag){ 3825 if(h->sps.timing_info_present_flag){
3817 s->avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale}; 3826 s->avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale};
3818 if(h->x264_build > 0 && h->x264_build < 44) 3827 if(h->x264_build > 0 && h->x264_build < 44)
3819 s->avctx->time_base.den *= 2; 3828 s->avctx->time_base.den *= 2;
3820 av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den, 3829 av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
7077 7086
7078 if(get_bits1(&s->gb)){ /* overscan_info_present_flag */ 7087 if(get_bits1(&s->gb)){ /* overscan_info_present_flag */
7079 get_bits1(&s->gb); /* overscan_appropriate_flag */ 7088 get_bits1(&s->gb); /* overscan_appropriate_flag */
7080 } 7089 }
7081 7090
7082 if(get_bits1(&s->gb)){ /* video_signal_type_present_flag */ 7091 sps->video_signal_type_present_flag = get_bits1(&s->gb);
7092 if(sps->video_signal_type_present_flag){
7083 get_bits(&s->gb, 3); /* video_format */ 7093 get_bits(&s->gb, 3); /* video_format */
7084 get_bits1(&s->gb); /* video_full_range_flag */ 7094 sps->full_range = get_bits1(&s->gb); /* video_full_range_flag */
7085 if(get_bits1(&s->gb)){ /* colour_description_present_flag */ 7095
7086 get_bits(&s->gb, 8); /* colour_primaries */ 7096 sps->colour_description_present_flag = get_bits1(&s->gb);
7087 get_bits(&s->gb, 8); /* transfer_characteristics */ 7097 if(sps->colour_description_present_flag){
7088 get_bits(&s->gb, 8); /* matrix_coefficients */ 7098 sps->color_primaries = get_bits(&s->gb, 8); /* colour_primaries */
7099 sps->color_trc = get_bits(&s->gb, 8); /* transfer_characteristics */
7100 sps->colorspace = get_bits(&s->gb, 8); /* matrix_coefficients */
7101 if (sps->color_primaries >= AVCOL_PRI_NB)
7102 sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
7103 if (sps->color_trc >= AVCOL_TRC_NB)
7104 sps->color_trc = AVCOL_TRC_UNSPECIFIED;
7105 if (sps->colorspace >= AVCOL_SPC_NB)
7106 sps->colorspace = AVCOL_SPC_UNSPECIFIED;
7089 } 7107 }
7090 } 7108 }
7091 7109
7092 if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */ 7110 if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */
7093 s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_sample_location_type_top_field */ 7111 s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_sample_location_type_top_field */