Mercurial > libavcodec.hg
comparison h264.c @ 5803:f896159a1a9e libavcodec
reindent
author | andoma |
---|---|
date | Tue, 09 Oct 2007 15:09:51 +0000 |
parents | 0be16259b7d8 |
children | 12b1717f80a3 |
comparison
equal
deleted
inserted
replaced
5802:d112d5c13ae8 | 5803:f896159a1a9e |
---|---|
3873 first_mb_in_slice= get_ue_golomb(&s->gb); | 3873 first_mb_in_slice= get_ue_golomb(&s->gb); |
3874 | 3874 |
3875 if((s->flags2 & CODEC_FLAG2_CHUNKS) && first_mb_in_slice == 0){ | 3875 if((s->flags2 & CODEC_FLAG2_CHUNKS) && first_mb_in_slice == 0){ |
3876 h0->current_slice = 0; | 3876 h0->current_slice = 0; |
3877 if (!s0->first_field) | 3877 if (!s0->first_field) |
3878 s->current_picture_ptr= NULL; | 3878 s->current_picture_ptr= NULL; |
3879 } | 3879 } |
3880 | 3880 |
3881 slice_type= get_ue_golomb(&s->gb); | 3881 slice_type= get_ue_golomb(&s->gb); |
3882 if(slice_type > 9){ | 3882 if(slice_type > 9){ |
3883 av_log(h->s.avctx, AV_LOG_ERROR, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y); | 3883 av_log(h->s.avctx, AV_LOG_ERROR, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y); |
7434 } | 7434 } |
7435 #endif | 7435 #endif |
7436 if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ | 7436 if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ |
7437 h->current_slice = 0; | 7437 h->current_slice = 0; |
7438 if (!s->first_field) | 7438 if (!s->first_field) |
7439 s->current_picture_ptr= NULL; | 7439 s->current_picture_ptr= NULL; |
7440 } | 7440 } |
7441 | 7441 |
7442 for(;;){ | 7442 for(;;){ |
7443 int consumed; | 7443 int consumed; |
7444 int dst_length; | 7444 int dst_length; |
7750 * INT_MAX when called for bottom field, because mb_y is | 7750 * INT_MAX when called for bottom field, because mb_y is |
7751 * past end by one (callers fault) and resync_mb_y != 0 | 7751 * past end by one (callers fault) and resync_mb_y != 0 |
7752 * causes problems for the first MB line, too. | 7752 * causes problems for the first MB line, too. |
7753 */ | 7753 */ |
7754 if (!FIELD_PICTURE) | 7754 if (!FIELD_PICTURE) |
7755 ff_er_frame_end(s); | 7755 ff_er_frame_end(s); |
7756 | 7756 |
7757 MPV_frame_end(s); | 7757 MPV_frame_end(s); |
7758 | 7758 |
7759 if (s->first_field) { | 7759 if (s->first_field) { |
7760 /* Wait for second field. */ | 7760 /* Wait for second field. */ |
7761 *data_size = 0; | 7761 *data_size = 0; |
7762 | 7762 |
7763 } else { | 7763 } else { |
7764 //FIXME do something with unavailable reference frames | 7764 //FIXME do something with unavailable reference frames |
7765 | 7765 |
7766 #if 0 //decode order | 7766 #if 0 //decode order |
7767 *data_size = sizeof(AVFrame); | 7767 *data_size = sizeof(AVFrame); |
7768 #else | 7768 #else |
7769 /* Sort B-frames into display order */ | 7769 /* Sort B-frames into display order */ |
7770 | 7770 |
7771 if(h->sps.bitstream_restriction_flag | 7771 if(h->sps.bitstream_restriction_flag |
7772 && s->avctx->has_b_frames < h->sps.num_reorder_frames){ | 7772 && s->avctx->has_b_frames < h->sps.num_reorder_frames){ |
7773 s->avctx->has_b_frames = h->sps.num_reorder_frames; | 7773 s->avctx->has_b_frames = h->sps.num_reorder_frames; |
7774 s->low_delay = 0; | 7774 s->low_delay = 0; |
7775 } | 7775 } |
7776 | 7776 |
7777 pics = 0; | 7777 pics = 0; |
7778 while(h->delayed_pic[pics]) pics++; | 7778 while(h->delayed_pic[pics]) pics++; |
7779 | 7779 |
7780 assert(pics+1 < sizeof(h->delayed_pic) / sizeof(h->delayed_pic[0])); | 7780 assert(pics+1 < sizeof(h->delayed_pic) / sizeof(h->delayed_pic[0])); |
7781 | 7781 |
7782 h->delayed_pic[pics++] = cur; | 7782 h->delayed_pic[pics++] = cur; |
7783 if(cur->reference == 0) | 7783 if(cur->reference == 0) |
7784 cur->reference = DELAYED_PIC_REF; | 7784 cur->reference = DELAYED_PIC_REF; |
7785 | 7785 |
7786 cross_idr = 0; | 7786 cross_idr = 0; |
7787 for(i=0; h->delayed_pic[i]; i++) | 7787 for(i=0; h->delayed_pic[i]; i++) |
7788 if(h->delayed_pic[i]->key_frame || h->delayed_pic[i]->poc==0) | 7788 if(h->delayed_pic[i]->key_frame || h->delayed_pic[i]->poc==0) |
7789 cross_idr = 1; | 7789 cross_idr = 1; |
7790 | 7790 |
7791 out = h->delayed_pic[0]; | 7791 out = h->delayed_pic[0]; |
7792 out_idx = 0; | 7792 out_idx = 0; |
7793 for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame; i++) | 7793 for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame; i++) |
7794 if(h->delayed_pic[i]->poc < out->poc){ | 7794 if(h->delayed_pic[i]->poc < out->poc){ |
7795 out = h->delayed_pic[i]; | 7795 out = h->delayed_pic[i]; |
7796 out_idx = i; | 7796 out_idx = i; |
7797 } | 7797 } |
7798 | 7798 |
7799 out_of_order = !cross_idr && prev && out->poc < prev->poc; | 7799 out_of_order = !cross_idr && prev && out->poc < prev->poc; |
7800 if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) | 7800 if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) |
7801 { } | 7801 { } |
7802 else if(prev && pics <= s->avctx->has_b_frames) | 7802 else if(prev && pics <= s->avctx->has_b_frames) |
7803 out = prev; | 7803 out = prev; |
7804 else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) | 7804 else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) |
7805 || (s->low_delay && | 7805 || (s->low_delay && |
7806 ((!cross_idr && prev && out->poc > prev->poc + 2) | 7806 ((!cross_idr && prev && out->poc > prev->poc + 2) |
7807 || cur->pict_type == B_TYPE))) | 7807 || cur->pict_type == B_TYPE))) |
7808 { | 7808 { |
7809 s->low_delay = 0; | 7809 s->low_delay = 0; |
7810 s->avctx->has_b_frames++; | 7810 s->avctx->has_b_frames++; |
7811 out = prev; | 7811 out = prev; |
7812 } | 7812 } |
7813 else if(out_of_order) | 7813 else if(out_of_order) |
7814 out = prev; | 7814 out = prev; |
7815 | 7815 |
7816 if(out_of_order || pics > s->avctx->has_b_frames){ | 7816 if(out_of_order || pics > s->avctx->has_b_frames){ |
7817 for(i=out_idx; h->delayed_pic[i]; i++) | 7817 for(i=out_idx; h->delayed_pic[i]; i++) |
7818 h->delayed_pic[i] = h->delayed_pic[i+1]; | 7818 h->delayed_pic[i] = h->delayed_pic[i+1]; |
7819 } | 7819 } |
7820 | 7820 |
7821 if(prev == out) | 7821 if(prev == out) |
7822 *data_size = 0; | 7822 *data_size = 0; |
7823 else | 7823 else |
7824 *data_size = sizeof(AVFrame); | 7824 *data_size = sizeof(AVFrame); |
7825 if(prev && prev != out && prev->reference == DELAYED_PIC_REF) | 7825 if(prev && prev != out && prev->reference == DELAYED_PIC_REF) |
7826 prev->reference = 0; | 7826 prev->reference = 0; |
7827 h->delayed_output_pic = out; | 7827 h->delayed_output_pic = out; |
7828 #endif | 7828 #endif |
7829 | 7829 |
7830 if(out) | 7830 if(out) |
7831 *pict= *(AVFrame*)out; | 7831 *pict= *(AVFrame*)out; |
7832 else | 7832 else |
7833 av_log(avctx, AV_LOG_DEBUG, "no picture\n"); | 7833 av_log(avctx, AV_LOG_DEBUG, "no picture\n"); |
7834 } | 7834 } |
7835 } | 7835 } |
7836 | 7836 |
7837 assert(pict->data[0] || !*data_size); | 7837 assert(pict->data[0] || !*data_size); |
7838 ff_print_debug_info(s, pict); | 7838 ff_print_debug_info(s, pict); |