From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH 02/18] avcodec/vvcdec: refact, unify vvc_deblock_bs_luma_{horizontal, vertical}
Date: Sat, 22 Jun 2024 14:23:49 +0800
Message-ID: <TYSPR06MB6433365D97BCB334C6D55D39AACA2@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20240622062405.285359-1-nuomi2021@gmail.com>
---
libavcodec/vvc/filter.c | 108 ++++++++++++++--------------------------
1 file changed, 36 insertions(+), 72 deletions(-)
diff --git a/libavcodec/vvc/filter.c b/libavcodec/vvc/filter.c
index d4c09b69f3..996e58dc3e 100644
--- a/libavcodec/vvc/filter.c
+++ b/libavcodec/vvc/filter.c
@@ -538,100 +538,64 @@ static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary,
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 rs)
+static void vvc_deblock_bs_luma(const VVCLocalContext *lc,
+ const int x0, const int y0, const int width, const int height, const int rs, const int vertical)
{
const VVCFrameContext *fc = lc->fc;
const MvField *tab_mvf = fc->tab.mvf;
+ const int mask = LUMA_GRID - 1;
const int log2_min_pu_size = MIN_PU_LOG2;
const int min_pu_width = fc->ps.pps->min_pu_width;
const int min_cb_log2 = fc->ps.sps->min_cb_log2_size_y;
const int min_cb_width = fc->ps.pps->min_cb_width;
- const int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
- (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
- int boundary_left;
- int has_vertical_sb = 0;
-
+ const int pos = vertical ? x0 : y0;
const int off_q = (y0 >> min_cb_log2) * min_cb_width + (x0 >> min_cb_log2);
- const int cb_x = fc->tab.cb_pos_x[LUMA][off_q];
- const int cb_width = fc->tab.cb_width[LUMA][off_q];
- const int off_x = cb_x - x0;
-
- if (!is_intra) {
- if (fc->tab.msf[off_q] || fc->tab.iaf[off_q])
- has_vertical_sb = cb_width > 8;
- }
-
- // bs for vertical TU boundaries
- boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, rs, 1);
-
- if (boundary_left) {
- const RefPicList *rpl_left =
- (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ? ff_vvc_get_ref_list(fc, fc->ref, x0 - 1, y0) : lc->sc->rpl;
- for (int i = 0; i < height; i += 4) {
+ const int cb = (vertical ? fc->tab.cb_pos_x : fc->tab.cb_pos_y )[LUMA][off_q];
+ const int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
+ (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
+
+ if (deblock_is_boundary(lc, pos > 0 && !(pos & mask), pos, rs, vertical)) {
+ const int size = vertical ? height : width;
+ const int off = cb - pos;
+ const int cb_size = (vertical ? fc->tab.cb_width : fc->tab.cb_height)[LUMA][off_q];
+ const int has_sb = !is_intra && (fc->tab.msf[off_q] || fc->tab.iaf[off_q]) && cb_size > 8;
+ const int flag = vertical ? BOUNDARY_LEFT_SLICE : BOUNDARY_UPPER_SLICE;
+ const RefPicList *rpl_p =
+ (lc->boundary_flags & flag) ? ff_vvc_get_ref_list(fc, fc->ref, x0 - vertical, y0 - !vertical) : lc->sc->rpl;
+ uint8_t *tab_bs = vertical ? fc->tab.vertical_bs[LUMA] : fc->tab.horizontal_bs[LUMA];
+ uint8_t *tab_max_len_p = vertical ? fc->tab.vertical_p : fc->tab.horizontal_p;
+ uint8_t *tab_max_len_q = vertical ? fc->tab.vertical_q : fc->tab.horizontal_q;
+
+ for (int i = 0; i < size; i += 4) {
+ const int x = x0 + i * !vertical;
+ const int y = y0 + i * vertical;
uint8_t max_len_p, max_len_q;
- const int bs = deblock_bs(lc, x0 - 1, y0 + i, x0, y0 + i, rpl_left, 0, off_x, has_vertical_sb);
+ const int bs = deblock_bs(lc, x - vertical, y - !vertical, x, y, rpl_p, LUMA, off, has_sb);
- TAB_BS(fc->tab.vertical_bs[LUMA], x0, (y0 + i)) = bs;
+ TAB_BS(tab_bs, x, y) = bs;
- derive_max_filter_length_luma(fc, x0, y0 + i, is_intra, has_vertical_sb, 1, &max_len_p, &max_len_q);
- TAB_MAX_LEN(fc->tab.vertical_p, x0, y0 + i) = max_len_p;
- TAB_MAX_LEN(fc->tab.vertical_q, x0, y0 + i) = max_len_q;
+ derive_max_filter_length_luma(fc, x, y, is_intra, has_sb, vertical, &max_len_p, &max_len_q);
+ TAB_MAX_LEN(tab_max_len_p, x, y) = max_len_p;
+ TAB_MAX_LEN(tab_max_len_q, x, y) = max_len_q;
}
}
if (!is_intra) {
if (fc->tab.msf[off_q] || fc->tab.iaf[off_q])
- vvc_deblock_subblock_bs(lc, cb_x, x0, y0, width, height, 1);
+ vvc_deblock_subblock_bs(lc, cb, x0, y0, width, height, vertical);
}
}
-static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc,
+static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc,
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;
- const int log2_min_pu_size = MIN_PU_LOG2;
- const int min_pu_width = fc->ps.pps->min_pu_width;
- const int min_cb_log2 = fc->ps.sps->min_cb_log2_size_y;
- const int min_cb_width = fc->ps.pps->min_cb_width;
- const int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
- (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
- int boundary_upper;
- int has_horizontal_sb = 0;
-
- const int off_q = (y0 >> min_cb_log2) * min_cb_width + (x0 >> min_cb_log2);
- const int cb_y = fc->tab.cb_pos_y[LUMA][off_q];
- const int cb_height = fc->tab.cb_height[LUMA][off_q];
- const int off_y = y0 - cb_y;
-
- if (!is_intra) {
- if (fc->tab.msf[off_q] || fc->tab.iaf[off_q])
- has_horizontal_sb = cb_height > 8;
- }
-
- boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, rs, 0);
-
- if (boundary_upper) {
- const RefPicList *rpl_top =
- (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ? ff_vvc_get_ref_list(fc, fc->ref, x0, y0 - 1) : lc->sc->rpl;
-
- for (int i = 0; i < width; i += 4) {
- uint8_t max_len_p, max_len_q;
- const int bs = deblock_bs(lc, x0 + i, y0 - 1, x0 + i, y0, rpl_top, 0, off_y, has_horizontal_sb);
-
- TAB_BS(fc->tab.horizontal_bs[LUMA], x0 + i, y0) = bs;
-
- derive_max_filter_length_luma(fc, x0 + i, y0, is_intra, has_horizontal_sb, 0, &max_len_p, &max_len_q);
- TAB_MAX_LEN(fc->tab.horizontal_p, x0 + i, y0) = max_len_p;
- TAB_MAX_LEN(fc->tab.horizontal_q, x0 + i, y0) = max_len_q;
- }
- }
+ vvc_deblock_bs_luma(lc, x0, y0, width, height, rs, 1);
+}
- if (!is_intra) {
- if (fc->tab.msf[off_q] || fc->tab.iaf[off_q])
- vvc_deblock_subblock_bs(lc, cb_y, x0, y0, width, height, 0);
- }
+static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc,
+ const int x0, const int y0, const int width, const int height, const int rs)
+{
+ vvc_deblock_bs_luma(lc, x0, y0, width, height, rs, 0);
}
static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc,
--
2.34.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 parent reply other threads:[~2024-06-22 6:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240622062405.285359-1-nuomi2021@gmail.com>
2024-06-22 6:23 ` Nuo Mi [this message]
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 03/18] avcodec/vvcdec: refact, unify vvc_deblock_bs_chroma_{horizontal, vertical} Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 04/18] avcodec/vvcdec: refact, unify {horizontal, vertical}_bs, {horizontal, vertical}_p, {horizontal, vertical}_q Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 05/18] avcodec/vvcdec: misc, use POS to simplify filter code Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 06/18] avcodec/vvcdec: refact, unify ff_vvc_deblock_{horizontal, vertical} Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 07/18] avcodec/vvcdec: refact out sao_get_edges Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 08/18] avcodec/vvcdec: refact out sao_extends_edges Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 09/18] avcodec/vvcdec: refact, fix naming convention of x0, y0 for sao Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 10/18] avcodec/vvcdec: misc, reformat ff_vvc_sao_filter Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 11/18] avcodec/vvcdec: refact out alf_get_edges Nuo Mi
2024-06-22 6:23 ` [FFmpeg-devel] [PATCH 12/18] avcodec/vvcdec: misc, remove unused ALFParams.applied Nuo Mi
2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 13/18] avcodec/vvcdec: misc, constify ALFParams Nuo Mi
2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 14/18] cbs_h266: add VVC_MAX_VBS for max num of virtual boundaries Nuo Mi
2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 15/18] avcodec/vvcdec: ps, derive " Nuo Mi
2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 16/18] avcodec/vvcdec: deblock, support " Nuo Mi
2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 17/18] avcodec/vvcdec: sao, " Nuo Mi
2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 18/18] avcodec/vvcdec: alf, " Nuo Mi
2024-06-25 11:53 ` Nuo Mi
2024-06-25 12:48 ` James Almer
2024-06-25 14:29 ` 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=TYSPR06MB6433365D97BCB334C6D55D39AACA2@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