From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 186CD4A3C6 for ; Wed, 27 Mar 2024 13:03:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8EA5E68D6E4; Wed, 27 Mar 2024 15:01:51 +0200 (EET) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2027.outbound.protection.outlook.com [40.92.53.27]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2708868D6D1 for ; Wed, 27 Mar 2024 15:01:44 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YXw/cuONsu7ZoP21uFxYYzZWulDMWht2B2dYwnerBKHdOnc/pNv94l2PB19o89TfpaLH/rlRpWQWuK8rB0yeRi5Wn/mRJ8gxobL1O/MhEx+xg1hI8eZNOQllbRVMtBFHbDb0YB+2zOaMbGoRURd/fyp2WAnKixw0RdnfbdwYohw9xQu84zfBxknvy8PDDnjpvopw2pkCfT4K8jxkCzpSqdJfDveTl5Flk6ggAr5kNYPhLKqvnDtm4ay3ghIIMj09YADrSQUe25HT8Rzg3ZLywAaiXMlNFCEMbDvw8rouTCtxKsbRmlbx2TdkzWq+pZq8vj/a6InaxBhrzq/yffDfCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Nj7is4El7g2B1BA7daduRZzniKW63MUbUaiBrwZbOBY=; b=T8bZDjXARFw/UNeqZ4+qv02Wd4/6OBeSZiXZOgJhDFpKc3eRWSVjAIO8l8eZCpoz2zOmRtViscTTtVuPiIeKXKbFqMoncYCGJwKst/gkw/qYBVOVgdknZvIJ2urp0UL2NJkGQs353zCN0DSubel0NXUidyBPwv6xTvWLU8YRh60X2JJyHbSHj7mlvqwk363sBU4ESP+ytI4ajd+vPD9n/+Mq0tW3sZIP4p334HMqfWVpj40m2sKzJIo8C/4udYnUAWyxacMCzoYD+AYx5BJYOJUAwZkO/9JScU367oFLHpyjgZNfjI5HdjMNDoxYacBhCOR5+zu8oklaJBENIuk56A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Nj7is4El7g2B1BA7daduRZzniKW63MUbUaiBrwZbOBY=; b=ppEbl/aM7/89LSyFzla929apLCYBZGXjmH0xhvJhsAHLGitO/u17UorS7thhpgVelZ2Gkh74fY1Sh/MUodMDvuPfVZVfLYwvbkNp68XkGq8ItlGzyjf+QZjkT2Uf4ASgOdDTNiqbvX0KI+09ShsaYMVr38XzMYXtUnG1ppTQWpMxDsKVGR0Olc6JReWwQVLTxbTvyUHZlYpbQ2aRyjokXi3zNaJauXG6waVlNKyrNOpSglo1XBAW+oOi6Eqejxeo4CLzlHuN3MHxF8eGgK6GTK43FAWBKj46Wktm0flFn7kLNoXAmrqefodCQtfyfh/YTKVSaV/C8EZP+LwBSW/Oyw== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB7107.apcprd06.prod.outlook.com (2603:1096:990:9b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Wed, 27 Mar 2024 13:01:27 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 13:01:27 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:06 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240327130112.6111-1-nuomi2021@gmail.com> References: <20240327130112.6111-1-nuomi2021@gmail.com> X-TMN: [6kKxZdVHL/F3wfWehf3Cc/ZDBhphjTft] X-ClientProxiedBy: SG2PR01CA0117.apcprd01.prod.exchangelabs.com (2603:1096:4:40::21) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240327130112.6111-11-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB7107:EE_ X-MS-Office365-Filtering-Correlation-Id: 84c6ef86-c141-4ca6-b0b3-08dc4e5e03bd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GuxTvRY84vnPu5bnXhWEfpHcl8xfLPZBo3aHgOw/geSoBvQzm3xOl6KGpgbR+fNMPiZ2xoTUANqNsw80enohMUSI1gF+sY60FkKQVQda8GeKBYq+PGny9LV7LjMHTytNjxv95Xw+ZanBbYsiroyYC85rAGHlvfE2VCkF8shZc7ANXBJD2UjnHqvlcA1ju2OkaFpxRInvDBe09u/+zg04e2OPM6la+dFg4hbs58HN1o1Hdv/lx3j+W6ftrdPoSf1MYJWImK2NIAQ3kh9nKqjLOmnT0u32JLbvUtcW7qacMK7Bv0vSKuT4fTqcX7MV99h/C7ZSUKAk502EPYIlUMDsgE27envfEu4M9aBSam61Oa8JtNt8F52CavXkW4+cw0wqYqUQwwwbFa3FITG2UdHbCVf59kU3O6L5673Fj0OCiFvKulRVRaTwyo5Ws23itPeDJ4y9YSpqPtHRohSs7g97WeZn7NGcmaZpSRSN603HHyV5blzAKgPPRJNxTJVQOKu2W+ADKVDkBB0xe+uaxFOv38HSsfdkPxJZM4vDkaVFiuSEfk4/V0FQGJdGdxp45gJS2S61f2B5v6/tTql5kTZfTMocC3mhI1HdO8axASeVnCmHMDcSIgVDIB4Rtnzg4pds X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZbYw76VWLdOpAIpIxNXgi4R7MNLvxe3czBh///FLNuFcemol/scNeBNnX3ga?= =?us-ascii?Q?kYYO2HH45VHQ1wWwkfXxaObHKUIGq8qaMS4zBbHW59cR8cRvr4iC+6n2q+Px?= =?us-ascii?Q?v0krM39AJIHL1Xl1JtE1LMyGht7xaTQEKkagt3lbBwGE0oCKUeNMretwc5i1?= =?us-ascii?Q?S3UMnTO4MfhCOofiHT21l00fal2A+oKqDOod8ICJ3BShKCK4ptXdgqHuQ2jM?= =?us-ascii?Q?f1+Czt4jBBfYvWFtjE+aLVfM99Ze7HoAYaXeI8WxB0VuO8dLCghrtEkttEcs?= =?us-ascii?Q?soeuqTlRDgbVl8BEqxc20I/QGVhQIA7BapWFlA1wkJ4OJhdgGoT/613s7jIv?= =?us-ascii?Q?HmOr99waOmffC3n3fqM5GnTvIt4PISwXSRzep+5BP2mxPGhHqxDj/6LInOWg?= =?us-ascii?Q?VpIlmSPJ3b5zjKg7CCmT2ttdPapE+rUc7tEbDM96vA3omlqycCrfpZshQIg0?= =?us-ascii?Q?wfQoZcMpftf9xvvIGa2KhJNvmvAQiQkETennbNHmeWbGIm527Rk5HwYiE8mG?= =?us-ascii?Q?Fpom0/lX+NKq894cqc2Y3vV/xHyeH4g6HKDWFkk/ebo1KKmt9tCR6nyjJNS2?= =?us-ascii?Q?eD5flIfJHzLC2yWnSiDmamqxFxq9TGRMQ80OkePrhZi8BfRcYQwWcSsiherK?= =?us-ascii?Q?O54nuJlm0FNTTlWXI8k5O7TI+USCg2/mlr15ZlP0J67KIF3dgNIhwjhbxOpq?= =?us-ascii?Q?WDOUD7mZM5oGvwiphGlS9HvsgKVKo0L3FsJIcfnaHFuQEmO+NdJdb+3zTSNx?= =?us-ascii?Q?V1hhRWodSukGBm11RcJevMpEj9T5jNuupk1frtFmc/t54krNKalPuyZ/o++A?= =?us-ascii?Q?VQnVXZaEtEv/EXPx/D8SOJ6iR8f42HfSjqJtDIIQcSGRKSdNrNfLD1TOpq9f?= =?us-ascii?Q?5Bqf3vYOMIujV6jF7gV2K719V13D1t9mFVpl7W1yRhOsmKudVqnJwHSG9Nm4?= =?us-ascii?Q?pwGJHveMSHtGptgDbu/DHMQeoucRWuSjnQZFJK2rP+Ymdfql9o/XSNEkOKP4?= =?us-ascii?Q?gRZeMLVHWWUxsGRJ5ImiY77jnkHFG2st9PYEZEMmdBtZGfaiutph1BPIg7R2?= =?us-ascii?Q?cJ8Z5Q7JnIjzK7oQwqjYAmC5jH/Nh8QgloxtDIvTpSVYIpuLTyFip2Qpk8AK?= =?us-ascii?Q?Bh+NFyEjvxpwB/ocSMKYaajq2R9kSLwQAzTKlvyF6KUb28bl4bJcm+nNSTFC?= =?us-ascii?Q?yr2NexE+Q6MUPoOsRvsxxR5xr2oB79vaQn97blnGYvJqGakW4Qzf8tW9wUWP?= =?us-ascii?Q?xG0OrCHOBKAzr/a0D15oPLSx3cYVVEQFRCjymqJW0w=3D=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84c6ef86-c141-4ca6-b0b3-08dc4e5e03bd X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 13:01:27.8218 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB7107 Subject: [FFmpeg-devel] [PATCH v2 10/16] avcodec/vvcdec: deblock, support subpicture X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Nuo Mi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- 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".