comparison h264.c @ 7382:f9e70983fc35 libavcodec

Set field_poc (it was half uninitialized before) and use it instead of the fragile first_field check to determine if we have 2 fields at the end.
author michael
date Thu, 24 Jul 2008 23:43:44 +0000
parents 16a60b2f7a7d
children c4e5f2158b20
comparison
equal deleted inserted replaced
7381:16a60b2f7a7d 7382:f9e70983fc35
2262 // SVQ3 as well as most other codecs have only last/next/current and thus 2262 // SVQ3 as well as most other codecs have only last/next/current and thus
2263 // get released even with set reference, besides SVQ3 and others do not 2263 // get released even with set reference, besides SVQ3 and others do not
2264 // mark frames as reference later "naturally". 2264 // mark frames as reference later "naturally".
2265 if(s->codec_id != CODEC_ID_SVQ3) 2265 if(s->codec_id != CODEC_ID_SVQ3)
2266 s->current_picture_ptr->reference= 0; 2266 s->current_picture_ptr->reference= 0;
2267
2268 s->current_picture_ptr->field_poc[0]=
2269 s->current_picture_ptr->field_poc[1]= INT_MAX;
2270
2267 return 0; 2271 return 0;
2268 } 2272 }
2269 2273
2270 static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){ 2274 static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){
2271 MpegEncContext * const s = &h->s; 2275 MpegEncContext * const s = &h->s;
3696 3700
3697 static int init_poc(H264Context *h){ 3701 static int init_poc(H264Context *h){
3698 MpegEncContext * const s = &h->s; 3702 MpegEncContext * const s = &h->s;
3699 const int max_frame_num= 1<<h->sps.log2_max_frame_num; 3703 const int max_frame_num= 1<<h->sps.log2_max_frame_num;
3700 int field_poc[2]; 3704 int field_poc[2];
3705 Picture *cur = s->current_picture_ptr;
3701 3706
3702 h->frame_num_offset= h->prev_frame_num_offset; 3707 h->frame_num_offset= h->prev_frame_num_offset;
3703 if(h->frame_num < h->prev_frame_num) 3708 if(h->frame_num < h->prev_frame_num)
3704 h->frame_num_offset += max_frame_num; 3709 h->frame_num_offset += max_frame_num;
3705 3710
3759 3764
3760 field_poc[0]= poc; 3765 field_poc[0]= poc;
3761 field_poc[1]= poc; 3766 field_poc[1]= poc;
3762 } 3767 }
3763 3768
3764 if(s->picture_structure != PICT_BOTTOM_FIELD) { 3769 if(s->picture_structure != PICT_BOTTOM_FIELD)
3765 s->current_picture_ptr->field_poc[0]= field_poc[0]; 3770 s->current_picture_ptr->field_poc[0]= field_poc[0];
3766 s->current_picture_ptr->poc = field_poc[0]; 3771 if(s->picture_structure != PICT_TOP_FIELD)
3767 }
3768 if(s->picture_structure != PICT_TOP_FIELD) {
3769 s->current_picture_ptr->field_poc[1]= field_poc[1]; 3772 s->current_picture_ptr->field_poc[1]= field_poc[1];
3770 s->current_picture_ptr->poc = field_poc[1]; 3773 cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]);
3771 }
3772 if(!FIELD_PICTURE || !s->first_field) {
3773 Picture *cur = s->current_picture_ptr;
3774 cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]);
3775 }
3776 3774
3777 return 0; 3775 return 0;
3778 } 3776 }
3779 3777
3780 3778
7875 if (!FIELD_PICTURE) 7873 if (!FIELD_PICTURE)
7876 ff_er_frame_end(s); 7874 ff_er_frame_end(s);
7877 7875
7878 MPV_frame_end(s); 7876 MPV_frame_end(s);
7879 7877
7880 if (s->first_field) { 7878 if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) {
7881 /* Wait for second field. */ 7879 /* Wait for second field. */
7882 *data_size = 0; 7880 *data_size = 0;
7883 7881
7884 } else { 7882 } else {
7885 cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE; 7883 cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE;