From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH v2 10/16] avcodec/vvcdec: deblock, support subpicture
Date: Wed, 27 Mar 2024 21:01:06 +0800
Message-ID: <TYSPR06MB6433D468FD5830EF54571F6CAA342@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20240327130112.6111-1-nuomi2021@gmail.com>
---
libavcodec/vvc/vvc_filter.c | 52 +++++++++++++++++++++----------------
libavcodec/vvc/vvc_filter.h | 6 +++--
libavcodec/vvc/vvc_thread.c | 4 +--
3 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c
index 11972bde41..ecb004d245 100644
--- a/libavcodec/vvc/vvc_filter.c
+++ b/libavcodec/vvc/vvc_filter.c
@@ -529,9 +529,10 @@ static av_always_inline int deblock_bs(const VVCLocalContext *lc,
}
static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary,
- const int pos, const int vertical)
+ const int pos, const int rs, const int vertical)
{
const VVCFrameContext *fc = lc->fc;
+ const H266RawSPS *rsps = fc->ps.sps->r;
const H266RawPPS *rpps = fc->ps.pps->r;
int flag;
if (boundary && (pos % fc->ps.sps->ctb_size_y) == 0) {
@@ -544,12 +545,22 @@ static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary,
if (lc->boundary_flags & flag &&
!rpps->pps_loop_filter_across_tiles_enabled_flag)
return 0;
+
+ flag = vertical ? BOUNDARY_LEFT_SUBPIC : BOUNDARY_UPPER_SUBPIC;
+ if (lc->boundary_flags & flag) {
+ const int q_rs = rs - (vertical ? 1 : fc->ps.pps->ctb_width);
+ const SliceContext *q_slice = lc->fc->slices[lc->fc->tab.slice_idx[q_rs]];
+
+ if (!rsps->sps_loop_filter_across_subpic_enabled_flag[q_slice->sh.r->curr_subpic_idx] ||
+ !rsps->sps_loop_filter_across_subpic_enabled_flag[lc->sc->sh.r->curr_subpic_idx])
+ return 0;
+ }
}
return boundary;
}
static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
- const int x0, const int y0, const int width, const int height)
+ const int x0, const int y0, const int width, const int height, const int rs)
{
const VVCFrameContext *fc = lc->fc;
const MvField *tab_mvf = fc->tab.mvf;
@@ -574,7 +585,7 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
}
// bs for vertical TU boundaries
- boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, 1);
+ boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, rs, 1);
if (boundary_left) {
const RefPicList *rpl_left =
@@ -598,7 +609,7 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
}
static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc,
- const int x0, const int y0, const int width, const int height)
+ const int x0, const int y0, const int width, const int height, const int rs)
{
const VVCFrameContext *fc = lc->fc;
const MvField *tab_mvf = fc->tab.mvf;
@@ -622,7 +633,7 @@ static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc,
has_horizontal_sb = cb_height > 8;
}
- boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, 0);
+ boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, rs, 0);
if (boundary_upper) {
const RefPicList *rpl_top =
@@ -647,12 +658,11 @@ static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc,
}
static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc,
- const int x0, const int y0, const int width, const int height)
+ const int x0, const int y0, const int width, const int height, const int rs)
{
const VVCFrameContext *fc = lc->fc;
- // bs for vertical TU boundaries
const int boundary_left = deblock_is_boundary(lc,
- x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), x0, 1);
+ x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), x0, rs, 1);
if (boundary_left) {
for (int i = 0; i < height; i += 2) {
@@ -666,11 +676,11 @@ static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc,
}
static void vvc_deblock_bs_chroma_horizontal(const VVCLocalContext *lc,
- const int x0, const int y0, const int width, const int height)
+ const int x0, const int y0, const int width, const int height, const int rs)
{
const VVCFrameContext *fc = lc->fc;
const int boundary_upper = deblock_is_boundary(lc,
- y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), y0, 0);
+ y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), y0, rs, 0);
if (boundary_upper) {
for (int i = 0; i < width; i += 2) {
@@ -684,9 +694,9 @@ static void vvc_deblock_bs_chroma_horizontal(const VVCLocalContext *lc,
}
typedef void (*deblock_bs_fn)(const VVCLocalContext *lc, const int x0, const int y0,
- const int width, const int height);
+ const int width, const int height, const int rs);
-static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0, const int vertical)
+static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0, const int rs, const int vertical)
{
const VVCFrameContext *fc = lc->fc;
const VVCSPS *sps = fc->ps.sps;
@@ -707,7 +717,7 @@ static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0
const int off = y * fc->ps.pps->min_tu_width + x;
if ((fc->tab.tb_pos_x0[is_chroma][off] >> MIN_TU_LOG2) == x && (fc->tab.tb_pos_y0[is_chroma][off] >> MIN_TU_LOG2) == y) {
deblock_bs[vertical][is_chroma](lc, x << MIN_TU_LOG2, y << MIN_TU_LOG2,
- fc->tab.tb_width[is_chroma][off] << hs, fc->tab.tb_height[is_chroma][off] << vs);
+ fc->tab.tb_width[is_chroma][off] << hs, fc->tab.tb_height[is_chroma][off] << vs, rs);
}
}
}
@@ -791,7 +801,7 @@ static int get_qp(const VVCFrameContext *fc, const uint8_t *src, const int x, co
return get_qp_c(fc, x, y, c_idx, vertical);
}
-void ff_vvc_deblock_vertical(const VVCLocalContext *lc, int x0, int y0)
+void ff_vvc_deblock_vertical(const VVCLocalContext *lc, const int x0, const int y0, const int rs)
{
VVCFrameContext *fc = lc->fc;
const VVCSPS *sps = fc->ps.sps;
@@ -806,11 +816,9 @@ void ff_vvc_deblock_vertical(const VVCLocalContext *lc, int x0, int y0)
const int ctb_log2_size_y = fc->ps.sps->ctb_log2_size_y;
int x_end, y_end;
const int ctb_size = 1 << ctb_log2_size_y;
- const int ctb = (x0 >> ctb_log2_size_y) +
- (y0 >> ctb_log2_size_y) * fc->ps.pps->ctb_width;
- const DBParams *params = fc->tab.deblock + ctb;
+ const DBParams *params = fc->tab.deblock + rs;
- vvc_deblock_bs(lc, x0, y0, 1);
+ vvc_deblock_bs(lc, x0, y0, rs, 1);
x_end = x0 + ctb_size;
if (x_end > fc->ps.pps->width)
@@ -861,7 +869,7 @@ void ff_vvc_deblock_vertical(const VVCLocalContext *lc, int x0, int y0)
}
}
-void ff_vvc_deblock_horizontal(const VVCLocalContext *lc, int x0, int y0)
+void ff_vvc_deblock_horizontal(const VVCLocalContext *lc, const int x0, const int y0, const int rs)
{
VVCFrameContext *fc = lc->fc;
const VVCSPS *sps = fc->ps.sps;
@@ -876,11 +884,9 @@ void ff_vvc_deblock_horizontal(const VVCLocalContext *lc, int x0, int y0)
const int ctb_log2_size_y = fc->ps.sps->ctb_log2_size_y;
int x_end, y_end;
const int ctb_size = 1 << ctb_log2_size_y;
- const int ctb = (x0 >> ctb_log2_size_y) +
- (y0 >> ctb_log2_size_y) * fc->ps.pps->ctb_width;
- const DBParams *params = fc->tab.deblock + ctb;
+ const DBParams *params = fc->tab.deblock + rs;
- vvc_deblock_bs(lc, x0, y0, 0);
+ vvc_deblock_bs(lc, x0, y0, rs, 0);
x_end = x0 + ctb_size;
if (x_end > fc->ps.pps->width)
diff --git a/libavcodec/vvc/vvc_filter.h b/libavcodec/vvc/vvc_filter.h
index 2ae4c33e2d..9597437d83 100644
--- a/libavcodec/vvc/vvc_filter.h
+++ b/libavcodec/vvc/vvc_filter.h
@@ -38,16 +38,18 @@ void ff_vvc_lmcs_filter(const VVCLocalContext *lc, const int x0, const int y0);
* @param lc local context for CTU
* @param x0 x position for the CTU
* @param y0 y position for the CTU
+ * @param rs raster position for the CTU
*/
-void ff_vvc_deblock_vertical(const VVCLocalContext *lc, int x0, int y0);
+void ff_vvc_deblock_vertical(const VVCLocalContext *lc, int x0, int y0, int rs);
/**
* horizontal deblock filter for the CTU
* @param lc local context for CTU
* @param x0 x position for the CTU
* @param y0 y position for the CTU
+ * @param rs raster position for the CTU
*/
-void ff_vvc_deblock_horizontal(const VVCLocalContext *lc, int x0, int y0);
+void ff_vvc_deblock_horizontal(const VVCLocalContext *lc, int x0, int y0, int rs);
/**
* sao filter for the CTU
diff --git a/libavcodec/vvc/vvc_thread.c b/libavcodec/vvc/vvc_thread.c
index 31c931f050..5d2e8c67b9 100644
--- a/libavcodec/vvc/vvc_thread.c
+++ b/libavcodec/vvc/vvc_thread.c
@@ -494,7 +494,7 @@ static int run_deblock_v(VVCContext *s, VVCLocalContext *lc, VVCTask *t)
lc->sc = fc->slices[slice_idx];
if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) {
ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs);
- ff_vvc_deblock_vertical(lc, x0, y0);
+ ff_vvc_deblock_vertical(lc, x0, y0, rs);
}
}
@@ -515,7 +515,7 @@ static int run_deblock_h(VVCContext *s, VVCLocalContext *lc, VVCTask *t)
lc->sc = fc->slices[slice_idx];
if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) {
ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs);
- ff_vvc_deblock_horizontal(lc, x0, y0);
+ ff_vvc_deblock_horizontal(lc, x0, y0, rs);
}
if (fc->ps.sps->r->sps_sao_enabled_flag)
ff_vvc_sao_copy_ctb_to_hv(lc, t->rx, t->ry, t->ry == ft->ctu_height - 1);
--
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-03-27 13:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240327130112.6111-1-nuomi2021@gmail.com>
2024-03-27 13:00 ` [FFmpeg-devel] [PATCH v2 01/16] avcodec/vvcdec: NoBackwardPredFlag, only check active pictures Nuo Mi
2024-03-27 13:00 ` [FFmpeg-devel] [PATCH v2 02/16] avcodec/cbs_h266: fix sh_collocated_from_l0_flag and sh_collocated_ref_idx infer Nuo Mi
2024-03-27 13:00 ` [FFmpeg-devel] [PATCH v2 03/16] avcodec/vvcdec: misc, add specification name for pps members Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 04/16] avcodec/vvcdec: fix uninitialized last element of xxx_bd and ctb_to_xxx_bd arrays Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 05/16] avcodec/vvcdec: support rectangular single-slice subpics Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 06/16] avcodec/vvcdec: derive subpic postion for PPS Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 07/16] avcodec/vvcdec: ff_vvc_decode_neighbour, support subpicture Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 08/16] avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to avoid misleading Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 09/16] avcodec/vvcdec: refact out deblock_is_boundary Nuo Mi
2024-03-27 13:01 ` Nuo Mi [this message]
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 11/16] avcodec/vvcdec: refact, movie the lc->sc assignment to task_run_stage to simplify the code Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 12/16] avcodec/vvcdec: sao, refact out tile_edge arrays Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 13/16] avcodec/vvcdec: sao, support subpicture Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 14/16] avcodec/vvcdec: alf, " Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 15/16] avcodec/vvcdec: mvs, " Nuo Mi
2024-03-27 13:01 ` [FFmpeg-devel] [PATCH v2 16/16] avcodec/vvcdec: inter prediction, " Nuo Mi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TYSPR06MB6433D468FD5830EF54571F6CAA342@TYSPR06MB6433.apcprd06.prod.outlook.com \
--to=nuomi2021@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git