Mercurial > libavcodec.hg
comparison h263.c @ 8251:d256dbf74ea6 libavcodec
Implement complexity estimation parsing and try to detect an incorrectly set
complexity estimation flag.
author | michael |
---|---|
date | Wed, 03 Dec 2008 17:43:39 +0000 |
parents | 2f5101a67500 |
children | 800444234375 |
comparison
equal
deleted
inserted
replaced
8250:cf4d575b1982 | 8251:d256dbf74ea6 |
---|---|
5664 | 5664 |
5665 if(vo_ver_id != 1) | 5665 if(vo_ver_id != 1) |
5666 s->quarter_sample= get_bits1(gb); | 5666 s->quarter_sample= get_bits1(gb); |
5667 else s->quarter_sample=0; | 5667 else s->quarter_sample=0; |
5668 | 5668 |
5669 if(!get_bits1(gb)) av_log(s->avctx, AV_LOG_ERROR, "Complexity estimation not supported\n"); | 5669 if(!get_bits1(gb)){ |
5670 int pos= get_bits_count(gb); | |
5671 int estimation_method= get_bits(gb, 2); | |
5672 if(estimation_method<2){ | |
5673 if(!get_bits1(gb)){ | |
5674 s->cplx_estimation_trash_i += 8*get_bits1(gb); //opaque | |
5675 s->cplx_estimation_trash_i += 8*get_bits1(gb); //transparent | |
5676 s->cplx_estimation_trash_i += 8*get_bits1(gb); //intra_cae | |
5677 s->cplx_estimation_trash_i += 8*get_bits1(gb); //inter_cae | |
5678 s->cplx_estimation_trash_i += 8*get_bits1(gb); //no_update | |
5679 s->cplx_estimation_trash_i += 8*get_bits1(gb); //upampling | |
5680 } | |
5681 if(!get_bits1(gb)){ | |
5682 s->cplx_estimation_trash_i += 8*get_bits1(gb); //intra_blocks | |
5683 s->cplx_estimation_trash_p += 8*get_bits1(gb); //inter_blocks | |
5684 s->cplx_estimation_trash_p += 8*get_bits1(gb); //inter4v_blocks | |
5685 s->cplx_estimation_trash_i += 8*get_bits1(gb); //not coded blocks | |
5686 } | |
5687 if(!check_marker(gb, "in complexity estimation part 1")){ | |
5688 skip_bits_long(gb, pos - get_bits_count(gb)); | |
5689 goto no_cplx_est; | |
5690 } | |
5691 if(!get_bits1(gb)){ | |
5692 s->cplx_estimation_trash_i += 8*get_bits1(gb); //dct_coeffs | |
5693 s->cplx_estimation_trash_i += 8*get_bits1(gb); //dct_lines | |
5694 s->cplx_estimation_trash_i += 8*get_bits1(gb); //vlc_syms | |
5695 s->cplx_estimation_trash_i += 4*get_bits1(gb); //vlc_bits | |
5696 } | |
5697 if(!get_bits1(gb)){ | |
5698 s->cplx_estimation_trash_p += 8*get_bits1(gb); //apm | |
5699 s->cplx_estimation_trash_p += 8*get_bits1(gb); //npm | |
5700 s->cplx_estimation_trash_b += 8*get_bits1(gb); //interpolate_mc_q | |
5701 s->cplx_estimation_trash_p += 8*get_bits1(gb); //forwback_mc_q | |
5702 s->cplx_estimation_trash_p += 8*get_bits1(gb); //halfpel2 | |
5703 s->cplx_estimation_trash_p += 8*get_bits1(gb); //halfpel4 | |
5704 } | |
5705 if(!check_marker(gb, "in complexity estimation part 2")){ | |
5706 skip_bits_long(gb, pos - get_bits_count(gb)); | |
5707 goto no_cplx_est; | |
5708 } | |
5709 if(estimation_method==1){ | |
5710 s->cplx_estimation_trash_i += 8*get_bits1(gb); //sadct | |
5711 s->cplx_estimation_trash_p += 8*get_bits1(gb); //qpel | |
5712 } | |
5713 }else | |
5714 av_log(s->avctx, AV_LOG_ERROR, "Invalid Complexity estimation method %d\n", estimation_method); | |
5715 }else{ | |
5716 no_cplx_est: | |
5717 s->cplx_estimation_trash_i= | |
5718 s->cplx_estimation_trash_p= | |
5719 s->cplx_estimation_trash_b= 0; | |
5720 } | |
5670 | 5721 |
5671 s->resync_marker= !get_bits1(gb); /* resync_marker_disabled */ | 5722 s->resync_marker= !get_bits1(gb); /* resync_marker_disabled */ |
5672 | 5723 |
5673 s->data_partitioning= get_bits1(gb); | 5724 s->data_partitioning= get_bits1(gb); |
5674 if(s->data_partitioning){ | 5725 if(s->data_partitioning){ |
5901 } | 5952 } |
5902 } | 5953 } |
5903 //FIXME complexity estimation stuff | 5954 //FIXME complexity estimation stuff |
5904 | 5955 |
5905 if (s->shape != BIN_ONLY_SHAPE) { | 5956 if (s->shape != BIN_ONLY_SHAPE) { |
5957 skip_bits_long(gb, s->cplx_estimation_trash_i); | |
5958 if(s->pict_type != FF_I_TYPE) | |
5959 skip_bits_long(gb, s->cplx_estimation_trash_p); | |
5960 if(s->pict_type == FF_B_TYPE) | |
5961 skip_bits_long(gb, s->cplx_estimation_trash_b); | |
5962 | |
5906 s->intra_dc_threshold= mpeg4_dc_threshold[ get_bits(gb, 3) ]; | 5963 s->intra_dc_threshold= mpeg4_dc_threshold[ get_bits(gb, 3) ]; |
5907 if(!s->progressive_sequence){ | 5964 if(!s->progressive_sequence){ |
5908 s->top_field_first= get_bits1(gb); | 5965 s->top_field_first= get_bits1(gb); |
5909 s->alternate_scan= get_bits1(gb); | 5966 s->alternate_scan= get_bits1(gb); |
5910 }else | 5967 }else |
5949 s->b_code = get_bits(gb, 3); | 6006 s->b_code = get_bits(gb, 3); |
5950 }else | 6007 }else |
5951 s->b_code=1; | 6008 s->b_code=1; |
5952 | 6009 |
5953 if(s->avctx->debug&FF_DEBUG_PICT_INFO){ | 6010 if(s->avctx->debug&FF_DEBUG_PICT_INFO){ |
5954 av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d\n", | 6011 av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d\n", |
5955 s->qscale, s->f_code, s->b_code, | 6012 s->qscale, s->f_code, s->b_code, |
5956 s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")), | 6013 s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")), |
5957 gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first, | 6014 gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first, |
5958 s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points, | 6015 s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points, |
5959 s->sprite_warping_accuracy, 1-s->no_rounding, s->vo_type, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold); | 6016 s->sprite_warping_accuracy, 1-s->no_rounding, s->vo_type, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold, s->cplx_estimation_trash_i, s->cplx_estimation_trash_p, s->cplx_estimation_trash_b); |
5960 } | 6017 } |
5961 | 6018 |
5962 if(!s->scalability){ | 6019 if(!s->scalability){ |
5963 if (s->shape!=RECT_SHAPE && s->pict_type!=FF_I_TYPE) { | 6020 if (s->shape!=RECT_SHAPE && s->pict_type!=FF_I_TYPE) { |
5964 skip_bits1(gb); // vop shape coding type | 6021 skip_bits1(gb); // vop shape coding type |