From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH 04/18] avcodec/vvcdec: refact, unify {horizontal, vertical}_bs, {horizontal, vertical}_p, {horizontal, vertical}_q
Date: Sat, 22 Jun 2024 14:23:51 +0800
Message-ID: <TYSPR06MB6433C7AD908BB846E54E9146AACA2@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20240622062405.285359-1-nuomi2021@gmail.com>
---
libavcodec/vvc/dec.c | 14 +++++++-------
libavcodec/vvc/dec.h | 9 +++------
libavcodec/vvc/filter.c | 32 +++++++++++---------------------
3 files changed, 21 insertions(+), 34 deletions(-)
diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index f5603306f3..356ed58e37 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -191,14 +191,14 @@ static void bs_tl_init(TabList *l, VVCFrameContext *fc)
tl_init(l, 1, changed);
- for (int i = 0; i < VVC_MAX_SAMPLE_ARRAYS; i++) {
- TL_ADD(horizontal_bs[i], bs_count);
- TL_ADD(vertical_bs[i], bs_count);
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < VVC_MAX_SAMPLE_ARRAYS; j++) {
+ TL_ADD(bs[i][j], bs_count);
+ TL_ADD(bs[i][j], bs_count);
+ }
+ TL_ADD(max_len_p[i], bs_count);
+ TL_ADD(max_len_q[i], bs_count);
}
- TL_ADD(horizontal_q, bs_count);
- TL_ADD(horizontal_p, bs_count);
- TL_ADD(vertical_p, bs_count);
- TL_ADD(vertical_q, bs_count);
}
static void pixel_buffer_nz_tl_init(TabList *l, VVCFrameContext *fc)
diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
index 1e0b76f283..a8492f1398 100644
--- a/libavcodec/vvc/dec.h
+++ b/libavcodec/vvc/dec.h
@@ -178,12 +178,9 @@ typedef struct VVCFrameContext {
uint8_t *tb_height[2];
uint8_t *pcmf[2];
- uint8_t *horizontal_bs[VVC_MAX_SAMPLE_ARRAYS];
- uint8_t *vertical_bs[VVC_MAX_SAMPLE_ARRAYS];
- uint8_t *horizontal_p; ///< horizontal maxFilterLengthPs for luma
- uint8_t *horizontal_q; ///< horizontal maxFilterLengthQs for luma
- uint8_t *vertical_p; ///< vertical maxFilterLengthPs for luma
- uint8_t *vertical_q; ///< vertical maxFilterLengthQs for luma
+ uint8_t *bs[2][VVC_MAX_SAMPLE_ARRAYS]; ///< horizontal, vertical boundary filtering strength
+ uint8_t *max_len_p[2]; ///< horizontal, vertical maxFilterLengthPs for luma
+ uint8_t *max_len_q[2]; ///< horizontal, vertical maxFilterLengthQs for luma
uint8_t *sao_pixel_buffer_h[VVC_MAX_SAMPLE_ARRAYS];
uint8_t *sao_pixel_buffer_v[VVC_MAX_SAMPLE_ARRAYS];
diff --git a/libavcodec/vvc/filter.c b/libavcodec/vvc/filter.c
index 06e1717b13..7ae36b2344 100644
--- a/libavcodec/vvc/filter.c
+++ b/libavcodec/vvc/filter.c
@@ -414,9 +414,6 @@ static void vvc_deblock_subblock_bs(const VVCLocalContext *lc,
const RefPicList *rpl = lc->sc->rpl;
int stridea = fc->ps.pps->min_pu_width;
int strideb = 1;
- 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;
const int log2_min_pu_size = MIN_PU_LOG2;
if (!vertical) {
@@ -442,7 +439,7 @@ static void vvc_deblock_subblock_bs(const VVCLocalContext *lc,
if (!vertical)
FFSWAP(int, x, y);
- TAB_BS(tab_bs, x, y) = bs;
+ TAB_BS(fc->tab.bs[vertical][LUMA], x, y) = bs;
if (i == 4 || i == width - 4)
max_len_p = max_len_q = 1;
@@ -451,8 +448,8 @@ static void vvc_deblock_subblock_bs(const VVCLocalContext *lc,
else
max_len_p = max_len_q = 3;
- TAB_MAX_LEN(tab_max_len_p, x, y) = max_len_p;
- TAB_MAX_LEN(tab_max_len_q, x, y) = max_len_q;
+ TAB_MAX_LEN(fc->tab.max_len_p[vertical], x, y) = max_len_p;
+ TAB_MAX_LEN(fc->tab.max_len_q[vertical], x, y) = max_len_q;
}
}
}
@@ -562,9 +559,6 @@ static void vvc_deblock_bs_luma(const VVCLocalContext *lc,
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;
@@ -572,11 +566,11 @@ static void vvc_deblock_bs_luma(const VVCLocalContext *lc,
uint8_t max_len_p, max_len_q;
const int bs = deblock_bs(lc, x - vertical, y - !vertical, x, y, rpl_p, LUMA, off, has_sb);
- TAB_BS(tab_bs, x, y) = bs;
+ TAB_BS(fc->tab.bs[vertical][LUMA], x, y) = bs;
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;
+ TAB_MAX_LEN(fc->tab.max_len_p[vertical], x, y) = max_len_p;
+ TAB_MAX_LEN(fc->tab.max_len_q[vertical], x, y) = max_len_q;
}
}
@@ -598,14 +592,12 @@ static void vvc_deblock_bs_chroma(const VVCLocalContext *lc,
const int size = vertical ? height : width;
for (int c_idx = CB; c_idx <= CR; c_idx++) {
- uint8_t *tab_bs = (vertical ? fc->tab.vertical_bs : fc->tab.horizontal_bs)[c_idx];
-
for (int i = 0; i < size; i += 2) {
const int x = x0 + i * !vertical;
const int y = y0 + i * vertical;
const int bs = deblock_bs(lc, x - vertical, y - !vertical, x, y, NULL, c_idx, 0, 0);
- TAB_BS(tab_bs, x, y) = bs;
+ TAB_BS(fc->tab.bs[vertical][c_idx], x, y) = bs;
}
}
}
@@ -645,10 +637,8 @@ static void vvc_deblock_bs(const VVCLocalContext *lc, const int x0, const int y0
static void max_filter_length_luma(const VVCFrameContext *fc, const int qx, const int qy,
const int vertical, uint8_t *max_len_p, uint8_t *max_len_q)
{
- const uint8_t *tab_len_p = vertical ? fc->tab.vertical_p : fc->tab.horizontal_p;
- const uint8_t *tab_len_q = vertical ? fc->tab.vertical_q : fc->tab.horizontal_q;
- *max_len_p = TAB_MAX_LEN(tab_len_p, qx, qy);
- *max_len_q = TAB_MAX_LEN(tab_len_q, qx, qy);
+ *max_len_p = TAB_MAX_LEN(fc->tab.max_len_p[vertical], qx, qy);
+ *max_len_q = TAB_MAX_LEN(fc->tab.max_len_q[vertical], qx, qy);
}
//part of 8.8.3.3 Derivation process of transform block boundary
@@ -758,7 +748,7 @@ void ff_vvc_deblock_vertical(const VVCLocalContext *lc, const int x0, const int
for (int i = 0; i < DEBLOCK_STEP >> (2 - vs); i++) {
const int dy = i << 2;
- bs[i] = (y + dy < y_end) ? TAB_BS(fc->tab.vertical_bs[c_idx], x, y + dy) : 0;
+ bs[i] = (y + dy < y_end) ? TAB_BS(fc->tab.bs[1][c_idx], x, y + dy) : 0;
if (bs[i]) {
src = &fc->frame->data[c_idx][((y + dy) >> vs) * fc->frame->linesize[c_idx] + ((x >> hs) << fc->ps.sps->pixel_shift)];
qp = get_qp(fc, src, x, y + dy, c_idx, 1);
@@ -831,7 +821,7 @@ void ff_vvc_deblock_horizontal(const VVCLocalContext *lc, const int x0, const in
for (int i = 0; i < DEBLOCK_STEP >> (2 - hs); i++) {
const int dx = i << 2;
- bs[i] = (x + dx < x_end) ? TAB_BS(fc->tab.horizontal_bs[c_idx], x + dx, y) : 0;
+ bs[i] = (x + dx < x_end) ? TAB_BS(fc->tab.bs[0][c_idx], x + dx, y) : 0;
if (bs[i]) {
src = &fc->frame->data[c_idx][(y >> vs) * fc->frame->linesize[c_idx] + (((x + dx)>> hs) << fc->ps.sps->pixel_shift)];
qp = get_qp(fc, src, x + dx, y, c_idx, 0);
--
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 prev parent reply other threads:[~2024-06-22 6:25 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 ` [FFmpeg-devel] [PATCH 02/18] avcodec/vvcdec: refact, unify vvc_deblock_bs_luma_{horizontal, vertical} Nuo Mi
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 ` Nuo Mi [this message]
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=TYSPR06MB6433C7AD908BB846E54E9146AACA2@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