From patchwork Mon Mar 18 14:16:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47177 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1043085pzb; Mon, 18 Mar 2024 07:19:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWzON7GHhlrUQJdZd0QTQYRVMYqctRoTKktArGQ/TurWMzo50n1sXmoRc4iknKmWzrLpsL4DztBSRhTMTdZ8856yA3l72PbzleGuw== X-Google-Smtp-Source: AGHT+IH0Qk6vKip2JMmmzCzpZP7613KSVNwcMhOeTQUgwsSMTYP5Jf8Gt6XZIwShb/R8Os0PPN4D X-Received: by 2002:a05:6402:2b8a:b0:568:7be0:50a4 with SMTP id fj10-20020a0564022b8a00b005687be050a4mr9334434edb.11.1710771572206; Mon, 18 Mar 2024 07:19:32 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ij11-20020a056402158b00b005685d8423a5si4700852edb.614.2024.03.18.07.19.31; Mon, 18 Mar 2024 07:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=OM0j8FLi; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 03CC468D2E7; Mon, 18 Mar 2024 16:17:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6946F68D2D0 for ; Mon, 18 Mar 2024 16:17:23 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXdS8NinDhfHzN7VgzV6nCrNbrKjxtj7/PfVQdCMmUyFK8Og+3YUHCFxYCXHPgX/2GVyLUDHSfJ4NA1RYD7Q29vGvrCKH85o8mLvu8eg79amrmDS/A+wQbgG/pG7/HFvUWOgfV1gur4jXueXjY5aVtnqKDXv2vLOrOHF6XQnKxpzMwE6Tw3JgIGyemiaH8la5o/eNW9FVqQaz+Og94UT6+OOF7Xnuvw/XSemoqPri2q9XE7YyrkQ0qAlr48AdhBWQ3QAtZiFhO20wsN/IXSX3Y88dHVSKDS1BqTETl+REVpR/wHOPMPx+hfs+gY4Vt775IXllnQblk1LeEtjT2q5Mg== 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=/YrsaOODjaGwZ0MqBEKUT7x/FraiYbZpemgFbJfY04M=; b=fMbhSnZI2efBumFunLmn+VtuLcoBgkUKeEy/2wJluVX9c6GArUmhLbgcxiZBSw8Nkaf6139NbLjOYmgHxqNb21BU1dbCKDMqq3LWw4tke5xuR68mHQQivW8r+7FvDeFkw7JN4pW7WtKS3zVHFXyzIPizoXLMo+YlUtqobzWz2mjfNJDJS5cbUQkASIiRdDKZnuWdZSNA+eu5UcU6f2Eoi/gBRVZZvdYGBc2oWZR2qs8+w5XbVqMJr+xodoyENE9BJvv+VDah4DFTzvF5gw4/gExE8FAkgxEdM95BEZCPxK62vEOEjxmFZQCAG4KtnI1QphccIzL2owvFPN96ZHjAWg== 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=/YrsaOODjaGwZ0MqBEKUT7x/FraiYbZpemgFbJfY04M=; b=OM0j8FLiScmNiVGAL0BZA/dED2OuDujmYVfAPqgx0y7RLmSsi3PY//UO/x7Tve7Op67t/HMfWZn+eQV9KBX8iGVRZj8qNezBdKkA9Htn0Dkl3fv2dsb50fbVjMpRklTCJnBDjmzRcMAcOS8vGOPFzroiHC7LCOGgQsMCKn/GFVnciicEQqZf/HoC1i5WCVTygIi5bsKeMZUhgdMd4mB/Da+PUddBZcoODBrmtvWR/045BdVFfKX6Sdaaq9QC/AkchDPOEDFgqOb6qdDPNpJove6Dx93siMrZV6W4kBhtDlKJK5DS9ZiDWACJQj2LcHx+rV2tKXyLViVdo3Mx6Tz22Q== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:06 +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.7386.025; Mon, 18 Mar 2024 14:17:06 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:23 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [sVQjo0wJKawRaTQ41UUiupf1kzSv8E4r] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-12-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: b24d4241-cf16-4713-a2a1-08dc4756176e X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF1NU6+cFbUMwrryYPyjLeOCYrhl+F4tIZTF2F8d6vWXO8Y2aaZN+k5nICPOdcdtxKfbrqj4IYUuTTNMzJTBGzup3bcO1Tn6jiYom7cNm1awCH4ZO9qZ1cTUv+KnEv+N0kgnWQQ1fWRb+g3XzGxBGJv1/MLIN45fk2JHibAOR7v5+zOeWMiGLWzb9Z2W8gKsCoGTwpCK6x4zJGl5Ga+qKZ22tYc9626phk4b9wOnp/6w2eMMbfcakPU1OldyAcwQFLtZ7N7U1KnyfsfijeexZAZ/pELD8VaF6umtM+H/vKzhuvMpBYneN4m8XnZLRKmreCyUtQK5cxfaOT8GQZwILUmdWP9X9ehKFwjF7dKaxMhddS5woSxCJ+iaNiMEx7D6LUbn1ZkA4uNuB9YoappzQ+NUveYHfThJvFlcWMUmrwKaGWjjyPh4YuSfaOPkShRy+VnW115acpsTrfUnAyFWdCR8ngVE17KkpXlVYaEZpa3BDE8x8XcHtQFlf4UcViU4UNO28QlDlsU9c+sKY13V1l3InJo/204b/EybNPXD23xO269NWK2ozvxMaB+fGFWDv7OpOi1u9nwQfWmNCLmgXFTi7QGEYKfshW1JI1IkVzMK6J9poO77HC5djNi/qHCY6V+KLJB8dul30ytg++bX3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cf16-4713-a2a1-08dc4756176e X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:06.7882 (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: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 11/14] avcodec/vvcdec: sao, 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: saZlwgjiPdtL --- libavcodec/vvc/vvc_filter.c | 40 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index 1a3cd02a9f..6b4c2050c7 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -166,39 +166,53 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) uint8_t horiz_edge[] = { 0, 0 }; uint8_t diag_edge[] = { 0, 0, 0, 0 }; uint8_t tile_edge[] = { 0, 0, 0, 0 }; + uint8_t subpic_edge[] = { 0, 0, 0, 0 }; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; const uint8_t lfase = fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag; const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 && !fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag; - const uint8_t restore = no_tile_filter || !lfase; + const uint8_t no_subpic_filter = fc->ps.sps->r->sps_num_subpics_minus1 && + !fc->ps.sps->r->sps_loop_filter_across_subpic_enabled_flag[subpic_idx]; + const uint8_t restore = no_subpic_filter || no_tile_filter || !lfase; if (restore) { if (!edges[LEFT]) { - tile_edge[LEFT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx; - vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT]; + tile_edge[LEFT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx; + subpic_edge[LEFT] = no_subpic_filter && fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] == rx; + vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT] || subpic_edge[LEFT]; } if (!edges[RIGHT]) { - tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1]; - vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT]; + tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1]; + subpic_edge[RIGHT] = no_subpic_filter && + fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] + fc->ps.sps->r->sps_subpic_width_minus1[subpic_idx] == rx; + vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT] || subpic_edge[RIGHT]; } if (!edges[TOP]) { - tile_edge[TOP] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry; - horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP]; + tile_edge[TOP] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry; + subpic_edge[TOP] = no_subpic_filter && fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] == ry; + horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP] || subpic_edge[TOP]; } if (!edges[BOTTOM]) { - tile_edge[BOTTOM] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1]; - horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM]; + tile_edge[BOTTOM] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1]; + subpic_edge[BOTTOM] = no_subpic_filter && + fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] + fc->ps.sps->r->sps_subpic_height_minus1[subpic_idx] == ry; + horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM] || subpic_edge[BOTTOM]; } if (!edges[LEFT] && !edges[TOP]) { - diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || tile_edge[LEFT] || tile_edge[TOP]; + diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || + tile_edge[LEFT] || tile_edge[TOP] || subpic_edge[LEFT] || subpic_edge[TOP]; } if (!edges[TOP] && !edges[RIGHT]) { - diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || tile_edge[RIGHT] || tile_edge[TOP]; + diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || + tile_edge[RIGHT] || tile_edge[TOP] || subpic_edge[TOP] || subpic_edge[RIGHT]; } if (!edges[RIGHT] && !edges[BOTTOM]) { - diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || tile_edge[RIGHT] || tile_edge[BOTTOM]; + diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || + tile_edge[RIGHT] || tile_edge[BOTTOM] || subpic_edge[RIGHT] || subpic_edge[BOTTOM]; } if (!edges[LEFT] && !edges[BOTTOM]) { - diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || tile_edge[LEFT] || tile_edge[BOTTOM]; + diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || + tile_edge[LEFT] || tile_edge[BOTTOM] || subpic_edge[LEFT] || subpic_edge[BOTTOM]; } }