-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patches: Add 0165/0166 to fix hevc regression
Signed-off-by: Fei Wang <[email protected]>
- Loading branch information
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
patches/0165-lavc-hevcdec-Put-slice-address-checking-after-hwacce.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 72ba373b829fe4a063161f19e3ce1d3b29e00de2 Mon Sep 17 00:00:00 2001 | ||
From: Fei Wang <[email protected]> | ||
Date: Fri, 14 Jun 2024 16:18:19 +0800 | ||
Subject: [PATCH 1/2] lavc/hevcdec: Put slice address checking after hwaccel | ||
decode slice | ||
|
||
Slice address tab only been updated in software decode slice data. | ||
|
||
Fixes hwaccel decoding after d725c737fe2a19091b481d4d115fd939e0a674b2. | ||
|
||
Signed-off-by: Fei Wang <[email protected]> | ||
--- | ||
libavcodec/hevc/hevcdec.c | 18 +++++++++--------- | ||
1 file changed, 9 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c | ||
index 1d2e53afc3..39beb7e4dc 100644 | ||
--- a/libavcodec/hevc/hevcdec.c | ||
+++ b/libavcodec/hevc/hevcdec.c | ||
@@ -2770,15 +2770,6 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext | ||
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]; | ||
- 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->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) { | ||
ret = ff_hevc_slice_rpl(s); | ||
if (ret < 0) { | ||
@@ -2799,6 +2790,15 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext | ||
return AVERROR_PATCHWELCOME; | ||
} | ||
|
||
+ 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; | ||
+ } | ||
+ } | ||
+ | ||
s->local_ctx[0].first_qp_group = !s->sh.dependent_slice_segment_flag; | ||
|
||
if (!pps->cu_qp_delta_enabled_flag) | ||
-- | ||
2.34.1 | ||
|
42 changes: 42 additions & 0 deletions
42
patches/0166-lavc-hevcdec-Update-slice-index-before-hwaccel-decod.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
From 2926a4bc063292658f1009f72a9eda6ea667cd5f Mon Sep 17 00:00:00 2001 | ||
From: Fei Wang <[email protected]> | ||
Date: Tue, 18 Jun 2024 15:54:22 +0800 | ||
Subject: [PATCH 2/2] lavc/hevcdec: Update slice index before hwaccel decode | ||
slice | ||
|
||
Otherwise, slice index will never update for hwaccel decode, and slice | ||
RPL will be always overlap into first one which use slice index to construct. | ||
|
||
Fixes hwaccel decoding after 47d34ba7fbb81 | ||
|
||
Signed-off-by: Fei Wang <[email protected]> | ||
--- | ||
libavcodec/hevc/hevcdec.c | 5 +++-- | ||
1 file changed, 3 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c | ||
index 39beb7e4dc..8bb564f1b3 100644 | ||
--- a/libavcodec/hevc/hevcdec.c | ||
+++ b/libavcodec/hevc/hevcdec.c | ||
@@ -2770,6 +2770,9 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext | ||
const HEVCPPS *pps = s->pps; | ||
int ret; | ||
|
||
+ if (!s->sh.first_slice_in_pic_flag) | ||
+ s->slice_idx += !s->sh.dependent_slice_segment_flag; | ||
+ | ||
if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) { | ||
ret = ff_hevc_slice_rpl(s); | ||
if (ret < 0) { | ||
@@ -2807,8 +2810,6 @@ 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) | ||
-- | ||
2.34.1 | ||
|