mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-19 05:49:09 +02:00
lavc/hevcdec: move slice decoding dispatch to its own function
Also move there a sanity check from hls_decode_entry() that should also be performed when WPP is active (note that the check is not moved to hls_slice_header() because it requires the HEVCContext.tab_slice_address to be set up).
This commit is contained in:
parent
7cce612a26
commit
efc827bf6f
@ -2578,14 +2578,6 @@ static int hls_decode_entry(HEVCContext *s, GetBitContext *gb)
|
||||
int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];
|
||||
int ret;
|
||||
|
||||
if (s->sh.dependent_slice_segment_flag) {
|
||||
int prev_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
|
||||
if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
while (more_data && ctb_addr_ts < sps->ctb_size) {
|
||||
int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts];
|
||||
|
||||
@ -2813,6 +2805,27 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext *gb)
|
||||
{
|
||||
const HEVCPPS *pps = s->pps;
|
||||
|
||||
if (s->sh.dependent_slice_segment_flag) {
|
||||
int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];
|
||||
int prev_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
|
||||
if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
return hls_slice_data_wpp(s, nal);
|
||||
|
||||
return hls_decode_entry(s, gb);
|
||||
}
|
||||
|
||||
static int set_side_data(HEVCContext *s)
|
||||
{
|
||||
AVFrame *out = s->cur_frame->f;
|
||||
@ -3152,12 +3165,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (s->avctx->active_thread_type == FF_THREAD_SLICE &&
|
||||
s->sh.num_entry_point_offsets > 0 &&
|
||||
s->pps->num_tile_rows == 1 && s->pps->num_tile_columns == 1)
|
||||
ctb_addr_ts = hls_slice_data_wpp(s, nal);
|
||||
else
|
||||
ctb_addr_ts = hls_decode_entry(s, &gb);
|
||||
ctb_addr_ts = decode_slice_data(s, nal, &gb);
|
||||
if (ctb_addr_ts >= s->cur_frame->ctb_count) {
|
||||
ret = hevc_frame_end(s);
|
||||
if (ret < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user