[FFmpeg-cvslog] avcodec/vvcdec: fix dual tree for skipped transform tree/unit
Nuo Mi
git at videolan.org
Sat Feb 24 14:30:58 EET 2024
ffmpeg | branch: master | Nuo Mi <nuomi2021 at gmail.com> | Thu Feb 22 15:14:03 2024 +0800| [1ffeeb8a269b87a3c27000b88837f1fa50395cb9] | committer: Nuo Mi
avcodec/vvcdec: fix dual tree for skipped transform tree/unit
fix IBC_E_Tencent_1.bit
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ffeeb8a269b87a3c27000b88837f1fa50395cb9
---
libavcodec/vvc/vvc_ctu.c | 24 +++++++++++++++---------
libavcodec/vvc/vvc_intra.c | 6 ++++--
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c
index 00476c81e4..2cf6e82f26 100644
--- a/libavcodec/vvc/vvc_ctu.c
+++ b/libavcodec/vvc/vvc_ctu.c
@@ -481,8 +481,9 @@ static int hls_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_width,
static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_width, int tu_height)
{
- VVCFrameContext *fc = lc->fc;
- const VVCSPS *sps = fc->ps.sps;
+ VVCFrameContext *fc = lc->fc;
+ const CodingUnit *cu = lc->cu;
+ const VVCSPS *sps = fc->ps.sps;
if (tu_width > sps->max_tb_size_y || tu_height > sps->max_tb_size_y) {
const int ver_split_first = tu_width > sps->max_tb_size_y && tu_width > tu_height;
@@ -501,11 +502,14 @@ static int skipped_transform_tree(VVCLocalContext *lc, int x0, int y0,int tu_wid
else
SKIPPED_TRANSFORM_TREE(x0, y0 + trafo_height);
} else {
- TransformUnit *tu = add_tu(fc, lc->cu, x0, y0, tu_width, tu_height);
- const int c_end = sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : (LUMA + 1);
+ TransformUnit *tu = add_tu(fc, lc->cu, x0, y0, tu_width, tu_height);
+ const int has_chroma = sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA;
+ const int c_start = cu->tree_type == DUAL_TREE_CHROMA ? CB : LUMA;
+ const int c_end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : CB;
+
if (!tu)
return AVERROR_INVALIDDATA;
- for (int i = LUMA; i < c_end; i++) {
+ for (int i = c_start; i < c_end; i++) {
TransformBlock *tb = add_tb(tu, lc, x0, y0, tu_width >> sps->hshift[i], tu_height >> sps->vshift[i], i);
if (i != CR)
set_tb_pos(fc, tb);
@@ -1125,11 +1129,14 @@ static void sbt_info(VVCLocalContext *lc, const VVCSPS *sps)
static int skipped_transform_tree_unit(VVCLocalContext *lc)
{
- const CodingUnit *cu = lc->cu;
+ const H266RawSPS *rsps = lc->fc->ps.sps->r;
+ const CodingUnit *cu = lc->cu;
int ret;
- set_qp_y(lc, cu->x0, cu->y0, 0);
- set_qp_c(lc);
+ if (cu->tree_type != DUAL_TREE_CHROMA)
+ set_qp_y(lc, cu->x0, cu->y0, 0);
+ if (rsps->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA)
+ set_qp_c(lc);
ret = skipped_transform_tree(lc, cu->x0, cu->y0, cu->cb_width, cu->cb_height);
if (ret < 0)
return ret;
@@ -1815,7 +1822,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, int y0, int cb_width, in
if (ret < 0)
return ret;
} else {
- av_assert0(tree_type == SINGLE_TREE);
ret = skipped_transform_tree_unit(lc);
if (ret < 0)
return ret;
diff --git a/libavcodec/vvc/vvc_intra.c b/libavcodec/vvc/vvc_intra.c
index 214ad38c8c..fb001d6713 100644
--- a/libavcodec/vvc/vvc_intra.c
+++ b/libavcodec/vvc/vvc_intra.c
@@ -602,8 +602,10 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in
if (cu->coded_flag) {
ret = reconstruct(lc);
} else {
- add_reconstructed_area(lc, LUMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height);
- add_reconstructed_area(lc, CHROMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height);
+ if (cu->tree_type != DUAL_TREE_CHROMA)
+ add_reconstructed_area(lc, LUMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height);
+ if (sps->r->sps_chroma_format_idc && cu->tree_type != DUAL_TREE_LUMA)
+ add_reconstructed_area(lc, CHROMA, cu->x0, cu->y0, cu->cb_width, cu->cb_height);
}
cu = cu->next;
}
More information about the ffmpeg-cvslog
mailing list