From: Nuo Mi <nuomi2021@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Nuo Mi <nuomi2021@gmail.com> Subject: [FFmpeg-devel] [PATCH 16/18] avcodec/vvcdec: deblock, support virtual boundaries Date: Sat, 22 Jun 2024 14:24:03 +0800 Message-ID: <TYSPR06MB64339ECBF4690959D925F06FAACA2@TYSPR06MB6433.apcprd06.prod.outlook.com> (raw) In-Reply-To: <20240622062405.285359-1-nuomi2021@gmail.com> --- libavcodec/vvc/filter.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/libavcodec/vvc/filter.c b/libavcodec/vvc/filter.c index a5635c60df..69d67cb7f6 100644 --- a/libavcodec/vvc/filter.c +++ b/libavcodec/vvc/filter.c @@ -55,6 +55,29 @@ static const uint8_t betatable[64] = { 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, }; +static int get_virtual_boundary(const VVCFrameContext *fc, const int ctu_pos, const int vertical) +{ + const VVCSPS *sps = fc->ps.sps; + const VVCPH *ph = &fc->ps.ph; + const uint16_t *vbs = vertical ? ph->vb_pos_x : ph->vb_pos_y; + const uint8_t nb_vbs = vertical ? ph->num_ver_vbs : ph->num_hor_vbs; + const int pos = ctu_pos << sps->ctb_log2_size_y; + + if (sps->r->sps_virtual_boundaries_enabled_flag) { + for (int i = 0; i < nb_vbs; i++) { + const int o = vbs[i] - pos; + if (o >= 0 && o < sps->ctb_size_y) + return vbs[i]; + } + } + return 0; +} + +static int is_virtual_boundary(const VVCFrameContext *fc, const int pos, const int vertical) +{ + return get_virtual_boundary(fc, pos >> fc->ps.sps->ctb_log2_size_y, vertical) == pos; +} + static int get_qPc(const VVCFrameContext *fc, const int x0, const int y0, const int chroma) { const int x = x0 >> MIN_TU_LOG2; @@ -429,6 +452,7 @@ static void vvc_deblock_subblock_bs(const VVCLocalContext *lc, // bs for TU internal vertical PU boundaries for (int i = 8 - ((x0 - cb) % 8); i < width; i += 8) { + const int is_vb = is_virtual_boundary(fc, x0 + i, vertical); const int xp_pu = (x0 + i - 1) >> log2_min_pu_size; const int xq_pu = (x0 + i) >> log2_min_pu_size; @@ -436,7 +460,7 @@ static void vvc_deblock_subblock_bs(const VVCLocalContext *lc, const int y_pu = (y0 + j) >> log2_min_pu_size; const MvField *mvf_p = &tab_mvf[y_pu * stridea + xp_pu * strideb]; const MvField *mvf_q = &tab_mvf[y_pu * stridea + xq_pu * strideb]; - const int bs = boundary_strength(lc, mvf_q, mvf_p, rpl); + const int bs = is_vb ? 0 : boundary_strength(lc, mvf_q, mvf_p, rpl); int x = x0 + i; int y = y0 + j; uint8_t max_len_p = 0, max_len_q = 0; @@ -557,6 +581,7 @@ static void vvc_deblock_bs_luma(const VVCLocalContext *lc, (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA; if (deblock_is_boundary(lc, pos > 0 && !(pos & mask), pos, rs, vertical)) { + const int is_vb = is_virtual_boundary(fc, pos, 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]; @@ -569,7 +594,7 @@ static void vvc_deblock_bs_luma(const VVCLocalContext *lc, 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, x - vertical, y - !vertical, x, y, rpl_p, LUMA, off, has_sb); + const int bs = is_vb ? 0 : deblock_bs(lc, x - vertical, y - !vertical, x, y, rpl_p, LUMA, off, has_sb); TAB_BS(fc->tab.bs[vertical][LUMA], x, y) = bs; @@ -594,13 +619,14 @@ static void vvc_deblock_bs_chroma(const VVCLocalContext *lc, const int pos = vertical ? x0 : y0; if (deblock_is_boundary(lc, pos > 0 && !(pos & mask), pos, rs, vertical)) { - const int size = vertical ? height : width; + const int is_vb = is_virtual_boundary(fc, pos, vertical); + const int size = vertical ? height : width; for (int c_idx = CB; c_idx <= CR; 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); + const int bs = is_vb ? 0 : deblock_bs(lc, x - vertical, y - !vertical, x, y, NULL, c_idx, 0, 0); TAB_BS(fc->tab.bs[vertical][c_idx], x, y) = bs; } -- 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:27 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 ` [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 ` Nuo Mi [this message] 2024-06-22 6:24 ` [FFmpeg-devel] [PATCH 17/18] avcodec/vvcdec: sao, support " 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=TYSPR06MB64339ECBF4690959D925F06FAACA2@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