mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-20 06:11:04 +00:00
avcodec/h264: Seperate SEI and IDR recovery handling
This avoids SEI and IDR recovery flags affecting each other Also eliminate litteral numbers from recovery handling This should make the code clearer Improves: tickets/4738/tickets_cut.ts Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d55d0bba48
commit
3f4a1a24a5
@ -822,7 +822,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h)
|
||||
|| pps_ref_count[0] <= 1 + (h->picture_structure != PICT_FRAME) && pps_ref_count[1] <= 1)
|
||||
&& pps_ref_count[0]<=2 + (h->picture_structure != PICT_FRAME) + (2*!h->has_recovery_point)
|
||||
&& h->cur_pic_ptr->f->pict_type == AV_PICTURE_TYPE_I){
|
||||
h->cur_pic_ptr->recovered |= 1;
|
||||
h->cur_pic_ptr->recovered |= FRAME_RECOVERED_IDR;
|
||||
if(!h->avctx->has_b_frames)
|
||||
h->frame_recovered |= FRAME_RECOVERED_SEI;
|
||||
}
|
||||
|
@ -1356,12 +1356,11 @@ static int h264_select_output_frame(H264Context *h)
|
||||
} else
|
||||
h->next_outputed_poc = out->poc;
|
||||
|
||||
if (out->recovered) {
|
||||
// We have reached an recovery point and all frames after it in
|
||||
// display order are "recovered".
|
||||
h->frame_recovered |= FRAME_RECOVERED_SEI;
|
||||
}
|
||||
out->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_SEI);
|
||||
// We have reached an recovery point and all frames after it in
|
||||
// display order are "recovered".
|
||||
h->frame_recovered |= out->recovered;
|
||||
|
||||
out->recovered |= h->frame_recovered & FRAME_RECOVERED_SEI;
|
||||
|
||||
if (!out->recovered) {
|
||||
if (!(h->avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) &&
|
||||
@ -1643,15 +1642,18 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
|
||||
|
||||
h->cur_pic_ptr->f->flags |= AV_FRAME_FLAG_KEY * !!(nal->type == H264_NAL_IDR_SLICE);
|
||||
|
||||
if (nal->type == H264_NAL_IDR_SLICE ||
|
||||
(h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {
|
||||
h->recovery_frame = -1;
|
||||
h->cur_pic_ptr->recovered = 1;
|
||||
}
|
||||
// If we have an IDR, all frames after it in decoded order are
|
||||
// "recovered".
|
||||
if (nal->type == H264_NAL_IDR_SLICE)
|
||||
if (nal->type == H264_NAL_IDR_SLICE) {
|
||||
h->cur_pic_ptr->recovered |= FRAME_RECOVERED_IDR;
|
||||
// If we have an IDR, all frames after it in decoded order are
|
||||
// "recovered".
|
||||
h->frame_recovered |= FRAME_RECOVERED_IDR;
|
||||
}
|
||||
|
||||
if (h->recovery_frame == h->poc.frame_num && nal->ref_idc) {
|
||||
h->recovery_frame = -1;
|
||||
h->cur_pic_ptr->recovered |= FRAME_RECOVERED_SEI;
|
||||
}
|
||||
|
||||
#if 1
|
||||
h->cur_pic_ptr->recovered |= h->frame_recovered;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user