mirror of https://git.ffmpeg.org/ffmpeg.git
lavc/hevcdec: do not pass HEVCContext to ff_hevc_frame_nb_refs()
Pass the only things required from it - slice header and PPS - explicitly. Will be useful in the following commits to avoid mofiying HEVCContext in hls_slice_header().
This commit is contained in:
parent
07eb60c0da
commit
381b70e173
|
@ -795,7 +795,7 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
|
|||
|
||||
sh->rpl_modification_flag[0] = 0;
|
||||
sh->rpl_modification_flag[1] = 0;
|
||||
nb_refs = ff_hevc_frame_nb_refs(s);
|
||||
nb_refs = ff_hevc_frame_nb_refs(sh, pps);
|
||||
if (!nb_refs) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Zero refs for a frame with P or B slices.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
|
|
@ -614,7 +614,7 @@ int ff_hevc_res_scale_sign_flag(HEVCLocalContext *lc, int idx);
|
|||
/**
|
||||
* Get the number of candidate references for the current frame.
|
||||
*/
|
||||
int ff_hevc_frame_nb_refs(const HEVCContext *s);
|
||||
int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps);
|
||||
|
||||
int ff_hevc_set_new_ref(HEVCContext *s, int poc);
|
||||
|
||||
|
|
|
@ -526,12 +526,12 @@ fail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int ff_hevc_frame_nb_refs(const HEVCContext *s)
|
||||
int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
const ShortTermRPS *rps = s->sh.short_term_rps;
|
||||
const LongTermRPS *long_rps = &s->sh.long_term_rps;
|
||||
const ShortTermRPS *rps = sh->short_term_rps;
|
||||
const LongTermRPS *long_rps = &sh->long_term_rps;
|
||||
|
||||
if (rps) {
|
||||
for (i = 0; i < rps->num_negative_pics; i++)
|
||||
|
@ -545,7 +545,7 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s)
|
|||
ret += !!long_rps->used[i];
|
||||
}
|
||||
|
||||
if (s->pps->pps_curr_pic_ref_enabled_flag)
|
||||
if (pps->pps_curr_pic_ref_enabled_flag)
|
||||
ret++;
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -187,7 +187,7 @@ static int nvdec_hevc_start_frame(AVCodecContext *avctx,
|
|||
|
||||
.NumBitsForShortTermRPSInSlice = s->sh.short_term_rps ? s->sh.short_term_ref_pic_set_size : 0,
|
||||
.NumDeltaPocsOfRefRpsIdx = s->sh.short_term_rps ? s->sh.short_term_rps->rps_idx_num_delta_pocs : 0,
|
||||
.NumPocTotalCurr = ff_hevc_frame_nb_refs(s),
|
||||
.NumPocTotalCurr = ff_hevc_frame_nb_refs(&s->sh, pps),
|
||||
.NumPocStCurrBefore = s->rps[ST_CURR_BEF].nb_refs,
|
||||
.NumPocStCurrAfter = s->rps[ST_CURR_AFT].nb_refs,
|
||||
.NumPocLtCurr = s->rps[LT_CURR].nb_refs,
|
||||
|
|
|
@ -205,7 +205,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
|
|||
}
|
||||
}
|
||||
/* See section 7.4.7.2 of the specification. */
|
||||
info->NumPocTotalCurr = ff_hevc_frame_nb_refs(h);
|
||||
info->NumPocTotalCurr = ff_hevc_frame_nb_refs(&h->sh, pps);
|
||||
if (sh->short_term_ref_pic_set_sps_flag == 0 && sh->short_term_rps) {
|
||||
/* Corresponds to specification field, NumDeltaPocs[RefRpsIdx].
|
||||
Only applicable when short_term_ref_pic_set_sps_flag == 0.
|
||||
|
|
Loading…
Reference in New Issue