Mercurial > libavcodec.hg
comparison h264.c @ 7310:033d10927d45 libavcodec
Remove delayed_output_pic, I do not understand what this variable was good for.
It is simpler and might be faster now.
author | michael |
---|---|
date | Sat, 19 Jul 2008 02:53:57 +0000 |
parents | 4d3c6cd51003 |
children | f9eaaadcd611 |
comparison
equal
deleted
inserted
replaced
7309:4d3c6cd51003 | 7310:033d10927d45 |
---|---|
3267 static inline int unreference_pic(H264Context *h, Picture *pic, int refmask){ | 3267 static inline int unreference_pic(H264Context *h, Picture *pic, int refmask){ |
3268 int i; | 3268 int i; |
3269 if (pic->reference &= refmask) { | 3269 if (pic->reference &= refmask) { |
3270 return 0; | 3270 return 0; |
3271 } else { | 3271 } else { |
3272 if(pic == h->delayed_output_pic) | |
3273 pic->reference=DELAYED_PIC_REF; | |
3274 else{ | |
3275 for(i = 0; h->delayed_pic[i]; i++) | 3272 for(i = 0; h->delayed_pic[i]; i++) |
3276 if(pic == h->delayed_pic[i]){ | 3273 if(pic == h->delayed_pic[i]){ |
3277 pic->reference=DELAYED_PIC_REF; | 3274 pic->reference=DELAYED_PIC_REF; |
3278 break; | 3275 break; |
3279 } | 3276 } |
3280 } | |
3281 return 1; | 3277 return 1; |
3282 } | 3278 } |
3283 } | 3279 } |
3284 | 3280 |
3285 /** | 3281 /** |
3310 for(i=0; i<MAX_DELAYED_PIC_COUNT; i++) { | 3306 for(i=0; i<MAX_DELAYED_PIC_COUNT; i++) { |
3311 if(h->delayed_pic[i]) | 3307 if(h->delayed_pic[i]) |
3312 h->delayed_pic[i]->reference= 0; | 3308 h->delayed_pic[i]->reference= 0; |
3313 h->delayed_pic[i]= NULL; | 3309 h->delayed_pic[i]= NULL; |
3314 } | 3310 } |
3315 if(h->delayed_output_pic) | 3311 h->outputed_poc= INT_MIN; |
3316 h->delayed_output_pic->reference= 0; | |
3317 h->delayed_output_pic= NULL; | |
3318 idr(h); | 3312 idr(h); |
3319 if(h->s.current_picture_ptr) | 3313 if(h->s.current_picture_ptr) |
3320 h->s.current_picture_ptr->reference= 0; | 3314 h->s.current_picture_ptr->reference= 0; |
3321 h->s.first_field= 0; | 3315 h->s.first_field= 0; |
3322 ff_mpeg_flush(avctx); | 3316 ff_mpeg_flush(avctx); |
7781 } | 7775 } |
7782 | 7776 |
7783 if(!(s->flags2 & CODEC_FLAG2_CHUNKS) || (s->mb_y >= s->mb_height && s->mb_height)){ | 7777 if(!(s->flags2 & CODEC_FLAG2_CHUNKS) || (s->mb_y >= s->mb_height && s->mb_height)){ |
7784 Picture *out = s->current_picture_ptr; | 7778 Picture *out = s->current_picture_ptr; |
7785 Picture *cur = s->current_picture_ptr; | 7779 Picture *cur = s->current_picture_ptr; |
7786 Picture *prev = h->delayed_output_pic; | |
7787 int i, pics, cross_idr, out_of_order, out_idx; | 7780 int i, pics, cross_idr, out_of_order, out_idx; |
7788 | 7781 |
7789 s->mb_y= 0; | 7782 s->mb_y= 0; |
7790 | 7783 |
7791 s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264; | 7784 s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264; |
7858 if(h->delayed_pic[i]->poc < out->poc){ | 7851 if(h->delayed_pic[i]->poc < out->poc){ |
7859 out = h->delayed_pic[i]; | 7852 out = h->delayed_pic[i]; |
7860 out_idx = i; | 7853 out_idx = i; |
7861 } | 7854 } |
7862 | 7855 |
7863 out_of_order = !cross_idr && prev && out->poc < prev->poc; | 7856 out_of_order = !cross_idr && out->poc < h->outputed_poc; |
7864 | 7857 |
7865 if(prev && pics <= s->avctx->has_b_frames || out_of_order) | 7858 if(pics <= s->avctx->has_b_frames || out_of_order) |
7866 out = prev; | 7859 out = NULL; |
7867 | 7860 |
7868 if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) | 7861 if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) |
7869 { } | 7862 { } |
7870 else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) | 7863 else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) |
7871 || (s->low_delay && | 7864 || (s->low_delay && |
7872 ((!cross_idr && prev && out->poc > prev->poc + 2) | 7865 ((!cross_idr && out && out->poc > h->outputed_poc + 2) |
7873 || cur->pict_type == FF_B_TYPE))) | 7866 || cur->pict_type == FF_B_TYPE))) |
7874 { | 7867 { |
7875 s->low_delay = 0; | 7868 s->low_delay = 0; |
7876 s->avctx->has_b_frames++; | 7869 s->avctx->has_b_frames++; |
7877 out = prev; | 7870 out= NULL; |
7878 } | 7871 } |
7879 | 7872 |
7880 if(out_of_order || pics > s->avctx->has_b_frames){ | 7873 if(out_of_order || pics > s->avctx->has_b_frames){ |
7881 for(i=out_idx; h->delayed_pic[i]; i++) | 7874 for(i=out_idx; h->delayed_pic[i]; i++) |
7882 h->delayed_pic[i] = h->delayed_pic[i+1]; | 7875 h->delayed_pic[i] = h->delayed_pic[i+1]; |
7883 } | 7876 } |
7884 | 7877 |
7885 if(prev == out) | 7878 if(out){ |
7886 *data_size = 0; | |
7887 else | |
7888 *data_size = sizeof(AVFrame); | 7879 *data_size = sizeof(AVFrame); |
7889 if(prev && prev != out && prev->reference == DELAYED_PIC_REF) | 7880 |
7890 prev->reference = 0; | 7881 out->reference &= ~DELAYED_PIC_REF; |
7891 h->delayed_output_pic = out; | 7882 h->outputed_poc = out->poc; |
7883 } | |
7892 #endif | 7884 #endif |
7893 | 7885 |
7894 if(out) | 7886 if(out) |
7895 *pict= *(AVFrame*)out; | 7887 *pict= *(AVFrame*)out; |
7896 else | 7888 else |