Missing refs shall be generated only when they are actually used. Without this change a sequence of a BLA picture and an associated RASL picture would still be decoded without complaints if the RASL picture is mislabeled as RADL. --- libavcodec/hevc_refs.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index fe18ca2b1d..84a21991c7 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -378,9 +378,6 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc,
uint8_t use_msb)
}
}
- if (s->nal_unit_type != HEVC_NAL_CRA_NUT && !IS_BLA(s))
- av_log(s->avctx, AV_LOG_ERROR,
- "Could not find ref with POC %d\n", poc);
return NULL;
}
@@ -426,7 +423,7 @@ static HEVCFrame *generate_missing_ref(HEVCContext *s, int
poc)
/* add a reference with the given poc to the list and mark it as used in DPB */
static int add_candidate_ref(HEVCContext *s, RefPicList *list,
- int poc, int ref_flag, uint8_t use_msb)
+ int poc, int ref_flag, uint8_t use_msb, enum
RPSType rps_type)
{
HEVCFrame *ref = find_ref_idx(s, poc, use_msb);
@@ -434,6 +431,15 @@ static int add_candidate_ref(HEVCContext *s, RefPicList
*list,
return AVERROR_INVALIDDATA;
if (!ref) {
+ int allow_missing = !(rps_type == ST_CURR_BEF || rps_type ==
ST_CURR_AFT ||
+ rps_type == LT_CURR);
+
+ /* skip generating missing refs in foll lists as they are not used by
current frame */
+ if (allow_missing)
+ return 0;
+
+ av_log(s->avctx, AV_LOG_ERROR, "Could not find ref with POC %d\n",
poc);
+
ref = generate_missing_ref(s, poc);
if (!ref)
return AVERROR(ENOMEM);
@@ -484,7 +490,7 @@ int ff_hevc_frame_rps(HEVCContext *s)
else
list = ST_CURR_AFT;
- ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SHORT_REF,
1);
+ ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SHORT_REF,
1, list);
if (ret < 0)
goto fail;
}
@@ -494,7 +500,8 @@ int ff_hevc_frame_rps(HEVCContext *s)
int poc = long_rps->poc[i];
int list = long_rps->used[i] ? LT_CURR : LT_FOLL;
- ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LONG_REF,
long_rps->poc_msb_present[i]);
+ ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LONG_REF,
long_rps->poc_msb_present[i],
+ list);
if (ret < 0)
goto fail;
}
--
2.35.1
OpenPGP_0x22AEF7EFBDCEFF03.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
