aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@googlemail.com>2018-11-07 04:47:51 +0100
committerJames Almer <jamrial@gmail.com>2019-07-21 01:04:04 -0300
commit2ac6315c7c3a0049b02d1d79f7944507fdc4c456 (patch)
tree7115348102bc7d936f7c23885421d4aca8d36dad
parent9d06c1f95ebe4f9c2cc05d041dbfd3de52d2518a (diff)
downloadffmpeg-2ac6315c7c3a0049b02d1d79f7944507fdc4c456.tar.gz
cbs_h264: Fix handling of auxiliary pictures
The earlier code used the most recent non-auxiliary slice to determine whether an auxiliary slice has the syntax of an IDR slice, even when the most recent slice was from a slice of a redundant frame. Now only slices of the primary coded picture are used, as the specifications mandate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com> (cherry picked from commit 8d1cf2d89481ca986af893425188d065c0f8f857)
-rw-r--r--libavcodec/cbs_h264_syntax_template.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c
index dbf9ff1268..4da4c5da67 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -1190,11 +1190,10 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
"in the same access unit.\n");
return AVERROR_INVALIDDATA;
}
+ idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE;
} else {
- h264->last_slice_nal_unit_type =
- current->nal_unit_header.nal_unit_type;
+ idr_pic_flag = current->nal_unit_header.nal_unit_type == H264_NAL_IDR_SLICE;
}
- idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE;
ue(first_mb_in_slice, 0, H264_MAX_MB_PIC_SIZE - 1);
ue(slice_type, 0, 9);
@@ -1272,6 +1271,13 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw,
if (pps->redundant_pic_cnt_present_flag)
ue(redundant_pic_cnt, 0, 127);
+ else
+ infer(redundant_pic_cnt, 0);
+
+ if (current->nal_unit_header.nal_unit_type != H264_NAL_AUXILIARY_SLICE
+ && !current->redundant_pic_cnt)
+ h264->last_slice_nal_unit_type =
+ current->nal_unit_header.nal_unit_type;
if (slice_type_b)
flag(direct_spatial_mv_pred_flag);