From patchwork Wed Mar 27 13:00:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47524 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp603802pzb; Wed, 27 Mar 2024 06:02:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUAVKklRHI1RaIrlGf61D+APi+6e55GYA2/lN55haBm2/FaXYicYuKpnc55R0qUuMbvsvtBkpEpUcA/56feBvBvZc71IUXyoiNwgQ== X-Google-Smtp-Source: AGHT+IGFFs3uI+p4478zaJphB8WrJrZNhTkuhqxDX6LpJYGX9Yb2JxewdEtwimY5KYaoNzpm/Srn X-Received: by 2002:a17:906:4f85:b0:a46:cef3:4aba with SMTP id o5-20020a1709064f8500b00a46cef34abamr3882701eju.75.1711544523581; Wed, 27 Mar 2024 06:02:03 -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 ky20-20020a170907779400b00a46660508cdsi4431345ejc.274.2024.03.27.06.02.03; Wed, 27 Mar 2024 06:02:03 -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=tDZjYY+I; 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 2875468D695; Wed, 27 Mar 2024 15:01:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2014.outbound.protection.outlook.com [40.92.53.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF4CD68D67C for ; Wed, 27 Mar 2024 15:01:29 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ldJadRIRdbpaamyPH6yF1X8O1jUnI6ToUup4hFUvXkKlKcVN11jqYWecMvQJO7DFbQ+rpFF6XwOSifi5+zbqX65jtMreUktXmzAdiKI3JstoyD+M2Wr9RxgzXR7KVeZpUbtaxlubq3P3v54DIsGy6fH0CFuant+LD1BbMbHuY6wzlX1ss9+xTuCNgCIYhmXVgCCWMIyIwL5syIdjhIqrRMfnmD/CSbrcXvjW003DOsoZsw3omovNu8WGvo6hT8XGFh3YfRrCYw+bAhfCn0TXRS9ayPI2tGM09DUCwNkriRMwxsYroBizrkkKdHpodlkojVYKNB1VEHRlmqEuzEc/JQ== 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=HVWAUmKoYUhOsbDrNeuReXht6LE0enQNGRwQz9znVi0=; b=nvWAP9lRhD0Ia9RxwrsUTRluQIcqj26rJtaslaAaxDl0K+zWq4mAnap/3wWNeVuqpqEtUlc60dUM1fM0pfuOrzVW1QkekUymHdHmkBEppTU7OaxUKLb0Qd9FGGgkAnCdXU8zdLgJdCH54kaTncGgZCyb80lFjJExgb67wsDvHxSQmPZ0wJPYtLYFxHTmBDex4aW5vU8sxkeUUqWvvzKZItuS92C45QIBP4I4xtC7GtXySDisVnrZrvmjFqLD0lt9ACBxUo9y26SZ7c13Aa+92H4ksZMF1xi9XjwyjtoOjNHg6krnoDV8zCVb0OArhPbPumh904Le1hjjopZOmOBkjg== 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=HVWAUmKoYUhOsbDrNeuReXht6LE0enQNGRwQz9znVi0=; b=tDZjYY+I+0Njn4XAX7t6iNr/edQLlNzEB0nyGn8E07fCaNIAfvjGljINbYhYp/1LNUNa2GmnWEuQXStPmogRd5tygD8ImKDNTQ12OGObaCK38hyNyB7EfI5XWIgc9ChphFxyb9cHPblMoDcVh0+DA9MH7D5RYEsToRP1rEFCm82cYgvLvNT6HUG4VYz0hXxRozV3wJzkwz7C02VTxOMw2+fiwbNpXd2kdefGzFjAFccr08B+Lfa5m6VVoMmjS/0a3jV63RE6k078LqVNoYkYL7VrjZ16ceEqxCRZMfxZTUMNix+mffz95oT8yvE59vxHh7OoUNBoi+RFjW3+fFdt7g== 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:19 +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:19 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:00:57 +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: [6IRXoW4u8Es/krQChi1Y/3A6C2nZ/IsQ] 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-2-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: 95566cdb-776e-4996-a6d2-08dc4e5dfea3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cSR+yLfSnr+WAi2iLlnGmOCedrr4xM+Xxo0kaKzue1n8qXH5lJ07XQU1N+Hg6XiEVQfmhdCXw9RyeP3VDB/gyQT3aIqs5SLHbP4Rske+UqYzIorLsVSf5zU4QqBn1MeWVk5HskmDnd3hfMKTCahvPfNOXWeG24CPQrJv7d2tLRMAXmT+Jx5LCV1/9PzzrOor6Z55TO2YCb20ipR738v6IJvm8nT42CZrV7dbVqbi2PRDn7JOfFIw5Ys/AAbwr0C9GbMwzczXq46SfbtA6DKXSAT04DZKuHF669ILvWXjnq9uNmNehJZI2o8FQaHG8ZkeOYEomt36UTzfz1MlhoUSpMEGxG/e2p8n/J1du/cXb/EcFP5rK7XoyXe/VAKNuNYCoBeEZijFynEH+tTiq4Xm4647d3IJ4Rq7pBtJfffguFfmgPQ7ZFtwzeKILC/QPG6EvGCgPP/1ddXCO137r8q9PaHUogyjAbBLAoqHoixQVA4ZjV4QoqLsXzyhHwO60ZS5qHUboG+JmnGV7gAxXhjmpU1xIp4qfK0naYyHVK9IE68un40daTGTI7mWNxzYW/g5lOoLiINtXSkumOYUhPTo5KpjuB3eOeCLex5ZkSOnyg4dZuIbQWFPUgxBfxRC4YgR X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiS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IuXh3rs1m4FZsoR2bPHFe3InOVGT+p+alYA4GcpfzVkPEb78qCbwWRbAWfdqKZcJCSp68Xh3PciwhB+UZBMujbHKM4JzjDQQOgucI7mSSepc5KCCMOh8B5Vn6fpkf9jKsVQGZe8z2mnPV3qL/CSObWwt77pRFXl8ho0InJnr4unAQRFk1v8u6d0eTJQ1IO1OFfiv6lyf4EyBK+leE5WEhq3eeqM6v7DwECmqgKHajhd0dj2Wq3ae5cEDw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95566cdb-776e-4996-a6d2-08dc4e5dfea3 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:19.3242 (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 01/16] avcodec/vvcdec: NoBackwardPredFlag, only check active pictures 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: WTH/I0FPcIIk see "8.3.6 Decoding process for collocated picture and no backward prediction" --- libavcodec/vvc/vvc_mvs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c index 6398fd3571..cf92202b5b 100644 --- a/libavcodec/vvc/vvc_mvs.c +++ b/libavcodec/vvc/vvc_mvs.c @@ -125,7 +125,7 @@ int ff_vvc_no_backward_pred_flag(const VVCLocalContext *lc) const RefPicList *rpl = lc->sc->rpl; for (j = 0; j < 2; j++) { - for (i = 0; i < rpl[j].nb_refs; i++) { + for (i = 0; i < lc->sc->sh.r->num_ref_idx_active[j]; i++) { if (rpl[j].list[i] > lc->fc->ps.ph.poc) { check_diffpicount++; break; From patchwork Wed Mar 27 13:00:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47525 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp603811pzb; Wed, 27 Mar 2024 06:02:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVZkN4thgHToDYyZ3X/i6UWgbZ8Ge1tIYl8mzQHC+nRJ1NkhU8CwrWS4T+10dTi6lK4qgkZA+9MKki8XgJERyMgbbe9jG5Tv+blTA== X-Google-Smtp-Source: AGHT+IHKDXjFpkmJ27FS4XmEruZBksyv/GAW+Lf8JUt5bOgDJPiy9bGDt7cVThfzxvNqXRp8II8K X-Received: by 2002:a17:906:6953:b0:a4d:ff1c:d259 with SMTP id c19-20020a170906695300b00a4dff1cd259mr897257ejs.4.1711544522339; Wed, 27 Mar 2024 06:02:02 -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 b21-20020a170906151500b00a465f304271si4334206ejd.483.2024.03.27.06.01.48; Wed, 27 Mar 2024 06:02:02 -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=OveWN0c6; 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 00B6768D681; Wed, 27 Mar 2024 15:01:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 565A668C7A1 for ; Wed, 27 Mar 2024 15:01:28 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VlV4zNVut7hCCYKoVFfXkvWAl//PjFTD/DpQ7f8RvzBQ3906xY1I/8Kf0F3FTL4ZB+qfsEcLMpzhprxww26Daw9QGVccAGovso4Geq0pr/WKuFJCcv2DhcdvSg9m3BUCVXUYu74RTEd3rXa+sazi18XJwDuuVQIeQHVqCOE3LBpnCxFA5NjQ4uOzl6MSDRBr8h9pjGou0fQE2lQ8smTliosWyH+UVM+/bObYTbVK1C9OzCIIAixLzvUt4jdQXJSu6LwqUhPjl0xjlmi19AHLCrZMemoUFfQtcBkv4tPGAYyuyl6UQJc+h2U3abgOjlSYwnyeraD4eOX5Uy0dwDGsoA== 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=T3K/5xgZdQOShRJ3hbot/KOLBKNOhiWBLrGl8fdQ8Xg=; b=Ze4EZ3/2nvkutTJHpDoZi4WvycaMDPJhvXt0HuC9EHXyTKJclh6BJWJpu8R90ELpuFgNprHANzx5Fcze3S99g+IVogQY6o9P7M0tjv3R7VgBV2crepluHYoBBP672kfF0dFwR7bg+eMnEuiEPHLTjNEV/6+lVPLz9cYpTblBVtPrhBP/kwsOwE0OqvFthypqIBUze254gdV9LwSwRWuKNGCRzuh4HZDL4drWVXYugokAHVNl4ZT2X0G1dwfKmkvQR4C1olDSMUVv5xI6juK/y2DkLipGIgWUPxXBKXkmULaAQc7XTHpCvmzjo/uMSd83WWYqR7u4igYkw5o+nFZMUA== 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=T3K/5xgZdQOShRJ3hbot/KOLBKNOhiWBLrGl8fdQ8Xg=; b=OveWN0c6/sqZW3PHL45qUfuC8VDeSRuyvsKqi+H1gTdBjg1Hz+E+v+LGt0oQyJdEo3UXCNgX2+mS0XVxet4JHYqH5+c/MPE/fkwpKP03J6q15EAVCvRCGzqLrr0tLDKTUaeopO5zvMrfsyWSaqKHjA6KIxX7wi8NauHyl7yOedPJq2rHfur4KO+Y2p7QnnmRz9dA+b1vE42mVjSumWnR9C8OMmVC8Gk/qtZANeVN3iT0aC9LI8bZBMIZFerJcBKG6XEK7RLuPkAPpJe51Hreo3sQgby0tpTqGQ27Of5lG98/fL1675s6EvbsxQYJwJ68qn2xkYhGN6gzwieSub7ROg== 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:20 +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:20 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:00:58 +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: [wNZDIq/IIlp5uNkC1BbQa62SS2epQw5w] 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-3-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: cf172744-50ed-432e-30ce-08dc4e5dff3d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cVQXhtF+6ijtef3BFr0j5C5DyPz5ImSvPH3fuiBc06RY6VONYhm6e6kDqdbJTT/yanjcnp9dreMivw0IYRJTzZx2fbGcg9DKJ29egjiLHq7MGFSz6cfn5VBtEzTwFmmUNGGar/4LMLBl2VILkP/7C/jTO55QhisMocGD/EfAgkgmUNXLJ0y8dFWqaCc1f5+/4pucUuBQ1Fopj90mKPi6N0B5H/tuzAetL6XaKWe55IxwPn3xB0gCG6OD+yy7SCgYb6lZL1BXqAbN6QHoLtHIActPXv9YQ2aogpS9EDyk1/A/js1OMoqJQ2+ekF/xhYKwYow2tLyii3RBI/ArRNidOlQAazJ/bBIVlNxWU/eO1ixpO+rwQZJwCFsKwoa14vhjzpV0iGnnBLGHhPcRRE5cHftf2jqowqce/Xg6eYgL/BhWI6E0O4njnF4lPA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wHh0E8B2/D0eP10dc54r8mSNQkSdnoK1bcSi+m4H4POSNiPbJzT996B9gY2gZsDJy9aUwL/5UULwzHBuhMXlXrwRoRNTCqGaxC2k/Bj8xEztLdgasXvYF8uvVO64ueO3L/AN76Z3ESQI7dtAZLZ8nf0TKGMD0BPXR24c4qrUXR88ash+s0DhAd6BbgxYqTrN5TxzSuJpxb+fh3A40oHB/wzFWHbZ6rlVX9fbf9C3NQsHwyTs4WIO5WvDgWQm1tFPJvK8Zp7MrGhwosICLAOyXLDZU09Rhdv2U23Ov2MxncLvoMA5ZU0SKoggT0ctuHa4iYjzQxQgrHnfjc/+2HiyhzkFFZQh/GXclPe3SK8cyoqIXtvldbPjO4H2qZx52oxOys0G7xCn2kdYoBr1pNLC3QNCJryUYApUn8+M/BwDMPa4dIQyH3GFGhARp8fKlX/0OBR+0fyG55vyeX7W9mnfCSb8CZf6BfMmGoU+usofD5uA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf172744-50ed-432e-30ce-08dc4e5dff3d 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:20.2737 (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 02/16] avcodec/cbs_h266: fix sh_collocated_from_l0_flag and sh_collocated_ref_idx infer 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: r24R2Vl/Zs6x we have to infer sh_collocated_from_l0_flag and sh_collocated_ref_idx from picture head if pps_rpl_info_in_ph_flag is true --- libavcodec/cbs_h266_syntax_template.c | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 0aae9fdfd5..f56066d470 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3221,19 +3221,27 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, flag(sh_cabac_init_flag); else infer(sh_cabac_init_flag, 0); - if (ph->ph_temporal_mvp_enabled_flag && !pps->pps_rpl_info_in_ph_flag) { - if (current->sh_slice_type == VVC_SLICE_TYPE_B) - flag(sh_collocated_from_l0_flag); - else - infer(sh_collocated_from_l0_flag, 1); - if ((current->sh_collocated_from_l0_flag && - current->num_ref_idx_active[0] > 1) || - (!current->sh_collocated_from_l0_flag && - current->num_ref_idx_active[1] > 1)) { - unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1; - ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1); + if (ph->ph_temporal_mvp_enabled_flag) { + if (!pps->pps_rpl_info_in_ph_flag) { + if (current->sh_slice_type == VVC_SLICE_TYPE_B) + flag(sh_collocated_from_l0_flag); + else + infer(sh_collocated_from_l0_flag, 1); + if ((current->sh_collocated_from_l0_flag && + current->num_ref_idx_active[0] > 1) || + (!current->sh_collocated_from_l0_flag && + current->num_ref_idx_active[1] > 1)) { + unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1; + ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1); + } else { + infer(sh_collocated_ref_idx, 0); + } } else { - infer(sh_collocated_ref_idx, 0); + if (current->sh_slice_type == VVC_SLICE_TYPE_B) + infer(sh_collocated_from_l0_flag, ph->ph_collocated_from_l0_flag); + else + infer(sh_collocated_from_l0_flag, 1); + infer(sh_collocated_ref_idx, ph->ph_collocated_ref_idx); } } if (!pps->pps_wp_info_in_ph_flag && From patchwork Wed Mar 27 13:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47528 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp604429pzb; Wed, 27 Mar 2024 06:02:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURuNyePalHC77mImUNDf1f5vM1xeDxsQgpIGn56bSlPni/Zn8RoWSILu/Z3tD8ce4XfZ3v/TQVMPJTi0dGnmg37Hwe63Mdp2F0VQ== X-Google-Smtp-Source: AGHT+IGGQJAXzBxb3qLu8zdkYi9gPZEoQZ0AJA2SQExcM+OmRblbCkFAavJTtzwYYNyaGHSHx0FH X-Received: by 2002:a05:6512:53b:b0:513:ec32:aa89 with SMTP id o27-20020a056512053b00b00513ec32aa89mr8538545lfc.2.1711544561378; Wed, 27 Mar 2024 06:02:41 -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 n4-20020a056402434400b0056c1c5f1814si2248402edc.189.2024.03.27.06.02.40; Wed, 27 Mar 2024 06:02:41 -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=C+MmQCGf; 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 7730168D6B9; Wed, 27 Mar 2024 15:01:43 +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-tyzapc01olkn2011.outbound.protection.outlook.com [40.92.107.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C4F9F68D6A9 for ; Wed, 27 Mar 2024 15:01:35 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MgPQUGbZ66zktawfr/cADpTvQWzxbMk4i8waBWDzIySl+rqp7LvMWcxIDaoZyrSNic8TWHmjj2SjHLUOxUmEQOum2FHxnOqbdUvRYe8RI4GLiN7zDhgO6jEwF6NTsNnku/u9GLttW3CT87WW2hFDA9RVHDF92RCj0Sehm5aM/k26zh+Y5RLTRyjoC9kdTu/J9JcmMrB1mDYFz+sL/pH1Xi2GDtkVlTNpoKBFB4Gj4/6xr/1O9ScEDLqnnW/AyjLCLitYX8Xw/XXS02zJEYmcDJnkvXTbfkkJG9tH2XxpKxr1k5p0M3465bNSd9QZhY0+KvKeje0NmsIVwNW6tE7+Sw== 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=xHm0CS650eOxxOba3eO2NFuOPCt6JT9TIZEGk1HKD3E=; b=hPurlHHk00IhXECoFsjrNxo+9lWXoC1g9cMZq6ABnQcSvu7nxwuv4ji1J1ARRl8BCtH2JR5OO1HrsdZtBdmYZk4OwPcW406ApZ+tqUk5D0ERrzsr5nDvPxU4VjOhtf0Ke/YvaUJ/32dz6tnVeqoIwlkSt1sEsAPoXlpxy9GFl6G8weAc2h0oE8G/n6mQo/BrxfNNqzK6IOImjc7nf9WXplMm1/z84PTTsXkCsEgC+zGPuXJ4KtfXBdiIuV+hJ7hwcnPLBSHBX0CGTefch8c8Twqlr1jRXl7xlwT3mKVYh2EwMR2RHSnZxEYuvjt1P3v25dqc7u79vQqWFwb3N7jT8g== 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=xHm0CS650eOxxOba3eO2NFuOPCt6JT9TIZEGk1HKD3E=; b=C+MmQCGf/Fuy95+B10mSwrix1Z81ZxopTMX6UkvRDSqsFJfiSzfhdS1J0gTOwwe2lFwGxMsmb9R8liVlcOYL27LABrLg9pPxQtNGTvVSCIIP37B30WoIX5Yg/8JXbtzpBdbaFGTEzjOlensGWdAdPFqfaBLbWJ2U0dwgJs0A/V/8cn5eJ/LwZweedM/FhxVH6cRXIH7Oi41y7hcvg2JAw5sqg8VRs6IdqHW1tEAh+ZZtlCZ4tXf/U113wTbnw1sLIMiXjJ4OmI7oeIgFX4unE62jQzs9PvbJ4zwArU43jIK2svhj6x5Is3ws0HLIQdei6pqjI3vxikOtVJ8CDPc0OA== 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:21 +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:21 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:00:59 +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: [PaWf6wjCzwPdYzBPaqqwPcoHTMysoVjF] 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-4-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: 67b59368-79f5-4d1d-b053-08dc4e5dffcb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kehTfk5ZUU1ZV0OBtCmW0bC5Hn+8i0WQtAHa79m3a1evI9mA7YCFjssTnlf6EYLhPlMvN2OAdOio/k/F3cqHN/wrnjrSmzplbSRyhVsIyyyLxpb459++rdM3M4W4GCsc/iwp12hr+27Yym6DJ9iHulTlU/+qwA2QvuAMdGPac3yK4NVwNNK0ANn2wgnaGlUbcNJe7oMXVv6g0Nvdn9WnTFIt/1tp/rRIkq0S3RZf+gV7cKktW9MIc3uNnhNuyETDRdDRej1k9Ohv3xHvA2gfwmq5Mxe60E/vTUfdiY1iuOQby9dnsL+yJI1DD7Z3aDzWV4CtcTAMVcKx8AYm8E6uLnJpb5FJT1POQEUFXGjhjLGZvEtQTTuMB+Fpw1Ca/UD9gr+bKRcHRlJmEro/GtL/hk7pCVOXLks3whkDlEGQVr7FalzNsYutqMjIzQGLA3ad52uzjrR9Jvm0wONXNwB8aL3zA2ErkJaGusmgcKdZNiF7fNdnIKFUE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1IgYL5CUAAocnwuqpGL7OvHSNTj787ILxJQVg7bB++KtFvdajZSE1q2H4y5Mg21hOjOOwaOAb4WsF/TuO/cwaaO4jZnwf6G6c7TaFzZK4drprQ38mysuCSJfoZh3f2iX7Y+ubhJwQug4p9wuWvTGEJ7bJirPHRx7rcfWxdziqauALa2xma/x5qh0yGsHKbU2qtXKaegsSyw4Bgt0VpW3PRBUkpjDcq6QRxZmhdGYBY+cn2fmXHIx+8KmYvkm8vVWb4nMR4DIKgtFuUel9Z52dFtJtWxEQiCssooDw8s1XHu9n/rz5mtPy2MeD/jht0RB0lDs4MZIB9QqRBGAr1S1xTLOzWr7ceHGUM+Xpo1JgxUxrrLNaSxOHapwabFXvYB5Zer8tTwd7Rhs99sJnnY4maogituV9MdkzPn4aqaCfrA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67b59368-79f5-4d1d-b053-08dc4e5dffcb 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:21.2126 (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 03/16] avcodec/vvcdec: misc, add specification name for pps members 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: 7jb2mW6+rPvM --- libavcodec/cbs_h266.h | 10 +++++----- libavcodec/vvc/vvc_ps.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 73d94157d4..21b9a4196c 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -588,11 +588,11 @@ typedef struct H266RawPPS { uint16_t num_tile_columns; uint16_t num_tile_rows; uint16_t num_tiles_in_pic; - uint16_t slice_height_in_ctus[VVC_MAX_SLICES]; - uint16_t num_slices_in_subpic[VVC_MAX_SLICES]; - uint16_t sub_pic_id_val[VVC_MAX_SLICES]; - uint16_t col_width_val[VVC_MAX_TILE_COLUMNS]; - uint16_t row_height_val[VVC_MAX_TILE_ROWS]; + uint16_t slice_height_in_ctus[VVC_MAX_SLICES]; ///< sliceHeightInCtus + uint16_t num_slices_in_subpic[VVC_MAX_SLICES]; ///< NumSlicesInSubpic + uint16_t sub_pic_id_val[VVC_MAX_SLICES]; ///< SubpicIdVal + uint16_t col_width_val[VVC_MAX_TILE_COLUMNS]; ///< ColWidthVal + uint16_t row_height_val[VVC_MAX_TILE_ROWS]; ///< RowHeightVal } H266RawPPS; typedef struct H266RawAPS { diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h index 1164d0eab6..d962cdf524 100644 --- a/libavcodec/vvc/vvc_ps.h +++ b/libavcodec/vvc/vvc_ps.h @@ -115,10 +115,10 @@ typedef struct VVCPPS { uint16_t min_tu_height; uint32_t *ctb_addr_in_slice; ///< CtbAddrInCurrSlice for entire picture - uint16_t *col_bd; - uint16_t *row_bd; - uint16_t *ctb_to_col_bd; - uint16_t *ctb_to_row_bd; + uint16_t *col_bd; ///< TileColBdVal + uint16_t *row_bd; ///< TileRowBdVal + uint16_t *ctb_to_col_bd; ///< CtbToTileColBd + uint16_t *ctb_to_row_bd; ///< CtbToTileRowBd uint16_t width32; ///< width in 32 pixels uint16_t height32; ///< height in 32 pixels From patchwork Wed Mar 27 13:01:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47526 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp604064pzb; Wed, 27 Mar 2024 06:02:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWaBCulXQYKq3NcN46EGUhkzpUWs2At3i1x6YP5Yon1Fjzy4WXYx8XKMTTZ+TMGrycgYJLYtoGgw5HGfDUG3KSO+CtiLLUmXyScxg== X-Google-Smtp-Source: AGHT+IHJ0nbJA69+3zBvnu8a9ZXLYx7t7Rb7S9EnWg7DXDsMdUUiA1ZbrWSmB9To/9NdnDB1fPnR X-Received: by 2002:a50:875c:0:b0:568:d315:b85e with SMTP id 28-20020a50875c000000b00568d315b85emr2936767edv.36.1711544539093; Wed, 27 Mar 2024 06:02:19 -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 q14-20020a056402518e00b0056c27851998si1884778edd.330.2024.03.27.06.02.16; Wed, 27 Mar 2024 06:02:19 -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=D6+9XHsT; 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 6013B68D6A7; Wed, 27 Mar 2024 15:01:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 BC40268D697 for ; Wed, 27 Mar 2024 15:01:33 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k03qPaX4aCGgWOfr1bn/fQ8uQSkSYbIhhC9lCuNf/bueEqyT4IJ0mxythtCUhDyCqdbhz3mcEnfFkwkp3LAZ3C+R2DDrRckhTywizRvjdKe1R9s9ENS35ibNlbbpL/0XsjUI6ptP/HYz0SCJOSfmVbUEZTN3chuGoAcZJmxYes+/zBet8gj/0f+UIdvzQRaM7cERXxGCG4VnYoKqXfPucrXGstfcD1//AJLihmgQcNk01OvmMnOHRG/KUqubtDdE8ZgcKqS+skWNR6qpmykuJT4tI37foqJq+qVAUi+/OyMiOdgzvYfbjsj0SuPZmPEW+WGQPqUDkkJt6rtGSqEfyA== 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=iHzeOqMwvVDXUUzP2Wd+ztCYetd+ywEt8szOPAXx6VE=; b=H7du2oRLB/31nNDYbJsV2JGvhl7rQ+4YMeutubhxXKBeF4FQRZ0+QhIOMESb5Du/iUVA6BDC6iIak/iwiNYdfZJjTCjIBdA/MRZDq3YxPm6eQbQoqKcExFo7DYsybB/gF3Uu+0tPoqgRs1TiIcdldUBGwj9JuTpw8GGTNwe6izgsztwzq0C8yB5i2WN7vzbqO3Av1k3FkDeHdKh2uGf6YNcpPcE+U84pVjn2TfVsCS7GKlQ1uscPLxAKbicWP6lnbmJ92RY8HW8tqD6668u0CXaFhoZonqDhjlPrWCeqeQAeeNv/YSO9U5my5/wQ+nZX6BnU05gcV5Y6+6SpiA71Dw== 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=iHzeOqMwvVDXUUzP2Wd+ztCYetd+ywEt8szOPAXx6VE=; b=D6+9XHsTERoaWw2TNQSkLviljM26Y6YAIVmhg0MLnIkAjkuJIusUNWtSeihhmZFEX2H4X9atS3zceaa6QYmOrwJduSuzeXL9adRJKEd6OANTbm800c6RPdTJsv8MJevnBq0cfz76wAgs2OCK17qMTQpWp1NHaN40f8pj7po+CE+EIT8D05kT+BZ3hrjlxw8tfADWO977ROyN9MYgFKwR/zKSMGy0yllSrQbEAIb9GcrzXP3A1IKxzSp6Tw236Q8GwW2uRwfgr8OGOwefInHIoI5XN7YLkiv7HiA41qNV6UeoD95T+bCOB89j+tZXecoBNm27zw1cXTdLQiq/wG0KcQ== 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:22 +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:22 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:00 +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: [vORLBAHz4n4dhiXxCTbYfT4U5IWlAdak] 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-5-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: 00df142f-a36a-45bd-3b26-08dc4e5e0069 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gL3eJNEZ9XAm5o1SkBCKRI1144ElYDnWYUN+E32X+gd9FZMwjH5W9/rAlQJta/Zp7EJQZjdpOMyOqIKJqYSER5qgVipQojhjzE2CnSN+nqOadMaWORcAIfb4xhIWznRN18UIpcx6vyA2Sz9lCsXVXbGJ4fE9C27MR2X0tedp6wPSHOqieGfbpMP56WS2v/WZFrSL8FF0RDxAN9LeKR11CP2gK+UGAlAhFMLpZvClQb7Sj1xrEBVN6TT6h80uykSnLH7fwWiYwwIMcvyNQLxrdjLH/JEIw8j0QdyPdWQufHDR5XlsUB6/iG5Ayt5Pt+9iyXxGUYzjcSM894j0OGu3PjVaAmjfEiPfWszP7KtwWmrqmrGaaVFXX8utv4Mk3deW/wBkv4nx6QRRV0FiiUAnxpVrxPOCpQEHIzv5wCGAEGvO7Dxb/CC5NDfoCnSq0JyHLZuqwX+QyHGtZyVPNR6xEmtPdFyJ1od5kwoVnEfYwU1+8gkMaaRleQ0CbdWemy49lTHgQt7tdmwoRvlgPzCTe9c5Cie7q3zvlLv6SrbGUNMVOeByQS/uJpUrrgrv/bErkeDAce1YvzSHoEen6uQ+4/eVTS5yryuZC7mPez7AYhSpkQF0mbZCnXVqcPsnMXPu X-MS-Exchange-AntiSpam-MessageData-ChunkCount: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brjYS5ju/LjF0tRm7nie54JJaCyjisiDKIligVmjWLP2aV7ydN8EKHlW7BsxsiJCNooUKBdKbTIFqRliSZUtwkaJRbR+G8P3WlHHGjHG09K4hTvtynT9m+6QoUaNforSr5Lr71OC4bXk2NVP7OX90LQ4tt2AzVvQaVj/4cfpSH1rsb0OfynI9WyQMfleZ7HkaIx5zSswPNKNhKyTAvpUVTZqhQLCfQB94VbpU63u2Eox9MJjQcv/EQe14bLbIKLPkBiFAw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00df142f-a36a-45bd-3b26-08dc4e5e0069 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:22.2939 (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 04/16] avcodec/vvcdec: fix uninitialized last element of xxx_bd and ctb_to_xxx_bd arrays 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: Frank Plowman , Nuo Mi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: heZV8PX73ago From: Frank Plowman see "6.5.1 CTB raster scanning, tile scanning, and subpicture scanning processes" Co-authored-by: Nuo Mi --- libavcodec/vvc/vvc_ps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c index 7972803da6..3e7c0b4f5b 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -290,6 +290,7 @@ static int pps_bd(VVCPPS *pps) for (int k = pps->col_bd[i]; k < j; k++) pps->ctb_to_col_bd[k] = pps->col_bd[i]; } + pps->col_bd[r->num_tile_columns] = pps->ctb_to_col_bd[pps->ctb_width] = pps->ctb_width; for (int i = 0, j = 0; i < r->num_tile_rows; i++) { pps->row_bd[i] = j; @@ -297,6 +298,8 @@ static int pps_bd(VVCPPS *pps) for (int k = pps->row_bd[i]; k < j; k++) pps->ctb_to_row_bd[k] = pps->row_bd[i]; } + pps->row_bd[r->num_tile_rows] = pps->ctb_to_row_bd[pps->ctb_height] = pps->ctb_height; + return 0; } From patchwork Wed Mar 27 13:01:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47527 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp604341pzb; Wed, 27 Mar 2024 06:02:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWHUzh10ziMIVKHb4Xa0Gk005wLwm3rDyuMqOHdwFRfZH4xi1/y+rAzx0wsYrFvTkxp7m4dBPHxkBRdUDHyjXmbCG52uKQvdvSG9A== X-Google-Smtp-Source: AGHT+IHX2SF0oBHaz56ngh0PrSx4tM7MmS1wyEgdVAvyQ9wDI0bFahwic94+4faLXkkC0cfb6Slz X-Received: by 2002:a17:906:52d7:b0:a46:47d5:2851 with SMTP id w23-20020a17090652d700b00a4647d52851mr2607446ejn.29.1711544556818; Wed, 27 Mar 2024 06:02:36 -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 rv21-20020a17090710d500b00a4725e6b8aesi4535189ejb.18.2024.03.27.06.02.28; Wed, 27 Mar 2024 06:02:36 -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=HN52dJJ+; 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 7D40E68D6AC; Wed, 27 Mar 2024 15:01:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2014.outbound.protection.outlook.com [40.92.53.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5CC8468D6A6 for ; Wed, 27 Mar 2024 15:01:35 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZf8yroaBgKNr/GBf8GTOnHudG+LCzS3hMInedh4QO4aX+s2MTGPXqkrdwhQ9cph9CQS9sxgmiqn7hKO9b8R8d2ixjNdfIJLsZsv6XeJkIn0+YRNReB6twUj4nzvamz9pQCf/CBxVpWL8uGhuF7TP+qYG2yZWFh88QNV1HaxhjbnDpsflyLilyNYrV4jjatmJfAlBIWhkl+W+ja105B3dCdhrbKcJHsa5rSwXUllEG/IGXZJ2zuuFJG2qWVKOopZ+ON4hlTWX5ykOWh5l1xyg2+fHNYvDDVRVY3Bcm04UQsiau8Ei10iAPkgEjalcK5wIraKktFfCnUd5OQwzqHljw== 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=G1So1XD7KkXhfzhLVXANHwNyN4AcJez6cXox0lc+guw=; b=UuG8cHM5F9fJ+Udmw8Zx1Bls70stetZDWSFdc0ox2JuzgOoK6FFhLSxOKmu7fr7idnAd4XApekOWzkJA8IadP5CnLXLYawIIn6M3hoHIzhi4W6vpe0zqd0KbwBIoUBNZrgH77TxWWxi0tr+8Om4Y/8gcnXcNxtB001lr/FOMkBDoe+14yCGSFuBr+3mZfFwCUxyvigLI4pIHLXFfxLhc1CVh9cV1wvyo67sA9K2KZq7BmOyfeTqMNPBuhbOKNu0a4W7l4PE4quqcyOizgjJpJ7QmLTs4uzgBM3XXeIJajuRCkry4EkVY05HmGVX2gbs/xS07/l92IbJK+8rM4UNqZA== 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=G1So1XD7KkXhfzhLVXANHwNyN4AcJez6cXox0lc+guw=; b=HN52dJJ+gbrPdQhCAzGEztLpMlLudU1pLGM9t0w9DbaZbYvFv6T+Pob9ndgUIXVhA9cr8lZM4M5/QiT2ERn508TGi3b314x7v4cmAgogKuhnjiGu8KfobXl+5sQpix5g29ANLKtA2ifWHsegrPMV8Ar5xhSkziw0PZY5C8ZDDSVA6NLyj/d9kL2U9sDv808M/0QLsKhSdL9lB+GRE1ChjQB4SukBF15KFB2zETgjRoMVGQ/bWsUcTb7w1PoyIxPec2yDm8ceuragRsM9UzgBUsmrqtb2oKyuzc3HgMYH1Nl+Nz9ib4E1l9pnzDMBc/0uwfKxXUkwQCA2eBwWDxdotQ== 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:24 +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:24 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:01 +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: [LsR2QxRRU8Vnj2oJgR3Hjf2TfSRUO4X2] 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-6-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: 87a85fed-1714-4349-39ee-08dc4e5e010e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gZ+MDy57zfsbMyfjL91uvmhm1gMvYyZx37/cYG5ANjsNAz5y5KAyxIC1e0YQ5NdtcIA+r9LiYDtemhNEufPD/AzQts66pEKz4iRtXcjM11+6K+ykO7pumvhmzukCZXjXfLpAzsRcKtiELtyqi66FBdkZNK2OFMo6/H6QQqeLc/FAHKR6kf16NWG1qQ66poUmNrXFwSnqcGdA7hBbAGxHi0ZIoQrid6TASEepgPUTy1uF0Fqnj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NHOvwyZBugfn7aMrpMrLgCrN5tTWxnwm5Qy/vqtcdA6cUC8Li1YcpgFmKXomE3+qwuXKOj7lZk8/mBL2t4oVXCIPenPdzvL9Sc4Df/Lah4qwA+WvzWo3xnIEocANG0QygNpcz3ePZHRCsvku2LX0Gv5FHJzWyJMBFmRWP1WBV+XCDtMBb9wsCLVB8yMcjPEn5/HJeTziGR9ya7+suZMTyA2Kl0ojVUC4udXsOTYEhbSQy/X1vps4FKn5/3PBDCOdZuAoKKY6uS+QAb/Y/sOJX4iN9+cuV/HWSMxnSXqPMB8R/oDRVEj+ijZ6IyXCGOp6oxuFSUI6VfrXWSksYjofVL6ER18AlDZsFC+bAsZu2vy/rBJLfK2TsbjLJgs8FW1I9MvD0iROhbxiVSs14rFfR8sLbQ+PPYg8+Jbgqw80kbUr1lCMl4fR3vIVC6/bFPIujNoC4laZ6f9DnjOJkwJz0YfVU3HFj6YMkVBNtWSrhxXRqzc90A6VPj9Y8/Lc3nsXYt6ImoMUI7kEuaKDFiHaPp7q1ItawGSAPFBYnf/0oRwGiDpk4Ir94rGHuzZLg8EMIa7gIpYnVXt5OQckSxgQu3ULf86TXiwDmQTCVebJ9/8vMYRq+mDFgwG3UrNibMnNkTJ/td5LurxeVKGtrNVaAwzkRyZA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87a85fed-1714-4349-39ee-08dc4e5e010e 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:23.3089 (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 05/16] avcodec/vvcdec: support rectangular single-slice subpics 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: Frank Plowman , Nuo Mi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6ckWJIDpENEJ From: Frank Plowman Co-authored-by: Nuo Mi --- libavcodec/cbs_h266_syntax_template.c | 5 +- libavcodec/vvc/vvc_ps.c | 93 +++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 7 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index f56066d470..725cee5b03 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2120,9 +2120,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw, } else { if (current->pps_no_pic_partition_flag) infer(pps_num_slices_in_pic_minus1, 0); - else if (current->pps_single_slice_per_subpic_flag) + else if (current->pps_single_slice_per_subpic_flag) { + for (i = 0; i <= sps->sps_num_subpics_minus1; i++) + current->num_slices_in_subpic[i] = 1; infer(pps_num_slices_in_pic_minus1, sps->sps_num_subpics_minus1); + } // else? } if (!current->pps_rect_slice_flag || diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c index 3e7c0b4f5b..6b5aa31ccd 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -346,6 +346,83 @@ static int pps_add_ctus(VVCPPS *pps, int *off, const int ctu_x, const int ctu_y, return *off - start; } +static void pps_single_slice_picture(VVCPPS *pps, int *off) +{ + for (int j = 0; j < pps->r->num_tile_rows; j++) { + for (int i = 0; i < pps->r->num_tile_columns; i++) { + pps->num_ctus_in_slice[0] = pps_add_ctus(pps, off, + pps->col_bd[i], pps->row_bd[j], + pps->r->col_width_val[i], pps->r->row_height_val[j]); + } + } +} + +static void subpic_tiles(int *tile_x, int *tile_y, int *tile_x_end, int *tile_y_end, + const VVCSPS *sps, const VVCPPS *pps, const int i) +{ + const int rx = sps->r->sps_subpic_ctu_top_left_x[i]; + const int ry = sps->r->sps_subpic_ctu_top_left_y[i]; + + *tile_x = *tile_y = 0; + + while (pps->col_bd[*tile_x] != rx) + (*tile_x)++; + + while (pps->row_bd[*tile_y] != ry) + (*tile_y)++; + + *tile_x_end = (*tile_x); + *tile_y_end = (*tile_y); + + while (pps->col_bd[*tile_x_end] < rx + sps->r->sps_subpic_width_minus1[i] + 1) + (*tile_x_end)++; + + while (pps->row_bd[*tile_y_end] < ry + sps->r->sps_subpic_height_minus1[i] + 1) + (*tile_y_end)++; +} + +static void pps_subpic_less_than_one_tile_slice(VVCPPS *pps, const VVCSPS *sps, const int i, const int tx, const int ty, int *off) +{ + pps->num_ctus_in_slice[i] = pps_add_ctus(pps, off, + pps->col_bd[tx], pps->row_bd[ty], + pps->r->col_width_val[tx], sps->r->sps_subpic_height_minus1[i] + 1); +} + +static void pps_subpic_one_or_more_tiles_slice(VVCPPS *pps, const int tile_x, const int tile_y, const int x_end, const int y_end, const int i, int *off) +{ + for (int ty = tile_y; ty < y_end; ty++) { + for (int tx = tile_x; tx < x_end; tx++) { + pps->num_ctus_in_slice[i] += pps_add_ctus(pps, off, + pps->col_bd[tx], pps->row_bd[ty], + pps->r->col_width_val[tx], pps->r->row_height_val[ty]); + } + } +} + +static void pps_subpic_slice(VVCPPS *pps, const VVCSPS *sps, const int i, int *off) +{ + int tx, ty, x_end, y_end; + + pps->slice_start_offset[i] = *off; + pps->num_ctus_in_slice[i] = 0; + + subpic_tiles(&tx, &ty, &x_end, &y_end, sps, pps, i); + if (ty + 1 == y_end && sps->r->sps_subpic_height_minus1[i] + 1 < pps->r->row_height_val[ty]) + pps_subpic_less_than_one_tile_slice(pps, sps, i, tx, ty, off); + else + pps_subpic_one_or_more_tiles_slice(pps, tx, ty, x_end, y_end, i, off); +} + +static void pps_single_slice_per_subpic(VVCPPS *pps, const VVCSPS *sps, int *off) +{ + if (!sps->r->sps_subpic_info_present_flag) { + pps_single_slice_picture(pps, off); + } else { + for (int i = 0; i < pps->r->pps_num_slices_in_pic_minus1 + 1; i++) + pps_subpic_slice(pps, sps, i, off); + } +} + static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int *off) { const H266RawPPS *r = pps->r; @@ -381,18 +458,22 @@ static void pps_multi_tiles_slice(VVCPPS *pps, const int tile_idx, const int i, } } -static void pps_rect_slice(VVCPPS* pps) +static void pps_rect_slice(VVCPPS *pps, const VVCSPS *sps) { - const H266RawPPS* r = pps->r; + const H266RawPPS *r = pps->r; int tile_idx = 0, off = 0; + if (r->pps_single_slice_per_subpic_flag) { + pps_single_slice_per_subpic(pps, sps, &off); + return; + } + for (int i = 0; i < r->pps_num_slices_in_pic_minus1 + 1; i++) { if (!r->pps_slice_width_in_tiles_minus1[i] && !r->pps_slice_height_in_tiles_minus1[i]) { i = pps_one_tile_slices(pps, tile_idx, i, &off); } else { pps_multi_tiles_slice(pps, tile_idx, i, &off); - } tile_idx = next_tile_idx(tile_idx, i, r); } @@ -411,14 +492,14 @@ static void pps_no_rect_slice(VVCPPS* pps) } } -static int pps_slice_map(VVCPPS *pps) +static int pps_slice_map(VVCPPS *pps, const VVCSPS *sps) { pps->ctb_addr_in_slice = av_calloc(pps->ctb_count, sizeof(*pps->ctb_addr_in_slice)); if (!pps->ctb_addr_in_slice) return AVERROR(ENOMEM); if (pps->r->pps_rect_slice_flag) - pps_rect_slice(pps); + pps_rect_slice(pps, sps); else pps_no_rect_slice(pps); @@ -444,7 +525,7 @@ static int pps_derive(VVCPPS *pps, const VVCSPS *sps) if (ret < 0) return ret; - ret = pps_slice_map(pps); + ret = pps_slice_map(pps, sps); if (ret < 0) return ret; From patchwork Wed Mar 27 13:01:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47530 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp604730pzb; Wed, 27 Mar 2024 06:03:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXIERkB0SSpVVv6e99STg9+c8zRTRl6za2nOi3BZ+QhLlc7g0r+lsj7D0pkSjbmb9A/aOWtSBhGeEi2ZhFB0NVYusQleuE4Jj332A== X-Google-Smtp-Source: AGHT+IG87JLSMrL/8w7J780GdAkXS8JwmdNOvyUXxhLTXzU/y2RalMMvWc07wvDaQ7oOXx0ten8l X-Received: by 2002:a50:99c2:0:b0:56b:b570:4379 with SMTP id n2-20020a5099c2000000b0056bb5704379mr8615762edb.4.1711544582550; Wed, 27 Mar 2024 06:03:02 -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 g3-20020a0564021ec300b0056b839703a6si4727169edg.36.2024.03.27.06.03.02; Wed, 27 Mar 2024 06:03:02 -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=XT1N1IPw; 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 9E07968D6CA; Wed, 27 Mar 2024 15:01:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 27F2468D697 for ; Wed, 27 Mar 2024 15:01:39 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxvDNcRbL+q6hpuXYS+FQSgsWEpvtSouPDoVanFS7Z13nDE27sCCtPt4MJ59Xt5kwZqIeqGbblFmHdLTcwBqB1Gx57VgE2EiOqoYDIGWDCOTrvtLT5gxoYpkVJiXbNndTzDS1a21I7vd7OplZRUoy8nFmuy1lkIbdi2FzlwqHBrkxMUL+jS25kw2h7F2zxlnoaa9mTN6oTLZOFwRiyUQUMZcv5F5A6KkqC0cKsyAHULQ+Hmx1lPlv4RWd92j3G9XIyfZLeah+tCz0AXn6SLnRnEXH+r23G+l7L8rzjY+GaVrWktYTfupUJFryBxCYXZjofeRnLqVSKpk3mHLeY7OFQ== 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=Iy13kliF7DEmrO3txDSyiqw4hRsG2DFDQmYcaiEwS6I=; b=Hao2uSrvbKeoWyb55pGvozexiI/zKmr0zI8z6wnL32/QhFmk2UXuWdSZ5F1fNfZMjGGnKu5ZceWhPqdDmq09oDi5KKOafg/g3nizGlJJv4Q+LtBHNOyy8hUroveCVQrvetUo4WDXJ6Hb5K3u8OyXdiP9KchH4byFQTMmem4s8IKHsaXKKFIBpMjUdgNNe1DOlDeSMqpsTVLP/+4Hdk3exLzI5cc7HpDpr7F7XE0ASNKLxwAyl3svNNYRmOmzRPr06bAGp1jDsJlx4Gt/mdiInIWbdaywJSMMXfEHgd+XAKp0AegD6n2epO6+lizxWBSi/Rj9xIuUsuGGA4+PpxLFAA== 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=Iy13kliF7DEmrO3txDSyiqw4hRsG2DFDQmYcaiEwS6I=; b=XT1N1IPwu7eyqIZi6J/RFwM9zMNL9sJwJaJ0CxcTQ+zfJ0yzUwjgH8K+eXRwlWuHnwfBaGOAH4Naty3MFSdxT0fXhnHY+z8/GhuSTwuenTKlh8pHaK8DGTXr6bUv/FCeSgGfSc3wo8M4ITSiqskCKCaTR4NqfD2J5jECdJjj8ShnyrBsvTYzgmefWvU0SsT/o4klzkTy4pJTZvdTA9mrSUlDX1FbDwO8tYAYd3vQX74hdQyOnBAATbamR02vGJ4xPjIUVIIAe5Pnrbhj0fEWvC2nNR9a22HcyqzQv7x1cFR4bu3/cezhEgIwMVYwAV8XWyUW+hndyF1N727B/W+eYw== 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:24 +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:24 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:02 +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: [HRKMs1OI/eFZ2Ma0kPxoSHMxSNN3KYCi] 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-7-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: 87c4f1e7-161b-4aa5-a3de-08dc4e5e0193 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W40Yrw0fYzTJdTYaDCvs9D5+EWWP5MgU/iwESO/jdsojeKLG9mJfdjj2lB8igPG31YEecQYZmYr9SjoyPMwcWuFIDtwmYwiW2iFjcfpduUe7b1AgTTqSFEX/khtYJUdhWbOiSLsz5ctjREuR1JTrM95xDbVQnIkjkg4XMRQ1JIropz05e62USpcSZQHTzcJUAlXxHa49dfmQMCuXBJ8xlse7rGHhxDfptH4noYXDFn8GFTNtZLNx/Rv+3dmD/gv3WvN4vITPbsfAIGwyaNyqzdXYE+tQolenyBP3qVEhvN5Ubkd3e79VUEyQKqVGFSusxMeR+fzvvkGYE7JGCIeaa/IE6SRRnq+pHwa0wWJtF/JizIFMGesNfzoBCeGEHV16CxX7SosLBF1mgxSJyjkSPvDJbGZuhgwObAAdIaa72X3vDqOrwFn6P6zl+tXNryg3dMkZ+F65FoxhsKdD/QTV/BsxvFO48HcaIS75uJI/RUDbmvQytyNGqMT+xNhyEJ9Vhc8JlVE0icV3Ay1nsi4QKmMagWktP8GSmfgh3nksQw8G056LxrZGiQtp2liVfS2b+3n9xXO2rRt27y6w15qjKtu0oqnxfzhzKc92ULPGYqJ2OkqP11RqkEtOfpz/4iw1 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Ex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ka+QQD0LAgLPGNmraxeEnMNEzO5KW2PODoU6+vBtuvN9VcXPjD0RH6GQ6jCLXbjAIRDvaMKd7mpp6NhrCarvb+4PJqrCjNHXNOQnky3Cata/vgAi4h2r59Zz+tiVNOuz1Rel3HxPBHEzftwfnHT1NNuGsg+UiLAK1f+RcdXQ60KkgdU2g1szFUo6kZqBlt8XTm/88WVQAl5+uaHO1LaDwUud9cnv4pXXc5Aroc/iQmeNVMQ8TULO3JrbAQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87c4f1e7-161b-4aa5-a3de-08dc4e5e0193 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:24.1999 (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 06/16] avcodec/vvcdec: derive subpic postion for PPS 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: 6t12SE74YX2h --- libavcodec/vvc/vvc_ps.c | 19 +++++++++++++++++++ libavcodec/vvc/vvc_ps.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c index 6b5aa31ccd..556135fee2 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -514,6 +514,24 @@ static void pps_ref_wraparound_offset(VVCPPS *pps, const VVCSPS *sps) pps->ref_wraparound_offset = (pps->width / sps->min_cb_size_y) - r->pps_pic_width_minus_wraparound_offset; } +static void pps_subpic(VVCPPS *pps, const VVCSPS *sps) +{ + const H266RawSPS *rsps = sps->r; + for (int i = 0; i < rsps->sps_num_subpics_minus1 + 1; i++) { + if (rsps->sps_subpic_treated_as_pic_flag[i]) { + pps->subpic_x[i] = rsps->sps_subpic_ctu_top_left_x[i] << sps->ctb_log2_size_y; + pps->subpic_y[i] = rsps->sps_subpic_ctu_top_left_y[i] << sps->ctb_log2_size_y; + pps->subpic_width[i] = FFMIN(pps->width - pps->subpic_x[i], (rsps->sps_subpic_width_minus1[i] + 1) << sps->ctb_log2_size_y); + pps->subpic_height[i] = FFMIN(pps->height - pps->subpic_y[i], (rsps->sps_subpic_height_minus1[i] + 1) << sps->ctb_log2_size_y); + } else { + pps->subpic_x[i] = 0; + pps->subpic_y[i] = 0; + pps->subpic_width[i] = pps->width; + pps->subpic_height[i] = pps->height; + } + } +} + static int pps_derive(VVCPPS *pps, const VVCSPS *sps) { int ret; @@ -530,6 +548,7 @@ static int pps_derive(VVCPPS *pps, const VVCSPS *sps) return ret; pps_ref_wraparound_offset(pps, sps); + pps_subpic(pps, sps); return 0; } diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h index d962cdf524..f60d8b81c6 100644 --- a/libavcodec/vvc/vvc_ps.h +++ b/libavcodec/vvc/vvc_ps.h @@ -127,6 +127,10 @@ typedef struct VVCPPS { uint16_t ref_wraparound_offset; ///< PpsRefWraparoundOffset + uint16_t subpic_x[VVC_MAX_SLICES]; ///< SubpicLeftBoundaryPos + uint16_t subpic_y[VVC_MAX_SLICES]; ///< SubpicTopBoundaryPos + uint16_t subpic_width[VVC_MAX_SLICES]; + uint16_t subpic_height[VVC_MAX_SLICES]; } VVCPPS; #define MAX_WEIGHTS 15 From patchwork Wed Mar 27 13:01:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47529 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp604579pzb; Wed, 27 Mar 2024 06:02:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUi61L0dZf+8LmjcY74riBNhgJuMrycmCK82+YaLhZJDPoMmv19A00cfhuTVFsgQzCaGCqBJmpXA6lsGg/BGA96p9h/MnOzdpDLWQ== X-Google-Smtp-Source: AGHT+IHLR5h7SRi5bYVWonZKc3FVwSi3nBcpxU1bmb23qQjunZPQ5WF+F86J3u8CFLeJBMgw5zH9 X-Received: by 2002:a05:6512:60a:b0:513:c428:9daa with SMTP id b10-20020a056512060a00b00513c4289daamr7471209lfe.0.1711544572734; Wed, 27 Mar 2024 06:02:52 -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 z12-20020a05640235cc00b0056bf79cb9edsi4565494edc.454.2024.03.27.06.02.51; Wed, 27 Mar 2024 06:02:52 -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=N4prwngk; 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 7A57268D6C3; Wed, 27 Mar 2024 15:01:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2014.outbound.protection.outlook.com [40.92.53.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ADFE968D6BA for ; Wed, 27 Mar 2024 15:01:40 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M+vQ83vE9UWr2Bs24gXYx6OlqtMs7K4Lfzbgm+ObYyAHMRbOuiokCFKP1zLBIO9ST3X+pXw9zB82FAbh3fvLImVSYek3mGs3uFPLRv+g11LFIbDxMK5q5IYmZESpSPIwtQHsaOZeGIV/EIEdLI4LNc9ig8vpF6DZhrX28K/6D71C+jH/VickW0JneGhiNGrCcmYXYFtmTBHsnJ10B8TWC8VnUblj8aBiE4+ux9q/b53IDuBwZJt7ZVgINlUkofC/lxSgPb1TJwXBpGAnG25ab2WZIFBA08b//Z5CGYVvhY+ZJJBMzjesVxq680qBIacAriS3+kMTTYSDia4fBarsgQ== 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=WBi9cD501AkcTUrFEtBUJxr+yO9W1a1BUZcsXPXWdaE=; b=e8eVd2pdKxB3jUI/ezBgiQOK1F7yn4dl3w/2S43eYom50/MJwJ0kEmjSNb7Di5pl9tZegJAPfDa4L6Dj8kzgi/AWYyALKMw9CZMsJl3frYzVMe3a4fGRwyLYZqpQM4/ag39HqtlM4iH6NSfPz6bj7++wvedJAbhioQ5AWgmo3NCN5quIHqRMMUyhnHpcY2QAgiV2SUgb2sEmD3rjO605hhUW863y5T7oCJ+/zwICEIuJyRhJTnaQzD3YxSXmxmBJyIq0zZm5C5o+vZObnXO1pKgsttrLiQ8Qnb8NDppOYJasXD7K9UVx3ZBAFiWuTKpR9Go6+FHqI+g/bMRGta5Vpw== 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=WBi9cD501AkcTUrFEtBUJxr+yO9W1a1BUZcsXPXWdaE=; b=N4prwngkLMakLZcmwlU585d3pqFV1INjTMeafsQCSRaqwB9rUeyhxuE2+sydrs1qfVpWo9D7jesedxA586zmlP/hNgkO5C1xXauYJGFkNbQHG6l13OmiYlGHbzqhevE5wl1KRCAypZmPeGvHevjmbsz/XP08s2OvTEq5fusGBIRFzfWqMxVFug1F4VH311+u/MvDsQxfXY7oh2j/Jjz5nAK+IbPz1wsi4IFpeCx0/5qS+l3vawfG4Gx+DL5apNrg84HJSozcYs+4/Q72ox3djWfNoVhO+puAZ07TjtT86bACdKe8R8I7EJkFiB9fD0QLTRr7+PtjBZp5/KzExbU0Eg== 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:25 +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:25 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:03 +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: [w2Z2+BQtEUYZplW0+iaNTVy01Qcjn5yr] 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-8-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: 104fa0ba-b615-45cd-aeca-08dc4e5e021c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wGQ4hJbxGOuBXPpI4SOz7LOh1to56MtikdjaRSS2Tyg+ZisujIRl9DGTVgS0Rs0L8fef43eZ/Zu3lynmUu7R6kagDg7M1ii6HiltxtT9BP7bsL9+tOY0++jeOfEnAiTclIH44NzkWgB3IgqOAd+BIMgbXaD1IBGqw3Xrw2cbaEPGGKo78TU1OjSx63DfkXUPoogH0H2Ic9zsLp6E7flbhtwUcnpK8+7z0oepO1aDx8VuP0IoHuDCSq6wdZ12iwgb02o2oOg3zGR9e48WJg7HJW5ZGsL5sHlanidfVfdakZ+skDvhaBCSSMMRWQ9jYpZNupQFZth5xab8C7Ym/jQQERC3y2bn7YoELTP6M7zVg7ORi8IW1ptGIxx3SiaozTQgctAVZ5l2FsmAWb48sIKRkNERNnHyYg70B1MeEdQKjWNYTOmvhh2pXTqArtbAnMCGAUiamKvKAfSKdVUOr4gS8VBmyC9RJ/iUavmblP/H39CFpOo9slovM1Byxm4UkH32/rhi/JZL+Ox5J6fqop57EEUZpsvJjH2Tv3ifknAurbxRJrETgimTIrXKy1GS/cg2goZTehchVV5xFoEjE1X92v3kbKu2bxjK3DaYmS1JgRxgQlxV4jcMstJPO85j+HuR X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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GMexkTmREtwrFFWepo2P1/ZBh48B9TWQ436/UuPmmiNPIElwT8euPSCXO7Qn8yiFgRWFWW/ZbghxayBmREhyAZtSR6u+W4WnxdRjJ/Gbx2deuVGXnMAXD94e1ezgb88OnSkfRIvINvkuYlwu3ubvt/Ft0ESs/DJbxGjwAui3Y02DKejxjsukCYoABA754/fJg4fauXnGxiQ2wNAj42tQERDkok5dtZk6/Yqw1A9lm554Xt3nWlUyTg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 104fa0ba-b615-45cd-aeca-08dc4e5e021c 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:25.0895 (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 07/16] avcodec/vvcdec: ff_vvc_decode_neighbour, 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: ystksAddpVgb --- libavcodec/vvc/vvc_ctu.c | 4 ++++ libavcodec/vvc/vvc_ctu.h | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index e48ffda938..05c3e04b83 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -2493,6 +2493,10 @@ void ff_vvc_decode_neighbour(VVCLocalContext *lc, const int x_ctb, const int y_c lc->boundary_flags |= BOUNDARY_UPPER_TILE; if (ry > 0 && fc->tab.slice_idx[rs] != fc->tab.slice_idx[rs - fc->ps.pps->ctb_width]) lc->boundary_flags |= BOUNDARY_UPPER_SLICE; + if (fc->ps.sps->r->sps_subpic_ctu_top_left_x[lc->sc->sh.r->curr_subpic_idx] == rx) + lc->boundary_flags |= BOUNDARY_LEFT_SUBPIC; + if (fc->ps.sps->r->sps_subpic_ctu_top_left_y[lc->sc->sh.r->curr_subpic_idx] == ry) + lc->boundary_flags |= BOUNDARY_UPPER_SUBPIC; lc->ctb_left_flag = rx > 0 && !(lc->boundary_flags & BOUNDARY_LEFT_TILE); lc->ctb_up_flag = ry > 0 && !(lc->boundary_flags & BOUNDARY_UPPER_TILE) && !(lc->boundary_flags & BOUNDARY_UPPER_SLICE); lc->ctb_up_right_flag = lc->ctb_up_flag && (fc->ps.pps->ctb_to_col_bd[rx] == fc->ps.pps->ctb_to_col_bd[rx + 1]) && diff --git a/libavcodec/vvc/vvc_ctu.h b/libavcodec/vvc/vvc_ctu.h index 8020e184c5..460dbdba59 100644 --- a/libavcodec/vvc/vvc_ctu.h +++ b/libavcodec/vvc/vvc_ctu.h @@ -421,8 +421,10 @@ typedef struct VVCLocalContext { #define BOUNDARY_LEFT_SLICE (1 << 0) #define BOUNDARY_LEFT_TILE (1 << 1) -#define BOUNDARY_UPPER_SLICE (1 << 2) -#define BOUNDARY_UPPER_TILE (1 << 3) +#define BOUNDARY_LEFT_SUBPIC (1 << 2) +#define BOUNDARY_UPPER_SLICE (1 << 3) +#define BOUNDARY_UPPER_TILE (1 << 4) +#define BOUNDARY_UPPER_SUBPIC (1 << 5) /* properties of the boundary of the current CTB for the purposes * of the deblocking filter */ int boundary_flags; From patchwork Wed Mar 27 13:01:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47531 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605069pzb; Wed, 27 Mar 2024 06:03:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUhGfKC7VWGJCiZDhNeFNvQTFsfU7u3YY077ZqilOcP36o/9gj7CWQqh05d6+xosqDzmF00SW3wKYu48g+/rgAKICcPyLxIOljvxw== X-Google-Smtp-Source: AGHT+IF0r0iA4Sj1bamzfC3CL7RofOVzQax3Ls4gY9ZwMAT+Hcclc2nMZZcYGWl2v68GtvJhZxCw X-Received: by 2002:a2e:964c:0:b0:2d4:3e96:47ee with SMTP id z12-20020a2e964c000000b002d43e9647eemr2306402ljh.26.1711544602926; Wed, 27 Mar 2024 06:03:22 -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 wq3-20020a170907064300b00a46629b7ff4si4425524ejb.966.2024.03.27.06.03.13; Wed, 27 Mar 2024 06:03:22 -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=fnAS4K+e; 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 9A4BD68D6C5; Wed, 27 Mar 2024 15:01:48 +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-tyzapc01olkn2011.outbound.protection.outlook.com [40.92.107.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 72F9868D6C8 for ; Wed, 27 Mar 2024 15:01:41 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KTkdeJePnVQ5K7CW5WXAV5jtfJGIUxW2C/9FNUSirTdKPu5kBy2K85P3PABld5IRv59XsTJmz2AzuYHa5qaSHJLGYIk3Hl3lEBIzsP5XTDk/4j6fYIZ8T6vLfLscJrdzWH5a+Sj8MM0J51E6T5Hj2hdacFpyKMAzg7wk4/TidxlD084v8aHZnU5fnnJ/K1EfHLnfATSmN/br2ciXJFbQ1lf0/06pBlrnMsfKgs6A6gAQfnJuho5S76DM51eJ0DzzgJ+M3m14pJd2/Fyakl1OExoATlkJLzILI3iXOxEexKMaZfyxuIZrQHBaAcz9iAEIfN8AD05g33Q7ukoX7b8hpA== 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=8C94lxIGpQ0gZB9UNXAb6EsgcEcIo1GlbV/gioLNkSg=; b=k6sTw6rjmrGFb1lJcKMyuMFqKsmtCLwDD10U9MA+BUcIpSydcRMHS0OovTL/5EzllF9WeuXTXvbBW0qjVmxO/VLLlMVbFNKvkdldBjDhlbM0N+otJG4husWfCsuvjh/dq0lYk1QVVoO370ndocBqLEq4L+1L+zghbSJuEtsfOAR70WTTF0urfeAsokD5E3L6dcPftdlmgUmUmWFBmwedQCuHkvlHeszcDkuAi0Z+/iUhg5I6BF3JcXeDdSj5Dfm7hHqEMqmUuWEG3PPoCIppucMtqxrKYCDDEEIaVKjnr5sZrOyNX4GXJXUOgAxtohzUyetiu5AN4Roue2GLPtv65Q== 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=8C94lxIGpQ0gZB9UNXAb6EsgcEcIo1GlbV/gioLNkSg=; b=fnAS4K+e+dXPXAjXe4XDk+VQ6Tn4NZBW0xTwYL6tliyH3dLwMumdyvMfw/gDG9HqCXfalLI6ze11W1X5y3QMRrAv9ahByYkcaOvjcuVstPmP909LXlu2xE4kH9T1PQR2fnHUqkvs8ctfZ4CCLvDVkRiLoXN8muOK/WMjKKAr9Y9R4jFUGq7wm8tna1Q0+LKVQyi47ankELGqooew8F9nG9/GF/3bjU3r9y4WWqI5z/VK1DkILox57GRINoJQHWGwyJfJfKGz6cyN/68hp6JqA2dxYB5YxWupJPaJga+LO4Lv1aOOy8k5HI3k+I3S1F+kwyOK9Nu5wiSofSPRAehyOg== 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:26 +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:26 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:04 +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: [9/IhFoTU0IGlsNFKkAyvcgXfjF9/Ibze] 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-9-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: f433d897-e8aa-4f51-5c78-08dc4e5e02a5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jfiW24Tg3tM7fBxcCaEuqiVeMoWqHsu5Aj6nb8BF2LUfDISE28AAjgZsQbKHx6Kyg3ujr4pVPm2YJJXZjgrsyqIhDqQqAU8z3yDNk/73zPKNojhE8WHJDQ7F0IbsgpLcD/QaA2yHC0PwRAlHHOLryn5UJra27ZxRnJej4OQ2u6DkdD5HkQBnMH4P7FqTZpa3jOOqsg8OHpPariy+EcO4D1SoKHr3G6xc3R7o4eSzSb0iYVYadIY4bysJA9ccK3wjMdkJYDWlZHTqc4Jmo+EIMvuoMvcnWjJ0mR71ebKbWDsfi9PMNGXJPP7SOw0qhI9/tiHBltOEsECK75KIgTTWRPVhG4CkOS+wKC4BlUfsGSMTZu8PgEkwiTL+b/YoFrFMX7xaWkVj30ZcTbtT0TyJN8W7ycZzb6lTQDisY4nO5YpTe+sQcuZEllw9455t5VSqIsFKrhCoiNx+5dgtG1fr0KukZZG3y6mCoMPb3Hd36PMosZ+NP171h0BTGdo4ikABbreolyyUuUwUmQhFpEBmljiBKxjRNZf6g/s0EVeIe3sxXrMdqaCKotraGrp4Wx80mJqA8bT8xG+m9wADlgLam3qf5/CQJ4sUUXKnX4ec/6ns8hj7OrjhL4DYXOXdV2Kb X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rEW8H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i23O9eHzrxGpe+Hkg6bljXUUZah500s3Am5lUPe697ra6kUpdYD0ujPENvEO+TWH5PRHwxGBxxUJHzyfSvHpIa1U04wbj0oRxwaUnZbLqfIQPZamTlIyxneeVbWMioP1RENDzfhCk2vyp3kAPT3scGgOe6M7c46NvbETjApivV5T0iAybCRk2jgbudxAWdCttj6FKrLtvoURR6P75ueZw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f433d897-e8aa-4f51-5c78-08dc4e5e02a5 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:26.0349 (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 08/16] avcodec/vvcdec: misc, rename x_ctb, y_ctb, ctu_x, ctu_y to rx, ry to avoid misleading 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: Z9kYh/mHOSmR --- libavcodec/vvc/vvc_ctu.c | 8 ++-- libavcodec/vvc/vvc_filter.c | 96 ++++++++++++++++++------------------- libavcodec/vvc/vvc_ps.c | 38 +++++++-------- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index 05c3e04b83..8ba12c8d9f 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -87,10 +87,10 @@ static int get_qp_y_pred(const VVCLocalContext *lc) const int min_cb_width = fc->ps.pps->min_cb_width; const int x_cb = cu->x0 >> sps->min_cb_log2_size_y; const int y_cb = cu->y0 >> sps->min_cb_log2_size_y; - const int x_ctb = cu->x0 >> ctb_log2_size; - const int y_ctb = cu->y0 >> ctb_log2_size; - const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == x_ctb && (yQg >> ctb_log2_size) == y_ctb; - const int in_same_ctb_b = (xQg >> ctb_log2_size) == x_ctb && ((yQg - 1) >> ctb_log2_size) == y_ctb; + const int rx = cu->x0 >> ctb_log2_size; + const int ry = cu->y0 >> ctb_log2_size; + const int in_same_ctb_a = ((xQg - 1) >> ctb_log2_size) == rx && (yQg >> ctb_log2_size) == ry; + const int in_same_ctb_b = (xQg >> ctb_log2_size) == rx && ((yQg - 1) >> ctb_log2_size) == ry; int qPy_pred, qPy_a, qPy_b; if (lc->na.cand_up) { diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index dded447bfa..10bd57e078 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -99,7 +99,7 @@ static void copy_vert(uint8_t *dst, const uint8_t *src, const int pixel_shift, c static void copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src, const ptrdiff_t src_stride, const int x, const int y, const int width, const int height, - const int c_idx, const int x_ctb, const int y_ctb, const int top) + const int c_idx, const int rx, const int ry, const int top) { const int ps = fc->ps.sps->pixel_shift; const int w = fc->ps.pps->width >> fc->ps.sps->hshift[c_idx]; @@ -107,16 +107,16 @@ static void copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src, if (top) { /* top */ - memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << ps), + memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry) * w + x) << ps), src, width << ps); } else { /* bottom */ - memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << ps), + memcpy(fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry + 1) * w + x) << ps), src + src_stride * (height - 1), width << ps); /* copy vertical edges */ - copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << ps), src, ps, height, 1 << ps, src_stride); - copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) * h + y) << ps), src + ((width - 1) << ps), ps, height, 1 << ps, src_stride); + copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx) * h + y) << ps), src, ps, height, 1 << ps, src_stride); + copy_vert(fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx + 1) * h + y) << ps), src + ((width - 1) << ps), ps, height, 1 << ps, src_stride); } } @@ -158,9 +158,9 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 }; int c_idx; int edges[4]; // 0 left 1 top 2 right 3 bottom - const int x_ctb = x >> fc->ps.sps->ctb_log2_size_y; - const int y_ctb = y >> fc->ps.sps->ctb_log2_size_y; - const SAOParams *sao = &CTB(fc->tab.sao, x_ctb, y_ctb); + const int rx = x >> fc->ps.sps->ctb_log2_size_y; + const int ry = y >> fc->ps.sps->ctb_log2_size_y; + const SAOParams *sao = &CTB(fc->tab.sao, rx, ry); // flags indicating unfilterable edges uint8_t vert_edge[] = { 0, 0 }; uint8_t horiz_edge[] = { 0, 0 }; @@ -174,39 +174,39 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) uint8_t up_tile_edge = 0; uint8_t bottom_tile_edge = 0; - edges[LEFT] = x_ctb == 0; - edges[TOP] = y_ctb == 0; - edges[RIGHT] = x_ctb == fc->ps.pps->ctb_width - 1; - edges[BOTTOM] = y_ctb == fc->ps.pps->ctb_height - 1; + edges[LEFT] = rx == 0; + edges[TOP] = ry == 0; + edges[RIGHT] = rx == fc->ps.pps->ctb_width - 1; + edges[BOTTOM] = ry == fc->ps.pps->ctb_height - 1; if (restore) { if (!edges[LEFT]) { - left_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[x_ctb] == x_ctb; - vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb)) || left_tile_edge; + left_tile_edge = 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)) || left_tile_edge; } if (!edges[RIGHT]) { - right_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_col_bd[x_ctb] != fc->ps.pps->ctb_to_col_bd[x_ctb + 1]; - vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb)) || right_tile_edge; + right_tile_edge = 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)) || right_tile_edge; } if (!edges[TOP]) { - up_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[y_ctb] == y_ctb; - horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb, y_ctb - 1)) || up_tile_edge; + up_tile_edge = 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)) || up_tile_edge; } if (!edges[BOTTOM]) { - bottom_tile_edge = no_tile_filter && fc->ps.pps->ctb_to_row_bd[y_ctb] != fc->ps.pps->ctb_to_row_bd[y_ctb + 1]; - horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb, y_ctb + 1)) || bottom_tile_edge; + bottom_tile_edge = 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)) || bottom_tile_edge; } if (!edges[LEFT] && !edges[TOP]) { - diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb - 1)) || left_tile_edge || up_tile_edge; + diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || left_tile_edge || up_tile_edge; } if (!edges[TOP] && !edges[RIGHT]) { - diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb - 1)) || right_tile_edge || up_tile_edge; + diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || right_tile_edge || up_tile_edge; } if (!edges[RIGHT] && !edges[BOTTOM]) { - diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb + 1)) || right_tile_edge || bottom_tile_edge; + diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || right_tile_edge || bottom_tile_edge; } if (!edges[LEFT] && !edges[BOTTOM]) { - diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb - 1, y_ctb + 1)) || left_tile_edge || bottom_tile_edge; + diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || left_tile_edge || bottom_tile_edge; } } @@ -245,7 +245,7 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) int pos = 0; dst1 = dst - dst_stride - (left << sh); - src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh); + src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry - 1) * w + x0 - left) << sh); if (left) { copy_pixel(dst1, src1, sh); pos += (1 << sh); @@ -264,7 +264,7 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) int pos = 0; dst1 = dst + height * dst_stride - (left << sh); - src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh); + src1 = fc->tab.sao_pixel_buffer_h[c_idx] + (((2 * ry + 2) * w + x0 - left) << sh); if (left) { copy_pixel(dst1, src1, sh); pos += (1 << sh); @@ -277,12 +277,12 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) } if (!edges[LEFT]) { copy_vert(dst - (1 << sh), - fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh), + fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx - 1) * h + y0) << sh), sh, height, dst_stride, 1 << sh); } if (!edges[RIGHT]) { copy_vert(dst + (width << sh), - fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh), + fc->tab.sao_pixel_buffer_v[c_idx] + (((2 * rx + 2) * h + y0) << sh), sh, height, dst_stride, 1 << sh); } @@ -994,7 +994,7 @@ static void alf_extend_horz(uint8_t *dst, const uint8_t *src, } static void alf_copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src, const ptrdiff_t src_stride, - const int x, const int y, const int width, const int height, const int x_ctb, const int y_ctb, const int c_idx) + const int x, const int y, const int width, const int height, const int rx, const int ry, const int c_idx) { const int ps = fc->ps.sps->pixel_shift; const int w = fc->ps.pps->width >> fc->ps.sps->hshift[c_idx]; @@ -1005,12 +1005,12 @@ static void alf_copy_ctb_to_hv(VVCFrameContext *fc, const uint8_t *src, const pt /* copy horizontal edges */ for (int i = 0; i < FF_ARRAY_ELEMS(offset_h); i++) { - alf_copy_border(fc->tab.alf_pixel_buffer_h[c_idx][i] + ((border_pixels * y_ctb * w + x)<< ps), + alf_copy_border(fc->tab.alf_pixel_buffer_h[c_idx][i] + ((border_pixels * ry * w + x)<< ps), src + offset_h[i] * src_stride, ps, width, border_pixels, w << ps, src_stride); } /* copy vertical edges */ for (int i = 0; i < FF_ARRAY_ELEMS(offset_v); i++) { - alf_copy_border(fc->tab.alf_pixel_buffer_v[c_idx][i] + ((h * x_ctb + y) * (border_pixels << ps)), + alf_copy_border(fc->tab.alf_pixel_buffer_v[c_idx][i] + ((h * rx + y) * (border_pixels << ps)), src + (offset_v[i] << ps), ps, border_pixels, height, border_pixels << ps, src_stride); } } @@ -1050,7 +1050,7 @@ static void alf_fill_border_v(uint8_t *dst, const ptrdiff_t dst_stride, const ui } static void alf_prepare_buffer(VVCFrameContext *fc, uint8_t *_dst, const uint8_t *_src, const int x, const int y, - const int x_ctb, const int y_ctb, const int width, const int height, const ptrdiff_t dst_stride, const ptrdiff_t src_stride, + const int rx, const int ry, const int width, const int height, const ptrdiff_t dst_stride, const ptrdiff_t src_stride, const int c_idx, const int *edges) { const int ps = fc->ps.sps->pixel_shift; @@ -1062,23 +1062,23 @@ static void alf_prepare_buffer(VVCFrameContext *fc, uint8_t *_dst, const uint8_t copy_ctb(_dst, _src, width << ps, height, dst_stride, src_stride); //top - src = fc->tab.alf_pixel_buffer_h[c_idx][1] + (((border_pixels * w) << ps) * (y_ctb - 1) + (x << ps)); + src = fc->tab.alf_pixel_buffer_h[c_idx][1] + (((border_pixels * w) << ps) * (ry - 1) + (x << ps)); dst = _dst - border_pixels * dst_stride; alf_fill_border_h(dst, dst_stride, src, w << ps, _dst, width, border_pixels, ps, edges[TOP]); //bottom - src = fc->tab.alf_pixel_buffer_h[c_idx][0] + (((border_pixels * w) << ps) * (y_ctb + 1) + (x << ps)); + src = fc->tab.alf_pixel_buffer_h[c_idx][0] + (((border_pixels * w) << ps) * (ry + 1) + (x << ps)); dst = _dst + height * dst_stride; alf_fill_border_h(dst, dst_stride, src, w << ps, _dst + (height - 1) * dst_stride, width, border_pixels, ps, edges[BOTTOM]); //left - src = fc->tab.alf_pixel_buffer_v[c_idx][1] + (h * (x_ctb - 1) + y - border_pixels) * (border_pixels << ps); + src = fc->tab.alf_pixel_buffer_v[c_idx][1] + (h * (rx - 1) + y - border_pixels) * (border_pixels << ps); dst = _dst - (border_pixels << ps) - border_pixels * dst_stride; alf_fill_border_v(dst, dst_stride, src, dst + (border_pixels << ps), border_pixels, height, ps, edges, edges[LEFT]); //right - src = fc->tab.alf_pixel_buffer_v[c_idx][0] + (h * (x_ctb + 1) + y - border_pixels) * (border_pixels << ps); + src = fc->tab.alf_pixel_buffer_v[c_idx][0] + (h * (rx + 1) + y - border_pixels) * (border_pixels << ps); dst = _dst + (width << ps) - border_pixels * dst_stride; alf_fill_border_v(dst, dst_stride, src, dst - (1 << ps), border_pixels, height, ps, edges, edges[RIGHT]); } @@ -1177,8 +1177,8 @@ static void alf_filter_cc(VVCLocalContext *lc, uint8_t *dst, const uint8_t *luma void ff_vvc_alf_copy_ctu_to_hv(VVCLocalContext* lc, const int x0, const int y0) { VVCFrameContext *fc = lc->fc; - const int x_ctb = x0 >> fc->ps.sps->ctb_log2_size_y; - const int y_ctb = y0 >> fc->ps.sps->ctb_log2_size_y; + const int rx = x0 >> fc->ps.sps->ctb_log2_size_y; + const int ry = y0 >> fc->ps.sps->ctb_log2_size_y; const int ctb_size_y = fc->ps.sps->ctb_size_y; const int ps = fc->ps.sps->pixel_shift; const int c_end = fc->ps.sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : 1; @@ -1194,7 +1194,7 @@ void ff_vvc_alf_copy_ctu_to_hv(VVCLocalContext* lc, const int x0, const int y0) const int src_stride = fc->frame->linesize[c_idx]; uint8_t* src = &fc->frame->data[c_idx][y * src_stride + (x << ps)]; - alf_copy_ctb_to_hv(fc, src, src_stride, x, y, width, height, x_ctb, y_ctb, c_idx); + alf_copy_ctb_to_hv(fc, src, src_stride, x, y, width, height, rx, ry, c_idx); } } @@ -1202,28 +1202,28 @@ void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0) { VVCFrameContext *fc = lc->fc; const VVCPPS *pps = fc->ps.pps; - const int x_ctb = x0 >> fc->ps.sps->ctb_log2_size_y; - const int y_ctb = y0 >> fc->ps.sps->ctb_log2_size_y; + const int rx = x0 >> fc->ps.sps->ctb_log2_size_y; + const int ry = y0 >> fc->ps.sps->ctb_log2_size_y; const int ctb_size_y = fc->ps.sps->ctb_size_y; const int ps = fc->ps.sps->pixel_shift; const int padded_stride = EDGE_EMU_BUFFER_STRIDE << ps; const int padded_offset = padded_stride * ALF_PADDING_SIZE + (ALF_PADDING_SIZE << ps); const int c_end = fc->ps.sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : 1; - ALFParams *alf = &CTB(fc->tab.alf, x_ctb, y_ctb); - int edges[MAX_EDGES] = { x_ctb == 0, y_ctb == 0, x_ctb == pps->ctb_width - 1, y_ctb == pps->ctb_height - 1 }; + ALFParams *alf = &CTB(fc->tab.alf, rx, ry); + int edges[MAX_EDGES] = { rx == 0, ry == 0, rx == pps->ctb_width - 1, ry == pps->ctb_height - 1 }; if (!pps->r->pps_loop_filter_across_tiles_enabled_flag) { edges[LEFT] = edges[LEFT] || (lc->boundary_flags & BOUNDARY_LEFT_TILE); edges[TOP] = edges[TOP] || (lc->boundary_flags & BOUNDARY_UPPER_TILE); - edges[RIGHT] = edges[RIGHT] || pps->ctb_to_col_bd[x_ctb] != pps->ctb_to_col_bd[x_ctb + 1]; - edges[BOTTOM] = edges[BOTTOM] || pps->ctb_to_row_bd[y_ctb] != pps->ctb_to_row_bd[y_ctb + 1]; + edges[RIGHT] = edges[RIGHT] || pps->ctb_to_col_bd[rx] != pps->ctb_to_col_bd[rx + 1]; + edges[BOTTOM] = edges[BOTTOM] || pps->ctb_to_row_bd[ry] != pps->ctb_to_row_bd[ry + 1]; } if (!pps->r->pps_loop_filter_across_slices_enabled_flag) { edges[LEFT] = edges[LEFT] || (lc->boundary_flags & BOUNDARY_LEFT_SLICE); edges[TOP] = edges[TOP] || (lc->boundary_flags & BOUNDARY_UPPER_SLICE); - edges[RIGHT] = edges[RIGHT] || CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb + 1, y_ctb); - edges[BOTTOM] = edges[BOTTOM] || CTB(fc->tab.slice_idx, x_ctb, y_ctb) != CTB(fc->tab.slice_idx, x_ctb, y_ctb + 1); + edges[RIGHT] = edges[RIGHT] || CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry); + edges[BOTTOM] = edges[BOTTOM] || CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1); } for (int c_idx = 0; c_idx < c_end; c_idx++) { @@ -1243,7 +1243,7 @@ void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0) if (alf->ctb_flag[c_idx] || (!c_idx && (alf->ctb_cc_idc[0] || alf->ctb_cc_idc[1]))) { padded = (c_idx ? lc->alf_buffer_chroma : lc->alf_buffer_luma) + padded_offset; - alf_prepare_buffer(fc, padded, src, x, y, x_ctb, y_ctb, width, height, + alf_prepare_buffer(fc, padded, src, x, y, rx, ry, width, height, padded_stride, src_stride, c_idx, edges); } if (alf->ctb_flag[c_idx]) { diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c index 556135fee2..d6fa04c169 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -322,24 +322,24 @@ static void tile_xy(int *tile_x, int *tile_y, const int tile_idx, const VVCPPS * *tile_y = tile_idx / pps->r->num_tile_columns; } -static void ctu_xy(int *ctu_x, int *ctu_y, const int tile_x, const int tile_y, const VVCPPS *pps) +static void ctu_xy(int *rx, int *ry, const int tile_x, const int tile_y, const VVCPPS *pps) { - *ctu_x = pps->col_bd[tile_x]; - *ctu_y = pps->row_bd[tile_y]; + *rx = pps->col_bd[tile_x]; + *ry = pps->row_bd[tile_y]; } -static int ctu_rs(const int ctu_x, const int ctu_y, const VVCPPS *pps) +static int ctu_rs(const int rx, const int ry, const VVCPPS *pps) { - return pps->ctb_width * ctu_y + ctu_x; + return pps->ctb_width * ry + rx; } -static int pps_add_ctus(VVCPPS *pps, int *off, const int ctu_x, const int ctu_y, +static int pps_add_ctus(VVCPPS *pps, int *off, const int rx, const int ry, const int w, const int h) { int start = *off; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { - pps->ctb_addr_in_slice[*off] = ctu_rs(ctu_x + x, ctu_y + y, pps); + pps->ctb_addr_in_slice[*off] = ctu_rs(rx + x, ry + y, pps); (*off)++; } } @@ -426,16 +426,16 @@ static void pps_single_slice_per_subpic(VVCPPS *pps, const VVCSPS *sps, int *off static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int *off) { const H266RawPPS *r = pps->r; - int ctu_x, ctu_y, ctu_y_end, tile_x, tile_y; + int rx, ry, ctu_y_end, tile_x, tile_y; tile_xy(&tile_x, &tile_y, tile_idx, pps); - ctu_xy(&ctu_x, &ctu_y, tile_x, tile_y, pps); - ctu_y_end = ctu_y + r->row_height_val[tile_y]; - while (ctu_y < ctu_y_end) { + ctu_xy(&rx, &ry, tile_x, tile_y, pps); + ctu_y_end = ry + r->row_height_val[tile_y]; + while (ry < ctu_y_end) { pps->slice_start_offset[i] = *off; - pps->num_ctus_in_slice[i] = pps_add_ctus(pps, off, ctu_x, ctu_y, + pps->num_ctus_in_slice[i] = pps_add_ctus(pps, off, rx, ry, r->col_width_val[tile_x], r->slice_height_in_ctus[i]); - ctu_y += r->slice_height_in_ctus[i++]; + ry += r->slice_height_in_ctus[i++]; } i--; return i; @@ -444,15 +444,15 @@ static int pps_one_tile_slices(VVCPPS *pps, const int tile_idx, int i, int *off) static void pps_multi_tiles_slice(VVCPPS *pps, const int tile_idx, const int i, int *off) { const H266RawPPS *r = pps->r; - int ctu_x, ctu_y,tile_x, tile_y; + int rx, ry, tile_x, tile_y; tile_xy(&tile_x, &tile_y, tile_idx, pps); pps->slice_start_offset[i] = *off; pps->num_ctus_in_slice[i] = 0; for (int ty = tile_y; ty <= tile_y + r->pps_slice_height_in_tiles_minus1[i]; ty++) { for (int tx = tile_x; tx <= tile_x + r->pps_slice_width_in_tiles_minus1[i]; tx++) { - ctu_xy(&ctu_x, &ctu_y, tx, ty, pps); - pps->num_ctus_in_slice[i] += pps_add_ctus(pps, off, ctu_x, ctu_y, + ctu_xy(&rx, &ry, tx, ty, pps); + pps->num_ctus_in_slice[i] += pps_add_ctus(pps, off, rx, ry, r->col_width_val[tx], r->row_height_val[ty]); } } @@ -482,12 +482,12 @@ static void pps_rect_slice(VVCPPS *pps, const VVCSPS *sps) static void pps_no_rect_slice(VVCPPS* pps) { const H266RawPPS* r = pps->r; - int ctu_x, ctu_y, off = 0; + int rx, ry, off = 0; for (int tile_y = 0; tile_y < r->num_tile_rows; tile_y++) { for (int tile_x = 0; tile_x < r->num_tile_columns; tile_x++) { - ctu_xy(&ctu_x, &ctu_y, tile_x, tile_y, pps); - pps_add_ctus(pps, &off, ctu_x, ctu_y, r->col_width_val[tile_x], r->row_height_val[tile_y]); + ctu_xy(&rx, &ry, tile_x, tile_y, pps); + pps_add_ctus(pps, &off, rx, ry, r->col_width_val[tile_x], r->row_height_val[tile_y]); } } } From patchwork Wed Mar 27 13:01:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47532 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605128pzb; Wed, 27 Mar 2024 06:03:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXe0WZjc07Ys7XUFXalkslwsPwdFMVSxkfoyF3pZUY5uum2KiO3SFuCX/Xag5TP9gydcSgLtyrRbc8HOsAv6X+Gx2qXaXPvC7swXg== X-Google-Smtp-Source: AGHT+IEved2PYYQt7OVCo6JF+qYqmHsxxIMTfhGqSHZ4cXwkUvlTI0l+a4IEYfyTjD1h35ELknpy X-Received: by 2002:a17:907:7212:b0:a45:cdd7:c481 with SMTP id dr18-20020a170907721200b00a45cdd7c481mr9948429ejc.1.1711544605379; Wed, 27 Mar 2024 06:03:25 -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 dc19-20020a170906c7d300b00a45b8e1352dsi4735128ejb.741.2024.03.27.06.03.24; Wed, 27 Mar 2024 06:03:25 -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=FhiXouvH; 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 C2D6668D6CC; Wed, 27 Mar 2024 15:01:50 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2014.outbound.protection.outlook.com [40.92.53.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18F3868D6CF 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=CJlpO3WElV7GTv47fAKHpVUKujtI/NeMzReDghENX2+FQLvquLqwehHoHnd9q7gScMBPkd+rO7sxePxZIJwxSCfTOyDcIud2hqUhUmvYvcwJrW356gGfXs3uMFTM+EWQVF2ECYIEeTjjAsbsFabmEbg8BpuDW0T+lVL0cutW9Jy93Cg+HXHqNr7eWB5qkYRh4uGhPe/17Y8iCyCN28EM0eGtIFiq1j6J9gJSaA3Q08X4FwI8F4wAItb3fFezCIO5F6E1/msAAikWhjpYk2GYaGpz9b29NlGkVVmvt+Ldln2aPBns5ISi56WLOkDJn8cVwAsfDyL+wkVVC/E4dKon+Q== 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=/2JtCP0x9zUOKSmAixxljMReLCurMfDvm5V0WW9MHNA=; b=fBvG8h1WrLawpK4CTtDefQMtbkcqIhFhxlI49IM98oyG43B7gQ19DU8WXpNuNOKLyqwqpdIL1LKdcqFMT9fonC7XmTOxB2deFe5Ytqyu1a8qNyGUI5b9B8kJwV7zx4XC5rkSCW/qfUJ2pSiz4a68QxGwQW13I8iRm4oLFOK3pNihdwZIKvZwt795tmB0Wpa2t3eBlDJaiRa32nAd4GIK4Vc74deM7meJ3K8XGd2I03gWQf87HDs01gwejgLlcDtNneMXYcWqQrRo4x9eyVmPlODyN43FmqlYVUCiCXea0MEADLfHRBTaeNOh6x8Pmo+eAms68ioRNWIIP69d4adyYA== 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=/2JtCP0x9zUOKSmAixxljMReLCurMfDvm5V0WW9MHNA=; b=FhiXouvHdhHIMA9DbqyfdZbxH2HLVdseqcnj25wz5glqXbNcUZfhkFH9PSfjENH5Mi9/yRWeHzvZ5wRx3NodlTSaW9kV0jHYi6oY4KJmkP3SQqLL1JnZRFevNmmXFaoVodVll4iNjoF+1hdb6whXKk2IpZyhL5zrZYrCrmky+nJt4i1IUTazooYSRtslSmBuw/ACSmHOMJ3llWH5w4f0MPBVqxiRmH7AVQMKWeMpuEMiXdXydCoR5WXuyhIoxRKpXBzHQniU00GcuzbHeT6ptYB7tVEE+yi4jFnsazuDjKNMdLiY6BoRT5sn7XIxPFAfuUvlu0GxhufH8jdqUNnM1g== 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:05 +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: [F/l5Aou7Q9dLiG1/8sBndu505VSol6x4] 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-10-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: f63c52d3-c5cd-4109-a9a8-08dc4e5e0335 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 38tESl8uNDiiyuaZJu/fhq9wEy8CR6/iGXh6hapzjSz4ygatL1G+cLRGkBv2dMkVCaKsN0tvQ8MMzF1vv3fdg0OO5iVCXllzf3zcLebXVJeLdZeUZtI7ljESFiQgMzagyt/MIoChWp5J8KwPEJCljU+sUCA+zc1jYQnFLmsw5aju/ybZzfj673Rob4gInuY9Lfiq2IN8FZT3NGGbCn/eA8Z0DvGpAoCkl87DrbLGxzIzTqxBKc1fuISAxRos3rT/bm7zzCTwZgOMvT7djcsxtMa5D1UQzLLXRIuGLZpGCNVBFxjYd23mcnVcSzNKd1jej13ia8NHY0PNjB512UpMqnd2oB28f5QSfTL5svgysLr8W3ASRzDLVZx/ht8y2fZHSATcG0PQmsKdIA2fbt/pXVYxtXqM8MASy0hLQSraqP5i2+eQsxoAN2eABBjw7qJ5BXR/NTXAJxNH0HTZN0tF9IaZzjRVel73XSRlzqnB9YJD1FvCFY6NZmXErRG/Xb4qCMUrB0oGxSRFlN4tq3NyNfjR+RyBP2JEpH9XT4LMzYZaWIsFSoxy860n5gV5Aj55Lo+77fS91YRA1EhxIzIEaVTVcNV1hmuPb+Qz2S7DT0RMdPbRCXOl7991c1HbScI0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tM7n5RKoJG8pvzQmXT5Fd7HeKM2UjRH6uRpYyz9Zddpp2Wh5dmeH/1ReVlcWhgYIl37HZfGMSS3A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W8kjVz7qiMWnQ3PL3v/El1rd7kcoeblsu2wkBTyWbfR+VaFLnUKgeDu3x7uvZr9I/WU602E6t4x985mz8lDAK/11C0Yg1OpfwjfECmo4ay1a2DsHy7xLqVzfhcfjzMbmOQZPuEi/kxWZt08dOzdBpaH3kjg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f63c52d3-c5cd-4109-a9a8-08dc4e5e0335 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:26.9374 (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 09/16] avcodec/vvcdec: refact out deblock_is_boundary 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: /qwV+XNJjRmb --- libavcodec/vvc/vvc_filter.c | 66 +++++++++++++++---------------------- 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index 10bd57e078..11972bde41 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -528,6 +528,26 @@ static av_always_inline int deblock_bs(const VVCLocalContext *lc, return boundary_strength(lc, mvf_q, mvf_p, rpl_p); } +static int deblock_is_boundary(const VVCLocalContext *lc, const int boundary, + const int pos, const int vertical) +{ + const VVCFrameContext *fc = lc->fc; + const H266RawPPS *rpps = fc->ps.pps->r; + int flag; + if (boundary && (pos % fc->ps.sps->ctb_size_y) == 0) { + flag = vertical ? BOUNDARY_LEFT_SLICE : BOUNDARY_UPPER_SLICE; + if (lc->boundary_flags & flag && + !rpps->pps_loop_filter_across_slices_enabled_flag) + return 0; + + flag = vertical ? BOUNDARY_LEFT_TILE : BOUNDARY_UPPER_TILE; + if (lc->boundary_flags & flag && + !rpps->pps_loop_filter_across_tiles_enabled_flag) + 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) { @@ -554,15 +574,7 @@ static void vvc_deblock_bs_luma_vertical(const VVCLocalContext *lc, } // bs for vertical TU boundaries - boundary_left = x0 > 0 && !(x0 & 3); - if (boundary_left && - ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag && - lc->boundary_flags & BOUNDARY_LEFT_SLICE && - (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) || - (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag && - lc->boundary_flags & BOUNDARY_LEFT_TILE && - (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0))) - boundary_left = 0; + boundary_left = deblock_is_boundary(lc, x0 > 0 && !(x0 & 3), x0, 1); if (boundary_left) { const RefPicList *rpl_left = @@ -610,15 +622,7 @@ static void vvc_deblock_bs_luma_horizontal(const VVCLocalContext *lc, has_horizontal_sb = cb_height > 8; } - boundary_upper = y0 > 0 && !(y0 & 3); - if (boundary_upper && - ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag && - lc->boundary_flags & BOUNDARY_UPPER_SLICE && - (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) || - (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag && - lc->boundary_flags & BOUNDARY_UPPER_TILE && - (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0))) - boundary_upper = 0; + boundary_upper = deblock_is_boundary(lc, y0 > 0 && !(y0 & 3), y0, 0); if (boundary_upper) { const RefPicList *rpl_top = @@ -646,18 +650,9 @@ static void vvc_deblock_bs_chroma_vertical(const VVCLocalContext *lc, const int x0, const int y0, const int width, const int height) { const VVCFrameContext *fc = lc->fc; - int boundary_left; - // bs for vertical TU boundaries - boundary_left = x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[1]) - 1)); - if (boundary_left && - ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag && - lc->boundary_flags & BOUNDARY_LEFT_SLICE && - (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) || - (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag && - lc->boundary_flags & BOUNDARY_LEFT_TILE && - (x0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0))) - boundary_left = 0; + const int boundary_left = deblock_is_boundary(lc, + x0 > 0 && !(x0 & ((CHROMA_GRID << fc->ps.sps->hshift[CHROMA]) - 1)), x0, 1); if (boundary_left) { for (int i = 0; i < height; i += 2) { @@ -674,17 +669,8 @@ static void vvc_deblock_bs_chroma_horizontal(const VVCLocalContext *lc, const int x0, const int y0, const int width, const int height) { const VVCFrameContext *fc = lc->fc; - int boundary_upper; - - boundary_upper = y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[1]) - 1)); - if (boundary_upper && - ((!fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag && - lc->boundary_flags & BOUNDARY_UPPER_SLICE && - (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0) || - (!fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag && - lc->boundary_flags & BOUNDARY_UPPER_TILE && - (y0 % (1 << fc->ps.sps->ctb_log2_size_y)) == 0))) - boundary_upper = 0; + const int boundary_upper = deblock_is_boundary(lc, + y0 > 0 && !(y0 & ((CHROMA_GRID << fc->ps.sps->vshift[CHROMA]) - 1)), y0, 0); if (boundary_upper) { for (int i = 0; i < width; i += 2) { From patchwork Wed Mar 27 13:01:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47533 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605315pzb; Wed, 27 Mar 2024 06:03:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV2b9mTNWD9tp2vqu/eBMKfVxft3YPxP7F8VDldvqZJk5TfqN692jsg/ceAvg8GEE/ayTkLyGCJXI+FOJfquFaCspE3StYRk+Q3rg== X-Google-Smtp-Source: AGHT+IGZeulOJv3vFWq8wqXfrbgDyriDJ5IqgX8XXFrY+QlkDzmAjulAyz8CG7TU4v0gC8JaqCm9 X-Received: by 2002:a50:9f42:0:b0:56c:1f33:84d6 with SMTP id b60-20020a509f42000000b0056c1f3384d6mr4968455edf.3.1711544617125; Wed, 27 Mar 2024 06:03:37 -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 g22-20020a056402321600b0056c49d393a6si46060eda.367.2024.03.27.06.03.35; Wed, 27 Mar 2024 06:03:37 -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="ppEbl/aM"; 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 CA9C368D65A; Wed, 27 Mar 2024 15:01:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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/tTql5kTZfTMocC3mhI1HdO8axASeVnCmHMDcSIgVDIB4Rtnzg4p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xsGRJ5ImiY77jnkHFG2st9PYEZEMmdBtZGfaiutph1BPIg7R2cJ8Z5Q7JnIjzK7oQwqjYAmC5jH/Nh8QgloxtDIvTpSVYIpuLTyFip2Qpk8AKBh+NFyEjvxpwB/ocSMKYaajq2R9kSLwQAzTKlvyF6KUb28bl4bJcm+nNSTFCyr2NexE+Q6MUPoOsRvsxxR5xr2oB79vaQn97blnGYvJqGakW4Qzf8tW9wUWPxG0OrCHOBKAzr/a0D15oPLSx3cYVVEQFRCjymqJW0w== 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: w8qyIni7DM2e --- 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); From patchwork Wed Mar 27 13:01:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47539 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp606151pzb; Wed, 27 Mar 2024 06:04:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVRzf4nwjRFHGcw9JEEpcA3X6BogTsfuBSLZ+rx/wS49wRwKPW+XqMysWUn+762V1riNXz+WmXW7ZDOpkxw5Eduszti49vey6iODg== X-Google-Smtp-Source: AGHT+IEvVvLexiln7eV4AV2PpEIiEmLJ9+0T+TuUmeCpUACE4HIwFhpxNMvyDh67M2f5jROxi554 X-Received: by 2002:a05:651c:20c:b0:2d4:77c8:39dc with SMTP id y12-20020a05651c020c00b002d477c839dcmr2750104ljn.37.1711544670158; Wed, 27 Mar 2024 06:04:30 -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 v15-20020a2e924f000000b002d11dfdbb09si3501571ljg.298.2024.03.27.06.04.29; Wed, 27 Mar 2024 06:04:30 -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=lxNxodrp; 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 14F4168D6FB; Wed, 27 Mar 2024 15:01:58 +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-tyzapc01olkn2011.outbound.protection.outlook.com [40.92.107.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 73F8A68D6E0 for ; Wed, 27 Mar 2024 15:01:47 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XF3jIx1X/1X5lWnJ8SXbhZmCaa2r9+2FTkQCVIjN+bvgazrqK6P8oxjLG7t2VM4PZ2zM2rYe6en5tU23rGudT8IGjQC+1q3kvPoxIkfdj5fSYRT9upK41ogf/fg4tXa3jO5olisj3pl30fcuNVUqsCag0KVaGY8pSkyq+iCi+rKWNMFDJ2ADEJfATBeMNVheuEYe4Nqbp4t6Zoi1VSd5OJHZcnnfm8W8/e1VktaAUHzViw876z76eSpPiHLx6gbtjbPAyyZ389gKcP/oFz7xGCenRKBvBjOgYS/KaJu3E3LylfYQejWDK5Ts9DYywr7xd0HeLndbwn7iAohAlkd89Q== 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=9FlncXTUF6cSgtrQbX0+fsFsv6N1asYEpyBexJrPDFM=; b=ZMYrALr2uNjxU8rpvr5iw1pLpr7vPvlw+iRf21hVnwFK/lVcmZ3iDxrDj80OOq4jioOJcMRU4Eh1BOAkmhuFGlbmBkyBEOF0EQ8bgUfeTYCbVNRuHP4SdTTbdYM4vI7zbinLji1pPJSIu1jIAh4SSiN1k6he2M954OiMR4diDGsY52ZdPhZ6/6H5wryA5SCVRHuBxBm4rJIWbTyzoLKS60cIDCwh8KKqh2eWsc8PQq/OD0o/GEa4Pc8XYcD+fDRk+B1AshfEKR8OWn9o84G4xsx8XLEZVhHZIOzlc2YBLmKCGBYmJgRoiXNPxczVoCEpWM9qqiPvoDUV39y/WJAHDQ== 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=9FlncXTUF6cSgtrQbX0+fsFsv6N1asYEpyBexJrPDFM=; b=lxNxodrpM9R840Ad1n7iIIEuRBh0kLGPPzw4VAkFYrq2FIUAGwX5buk+zwj6UHNIkigc5lw3gFSGjdxEdjTicS/pcwBbSdzpuF8iw3JBMj4ArjSJwZcBGYKXjrwyiR3vmmqOf2cVbK0/ZD3WMkxr5fodnJeNEfZviw5PgmZdHa2fMOCGMGx4VQMvQw6rg3Ug/HuDxsz+dsNbYj5Uh9vhhzIbzvuQmMFdFeB9EBkraUW0PgotCbJndvEynfa3PvEkaA4UU24QCchT9hxVPns+HrCAtQo/w94OvcwkTTv1YcZoCMdv5SeleTz/RCZcBbvbzjXSsEKRcqYRPpg+AuTSZA== 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:28 +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:28 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:07 +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: [GYZvbkg94gYVZ36LemfL/QynACj1q7BA] 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-12-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: 92c3e460-cb9e-4e3f-0aa5-08dc4e5e0449 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1HpEudTcaQHiOyuKiEcgyU6NNAUdebt5UHOrWrJXfLGXEjJ5kpxohsKGeG70C5LFGPgzwBNMJ81j4xjerPPVcFCB9Oy6zI1cgSdxsR4/5dDXLGUFll28RfOVHR2WMISwlJ43uBfFVuVur9eNaDEwu76VaPVakD/5VSoWGQ9taf+L0+1Et+ujxe7sviu5oRIKY5tVl/ftakS1mOx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TOLKbML5eybjn2xMvGm1wanTYdQTr5AMRRn6H8Py8bfBHZN0qSwYH0o9dYxmfjaKcbZm9TmbbXqf7JiDNTMeb/hh1I62j8D+Xxe6r1pI737wBjsY3vGcduHyq9QYKD0hPIZcg/JMvKqxwA2KYseuk89J5yd6sRyGWOmUx7k9Moa3Fp4bzh6PKc5mKxrFHRYQQ9qFSGHul+UW+gp1QSiiTCTD5TUiv55so4PtbXWCtpCZCKrX8L/VEocEehVhH4HH2z+MgipLk1qLJRYouJ0G4m4w8dF2zWWNUCwzNH1qbZ2i4ip5LPtAfg3L6BR37rRa98Rt4+8/g5jWIsiul+xLGjAxZEFu4PMEwCmJsPHjRjYh3ef5q4MtgtMGYreqb1CDe1Yby72lBpWY3veLO2izlzRPxbFnFU/bfJdFksNTnuR4Kej88bzpJ6SeQoHVMwoc6IRVAe4abkQCNeabV93sJW0RuTSQfWCExR3yWwwc0/WDYCjVy8owglbEV80jMt7XEiWOxYtHNAs9Yu12YVkmr0mjDWgJpuADbaf3NzgCRNhnhmn5tjbR4MUemL9FXW9ZQ20/mCgFPP+gvgkCFxDu9yM4OVPNXbl88Hk8lHq24KXbl0KsV8Z5VTV83l2iGoMoL4VdKAN5EE+65GDhxwBLcw/zNqbOHdY2jTlVY6ndnyZH3vjFsrLaTPMCo9f2iAscj1yGo/TyksA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92c3e460-cb9e-4e3f-0aa5-08dc4e5e0449 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:28.7525 (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 11/16] avcodec/vvcdec: refact, movie the lc->sc assignment to task_run_stage to simplify the code 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: GmNTTF5YxGyb This change also make the lc->sc assigned for run_sao --- libavcodec/vvc/vvc_thread.c | 66 ++++++++++--------------------------- 1 file changed, 17 insertions(+), 49 deletions(-) diff --git a/libavcodec/vvc/vvc_thread.c b/libavcodec/vvc/vvc_thread.c index 5d2e8c67b9..8f23b8138b 100644 --- a/libavcodec/vvc/vvc_thread.c +++ b/libavcodec/vvc/vvc_thread.c @@ -416,7 +416,6 @@ static int run_parse(VVCContext *s, VVCLocalContext *lc, VVCTask *t) const int rs = t->rs; const CTU *ctu = fc->tab.ctus + rs; - lc->sc = t->sc; lc->ep = t->ep; ret = ff_vvc_coding_tree_unit(lc, t->ctu_idx, rs, t->rx, t->ry); @@ -432,15 +431,9 @@ static int run_parse(VVCContext *s, VVCLocalContext *lc, VVCTask *t) static int run_inter(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { VVCFrameContext *fc = lc->fc; - VVCFrameThread *ft = fc->ft; - const int rs = t->ry * ft->ctu_width + t->rx; - const CTU *ctu = fc->tab.ctus + rs; - const int slice_idx = fc->tab.slice_idx[rs]; + const CTU *ctu = fc->tab.ctus + t->rs; - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_predict_inter(lc, rs); - } + ff_vvc_predict_inter(lc, t->rs); if (ctu->has_dmvr) report_frame_progress(fc, t->ry, VVC_PROGRESS_MV); @@ -450,14 +443,7 @@ static int run_inter(VVCContext *s, VVCLocalContext *lc, VVCTask *t) static int run_recon(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { - VVCFrameContext *fc = lc->fc; - const int rs = t->rs; - const int slice_idx = fc->tab.slice_idx[rs]; - - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_reconstruct(lc, rs, t->rx, t->ry); - } + ff_vvc_reconstruct(lc, t->rs, t->rx, t->ry); return 0; } @@ -469,13 +455,8 @@ static int run_lmcs(VVCContext *s, VVCLocalContext *lc, VVCTask *t) const int ctu_size = ft->ctu_size; const int x0 = t->rx * ctu_size; const int y0 = t->ry * ctu_size; - const int rs = t->ry * ft->ctu_width + t->rx; - const int slice_idx = fc->tab.slice_idx[rs]; - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_lmcs_filter(lc, x0, y0); - } + ff_vvc_lmcs_filter(lc, x0, y0); return 0; } @@ -484,18 +465,13 @@ static int run_deblock_v(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { VVCFrameContext *fc = lc->fc; VVCFrameThread *ft = fc->ft; - const int rs = t->ry * ft->ctu_width + t->rx; const int ctb_size = ft->ctu_size; const int x0 = t->rx * ctb_size; const int y0 = t->ry * ctb_size; - const int slice_idx = fc->tab.slice_idx[rs]; - if (slice_idx != -1) { - 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, rs); - } + if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) { + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); + ff_vvc_deblock_vertical(lc, x0, y0, t->rs); } return 0; @@ -506,20 +482,15 @@ static int run_deblock_h(VVCContext *s, VVCLocalContext *lc, VVCTask *t) VVCFrameContext *fc = lc->fc; VVCFrameThread *ft = fc->ft; const int ctb_size = ft->ctu_size; - const int rs = t->ry * ft->ctu_width + t->rx; const int x0 = t->rx * ctb_size; const int y0 = t->ry * ctb_size; - const int slice_idx = fc->tab.slice_idx[rs]; - if (slice_idx != -1) { - 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, 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); + if (!lc->sc->sh.r->sh_deblocking_filter_disabled_flag) { + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); + ff_vvc_deblock_horizontal(lc, x0, y0, t->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); return 0; } @@ -528,13 +499,12 @@ static int run_sao(VVCContext *s, VVCLocalContext *lc, VVCTask *t) { VVCFrameContext *fc = lc->fc; VVCFrameThread *ft = fc->ft; - const int rs = t->ry * fc->ps.pps->ctb_width + t->rx; const int ctb_size = ft->ctu_size; const int x0 = t->rx * ctb_size; const int y0 = t->ry * ctb_size; if (fc->ps.sps->r->sps_sao_enabled_flag) { - ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, rs); + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); ff_vvc_sao_filter(lc, x0, y0); } @@ -553,12 +523,8 @@ static int run_alf(VVCContext *s, VVCLocalContext *lc, VVCTask *t) const int y0 = t->ry * ctu_size; if (fc->ps.sps->r->sps_alf_enabled_flag) { - const int slice_idx = CTB(fc->tab.slice_idx, t->rx, t->ry); - if (slice_idx != -1) { - lc->sc = fc->slices[slice_idx]; - ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); - ff_vvc_alf_filter(lc, x0, y0); - } + ff_vvc_decode_neighbour(lc, x0, y0, t->rx, t->ry, t->rs); + ff_vvc_alf_filter(lc, x0, y0); } report_frame_progress(fc, t->ry, VVC_PROGRESS_PIXEL); @@ -602,6 +568,8 @@ static void task_run_stage(VVCTask *t, VVCContext *s, VVCLocalContext *lc) av_log(s->avctx, AV_LOG_DEBUG, "frame %5d, %s(%3d, %3d)\r\n", (int)t->fc->decode_order, task_name[stage], t->rx, t->ry); #endif + lc->sc = t->sc; + if (!atomic_load(&ft->ret)) { if ((ret = run[stage](s, lc, t)) < 0) { #ifdef COMPAT_ATOMICS_WIN32_STDATOMIC_H From patchwork Wed Mar 27 13:01:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47540 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp606305pzb; Wed, 27 Mar 2024 06:04:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUtScw99Ime0YGSkGXbUThhnN50SQrutvh8jUAl4VJN4NEmwF4MBnlfrMCbxqm5q9YRGWGjsybrGvkxTSmljO4SDG2b7cRCBJm7Iw== X-Google-Smtp-Source: AGHT+IHmX+3mLGThdXy32xZfogt+5BmePfgO2+DFR4BL91+G1WT6xKBha3FbjDDXBaFLB/yDV4ba X-Received: by 2002:a50:d583:0:b0:56b:ec47:a846 with SMTP id v3-20020a50d583000000b0056bec47a846mr2924696edi.25.1711544679524; Wed, 27 Mar 2024 06:04:39 -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 j18-20020a05640211d200b0056c2cd8adfcsi1542947edw.276.2024.03.27.06.04.38; Wed, 27 Mar 2024 06:04:39 -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=eUr4kAlS; 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 2CE2368D707; Wed, 27 Mar 2024 15:01:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2014.outbound.protection.outlook.com [40.92.53.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9CE9168D6E5 for ; Wed, 27 Mar 2024 15:01:49 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVIhobYitX9DCr6wRWjFNP5B/6pqFKle6yzDJvT2GlS364W+K3eG+nwvKJ+w0n/LZ1YT4sUclupQV2I4Kn+XM8ShgEZ4yLo/AlpMK4ztJTRZ9zE2uQkxQorHVUoZ0nLcYPH7cwCDs/7Hxq/jr5QO60ysyC8uZv/crxEShOn3gsH9+0D68SfHY2ayK77iUXlHOA2KIm2y8vwDMFn5ziZD1kUwbNtfe49GN8xBOrafh5GXQCay98EGWqoUD6RxgqhyyN6C0QBNR39MWFNX2dE2/4IGAYtg3KyHZU5GiUpHOWmtL2mp/r8weEv2iCLeCvsFvO9ru1dYiTesMOWZrGJADg== 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=4sDd2FozXmsj+8fUfPNCQVdq0ZK3YBBlEl2U0eOaXMo=; b=botSov5T8iNgEay7hNH5mbsf8irUbif0iZDS6KBbczUGC9fniZ5W6zBWm1/0Vw8GWjo6+SJafeTzLCiyeTsTejLjb+s3p3bOYCYNQVPlxk75W+E+104qUNuE3/5lhl1XIb2KevC0iPhpRCI1j0Dhz1BUGYdXIVc2VXRZ3CDAMUH3TRidMZRy26XftDIsoUUcWf5qg8bPzjsKUiSzR0Xo4gjKXweOM/Ws0FXc9Rv8zb5wLJBlFT8/NEi60uaUjex0PmiGHHxi/wxHfmbLjaL8i2A9COX69Afrx9kb8LHEjROusY6JaYFDL9eec3lKwwfkPVVdTPsEHxKH0ezvTjPu0A== 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=4sDd2FozXmsj+8fUfPNCQVdq0ZK3YBBlEl2U0eOaXMo=; b=eUr4kAlSACcXWddx4tV7LBtpskR0jCILhvTckjgZoXpEG8lgkbTaATk7jqFitvN9K36HOmBqJbP3iXoWxUvtfHtKseszgdJpjOQzIxFC1PGpjnsUNJeQpnjhwdqZC0d9/fuO24Jb7NJRyWA2awsyLETozVa4T+fxecbYPJ8pnYpELcvCMhWG8freGlOflE/G5v5XqxKaFJ955JMjQ2031BIK+4k84oZM5FzyzycQMBbigP++C0zkU27fB303cFe9h9TwJ9U6UCOX3M9IVGipQz5RpLMUSUXYI/3iwAwBllx3WyHFB84aHVzog75eJhfx2i4Twm1euAe9IAVNz03tEA== 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:29 +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:29 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:08 +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: [b+lXmZ0myqM+P62rioMoGLjE+nOGY12M] 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-13-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: 5117c862-f7d9-4c76-8d0a-08dc4e5e04d2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /odxQ46YsM+E/9zM+mmuFHWRaFfwKl0hAOHjYq77U6uYUCQzYVTvd6cmLtOODMBiK2o5Lo2SUjNpJgqAJT+++7/YG6czsBRam2oXlE6FLcGrFRSCRzOhj9HKmTMV0yjvcnR2ZXzPpPOq8OvptY+ItK+9xC4AJgmCx+AnF5RYrKlWUYjE0nlep8Bl9B6Z4jH4TZyfmW04KHVegpMVzaSg48O1E1zKte7uUYoBbstE8xPZJDP87ErpUrkxZ87VISM4jt56Nq16tI4vi2T3/h7gkcBMcmHRpZOqE/Tq88uA1Q9zFANTtn5U1dmUWBMN1BxAHBdK0CaNuJEhaidrhJhkKYXx4Hidt5qzb0EztmxXCre83igMr6GMnG9DhPHUU2WkYeSH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qYP5RklsCak82a/zNffnUcxiO2przCUwYDYPNvxgazGFu36PzrktfT/F2J9S9DblbLgHQDNgnN3xl34eD6sIQqpCHPPfPh98SePzSmpSUadsxxG+ixIh19kvZ4D5frOJ/WsF/sXo77TtM7jQUZU7BZzuRwogzGKqWduGoWsHSS9tFHOz5gb3Li9Eo0lHfElobWaGDOkoZWWN0lajbrSg4t7/1N7rxpX5zAIRfiqWj5ajcS9R7OCcgzpgBJBZw7W0f5o4U3Xq8BOEBP5oObY7Ic2lQ9j1TAUGdM//Fzo+LtOGtSxLDexgFvoK8KZQoRgTOh3q7DfgUP1qA0QeeMHsAqIzruvdJqM0noyhioLpVYaAGu0WiMf8Mgnhdpqxhe1TOxe2HoHJLEQTCvz2o/bgCwsaePztjMfIk0N+GKPFacRkgPKWGCLYM0rjMzAYaHCBG96QtCSCQiDa/8c8F/QVNuHdbjQpBcqaAiSQJne+vT7WT6Y+YPczQtvVuHJl39MGXzMxpGJfsetAw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5117c862-f7d9-4c76-8d0a-08dc4e5e04d2 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:29.6759 (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 12/16] avcodec/vvcdec: sao, refact out tile_edge arrays 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: kt/vQh1UWMwo --- libavcodec/vvc/vvc_filter.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index ecb004d245..1a3cd02a9f 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -157,56 +157,48 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) const int ctb_size_y = fc->ps.sps->ctb_size_y; static const uint8_t sao_tab[16] = { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8 }; int c_idx; - int edges[4]; // 0 left 1 top 2 right 3 bottom const int rx = x >> fc->ps.sps->ctb_log2_size_y; const int ry = y >> fc->ps.sps->ctb_log2_size_y; + int edges[4] = { !rx, !ry, rx == fc->ps.pps->ctb_width - 1, ry == fc->ps.pps->ctb_height - 1 }; const SAOParams *sao = &CTB(fc->tab.sao, rx, ry); // flags indicating unfilterable edges uint8_t vert_edge[] = { 0, 0 }; uint8_t horiz_edge[] = { 0, 0 }; uint8_t diag_edge[] = { 0, 0, 0, 0 }; + uint8_t tile_edge[] = { 0, 0, 0, 0 }; 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; - uint8_t left_tile_edge = 0; - uint8_t right_tile_edge = 0; - uint8_t up_tile_edge = 0; - uint8_t bottom_tile_edge = 0; - - edges[LEFT] = rx == 0; - edges[TOP] = ry == 0; - edges[RIGHT] = rx == fc->ps.pps->ctb_width - 1; - edges[BOTTOM] = ry == fc->ps.pps->ctb_height - 1; if (restore) { if (!edges[LEFT]) { - left_tile_edge = 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)) || left_tile_edge; + 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]; } if (!edges[RIGHT]) { - right_tile_edge = 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)) || right_tile_edge; + 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]; } if (!edges[TOP]) { - up_tile_edge = 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)) || up_tile_edge; + 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]; } if (!edges[BOTTOM]) { - bottom_tile_edge = 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)) || bottom_tile_edge; + 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]; } 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)) || left_tile_edge || up_tile_edge; + 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]; } 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)) || right_tile_edge || up_tile_edge; + 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]; } 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)) || right_tile_edge || bottom_tile_edge; + 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]; } 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)) || left_tile_edge || bottom_tile_edge; + 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]; } } From patchwork Wed Mar 27 13:01:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47535 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605487pzb; Wed, 27 Mar 2024 06:03:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBCHQgJ4xKf7mW8Nbmqswa+p22tVH670Re0FfOYRBBXKjKk2lSLFlYFE3ReYeW5p0gpLR+JVrWU9n76J2mCniPNmoCg3i9KgX9+g== X-Google-Smtp-Source: AGHT+IGihOofXur7UL+9B8ZU1QPUIWwhXhTNCWoI1odUUU1bx7BF1KftLr/p3aOggg/CqH+lDzwk X-Received: by 2002:a50:a6ce:0:b0:567:9306:5d0b with SMTP id f14-20020a50a6ce000000b0056793065d0bmr2881240edc.28.1711544626605; Wed, 27 Mar 2024 06:03:46 -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 t20-20020a508d54000000b0056ba8ea9645si4577841edt.470.2024.03.27.06.03.46; Wed, 27 Mar 2024 06:03:46 -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=YLsJLyKu; 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 D7C4268D6F2; Wed, 27 Mar 2024 15:01:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 AE02268D6C8 for ; Wed, 27 Mar 2024 15:01:49 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JSxbNoyoBo1PZK8rZhwrIIJtjDdyoAUmeCgXuF6QXFamV8n6jzhLfNSxzhMFlVKdo6XRDCru1+c2Rj6r0r7fR6UjIl9MEoE3+fsMNSAUR2CvYvlokvoIvTBdD0xe0mGx4Ro5XzTDGP0hxX5FRGe130RKINHHb7Xx3aQMc6TZVl01/pg2LOVTkuE+JUL5fQOYUktPbvFLCiz3uaSm0TpmpGsaJduAptxXWx/jkdkAhnkaFaBbGnfzd9WLMLABhFSEU0hTtKT1+MWiYDW9qBCoec8S0WvtsV6q32fsjHiO9kD9uoU5jjxqc+Ll+US7h1WVVkeJLUbwPcOKXtJw7VsvhA== 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=DHKfpMqbokJcXkAggxbeELTdOOpgUL5VJJW1tLbFtX31YB0uscOpd7dhpMb69JlYuNwc5gX8rPHz9rLEl/GCSwmauk0XhCgD+ysfyOImeF5pxcmmxQ/QQuRxRFtVXOus5UcrULwWyhpxOONEK1ICBI0QkluezMK2ljRSTDqjovA3z2l081PaD4uAfhSDN1pVn9M2u9Zb+TqmUNu1udwb/PChGgPmNghsJjaOsSHrg51kPY+mxuvncrMn0ZRhtGnPmma5uapt8soHVbBHt2uD119idXW8qFHDhqCBs+icZvsXekPTj78r0sVsUQLljFXV32UEowrvOs9XM/c9caNEMw== 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=YLsJLyKup0aB5wTry5oLtj8c5cVFP+sAQ/DI7OEcMDVXHowkP6M634xIlC3I+pShqmuUrD51SYExxBcjeUxgtGLPyG5skTNJV3SbHrZyfFJojvurWsWGLMeHNrNirR5eLyxi1jSpnJozoyBe8n2Woj3hZrMcKSCBba4tFVT0dHddxzH2uFxXpsgJjVFJfX1t13sXywCx2oAMJNO8zOO4BaCKyrSNazR5aR+/4fX+z569BdEOgl+CSGq23Y6xUNUxsKJ7CNfhsfj8wF/7pfq1FgQnLc/NncKqV5vHEZS6GQXDtQ5nLq4V+FOVC3cdCQ3d0yKa1PE0WWFDWr78aOBfoA== 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:30 +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:30 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:09 +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: [/14mBAOjYU09V1eplwCNuE+s5qsGLhEL] 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-14-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: 0ebf0468-8b45-4a11-dccb-08dc4e5e0560 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TfcRFSI2CSjpPiS140zVGTOAjoVD6wittmysYfal4oMpcNC4CAYzHO7tm7UfYLEaHz05epeuPswcyMNuFa/c8YEcTDhXmLADFVSIh2CqhfjS33dgSRvzJyyRdMG3zgxdP91kf+76+KaZhfJl4qq7NjLwpPMkLeAgjfTk3qInGiQdwkJjpzPXiM+TXPaZVLK/Z04AkwXX+SlPXunmvwZuP3c1l9lW1SMLr7R5t6/SXrDqqno09MCpuYDwFJSfWETjDtCMfbfBMeuj24xQhzONm0Lx2Bg8/o7JF6hmo9ENqMZcdKi4fJ4Jy0UE4vFIGr4CeSbDFukihB9VEAB8XiOfJi8ws3tSWQzcIA9eGdiK2XVCdB7KyVl8z3/JRR2smWTzPK+zbsVxrsW8EXcqhPSfWO98IHL2mngOI1Fi+VU45OLkfoybl8WvfWXwxCH9m6de+czQxcI8x9vh8KgM7/l9g6BF6XsJJrCFrmN71SE3Uok6t4ZTOTp/skNmcqRbB9POKcmJT2+llMhR9iDAJrcV8hB97vS2y1BKX0T5kK47yT6bM3OE4kYii0mBuyISdYH/T69wh+WapNlUeMGhaXPPopnR94oCPxGOHLJ10grfD/M9ZfQn73WArhoYDe631HXS X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zyXn+ODrzDLO5nLwl0ylpAn85z/Ub6EjPAAdhQX8utUzyTFxpE/DRi00DY4Y+cpQabjqhGCwPRLAoXq/4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zo3CjtSHRswSg1XlYa8szNiAZxZN5G+T2LtKLIxlW0xNfxcaqj2FsSJ3mlVh2atjW9JUTu/6P1P0ee5BY5glzeTqJtyoy/c0QVwPS9o+GdNUSH1qDGsh900jTCUY2V1Nu0/hOkXW8t8O3cNCjLS0DSdnKKvs+FZD5XIu1hCr9Bg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ebf0468-8b45-4a11-dccb-08dc4e5e0560 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:30.5975 (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 13/16] 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: iPx2bEZV2iHD --- 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]; } } From patchwork Wed Mar 27 13:01:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47536 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605628pzb; Wed, 27 Mar 2024 06:03:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXXvxYGCFyp9uYJGelFwf8B918M1KQrkkirk359yAdCI9hVPihdIIt7JVz0Mj4qlcWdS6M7ynpQHDEWvlsGXR6I7GU1/1KedyHKAg== X-Google-Smtp-Source: AGHT+IHp1x073bV0Mtbp/ZxI7XPKJYBGj33azZkEkfJDX3wxQLyUYgnIz7tYwMOcPS660Vz2xa41 X-Received: by 2002:a17:906:7717:b0:a46:74fe:904f with SMTP id q23-20020a170906771700b00a4674fe904fmr1895900ejm.26.1711544637664; Wed, 27 Mar 2024 06:03:57 -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 sh34-20020a1709076ea200b00a4a3a4c152fsi2814598ejc.858.2024.03.27.06.03.56; Wed, 27 Mar 2024 06:03:57 -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=K4NgOTG0; 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 F0EEC68D6F6; Wed, 27 Mar 2024 15:01:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 1745C68D6C8 for ; Wed, 27 Mar 2024 15:01:50 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jDr+v1zKFNDeMHYxFd+KLyegwwyJLQHChLjITlUBTC1xFlYXh5qp+3DkHH626Wt6iKhOmg+02iPf7U07D0zbHGBfZBhJQ0pFgNjCh+oV3H1EBuw6RoYtq7Quhu9DmRImjlxAVW51p18UBsvMqG5M7rP3tjBuoLwES6hJsWf9SVv6foKAYZkVmFyvHsG0vpq5kbYccaaYbZyfukC0LRouQpDFxQ0TnNNgQo8lBTk3n6o275KPbc7DhOv6IPWXcwl33t8uGTAFLcy0dNOyeYns/JZP5800VXXaw/GqU6uxLNZ4R7dRy+RVLpPJ8tsof3MnXXWQW2SvMepTXYN95xQLrQ== 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=ithhzWDXZiuuzLm2evX4RDDRFzZlvgPcz3A9uL4L12o=; b=f8VgeBZkQMkDlIlrHMDO2rMZCQ7WAVu+SUc06h4bKYdP7s696i3O5Fqvm8XKXq/ECp4mjKAsXeEvB96R4ErLEmCLBJLfUwCBrfERauqjD11FHsgK46+gmFXDE+GCc3nMT8P6977bI7YU5VEPjqz4rKquVTCPDQdB5D/Cloy62nT02/gLJBfV2h+EE5mB8qkQhpB167NbZP6IbqqZBHfQVbN+PpMC/dLzh3o1ME5AlTAepDN07fUkZA4aZSK+IGDT+LlX522zlCWwdpcyvcjdenSiaQMCJFFtXGJsSYpzEzd08xTF1RRoMnfNixEumz2SY7A3NxZ2z6EWZCjEQwB34Q== 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=ithhzWDXZiuuzLm2evX4RDDRFzZlvgPcz3A9uL4L12o=; b=K4NgOTG05Qrvd3Vazq3qfkbIRiyZpwcSWuVngraAupI9C6tJvln/mc8SVJLbRoy9trKY+zlco5SsHZANcxv/BiGWLBs2JQSvTC615J3dS3L/CCT8caXx2K7/EKwZDj5yOWaZ4tyioP/cjulCkaM3eha6xHXXFbrIrVF0mzpf1mv9xw/Vt5ElsCA4vT7Lz56Z1+sAfmrBoY+E0PxRvxb5MGhaBHA48X0vPzl2mgb/bUkQVP0LnxoKaNX8cJAG0fqADepjmVhSlBMOeSxl0SIuEdWnx+sVxsYalQ2f1R5NOzgp610AmJxxBKgDwyu07PIogN9pIdR1omjgyw/crzeY7w== 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:31 +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:31 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:10 +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: [TEIOs8TOypWiaICyXgUL+Uarev1OXEIB] 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-15-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: 789fca45-eeac-4770-89a1-08dc4e5e05f1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z3lyMal4Tcyr65dlee6RRoM3xbEH5oCb2bLEmPfk56xM24uT+GoOpZTibm/+nNkNMjL01nEHRgaCz0Ah4n2ItE508P6NneC20xFFp2EPUboYasP4e/53LVCWbiU6DKXVA318FFK049q5zt5cHTdRuJGjMuxptXPTxgjQlnZxPfd0ZzoInF+XXLKBdkzI9t5AWvgZ4opgTiMVcLZVmCvpHV3hNR31myTrkpMA20UMFINJPbOCNOR1Y3YZey39MnguVjI4a/QCzlS9yqOfEysjHfrCN6gWiQ6tvhsX+to40zekrv76bW6SPek+h9eayYLSIEGN93XegslrRV7udXvxcimKleEpiv+olc8zwwNYWkKQB0oNOeNq02lmdaCmHEYvDW08lEn5o7Kz1QeWyurUP+zT6irBQ6Klc8exgj6jQ+EnasaLGavjlzIUS3a5RZX1R/aJcnqqu3AV5SExPXtZLGj2qhIHJXlUNlTkrV05Bj9l2N1fJ0DcXgc7PgRIhVidS2PUWT7MLJY+nvgpynE2q7Llw3S0b6KwqUOLWLPfuEUkYUv3yF7IzP7OKQ+dCYdbtucyy3uC/2mMqQhRx5Cj0T7oALwBUlOPZZCTQIWLVT8qPY/halx7+3dNBTg3VBD0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X2lruVLJsYVm93qMlPniryviSaaG6lXnQ7e37NyMUtsoKGWdyC6L3mTdHu43gXOVuJurMP26/BOCti33NS2Az281jU5WWfl/qN70/UzSjKwjV2a4tSaXQ5XH7Be7t+GjJAm/XxXwABgTW1g6d4OUQQJ7gQAqaMeBtjoXuMDeuOg2Rk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Pl0M3Kx1paXAlE+ZwtFqUb5PuQKrr4UYjwQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 789fca45-eeac-4770-89a1-08dc4e5e05f1 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:31.5727 (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 14/16] avcodec/vvcdec: alf, 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: ntYxxz8ZyVO8 --- libavcodec/vvc/vvc_filter.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index 6b4c2050c7..de0816619b 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -1199,6 +1199,7 @@ void ff_vvc_alf_copy_ctu_to_hv(VVCLocalContext* lc, const int x0, const int y0) void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0) { VVCFrameContext *fc = lc->fc; + const VVCSPS *sps = fc->ps.sps; const VVCPPS *pps = fc->ps.pps; const int rx = x0 >> fc->ps.sps->ctb_log2_size_y; const int ry = y0 >> fc->ps.sps->ctb_log2_size_y; @@ -1207,6 +1208,7 @@ void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0) const int padded_stride = EDGE_EMU_BUFFER_STRIDE << ps; const int padded_offset = padded_stride * ALF_PADDING_SIZE + (ALF_PADDING_SIZE << ps); const int c_end = fc->ps.sps->r->sps_chroma_format_idc ? VVC_MAX_SAMPLE_ARRAYS : 1; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; ALFParams *alf = &CTB(fc->tab.alf, rx, ry); int edges[MAX_EDGES] = { rx == 0, ry == 0, rx == pps->ctb_width - 1, ry == pps->ctb_height - 1 }; @@ -1224,6 +1226,13 @@ void ff_vvc_alf_filter(VVCLocalContext *lc, const int x0, const int y0) edges[BOTTOM] = edges[BOTTOM] || CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1); } + if (!sps->r->sps_loop_filter_across_subpic_enabled_flag[subpic_idx]) { + edges[LEFT] = edges[LEFT] || (lc->boundary_flags & BOUNDARY_LEFT_SUBPIC); + edges[TOP] = edges[TOP] || (lc->boundary_flags & BOUNDARY_UPPER_SUBPIC); + edges[RIGHT] = edges[RIGHT] || fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] + fc->ps.sps->r->sps_subpic_width_minus1[subpic_idx] == rx; + edges[BOTTOM] = edges[BOTTOM] || fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] + fc->ps.sps->r->sps_subpic_height_minus1[subpic_idx] == ry; + } + for (int c_idx = 0; c_idx < c_end; c_idx++) { const int hs = fc->ps.sps->hshift[c_idx]; const int vs = fc->ps.sps->vshift[c_idx]; From patchwork Wed Mar 27 13:01:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47537 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605798pzb; Wed, 27 Mar 2024 06:04:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV10355D5IoChRxzBw8EzuDMUXumvzAq8IziPOQuSfKKyf+gzNkXe+ARckzbzC1wdVES6oaKAdf2AzWfmOkWLbog4JZox/fsot9uA== X-Google-Smtp-Source: AGHT+IGke9xh2ZLbLxYzF22CYK8t8wGUUNLliWN7fr+GuS6xHXG99GbD9rqoVOS9/qJUzYMHIIeV X-Received: by 2002:a17:907:3609:b0:a4e:ed9:3b05 with SMTP id bk9-20020a170907360900b00a4e0ed93b05mr42654ejc.46.1711544649472; Wed, 27 Mar 2024 06:04:09 -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 m9-20020a1709061ec900b00a47063487fdsi4455413ejj.332.2024.03.27.06.04.06; Wed, 27 Mar 2024 06:04:09 -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=kcQJ4ham; 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 EF01C68D6F9; Wed, 27 Mar 2024 15:01:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 ADCB568D6DC for ; Wed, 27 Mar 2024 15:01:50 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M1+UQbtE7YkRIFieiO5+2vojBK6UOI9B8XsEdDY4NsJGmYVx0g7MifD2HeYz1iJrPaAUS5d2dbrzG7Zqb9ejbtlXsM5r4BGsxgO2h8+m4B3kQ5sj617aPfv1JmXXNXvS1LXkPEXHYMd1jJ+aU2NAUo1hac8aSuxA0W36IWauElfyTjy9W76KvDddjbLUrauahCpuFnvavDow40YLzjTdPUSvkjs9dS93GLtBbgBfdz5jryieKDMGsD0ZvHpL8xYsXUVIZ4fkmxzpxVoPl8gF80aIb/RZY1CfeNQH0ZNf/bZx2GWpiWobQAqhHj2UTwuTuWWhwiXF8EElQyQgOOetAg== 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=7qcEyv/WK9ZKtLc3JvWNnZQbtJvCmf0kidKBjd9iO0o=; b=A0H8bf+BPhbBRjKp78oA1AcXxhMO8hsy7FwwQITvTLiyqRTysCQr17qEfQdIWId1Giec4Ij9T87r6ovqherdIXYQvDjPh85yYh1ro7s1NP/ujLEvExTPm38IlHLNTKoRGFxtZD8zQir8gaobSRS6hWVQPUmCSiN/PhIS0Tue+51q+V2twQNABpQiaFyYKJzBZXL3Zg92CKEO79O7UtHLK+fnOYB+9I0dyMjSTIlekyNAghXefmYR/bug9j6TUMbv/ClxQq2YdJVza0QkFJZMeVLCTLgvTwNc9P6s+Wi10YG4uRXMSsdu6a2TO4CXk6/Uzx0AGsC+FbePa/FFQxNCFA== 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=7qcEyv/WK9ZKtLc3JvWNnZQbtJvCmf0kidKBjd9iO0o=; b=kcQJ4hamdqwYu+n7r7bqBKe9fsLgyXMrN/0ICYFBGMkEkrYkPyXlYpQQW0CknoiJR9uyG/3WaXJPF33/eUQ0eOackhUxzSFGy22FQ8EUBRLhBPnQJz8wvsNbGUMZPkVMOSWbsimhlmqI3X3UAvHTestNKwoBjJb7NGHRLarAmDvkQZqr/rZ0Ub58Af6VAEkpUURmINuV2YhzcQoI+SHAczvDEQ+vEadB2unwmcT3UdGCQ6i2Gh+FkCPo5K0de1wSHzyBkaGjY/DgqcDU6o6ZHWcCg7sK068wkQF7c0YofvsaV4sLQxxnQm4Ia7tOWPQ0bXFog8Jn5ZKkQuKP1OrP0A== 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:32 +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:32 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:11 +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: [go2tc9Vh6LC7znIWaGp8cmk6jhU/rkK2] 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-16-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: 037431c5-f443-4041-c9a6-08dc4e5e0682 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JCby56d3/aEVzAxbc9I4wd3d/902LlQBsYJvvweseC+V09+jMaLpJqn9P0vBM0Bf6PNmOYH5iRmnMwZZ9g/Ta94aUmSl4yNVNCx0EGQBKycf6ZWvA4ZsWXDu1Dau7BqVlTAfA0idmz9kOb6MMQeF3IgMNS2eMuK5LPOIIziWsC5G+Lb8OvfFVtgILh1avoTrrg+aHWyAaGb7D3HdzDm0aSWysBtfQcY6dMQrw0m/7f1/NQUszL6iKByRmxvovyqeA1XJLGyzkjI10W51XJVVT1vwj9oii+VirkpKd5DSg4NGeoGZJfwhAVTSnon34KiD8KTVCTBVZHgHIqysDqvYeK3BDapYLwGQN7raLPbe8FloDKtEgACnAIc0znbvhrDGKBlWOdueuMxuTuXdujjBVCJOxyqwLQxGNWugaN4KStuNB37W7DrSSgP0iJ/PN5uKiKEU8cdvxyR/tPvysVweR0dDDd93rUnwaKwc0clfjgNXzm2RCHa8mutvowBT/Hucz4Va3wPHhMORC1DZrkoI0ZwwV+Ag9mNwXRfdVmB+jHWoOd6O2OO+ZbE+Ob2xI4LZZ7VSsOGE/cT+fHyzdlmvvIpCrckmWofh7dHZ5uP4jSg= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cK974/fNmpZ/j5T9IrdATHpWI5XWq8pPcbOvpc05OPK1sIMws16z0OYabmx34z+juClsZnm094jowNTa7FzrxrHNATHdkN84JbojgpNl68jPuhyNfDOFvJbhsA/bF0hNE7g5p7bR2UwMCzYcpsUZ5EIkAtTC9QMEc1PB0l7US2numg0it+GxndGV7cr2Q1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Zm8k7g4mp/77ivg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 037431c5-f443-4041-c9a6-08dc4e5e0682 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:32.4969 (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 15/16] avcodec/vvcdec: mvs, 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: twgV9pTNrd0i --- libavcodec/vvc/vvc_mvs.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/libavcodec/vvc/vvc_mvs.c b/libavcodec/vvc/vvc_mvs.c index cf92202b5b..37a2d0a228 100644 --- a/libavcodec/vvc/vvc_mvs.c +++ b/libavcodec/vvc/vvc_mvs.c @@ -200,10 +200,12 @@ static int derive_temporal_colocated_mvs(const VVCLocalContext *lc, MvField temp static int temporal_luma_motion_vector(const VVCLocalContext *lc, const int refIdxLx, Mv *mvLXCol, const int X, int check_center, int sb_flag) { - const VVCFrameContext *fc = lc->fc; - const VVCSPS *sps = fc->ps.sps; - const CodingUnit *cu = lc->cu; - int x, y, colPic, availableFlagLXCol = 0; + const VVCFrameContext *fc = lc->fc; + const VVCSPS *sps = fc->ps.sps; + const VVCPPS *pps = fc->ps.pps; + const CodingUnit *cu = lc->cu; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; + int x, y, x_end, y_end, colPic, availableFlagLXCol = 0; int min_pu_width = fc->ps.pps->min_pu_width; VVCFrame *ref = fc->ref->collocated_ref; MvField *tab_mvf; @@ -224,10 +226,12 @@ static int temporal_luma_motion_vector(const VVCLocalContext *lc, x = cu->x0 + cu->cb_width; y = cu->y0 + cu->cb_height; + x_end = pps->subpic_x[subpic_idx] + pps->subpic_width[subpic_idx]; + y_end = pps->subpic_y[subpic_idx] + pps->subpic_height[subpic_idx]; + if (tab_mvf && (cu->y0 >> sps->ctb_log2_size_y) == (y >> sps->ctb_log2_size_y) && - y < fc->ps.pps->height && - x < fc->ps.pps->width) { + x < x_end && y < y_end) { x &= ~7; y &= ~7; temp_col = TAB_MVF(x, y); @@ -991,13 +995,18 @@ static av_always_inline int compare_pf_ref_idx(const MvField *A, const struct Mv return 1; } -static av_always_inline void sb_clip_location(const VVCFrameContext *fc, +static av_always_inline void sb_clip_location(const VVCLocalContext *lc, const int x_ctb, const int y_ctb, const Mv* temp_mv, int *x, int *y) { - const VVCPPS *pps = fc->ps.pps; - const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y; - *y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(pps->height - 1, y_ctb + (1 << ctb_log2_size) - 1)) & ~7; - *x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(pps->width - 1, x_ctb + (1 << ctb_log2_size) + 3)) & ~7; + const VVCFrameContext *fc = lc->fc; + const VVCPPS *pps = fc->ps.pps; + const int ctb_log2_size = fc->ps.sps->ctb_log2_size_y; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; + const int x_end = pps->subpic_x[subpic_idx] + pps->subpic_width[subpic_idx]; + const int y_end = pps->subpic_y[subpic_idx] + pps->subpic_height[subpic_idx]; + + *x = av_clip(*x + temp_mv->x, x_ctb, FFMIN(x_end - 1, x_ctb + (1 << ctb_log2_size) + 3)) & ~7; + *y = av_clip(*y + temp_mv->y, y_ctb, FFMIN(y_end - 1, y_ctb + (1 << ctb_log2_size) - 1)) & ~7; } static void sb_temproal_luma_motion(const VVCLocalContext *lc, @@ -1015,7 +1024,7 @@ static void sb_temproal_luma_motion(const VVCLocalContext *lc, int colPic = ref->poc; int X = 0; - sb_clip_location(fc, x_ctb, y_ctb, temp_mv, &x, &y); + sb_clip_location(lc, x_ctb, y_ctb, temp_mv, &x, &y); temp_col = TAB_MVF(x, y); mvLXCol = mv + 0; From patchwork Wed Mar 27 13:01:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47538 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9f96:b0:1a3:b6bb:3029 with SMTP id mm22csp605929pzb; Wed, 27 Mar 2024 06:04:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGKHjJdI+pi0Jdd1fe+yBhuBcx8oPFLmwWADKSaymuS/zsUx7lFMuZwsIjT4n0vgDzmWThdu+MVpa3faUkIc95WFEr5+l2FN9mtA== X-Google-Smtp-Source: AGHT+IEKTUwdA3vJGffcJlyzwCQyW4wzd6Iz14hbWkBRaDK3PrKk6TveF8cXC0Lgt2cVJXtOZWgk X-Received: by 2002:a50:cd94:0:b0:56b:863c:2c92 with SMTP id p20-20020a50cd94000000b0056b863c2c92mr1021140edi.34.1711544657810; Wed, 27 Mar 2024 06:04:17 -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 m12-20020a056402510c00b005683842d7d3si4576074edd.381.2024.03.27.06.04.17; Wed, 27 Mar 2024 06:04:17 -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=rXNjpYgl; 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 B485B68D6FE; Wed, 27 Mar 2024 15:01:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 2C1BD68D6E0 for ; Wed, 27 Mar 2024 15:01:51 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzffR2dURQ5ivRNGJ7+hmUK2X7kFK/OmEVsKOXq9ovyJf6QG4Chd5xsjUogtnB0/jYd+Li0LngGjmolRKH9yUc7G+6nh/4M0U7zhT3ADk7m1nzy9BX9TbB3uorN8uCLz+I2+xFSxQ/CCwhvGLF0NoIFBERxpqTnt7GOf7jhvb733I4hkAOyRBGpKpW0o5cdf/ymRddIwsJoJ/E1cfHGFwwRBROkys1LJ17CHxYaRQZEaCCdtB2wSxhiBwOAYnWRr2tvEAk1MmkpdHqwAGcCqFAglkO5H8RlsDXRLjxan1xfDdkS8EyX6iGQr07aPFl9u8kEqXZfuhnvzNxbsQf6s1A== 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=1W+scUffJES1fcjP5hvp3L+YrFiepKUmatPufAbLZZI=; b=ht8/Thusn+x+gs1iMpFNvhrkBYNy9T7EB812Biim7HB0BHDuhLa2zHK3ncCwbYOI/5ZFlVdCNVqSXeTcXUaGq/Fb3mx97Mp6Rp4PgFXODVGi93ax0w9m8Nur3Qge7g6E3+PlbZELwqOVKbWgLLTNT+nhd4mMnJbqI2PdHwcBW24iygmM9QKJuC2ekL/2w4WwMWcontmx2oC1ZKsUGd4Xr7Tb9QsRqLfHUl+Zwwp5z0X6LtsDm+mIS8misTOPBeqTueoQlU10GwTpqmwrVFyoWNzqKHzwNbksxyyupHo+04n2DLRGo6JbG3yZGuRNMTg4wGfv4xF2vTvX8kAnupAeHA== 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=1W+scUffJES1fcjP5hvp3L+YrFiepKUmatPufAbLZZI=; b=rXNjpYglob0+Hsysv/giHQdwKdi6lI8zKbrLUqaIPgOmpBpJ339w6kcqOSr+74L63+AlalYWz6joT4dF4FDWZXAJksraInfuNJuh6mzVbRQqZave2YpMlNzcvCUzeQ/LBzm+0aveadezlMGO7P4Q1lWmohGxZeOc0o5fillkHK0E2jrhCwrPmbutjRxPN3eD4g9cJ03WNdULRW0eDf18lSQDe1a3ifS7F9YNnc1bXG/YYdTxUwSnTm5K63mR2rRHGbxLKg8LcIuUAa255N9je5vBFdh1LIx/NObSOo/E2Z+K+Al0pwvpiLi0EuiinC7/V14Lavt4Q7nBin9/6mGdSQ== 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:33 +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:33 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Wed, 27 Mar 2024 21:01:12 +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: [NfPpKetnPDSmIO/T4uNpn2ryDSN7TloE] 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-17-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: 5a451881-7f0e-4392-eedf-08dc4e5e070f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zN6R1o/eMJraezCgZvyoaC2Mhr0OYmSG5FetqQP0cUT8mMAW7lV5xR/E6cxO2Ro0MF+lD3DrlhMXIUhjw2GjIjFhDzJHmi6x1EJTEA8g8nuoxieI90+NbtHhmSuu6NFSA3f2Sy6PKOu8ZhuvzTrFqZ8sfh9I4+zt/jG1xCfIZNGdENaDVu2pUQyiCaEGPe7FQFm/PHVIOE4eNX8kFCQgPgyXg1rXbL/H7TQo3y2INmmvfpdEie89gH3wN9yGdEcyiuRRL91K4SXrTT/wiAXrqblWyTgUcTsj/78M7PchNQqKDurlBqkjGrzuM65WhIfNyBWEUIJHfXz3geMXovBHOWB2/qHgs1/Zd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Cx3VxwbrfM8wXVYPRki/2kJZ8+ckjsMCWtzpZJ0yWjiHqbY+uXcGc+SeZZI3JzbdzX2MKx+Teb7awqGwIAKSWrs3fgagn++cjtoh4SQPJiqNWjQUgh3MenN2tRGDeQU80pu6KnVJ54kEKE2noDurWeZYHA0fZbo/c5MvwLXX6MEe5avg9+S7NZwxZMPtDOGm/VrEzUAp0zjw5fzyNdj0bQ084pKK4bQXXaliWV1ovzGh3TjrP+gAb2q7h2hTJhL+D7NvD0EOstZMLIfSN96e+sWFuRP/TpluUq3Dl5etXid/s0wx/XmwNFcP7o7O9zDCRlacTWdEY3EXSoIQj19Sjp6VDCkYY7VlySpYcbx9b3DkMQ5j84i1t+e/KGrNC//rFTmZMzuDx1VD1TF4pVhN5SzBVHvNBsFYiR1HFt0UmMA0XW5mMfr+l6T6j+UBEfq7p6ilHWi6FeTDuALHs9J306JsHBW7t8FeMcf+eER2+ZHAVkamc2VxbGDcHWtRfO0AmMtSl5b5PjVp2gC/mUbPs6DSino6ePa0DAzl9YrJGCtWQIXefzVhQd/cxSy4DweiD+UC+ihykAAMchRemoU92e78l6CFSqp3hETC/ujV/yAWX7ZupL01Y60k99CQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a451881-7f0e-4392-eedf-08dc4e5e070f 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:33.4118 (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 16/16] avcodec/vvcdec: inter prediction, 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: 1dqrN3WjAMxO passed files: LMCS_B_Dolby_2.bit CodingToolsSets_E_Tencent_1.bit SUBPIC_A_HUAWEI_3.bit SUBPIC_B_HUAWEI_3.bit SUBPIC_C_ERICSSON_1.bit SUBPIC_D_ERICSSON_1.bit SUBPIC_E_MediaTek_1.bit passed dvb conformance files (https://dvb.org/specifications/verification-validation/vvc-test-content): VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.bit VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_PiP.bit --- libavcodec/vvc/vvc_inter.c | 79 +++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 23 deletions(-) diff --git a/libavcodec/vvc/vvc_inter.c b/libavcodec/vvc/vvc_inter.c index c5629f7f6f..1a87cb71cf 100644 --- a/libavcodec/vvc/vvc_inter.c +++ b/libavcodec/vvc/vvc_inter.c @@ -30,14 +30,34 @@ #define PROF_TEMP_OFFSET (MAX_PB_SIZE + 32) static const int bcw_w_lut[] = {4, 5, 3, 10, -2}; -static int emulated_edge(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, - const int x_off, const int y_off, const int block_w, const int block_h, const int is_luma) +static void subpic_offset(int *x_off, int *y_off, + const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma) { - const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE; - const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER; - const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA; - const int pic_width = is_luma ? fc->ps.pps->width : (fc->ps.pps->width >> fc->ps.sps->hshift[1]); - const int pic_height = is_luma ? fc->ps.pps->height : (fc->ps.pps->height >> fc->ps.sps->vshift[1]); + *x_off -= pps->subpic_x[subpic_idx] >> sps->hshift[!is_luma]; + *y_off -= pps->subpic_y[subpic_idx] >> sps->vshift[!is_luma]; +} + +static void subpic_width_height(int *pic_width, int *pic_height, + const VVCSPS *sps, const VVCPPS *pps, const int subpic_idx, const int is_luma) +{ + *pic_width = pps->subpic_width[subpic_idx] >> sps->hshift[!is_luma]; + *pic_height = pps->subpic_height[subpic_idx] >> sps->vshift[!is_luma]; +} + +static int emulated_edge(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, + int x_off, int y_off, const int block_w, const int block_h, const int is_luma) +{ + const VVCFrameContext *fc = lc->fc; + const VVCSPS *sps = fc->ps.sps; + const VVCPPS *pps = fc->ps.pps; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; + const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE; + const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER; + const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA; + int pic_width, pic_height; + + subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_luma); + subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_luma); if (x_off < extra_before || y_off < extra_before || x_off >= pic_width - block_w - extra_after || @@ -57,14 +77,21 @@ static int emulated_edge(const VVCFrameContext *fc, uint8_t *dst, const uint8_t return 0; } -static void emulated_edge_dmvr(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, - const int x_sb, const int y_sb, const int x_off, const int y_off, const int block_w, const int block_h, const int is_luma) +static void emulated_edge_dmvr(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, + int x_sb, int y_sb, int x_off, int y_off, const int block_w, const int block_h, const int is_luma) { - const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE; - const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER; - const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA; - const int pic_width = is_luma ? fc->ps.pps->width : (fc->ps.pps->width >> fc->ps.sps->hshift[1]); - const int pic_height = is_luma ? fc->ps.pps->height : (fc->ps.pps->height >> fc->ps.sps->vshift[1]); + const VVCFrameContext *fc = lc->fc; + const VVCSPS *sps = fc->ps.sps; + const VVCPPS *pps = fc->ps.pps; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; + const int extra_before = is_luma ? LUMA_EXTRA_BEFORE : CHROMA_EXTRA_BEFORE; + const int extra_after = is_luma ? LUMA_EXTRA_AFTER : CHROMA_EXTRA_AFTER; + const int extra = is_luma ? LUMA_EXTRA : CHROMA_EXTRA; + int pic_width, pic_height; + + subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_luma); + subpic_offset(&x_sb, &y_sb, sps, pps, subpic_idx, is_luma); + subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_luma); if (x_off < extra_before || y_off < extra_before || x_off >= pic_width - block_w - extra_after || @@ -88,11 +115,17 @@ static void emulated_edge_dmvr(const VVCFrameContext *fc, uint8_t *dst, const ui } } -static void emulated_edge_bilinear(const VVCFrameContext *fc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, - const int x_off, const int y_off, const int block_w, const int block_h) +static void emulated_edge_bilinear(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, + int x_off, int y_off, const int block_w, const int block_h) { - int pic_width = fc->ps.pps->width; - int pic_height = fc->ps.pps->height; + const VVCFrameContext *fc = lc->fc; + const VVCSPS *sps = fc->ps.sps; + const VVCPPS *pps = fc->ps.pps; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; + int pic_width, pic_height; + + subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, 1); + subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, 1); if (x_off < BILINEAR_EXTRA_BEFORE || y_off < BILINEAR_EXTRA_BEFORE || x_off >= pic_width - block_w - BILINEAR_EXTRA_AFTER || @@ -111,19 +144,19 @@ static void emulated_edge_bilinear(const VVCFrameContext *fc, uint8_t *dst, cons #define EMULATED_EDGE_LUMA(dst, src, src_stride, x_off, y_off) \ - emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 1) + emulated_edge(lc, dst, src, src_stride, x_off, y_off, block_w, block_h, 1) #define EMULATED_EDGE_CHROMA(dst, src, src_stride, x_off, y_off) \ - emulated_edge(fc, dst, src, src_stride, x_off, y_off, block_w, block_h, 0) + emulated_edge(lc, dst, src, src_stride, x_off, y_off, block_w, block_h, 0) #define EMULATED_EDGE_DMVR_LUMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \ - emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1) + emulated_edge_dmvr(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 1) #define EMULATED_EDGE_DMVR_CHROMA(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \ - emulated_edge_dmvr(fc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0) + emulated_edge_dmvr(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, 0) #define EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off) \ - emulated_edge_bilinear(fc, dst, src, src_stride, x_off, y_off, pred_w, pred_h) + emulated_edge_bilinear(lc, dst, src, src_stride, x_off, y_off, pred_w, pred_h) // part of 8.5.6.6 Weighted sample prediction process static int derive_weight_uni(int *denom, int *wx, int *ox,