Commit 2a9bed8f authored by Anton Khirnov's avatar Anton Khirnov

hevc_refs: reduce code duplication in find_ref_idx()

parent d29aaf12
......@@ -360,26 +360,16 @@ int ff_hevc_slice_rpl(HEVCContext *s)
static HEVCFrame *find_ref_idx(HEVCContext *s, int poc, uint8_t use_msb)
{
int mask = use_msb ? ~0 : (1 << s->ps.sps->log2_max_poc_lsb) - 1;
int i;
if (use_msb) {
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *ref = &s->DPB[i];
if (ref->frame->buf[0] && (ref->sequence == s->seq_decode)) {
if (ref->poc == poc)
return ref;
}
}
} else {
int LtMask = (1 << s->ps.sps->log2_max_poc_lsb) - 1;
for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *ref = &s->DPB[i];
if (ref->frame->buf[0] && ref->sequence == s->seq_decode) {
if ((ref->poc & LtMask) == poc)
if ((ref->poc & mask) == poc)
return ref;
}
}
}
if (s->nal_unit_type != HEVC_NAL_CRA_NUT && !IS_BLA(s))
av_log(s->avctx, AV_LOG_ERROR,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment