Mercurial > libavcodec.hg
comparison h264.c @ 7381:16a60b2f7a7d libavcodec
Minor simplification of code in init_poc().
author | michael |
---|---|
date | Thu, 24 Jul 2008 22:29:38 +0000 |
parents | 9faeb82ba80b |
children | f9e70983fc35 |
comparison
equal
deleted
inserted
replaced
7380:9faeb82ba80b | 7381:16a60b2f7a7d |
---|---|
3697 static int init_poc(H264Context *h){ | 3697 static int init_poc(H264Context *h){ |
3698 MpegEncContext * const s = &h->s; | 3698 MpegEncContext * const s = &h->s; |
3699 const int max_frame_num= 1<<h->sps.log2_max_frame_num; | 3699 const int max_frame_num= 1<<h->sps.log2_max_frame_num; |
3700 int field_poc[2]; | 3700 int field_poc[2]; |
3701 | 3701 |
3702 h->frame_num_offset= h->prev_frame_num_offset; | |
3702 if(h->frame_num < h->prev_frame_num) | 3703 if(h->frame_num < h->prev_frame_num) |
3703 h->frame_num_offset= h->prev_frame_num_offset + max_frame_num; | 3704 h->frame_num_offset += max_frame_num; |
3704 else | |
3705 h->frame_num_offset= h->prev_frame_num_offset; | |
3706 | 3705 |
3707 if(h->sps.poc_type==0){ | 3706 if(h->sps.poc_type==0){ |
3708 const int max_poc_lsb= 1<<h->sps.log2_max_poc_lsb; | 3707 const int max_poc_lsb= 1<<h->sps.log2_max_poc_lsb; |
3709 | 3708 |
3710 if (h->poc_lsb < h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb >= max_poc_lsb/2) | 3709 if (h->poc_lsb < h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb >= max_poc_lsb/2) |
3751 field_poc[1] = field_poc[0] + h->sps.offset_for_top_to_bottom_field; | 3750 field_poc[1] = field_poc[0] + h->sps.offset_for_top_to_bottom_field; |
3752 | 3751 |
3753 if(s->picture_structure == PICT_FRAME) | 3752 if(s->picture_structure == PICT_FRAME) |
3754 field_poc[1] += h->delta_poc[1]; | 3753 field_poc[1] += h->delta_poc[1]; |
3755 }else{ | 3754 }else{ |
3756 int poc; | 3755 int poc= 2*(h->frame_num_offset + h->frame_num); |
3757 | 3756 |
3758 if(h->nal_ref_idc) poc= 2*(h->frame_num_offset + h->frame_num); | 3757 if(!h->nal_ref_idc) |
3759 else poc= 2*(h->frame_num_offset + h->frame_num) - 1; | 3758 poc--; |
3760 | 3759 |
3761 field_poc[0]= poc; | 3760 field_poc[0]= poc; |
3762 field_poc[1]= poc; | 3761 field_poc[1]= poc; |
3763 } | 3762 } |
3764 | 3763 |