[FFmpeg-cvslog] lavc/hevcdec: move constructing slice RPL to decode_slice_data()
Anton Khirnov
git at videolan.org
Tue Jun 11 18:51:25 EEST 2024
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jun 2 19:55:01 2024 +0200| [47d34ba7fbb811e23ea4485cf8066e3a045e74f8] | committer: Anton Khirnov
lavc/hevcdec: move constructing slice RPL to decode_slice_data()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47d34ba7fbb811e23ea4485cf8066e3a045e74f8
---
libavcodec/hevc/hevcdec.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index c148244361..804cceac3e 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -665,11 +665,9 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
if (!sh->dependent_slice_segment_flag) {
sh->slice_addr = sh->slice_segment_addr;
- s->slice_idx++;
}
} else {
sh->slice_segment_addr = sh->slice_addr = 0;
- s->slice_idx = 0;
s->slice_initialized = 0;
}
@@ -2801,6 +2799,7 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext *gb)
{
const HEVCPPS *pps = s->pps;
+ int ret;
if (s->sh.dependent_slice_segment_flag) {
int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];
@@ -2811,6 +2810,15 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
}
}
+ if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) {
+ ret = ff_hevc_slice_rpl(s);
+ if (ret < 0) {
+ av_log(s->avctx, AV_LOG_WARNING,
+ "Error constructing the reference lists for the current slice.\n");
+ return ret;
+ }
+ }
+
if (s->avctx->hwaccel)
return FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size);
@@ -2828,6 +2836,8 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext
s->local_ctx[0].tu.cu_qp_offset_cb = 0;
s->local_ctx[0].tu.cu_qp_offset_cr = 0;
+ s->slice_idx += !s->sh.dependent_slice_segment_flag;
+
if (s->avctx->active_thread_type == FF_THREAD_SLICE &&
s->sh.num_entry_point_offsets > 0 &&
pps->num_tile_rows == 1 && pps->num_tile_columns == 1)
@@ -2938,6 +2948,7 @@ static int hevc_frame_start(HEVCContext *s)
memset(s->tab_slice_address, -1, pic_size_in_ctb * sizeof(*s->tab_slice_address));
s->is_decoded = 0;
+ s->slice_idx = 0;
s->first_nal_type = s->nal_unit_type;
s->poc = s->sh.poc;
@@ -3151,16 +3162,6 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
return AVERROR_INVALIDDATA;
}
- if (!s->sh.dependent_slice_segment_flag &&
- s->sh.slice_type != HEVC_SLICE_I) {
- ret = ff_hevc_slice_rpl(s);
- if (ret < 0) {
- av_log(s->avctx, AV_LOG_WARNING,
- "Error constructing the reference lists for the current slice.\n");
- goto fail;
- }
- }
-
ctb_addr_ts = decode_slice_data(s, nal, &gb);
if (ctb_addr_ts >= s->cur_frame->ctb_count) {
ret = hevc_frame_end(s);
More information about the ffmpeg-cvslog
mailing list