From patchwork Mon Mar 18 14:16:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47167 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1041986pzb; Mon, 18 Mar 2024 07:17:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWGKdf4G5lWPom1UGIctyVEaUxDzwYIbBkGPfn6MqY85tVp8ailqXPl0uPN/lb5RyFTGt8iqHdkk15Y2udr7kYRBHZpPodO56d5VQ== X-Google-Smtp-Source: AGHT+IGFciQI2vA1SAttRmUsD2yipNqZgqvS4VGfCwLWBWNiTKlKOgbRCIhwOP60Bdv6tMLQSQU8 X-Received: by 2002:a17:906:6c8e:b0:a46:b9fd:b7a5 with SMTP id s14-20020a1709066c8e00b00a46b9fdb7a5mr2445042ejr.58.1710771472915; Mon, 18 Mar 2024 07:17: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 o20-20020a170906289400b00a465faf69aasi4288484ejd.920.2024.03.18.07.17.52; Mon, 18 Mar 2024 07:17: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=BgVEfhEy; 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 D558E68D28E; Mon, 18 Mar 2024 16:17:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01olkn2053.outbound.protection.outlook.com [40.92.52.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA7F068D292 for ; Mon, 18 Mar 2024 16:17:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OCzDkOmVR/UyegN419Cc9avWm+qGKGxHinho5drX0+AkrmcS8t8w+7I+UIMa6ZOZyXyJCwv1Z6AP/AhN5/q2B31ypDSmmZc01yYN7+zShTrnVgUvHAgJevg5Hnvk31BxdgIhqNPL0ImYhogYjhB2RKzjKD4izvrw6Q16d16c8eQ1iTU33EXaD8oPpOxyWr8dDOj0DBVfDCikr58aMlAJPtJrCPT+hnRJB8bKZxOue9MnC2YaFElZTEgeEIj9tfkihzgu+Z2sx0n++67ulzNEGHPqjJf0Zuy4sV77FZkhkjP2R8wH1CfyztU+8DwwIgnGigir/afg1MntZd2jkTlRyg== 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=kPjOa8IU8UUWUZe36l5smVwJ+UkHn2AYDDOWr7/m3FtOo/u3nnv+5q0ZGt9jHjoe9F8XwhHbZ4AxvyiXa4Cg+RR6cRPDQtAlPkTxczoxpqou/GHEQl+lUkGsMmPlDd2HcmSUXnTKZG2J8ZvSNjp2P2YryabOCWLq5QlCotmYVBOlPPhyHZKj6ZRy1hkpsMCWFJOX7HsB3O2aKOv3q2nqFLWx+6ysuPBD8OZywskQ7eiNBsw++9oYbIvCHyV1OB1DT0K1UbefCkRsQEfb4H5zNNzItKPJBrsIqU/Fmbc5rcIEprxcibqq487n4OMeGaXDf3pM71vkx5/ZfzPFcg3LEA== 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=BgVEfhEyVtB0c3S1+4NIyCct83xtkWtXdPxeDe+uFHbCrIdA4kp3yxvCol1hSajedXt4oKgRAe2JA3+9KkvTeD433bTOwo0n+nmtdBL71zbopCCScO1+gpm7cYqfJ5FiyKqjE19PZoF8ukxLWIJyTWtgli+ICcd1emkFzyBAyfVg+dFGnpWG66Nycjh60pKHTF/PFbVaVwS3RVkjBxAAYwCrx1ELGVrZEyCu1UC4P0YwCJctJyYEHvRLiRU70PIOx4lRtWlMa4vSCgnlXh1j8QggCxYCt7CbkkEsWQVO+/b2Xm6QI0klBFV/gVFQnhApJcUD9LVg/J0Z58Awai/fSg== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by PUZPR06MB5724.apcprd06.prod.outlook.com (2603:1096:301:f4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.18; Mon, 18 Mar 2024 14:16:58 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:16:58 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:13 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [RHS0TaMCDrRUeEaqzvBE+v8JYo+vBFrT] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-2-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|PUZPR06MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: f9eff1f9-fd2a-43ca-85ba-08dc4756124a X-MS-Exchange-SLBlob-MailProps: znQPCv1HvwVyACnTOSFL5RJO0O1WevBvaGflGsgnqHve6qk1hGjoqDTpqqOdwXrl3q2MLwtQ1WaGcfh7hMwOdBGUe4euPOtZabNdV2z0VSTARQkaXdycPeRaIo7jhlyh6WiNlk3rf5gZaY/WcW12+cSwGWA1lG3H9+ZZjDCzra0c2qFkyxKKFnoBON+ocmLUmpNGolxCDp2FNgWNNCR7Y4TOIDvapEEMxmus/a2254qUmvdW22+0O05eAmaEYf9sEoiI6Ggp0EBkhlGO+pUAGN9NjMGBHfPA8nkJZHD5GTfI82ceVP7+JXZMoHaaxduUBTIyXR8JKPaTiOzi0/J9X6mcFre89VKUQpHiJAl7qzi5VpFpl0x4CTVL2yP02dLUg+VyfC4IM/U0Eyuizv0GKaIzE5J6s7wGajkSYOYd/w7Hj8/E75zCU4dTiKYEaid2b4wx26nfwlKUIDiov1VYiUPvtDQgD7dWDE+6xYlPEcx+a1JlZcHWkwgc51xCjH3hA3X9unnyQbVHryOPFSG6JFJI9Evngdrp4qvSMfKLYG+cRmiSEjuINX45ykldPEEQfmgN0pZuAGbZqiHV43I8yYg8zd/JbMsCFNiuDdaFF6JHXv29Cf5oTyjEvCIooJMH//x4hze8RGqa29UApqKOrOil/daDArWI28SfiTeRwrlrf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-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9eff1f9-fd2a-43ca-85ba-08dc4756124a X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:16:58.2121 (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: PUZPR06MB5724 Subject: [FFmpeg-devel] [PATCH 01/14] 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: x2FlqkGzSnTH 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 Mon Mar 18 14:16:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47165 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1041692pzb; Mon, 18 Mar 2024 07:17:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXulLjPWXTK+dM8jBe0hMw+eYLWHPPOLigCQ8jYH09M31DPAWihQDWBmGK/X+pBaesdXEM+v4ZtAh3Fea/MiYIxGG7xQuxoJQamtg== X-Google-Smtp-Source: AGHT+IGvKEzSUfzL86z4rk4xPnrN9C8qL2GFxudbWA09cjX5gsILKTaohsh+sMEcDBY4YiN0s3yU X-Received: by 2002:a50:8e03:0:b0:566:1952:afc4 with SMTP id 3-20020a508e03000000b005661952afc4mr15339475edw.6.1710771448385; Mon, 18 Mar 2024 07:17:28 -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 e14-20020a056402190e00b0056b8d091c31si49671edz.269.2024.03.18.07.17.28; Mon, 18 Mar 2024 07:17:28 -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=PZm31nC1; 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 8FAFE68D28B; Mon, 18 Mar 2024 16:17:12 +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-tyzapc01olkn2032.outbound.protection.outlook.com [40.92.107.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2AAB768D1FC for ; Mon, 18 Mar 2024 16:17:04 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HwyeTxJHpPySA3TrguDIncmXJvb2DYIIGEnqwRbajFg9HjWJG9aX8guNaVnH0uaW2G8//zXb6Zw0HKNlcgwJekoCgOgt9s3U6dnp0Hq3bI7/UBSIXy04bZ2qly24RGmw7twHLfn2GBeYcE6AdvrjwzPpuiHg/RkI7iaims7QMBu0Z6AZx/mWu3JMhoGcYGPps+BCV9lYl1CJZ4oq4nunWPDe3F0v/8qO6Tm6F9apIr9L2shH9jv5o/bKqY0GG1Eib+ox7eBjWcJpd548nLI0d42xWOgbOW+AiFM96a74ZP3jWPl5OWK/g0ljSEmEIai5VdC6dS0Ad8NLMIzKTm3XHQ== 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=ODgLi1N6rRva/0JSe2IoECeDBrCR+OtCOzu7FALuhPU=; b=bfx9TYhdd7WwnmXzLEZCzQnrz1wLSndMTVeWYWZd9w/1NVFgjz5rndIW3o6PCV9pzh7RC9wfNyvJsdDtoxdrziyFOoQaVgaIWBhyQpd2oOijYR3McgjlvCGRTxjQD/5KvALZkmvZ5hfzGl4mx0mWk8UrFXnpbvit0a0E6XVwrqUqgolxaV1ReXD6Md5hCAEvHTMDmbfNefGYFksCJ5n1pMdFH+wsnrkns90ivFUD9QP3o/3s4h7lTeLoJgh+h9hvTSXbtGQ4n6alw5W8cULELImfKJ3nBRYDi98xJs7KssUYxcQc3eMU5MgDRiID1X2HCUaqEE20/+MEXGFbthW9Vg== 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=ODgLi1N6rRva/0JSe2IoECeDBrCR+OtCOzu7FALuhPU=; b=PZm31nC16bj8ohCu0gINOz+TQQlIjgFuU7wApciVg27S7QkKinSF7X2sMnAhQdXSNy4iNTEJhV3BCdkqLYda1kRdfhGOTZoHiPQ0yjpd+JA22w1kUf9GNBIe0daA1NhXn5mWPTbZgFPsJqA4iPNH9TpFQz0r7BvuB4D9dN5i5zZNZp9NkCjAt+yzwn3acDBFHQDgk7dKDBFi/GOO5dWp31MuruBSs0wSNbt8owsrYQch823C/c3xeYxqUUnwgy/8frqjgnc81EQvYffJW+p67MmRRq28F8Glp1nlZZUFfgt0t/rDPcSpnX/DAHK8tSYj8EnXjuD+QJ2gwJt1TsJUDw== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:16:59 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:16:59 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:14 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [VPLsafvq7hKgbrTqbx2umMPh58p9/qyb] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-3-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: b3645bce-37f9-4ca3-70ab-08dc475612d4 X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF1pXdaqqmOJjSvpN/uN0c42eAHVY13NfeyJUcr9bxTFdU2vvTyJEhQxvIJeroxuVUZdzvMUSZYTyK1PEjfbOynCUy8c8bZNxLMP5yX2lwVgpj7GvpHE6D4Jm0DpqMo3a/eNk6z2jI0HottjOh3Ww9WNXAaUmsbnqm5ogxFXBW4uhaOy/wDfy8p5eIRmrdpBUWYwCvy5vrW7fBA76pZD2Cl+uBmy2gqytS+i2W87WRJUPS9pkaW2qsHz/85e8YpR9rJ5/64bbMs2L/yJVVnK7cdJBzz2SbEfGKe2XSuP6mfHQAtRM8CAE6iiEKew5fVnhauRMhjH3qpLXcetsPAYUNPq0Yvao0Z5xGTsUqTe5lri4MWVLFQO7H+OZ/EeS1ojmTtXwd9bA2kDZAxaa8XwB64YT/0fBhsVwizV9tZ87ZVrN5ELqjKGiuXJCY8hblxldZ4nzuSgvD1/z0J4+hpemzuF+hSrAcY+Qac2UCUMG9yTiOARwlLx+2jiZ8yObZ3rNEfVjbsrR8w8srU24AsOLMn+7llzdWqKeDENQvE0N7blc4P2ZXL+rpBDvtZ3/uYeijbjk5fxACunxaCxsQ7qWPuwN6LEmAsXRS5haHGIAvT0tLBrnl64hoa+zsLa5F9RO6H7Eg+b/BQDzCCr0vzvfkxa31x/IVaAxzDOVwMpSmaXos5y+8vtPN7Ht//vnKxH5HOq+KojFeW3Ho= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D+Dv4oxvRyAY0Dws9lKoqkvVw2J90xTToUq9t5OsGi7drAYgBkf6PuGKA+h0WT0+OeChBufCf2ED5WxyIFJJ4xk9pVutzaT6QuiyL7TG74+vKXBIjWPjfufrFlzm52CUSDQyeDoNHWkvJNkvggHfugZLLzv3KKWbRU+rsBZ4YDurjiTwZFN6oKSLsn4Vj7D2MpVPhQybkGyjlYySI7MX/8Pn22qeW+vC0kZyW2VG5dGQpDTZfZbesUypUn7CvVahTxuwkQLAHRWlMEy+QLCPKFQvgs5j5QDgzJxW7OBuV0SLxODXJmIzpGSzEpIqtMsp66mkUfHs2T1hk4LRYmFYcv0wLtyu7qQVfNyWOLtfaVfROApo+ZbNJmnZVCuHHlqWzVlstla//TY7XUt5Nz/uAQZ6ldxMIrFRtcIPjgCe+qKhSMiw5NZc4blWKMoLAmGlQMn0lEf2oZgt3z/bFwN4PL00Pn8wumsQ4hfRuKXnI0f+4se5S4BymipnzsrliIhYYNANwDOpHqMk2UF+4ZMwQEISyWWuQs5p6TlJaXtEjQ8AYlb4oFWWtD1r94M5NlyZFJuP8xVBru1ODm10DDe/jxBugSexUiqMb5fzebzlfC7i7SQXe5TB16eQXbmoBrja X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fp7ZCoz9FOGrlcFs7GkeYk1wBEsSwbZNSAg1M2o5wgW/UJiYf4EaedQJwgnAu2v5fBbzWNWBgBsoDie1px3n948plir5l91nTB6dh28J3m9yUUATH+GDJS+OKYZ/OmRgN0g60PDZODhlQb8K7GRo9Pk35mQFxrU0bQ2/xzQER+g5/uLNxCGAGn01Xt4MAC5F2klSVhVY6BkOKY3LEaaDur1psQRWwfE6iaJOvHkQj/DAyaf2MlHdl4A1fuX4hQtGl1nj7RVLIFllbVuqlhFFb5ADW8BoqjJn994ImO/+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ab-08dc475612d4 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:16:59.0731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 02/14] 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: Eg+QHAhinFUF 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 49fb12ba77..15368502d7 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3219,19 +3219,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 Mon Mar 18 14:16:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47166 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1041856pzb; Mon, 18 Mar 2024 07:17:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXYzaDiJ2nCM1tq8HsUsCWoC4jRBucczKh5Bz14pgFzUPcBtEHFmgiH+vDuUHpod22GkvTuU6uW5D3SMNus/hOI2Xigr162m/R1mA== X-Google-Smtp-Source: AGHT+IEGbRDk8jHOWZUwSuQDM96WJsTLzJXgoqXi7jCH/yo35tH7Yugpd9PVhzzTNtFNQP8pC4lR X-Received: by 2002:a17:907:7294:b0:a46:b64e:58a1 with SMTP id dt20-20020a170907729400b00a46b64e58a1mr3777257ejc.25.1710771460799; Mon, 18 Mar 2024 07:17:40 -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 fi9-20020a170906da0900b00a467df32d76si3587836ejb.446.2024.03.18.07.17.40; Mon, 18 Mar 2024 07:17:40 -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=ClgYEF0o; 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 A261F68D291; Mon, 18 Mar 2024 16:17:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7262B68D28A for ; Mon, 18 Mar 2024 16:17:07 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ReihKpxuNa2hucb1OhG8AOdEvjwUL8zd7Chja4EXpVfNl4xbpqbYsWnCKWxIpTYRIMAKIK7WQuTvJK9uRGASgQKOq5whQFFBM3nMRal91DnvG+9fi2+VzRo9csjLv5RHD7gWqG1VRSYXGhcplXl8nUnpcKAZxnNOnDb0FPojKFoB9iqJYxKNqYyn1oduSH05ZviWvopKqC3FSmTvYBx3J2/f4HFjonMhRKj/HwnX2ztjYTSDYOTBBS5p3aouxB+i6/y755+mSDGuB7gYKiwijJFVOZpRuiq7lhzBUngs4EibWIm/fdLmXetPPo4S8H0f7S86bzB8LR1bDcHMu9VC8A== 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=NccN9OGv5/Vjb22YjTIMkzPjvBpaDy7Fi2jZcE9hx30=; b=GIgjRLEVUIb0g1eEhTe20SwCqP98cs9aNZ89qjMbP1yAmRYpZ5Jxf+vw0yGcm5yxEtY5qh2dLWI3WGUOyZToRMxZAYPTvg/2DzVk+axBhv/dHhzFC0xZNsc/naB6mSwOIHnlGkyaiF9WYK7yBhRdyHE1vrR2A0C58k5BrQ/KFyyYB564W7vp77sF0KSAC7JEC0qQd38CjK68IHVV/2XJeRhczp3UjSodsQ8GWs36WR3+FUOyV8Ol/gjpz4H/Op3e+1Q0NafgmFxi9wTrhEkINQ5dmtGRJOgNp2i+Ot6kskysskc2/3ERxM2F/jcoj33ZmzkeHpQbTTHrzWrXsg1dhg== 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=NccN9OGv5/Vjb22YjTIMkzPjvBpaDy7Fi2jZcE9hx30=; b=ClgYEF0owsqBpF2nA7JWkFCFmDhL23VHBrY4qUWWhPgs4Y0CXWeJXarHMlGCCBGNa6its1aw+CTMRvTyT0LB8Bno4/Ss/yvAW1Nq7bPfE0tuM4Mn90IofXTdkVvgqVB15/HH9Ws6GQs11jBj+iQG4Ga481NP8raMGCkbl/I9Q3XM63riJfY6/mQqZRsEqz6+HNc5JtPIpC5gnKJxgXCV7RGWGUkMi8CAlT3/yVXIdn+DAlfeYoY00Sa+NnoCYWXtpxLYPAMZR3wR2a3ZOMHGfrR3AF8Gw1X38QHJElV7C/HrZML43wVlkyCaMLe6blnRHxXRflvcR3SkGKB49di8rA== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:00 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:00 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:15 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [5AP5fgpVJQmG4gp7d7zCn5hSUuY1iBgt] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-4-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 1856dc95-c446-4e63-07f4-08dc47561367 X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF14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Ssnnf8LnAiDjYz0M8gmH3g9VizweS7SIUOY1QWFbmXTtt5u84K3akOOmI17WU4JKNNqzefWNKkU9Vti8o42+ibZIzGH22mA4ObnfVC3h0WxdjxrirC0MxLuXH6LimPHzb3Uk406VBiKqHHe9QHbVS/CIiWnp5JYGfsyfOUq9YWnnpY9fqdmQi3lK5UOa5I0AwcPDC4Rzalh3i5Q0hDqKfTc4H40pq1zg6TalzMSy9YF3loltdll57l2990No4yemXz1sNgFG2s2oG9+cb8VzF9hjKKO5ntrHSYnBplNucl16LoKXqak0P7THdl3H4Gfrn+jCYFHr+lZ2iZU5z7s9+US5D23nN9+JeLu0prutfu6i5zaR6FR9QnM8tmECDG1HZWjPIKEgC/cAMZ2acs1vbLMh3/vsE+hdkHj/VqYurw8kvdVhStWcb17doLjJtBITdscmymz1ArVFMNE4iFMFqUqVaJEhGCp9QBBD7FVPXx9oSedWwk+nQ4qmFtDERarl2/aVZ7PU/MdyY1fIPDLmjk2LkWTwE9Ci+azEDZ9aFjDRegZ9Re0ShhBQYb8HWibtw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1856dc95-c446-4e63-07f4-08dc47561367 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:00.0276 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 03/14] 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: YXIbhfJvM4ap 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 15368502d7..9fa7e0eec8 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2118,9 +2118,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 7972803da6..bb13b04a5d 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -343,6 +343,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_multi_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_multi_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; @@ -378,18 +455,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); } @@ -408,14 +489,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); @@ -441,7 +522,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 Mon Mar 18 14:16:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47168 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042120pzb; Mon, 18 Mar 2024 07:18:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVBkDek/Z4upPWWOYrTZtiABc1nxdzbtUIuNNu8sivVaaJe61FmFXZRKqvWBqVE8vrvZxFQIJvxJppJhCq1MUijXSACnAF9QomKWQ== X-Google-Smtp-Source: AGHT+IFsdGa3bPA87u+hNDkAT9+IfqX4EuZ9Lknj880UonfF0t2AIIqaoxSKpOTlUmXRY+NCLdMu X-Received: by 2002:a17:907:7e89:b0:a46:ae35:9939 with SMTP id qb9-20020a1709077e8900b00a46ae359939mr4344885ejc.50.1710771483314; Mon, 18 Mar 2024 07:18: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 n14-20020a170906688e00b00a46b6108abbsi1587239ejr.94.2024.03.18.07.18.02; Mon, 18 Mar 2024 07:18: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=P15SVJf5; 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 D8F9868D29E; Mon, 18 Mar 2024 16:17:17 +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-tyzapc01olkn2032.outbound.protection.outlook.com [40.92.107.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D0E7868D210 for ; Mon, 18 Mar 2024 16:17:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k5cK6AQsaBXMxwsWgTh06v9l0YWQgQJRki7iK3xVwt9DaC29ukb03qrw5m2UPzmKvx6ugEN17LAq8RZEr3I6o38Cew5sPsSxD5DZ9IBuP0re1/JayRuMoFc1FNpHuiYLNlQzQduGYj1izaVWEPk+HRZwl+A1LMDjX+y407tmiAO0Eh3+jrZQ8OAI/fjL/nP+iNBo2jTyv6/YzkPGgQOoUB/RgTHu38oqHYC0WARYDC+Tw9iGBdjsVEiVgFcpWqdjYspPpM73LdWN8QbAnHgsBP2kuSBf70EJ4mAuOxirc3M+q/7ymUcB/mXLg1ptgcYndxDYk8I1ho7Zv3TcbTuuNw== 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=zvozsUqlDIgxiFNMsmUoVJnV6kwOPaTibnyXt/NCHio=; b=Q2wUYWgmuIaN6XkOCXdyHePg3xEGl3azMXtt/UPoO7xQfVfgZcLWo6fS2h6IglR62tyeCUvulVXpMu5rk1XPJj7oxDL+nbhoi0S4GE5d2grj3Jx7wJqZCmdIA1Ime9ddZi56hSyrgqeP0WPJ1FrJa4pTMM0bunuqut+mkK0qT1nBs5uv42dP0sJH2DGuUoXPWwRpz3wMFe2Ph9cSFl08TbOIle4fKV9Nm6V8ShyIBnXhO22k8HpfiQhAemPZ+D7RVaQ1IiwXu+yCFKAbiKNiAVKcauCHcppDQXXYFM3oPqi+QPqCbk3Rk2SI6oU4blwjCdKUdldrk7kDVPcF3nPx5A== 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=zvozsUqlDIgxiFNMsmUoVJnV6kwOPaTibnyXt/NCHio=; b=P15SVJf55tcodUbuKI4P8hvqdzod6qhMw/C/6h6tgm7EQViWRdM3B78bw6rpLX6Sd7unYMujw1NmaLTRy0dxptg9dywfM72pI0Nnw2Aa/r6G0HKBx7U+hV/NW1SfJYGLak1ypvotIM1Fd7y/lQZfclP0McdabkLcPfqYhIWuIDbn+Ray44aAV/Yu+lvEwdXPk7OGUo/LTrffs4qLAywJpOkUZAaIsv30Jc054G0qJZUiPBGUwCsn4sBDRFGFi21RxGoc+YXbX6LDnJwLVa5Mo295bcrCOKm2+jkytSSRu4iWsHfAtzW7HZaIyfY+OioUiQb8Kbg4z7S2najdUSYyWw== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:01 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:01 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:16 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [74owV7LSn7g8yZJqAZgpEBsL4RJHM+Ac] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-5-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e4277d7-3f5f-441d-2fa2-08dc475613e8 X-MS-Exchange-SLBlob-MailProps: znQPCv1HvwVyACnTOSFL5RJO0O1WevBva2q2icN0nwyXQLWUtK3WMHy+JnRRC96QAT2fWQnrLMlYQGs7GzktnEKqCqkQRgpTlRV8kh3gkwEgD9gsxpo6nu/eCKwp0sT6EMu43o4itHKDbIGzcG88lm3zCPTpqJCnnV4dYjahlzV9NUWNz4tN/StLbNrPHj+ap0Sm4Z9TSzF2hfeNqoEKaa+nix5mN3dhEmDHaXAEpv8jKdDll0GRMwFrZW3tFvo3PpLRDtblWpZveUpQV27RXX/+HVmIMpP/3+JskRQnbteITQky2FL3snlBHCyxWk9uGjHMsxbYfc71HUU/c4r/5S690s4RtQw5I5+Nc1kSKqpMm0Tp3UCY6QLj3Vdo3pyi7PDVeldJS8pfeMxk60dQAtCULvh9YZXxEEiBPeMguoKq94ljVpZeUEL/9YTapv9J5yoCfO+zMZKa/P6OCcpPXlerFyUCC8lXOrhHTJvJy9qgc2NYDrsB07LngDpWmNMkaK5LE07pshBPaIUIeRKquE9zWdhnYaVu5fUGrwv8t47AKkndbMBfMnp1eCQ5BIY2taVzpvT71JjNNztdS6YwYYycwXp2qKkWKeVhI4aRoavD8wtFlXhfA9wARr+d8MaMiPKe841dNrHI9vOS8nIUOQ+nL0gQUkLXn8WHTNr6J6S0V3JwVFl+leU01uQI6qiuvBNIQqU3MjMRBNSOd3EmqwY3s5tt2lJTVjB/pOpal9JHx06ObYLfMFT6uZTJj0YGM7cXcnaEKaQ= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vSs2TSW4j7xAy4xxoqlZY27gB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vXU6dvj4xcg7BuvPgRzGk4+xl54VetCk2D8YBw4iTfUjexNptZLEpC3HeOUj2k4VdlYpII9PWz67/wruXkKJt1+/xZVyD4vvHPYSVkdXBlYrforpf+ZDUGSXAEkRCJpUSpQ//L1TjoNgyKVp4o7PTtvSsmRBRUYRJ3C8P3miGwcGWf3Fz4vcCTw/ddPVMOMMYrVHpsdZGJYBzKOXmOITfLFTPrcRaW+e7VFEn5Ggpwa3/R2GUjXePrZKqHoYfyrpGKT77bGq+aerSIsGLh25n04mZsRL23nnjqnYgBk1tc63sRz2DJygeANdVB/rbaZgRhi38Mwm2+DSH6rhD5UFIXSaByH3Q15HvD57vxgKN0xna82ei/Xcajg0WRRGwKHb5IxMzyBBwt8QhWZp4GSZhWofub/HVVMJyCF2iYmvrrjdvsHexilyqftn/4zYoqK8AXqTVhvC2vkPioPbmzLxg0jme3FxbQqnB9dAqmEHspX1vz8Ej9teeLV4zwWjFMWhS4ywdKixY9NgsMiWuSPQdxIY21LobPnxcSMAOeEITwG1PE0/UswywL7xFURDXBrHSGaZyEohcs+wvdVSafmD/Lu0Y9TvWZyely+8gXQmB7K2WCJDO17lGKH+AyNYAGxQ5amHuR33iTAQ1e2/JyZIRpxrCS3ys5PA8KXfh99JWH8W48b9EyfF+O4f6Hbiyaqmw8QUF5GnKzd/2HRd5epoLSR3RLT/ozq77Y6kDujNpa+y/tIH4+J9n2WnobtxGknYvfpSBs06iOX0rN5+UQ8wtSSDnKvNhd17ceV72KGR3U5Pfk/ZrTJE1P8DDA9PX5JzJbDZ3+yvyiO6An0YUSwnBJ3x9Ctfam7F/OKgEcl9cyg90pVa369ZbeCXA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e4277d7-3f5f-441d-2fa2-08dc475613e8 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:00.8657 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 04/14] 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: e/eZK1byY7NH --- 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 bb13b04a5d..bbd666307f 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -511,6 +511,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; @@ -527,6 +545,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 1164d0eab6..35b46e234b 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 Mon Mar 18 14:16:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47169 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042219pzb; Mon, 18 Mar 2024 07:18:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3crf4re+cJqar5vCvjHXQ1N3aD1nbelj80NjRt/BauGj0dwpnUqEz+WEe+98nPDzjloIz2O8iV4+eEMP98wkzEx2r1/CIwHpsXg== X-Google-Smtp-Source: AGHT+IFAv62KqQC/2bbSTPQMJxo3JNDS8Lxq6KctTY2cDquJrylX6WEzx6vmZnUulha/5B17Qgu2 X-Received: by 2002:a17:907:d40f:b0:a46:7210:b46f with SMTP id vi15-20020a170907d40f00b00a467210b46fmr10243774ejc.34.1710771493497; Mon, 18 Mar 2024 07:18:13 -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 b14-20020a170906038e00b00a46a8fd1b4fsi2293408eja.1007.2024.03.18.07.18.13; Mon, 18 Mar 2024 07:18:13 -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=ifjmCfqp; 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 0E47468D2AB; Mon, 18 Mar 2024 16:17:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 19ACA68D29F for ; Mon, 18 Mar 2024 16:17:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZznFnZy/CLxvvh7CM9EYjy6V4vfIvkeuE8D9w/7+EbdKuQISybaDGlMJBsRHIaVAbpO/ZDxBMCz+ti+yBoGuZTHUCPBrwHa4lT+QhxNinnWTBejB0J5nr6Oi130fadDA2d/64kNtusQ8zPhZn4L6CrV/wL5jVo5BGnsy57qU01tyNP+WLobh3LBvXm0FL5phr8pRZx5N9NSDU2FQuXLKz2oYZfwi4QVn1e8SuoU0a8DOf4kPtgYQTCnAUAGyfCwbD5kOy6cH4hVi+SNSQuAUPwLa9pRBYyW3eVR9hh9WRBD6yiYohuxZt0za0vFTso9zb9RCI+A6BEFCFhD8m1x4w== 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=6LWw13vuwSxrXBNrqlnI8Mq8o3HpZv8p1bezJZ1kZzo=; b=KdEAKej13XaAk9W1ggTCogiimznU816qBve3MIVu0UKeYkNww8yfcYzWppAHkpPn84pnKCRkWN1r9VyoNp4/pGv/V8iZDLGEQTk5NF1/Sbhs00NR/NuZ8ivg2h+cZKret/bH7NQHl/Bt7GesCFn8EgJukG1SVJNdr8pRlDOillY1Ybi2USIl8kY1hJtpUgFtD2+5NbzYFQe/qobfyLsZQE+UxuJfbh0yq3P/Ui+jrgLloZWPZwSS5JCEJ5Ux8ccbx+ZkKmAftnN6GzQ70UY9qbBgVJRl0WfbLVQgBfiTv+wz8gnnCsAG4hE/8rAjjMuB3DVqfm7Mg8cfBv/foqRSNw== 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=6LWw13vuwSxrXBNrqlnI8Mq8o3HpZv8p1bezJZ1kZzo=; b=ifjmCfqp5xqk1RnGDgJamjmlLWna58iZNdT0/W7ty4+UnR4LDtkh+FAkgWJJAOHO2hcu9MJQ5Z7oovb4PLIMd8Lc/W7oD+EwPLUqM74Vw4fIWsGq9TXebdCIvEKqRCZmj5h7Sn7J7/iEzoln+ntCtw+EP7d0Z9Q4772x+ZBpzT0CISxRWVbhrMsFPREeouxI1IA21H8CVKePP2Qmsl+/bfxzjNCjvAg0OGoPvi1lK31M8bVA0PGocESSPnzyXv/P6JDR4jFV514YEql7R3K2L+KcU96hj8xvqM9jsJcZ8a2ZxUJa5ryHshARGb9+2KPxKvwRIM/Kh5LY8/y7Rqry+g== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:01 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:01 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:17 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [JTJh/IfHy7A22ecy/mS5bpK0xJ31JM3Z] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-6-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c597ceb-be91-4bc3-50b7-08dc47561467 X-MS-Exchange-SLBlob-MailProps: CLk2x5OX5VbP4DIzMIdqbAoMZfh5Eiv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LJGG4RgXk6UFl2LT44TMCmFNcrUAP+5TWJoW+ffVC8s4TwWcjhHOQ8EKbyfXlJPft2TFvNa33voXUks83wIsmZMJR88bC1LwCPVSgh9MtzsIhkZbJfdYrXftme4D++AiWTIGAERYgMr8l3TmSRBegsMDBLleIYUyUWHhR5TwYSRYn5Pfa6LHXEbP1LMmZ9YLF5F0tjI3E02/c6M7y+JQez+eNCc4MLPw3TKgvtVIh0ghbqTwIgAd5s9F74ZOmXAdLG2R/fa38jjvV3VLF+eih3xoGvPdK5fd85P/1y9I/Z0HlgvfIrCbrB0zdjh1ndMVeR4FuVFAPkNHcL9Nv1YCdYjJw1jdB4nSnednTC2Idou7+9p2P4nKhNMpOCCJB8WElksterbHwYPSONqBu5hIlmFD2H4E3oRX6U0cBSILmcv7dQEXeOq8rw0s7Fx1mrZdDSCYzRkB91iWBDnh+g+skubWj9dpKCvPPpKCKcdHdoq8mmlAh3XIRw1qkYTzcJp8IQB67LICL0eUbYiUGkUo6WIdCjuflU2oiy4IyGVng== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c597ceb-be91-4bc3-50b7-08dc47561467 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:01.6972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 05/14] 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: HzXpApEI4Rea --- 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 75b9e73ae3..75d9f07143 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 Mon Mar 18 14:16:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47173 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042644pzb; Mon, 18 Mar 2024 07:18:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUDgdIsSanAw+2vNuT+LXgqcWmSMrOd2TupA5hnahXa7E4+xDW3aNl89NLo1ocrwRcAliOkTaS16ICJrLT5UJfeNDcgX2+zzXsKDA== X-Google-Smtp-Source: AGHT+IEjoXXtxERCsikEqegyLczZ6LIAqtDMsTrIeVxAFpJ9sa3ama+zpWfAm0JwYKqQxWRejr5j X-Received: by 2002:a17:906:f295:b0:a46:bb6c:9ed3 with SMTP id gu21-20020a170906f29500b00a46bb6c9ed3mr2175363ejb.68.1710771532866; Mon, 18 Mar 2024 07:18: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 ck22-20020a170906c45600b00a4654dfeacasi4386170ejb.258.2024.03.18.07.18.52; Mon, 18 Mar 2024 07:18: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=byRo5Q5Z; 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 7957B68D1D0; Mon, 18 Mar 2024 16:17:24 +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-tyzapc01olkn2032.outbound.protection.outlook.com [40.92.107.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 78D7468D2A8 for ; Mon, 18 Mar 2024 16:17:15 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PtdQSD8wD9EqnQrDfYR8wH597rQx9cwO3S4hsaJM29di85tbx+ORq9mCfMQ7eugiyGsYa8oASSgmg0t3Cpco50VEyeCisazvRyf8J0KYEpQdywDyIzHohE/vrpeXqzpjguXRWvjuFZ7dre6XxUHex88XdTuep7/eXBAkzkuv2BHyqgQEmDjpP6SyJURlCsWbNhBKksfskGhWXCSnWsw7gHDkibbLgVvTRwGkfEcYjysvy+2fvUjSThkNxcyaTZo6LYWQE2PjQUAYqq6SMoZyQMoecY5sJxPhIL8J/rteQvl84597zf1HK3Us29hFWvuZHmE491nAQ7IP3Tf7tnn8Ag== 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=uFuWrKM/37tokplLu/lbf/pBcWIFR9Q4xQMNjQCtwoQ=; b=AJ1xAf9LD+aAo55ck7KDZ/pO+82i7o3ZGdaqe8uxG2r3Z9YaevxHZZxrMkROtN4jOjlPZjrFKVmTAxELT4G81XbEiMdrYfnH6+4CjENjHVgf0vUsVWquVurLEvFTLhutk5+p+QN2Lpi2rkOw0SfAuph4w/sODcMSXOYAIAMa673ckMo6lekHk+PfwUf4KKFMBIh6o3+3H0DUvRSrzXfObPO2CqWgG4ayXUUAIUZDlLObSH+MRLIMKUn6p8yP7zfb7FZbJaTGwSgSxxF+TA15AUmt8eb/yeH5AyXfk3yTIEbMCCoAEOxngm3WniCnHCdRi4FSsOuyo5boIAvbOCDgeg== 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=uFuWrKM/37tokplLu/lbf/pBcWIFR9Q4xQMNjQCtwoQ=; b=byRo5Q5ZPfq29KFgpxPckVh+2C2q8W+Zg417cZcSFDDY8lcdynYHU2VywW4nNxLDBEM0kT/+M9FTogiRhVgugub0PJHUkUFPUsBV2+OqAmo+bE6HFm7EtEJXhbRK+t90r67UL8xdvgpTFzBv27YTccimrJ1eJouPcUMJjMQ6JAHhTHlrzCqaaEgxFymFZprQDRqb5nfjizabukqksZnGrUbyT1lujH8gKWDOu0+GHX+PNnseNZe7e5goztyY6Fp1b5TV5/DnJ0KBzieOEaCwlfUJquDbyHAyQ1i6Nod4w4NefMeTv4IX9aoPhEUU0wYYllikZ9TXSoj/r0p3loOnPg== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:02 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:02 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:18 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [bzXgbe/kPzlhAuF4Fj9UBSLM/wmUFc8e] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-7-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 36d893e2-912f-4254-8244-08dc475614e5 X-MS-Exchange-SLBlob-MailProps: qdrM8TqeFBtQM6LyuMuRQGpfKJqciaiF6xLc8j7kZKBDM+hSs9cdVr8Zng1U6+nqG1FH8xLQzYF8iHlR5HJXA8O1m/esO/Ba9Ck3JNHJ3XnHJ76pHjKwfJp3U/DPXdk9qzovoqZ3/2OUA5UNDt7piqGKKbyOFksRqk/Pn/tTZE+TTPczLqeJBkS9CEBmw9mrzHL9A8ZZ0CagkoHCbxEq2q2aeN5szI0a8bNCUeUU+3cRojfyFbYVfsKePy19NVl98gKrld0cW7zY7EDeE3kpZrkII5+YTXbmV0vPvNtwaWKrNuEvjyhDifyZowfWmHYXi1jDlfAPj+3KWngKzrHLBbiZZaYeRrWAvn0byV1zZUM6gJMz1V4TinVvTwmV8pclxJVkmXNbzZzqt3qPSyP6G99Woj0Fr3T88p6cIOamia2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Rbtlg+UNsZqVwcNJ7F9L6jU0An5aRjYTfwFmtjZHZfVTbMDYjv7WBuzAJh9iVIAccEX93eW8gKtbajx6a5XzzpYRc17WVmV2owx+Qn+1/Wq6gijijmeLxZsxOHvXGZ3V/QGdRSyiQJBM9FRpAQxzOP94DdQlrWZ45mjBCOWyqO0ISubbVNmnVdS3msUm6HF3q5JBanLEfx43F51Junq7MzuflNAaqW7wBTBNQNzLdwaBq5MA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36d893e2-912f-4254-8244-08dc475614e5 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:02.5439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 06/14] 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: pZ+sJAO+kp3D --- 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 75d9f07143..519bd1ba76 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 bbd666307f..d1d6be390a 100644 --- a/libavcodec/vvc/vvc_ps.c +++ b/libavcodec/vvc/vvc_ps.c @@ -319,24 +319,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)++; } } @@ -423,16 +423,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; @@ -441,15 +441,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]); } } @@ -479,12 +479,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 Mon Mar 18 14:16:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47171 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042437pzb; Mon, 18 Mar 2024 07:18:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDKTeCUQ19l+pxeF98+2M2+BnOlAw4MBajqs37azxDEYkbl7RpPaXmagKwBXx/IYfsZvtdaEbhuW0Pa8RsxOAmXvVB9dkEvg/44A== X-Google-Smtp-Source: AGHT+IFZ9ZHUoQhCQ8X4fPu1NvhbT06DkHcszElcq+jOZSqk6EkHiQBZ61xKRQFwdpQf8wvk0i3A X-Received: by 2002:aa7:d3ce:0:b0:568:b393:ade0 with SMTP id o14-20020aa7d3ce000000b00568b393ade0mr5304805edr.1.1710771513532; Mon, 18 Mar 2024 07:18:33 -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 fj12-20020a0564022b8c00b005689f106b7fsi4688359edb.313.2024.03.18.07.18.33; Mon, 18 Mar 2024 07:18:33 -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=gNW+muQN; 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 43FD568D29B; Mon, 18 Mar 2024 16:17:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E114A68D28F for ; Mon, 18 Mar 2024 16:17:18 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LaMsiFWhZvS/7c94GPmASOItmybQdCWoEDBQmM6Ajr19eUO5SqJJ7HHLbc+CnAGZb4bKfZSUUWZ4XjLFQp7hCCX/ohh6rvAHJtKl7QgbKqVxvbcDcGb7ViX9nPwkiNkNBdzkzxggrMSXUYqRcA2JGznTJUjuzvP6lDrZe1fNKuxwtB/ihmzmT1o6lwRCnct28Tslk+CTAQLVBjdT76jvO3EO9n3ETEB9u/dmaTNjxQtk3i/ZjzRA5LndEY5/QkCfvUBE0LEAoyE4amDg2nBLKVBdnHmU9N3U814RwDH1FuLDEZJHIbjPHimqzGyRQ2zW6+MTiLjjWKgSozy5UyRB1Q== 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=YobLNo2vdt1wnqRUNP+o4V0/3rnENPGAe5oTXzDtYapTi1H9fRlQDxaHCe6+vnBwLqkde6jJ7eG4SL55lJsxGhWpvj1cpJNr/MobsAmzRm03r5Pio7cnqfLAPmli8ZB4/aU0XRVIee0/KuwlO5mHb85WtShlxxVcY3Tqyt0o1/M+aUEfQZ/PlIk3g/Y5RcJBAU3529jYa5wldt3oz978psLN+GEV3vrNHzFPtLkx/VYMJ0Wt6BUHcANTXaP7jvkZJcpKOgt0hnVlSfeuGIT5clSO9dFFZYZC9o8JAY0KKcBUl7KfhPgpxlLNj/YolqWHPk2swDyfnnw+VPRWrjwmzg== 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=gNW+muQNX2NYmQQEzOygzX42PHpPWG/6H0nd795K+WGNbVoCgB1itznJLLb764psXf5XaZhA8PUOk6ivl5vE0k9+S3pkd5M4oxjYIAJ9JnsalOKS1Aofc8C/a0ymG6WrAgOyoFK/Ljux45BfEX45v7/3JbQoCd4YaRQuM0je2mm8AIaAO7rfYALYsBsSIC0GnjvrlY7qgcHLMgJF0ob7QoEAejhl8G0SfKR43gvLvBI8I8cnXJIF+9RwbSbuNdTj1i1yaFoVBz0Lg0a1xhpqVFHQITM8N6lRdJ0pXqETNjjUk08sdRKixeOjpQuigvbiZCjeWNvW6fdc0n9Cjsq9kg== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:03 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:03 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:19 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [VEiqxie9X/no2Twm7L71hrh98gLgPrfY] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-8-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: b39ba707-a3a1-444c-ab41-08dc47561567 X-MS-Exchange-SLBlob-MailProps: znQPCv1HvwVyACnTOSFL5RJO0O1WevBv3nTXuDteMAMHWwWx2K5B/8b468zDt3yRi8xeG+YztGA8x5C53rsPyyrGSWKPxqkOfzcMw+9prArX0Of+LKGxb4W9xYcGSqsz//SXdV59Uq0uV73Ms0B821FyaZSzl0tlYdv9dyh4UsmLDm46ARzlDDfYSlrBdEJjrRagDr9tNPz3oFWJnXSG3M8JUZMfFj7RmNbbE5EwI40BxryU1BJtF9NjyCJy3i81RU+N5gh6aqn0yimgi3UF7NiuiMG0xa85qgqADLEB/4w2aVELGbekdrgqX/yyd63QekC2F41Szb4GoDWLmybnaGrGsRlsXk3WitRFTKG20OsZPy8Yer4+TIEF3X4vZ52f0FkSFplSzgSMofMPVWKetZFvP1WbihCk0aFJ6V4pzZlRkOREqFoViRfuFaVBziKVo10ahpDOnTM9nQ9RTReHZGXKBI4HRAnUwdaS0D1TinoTl47yOWfyJugSiJvBTZi5C4smAP6J+03s+GbCdgVz2ZgxaesiTvLOMmJMfr4ZtkcO4R+1/FscTZ/ba8uXlHr0/7UbdMmjVBtgpL3WbOi2T97QVSIH5fKvslfexz2TAe+HRW7/w+ZEIpr2jxDvO4KFeACDsaCmXBBL95yIEKnPN0/QhHqIvYW5oBS1L1VbbGD5a5egS9P6CJK33ReojaBYbVPmZmiIEJoFh/xrGtBMpRjy01hlbBycXTwe77Rrfr/zRdNNIiWYK8GdYjgehzu7w9e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Tenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:03.3990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 07/14] 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: P4EdI/3YwZph --- 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 Mon Mar 18 14:16:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47172 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042536pzb; Mon, 18 Mar 2024 07:18:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUnVMloHI+j7zxrVoivvz+1Y8I+czdYeX/8mz9cgGraEzvfjbP0xvhC7qTWf9FEN9BVCETqT69POyj1vu9yO3OEk9na6zmwUhIuow== X-Google-Smtp-Source: AGHT+IG/oiu/5KtDn0vbmOGyMFqZ6/ELMvsNQxm86+KDrqkDTNeJZX3tRSAl9ofB8TTs2qOvTRlO X-Received: by 2002:a17:907:c1a:b0:a46:4cc9:765 with SMTP id ga26-20020a1709070c1a00b00a464cc90765mr18172675ejc.7.1710771523108; Mon, 18 Mar 2024 07:18:43 -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 u18-20020a1709064ad200b00a46bda1dbf5si1071599ejt.567.2024.03.18.07.18.42; Mon, 18 Mar 2024 07:18:43 -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=mPkIK285; 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 63F2768D2CE; Mon, 18 Mar 2024 16:17:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B4F8568D2A8 for ; Mon, 18 Mar 2024 16:17:19 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nYTSVsMwkLiMyeNHKYITwM2WGfemn3bwbR6LbZjiCc+5gAxIEaseSGKCwuxE0mKSXQXl8/l8We5QLVXBC2dxYc4mr0kltPKRiigVm4zldPIg7SqYsMKjmhDPpeUit29oRksVZMWv9/cX7Moa/tvojM0xRcH7j9Irnk0dr0XUt6cIEicPTQirD0B2RhouIDwaPXGLnQnJOz9XI42AwNqWJJa2UmBA1Sgcaw+a0O5faJ+DCQsjwixAxNFI1zx1/uhv/X3+XfWvYCzjotKNg1uQppdjkkb10KneFsXjAvOq+AEwrGV6aCaEDofehkGhpg9m89Mxdee7tBy0VSLKyYqGjQ== 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=Ig5Xa6yV3PQpySiI5f8oAXSJq9ObGVNsixRZlZJ/+8x/xFC/DRgy6XBYmBA7Dndq42JCUwIOoWuQ0sPDXMYtVPBlwM6m2s3jqqYSum2l/AVEVGG0LKlEX7Aj95oMQHgG9fCgWrY27Ni6eFJM9i3br8wZeRpVWPb5cNJlq/uWemYlGVddVAI1V0PzyXQjatGFqlwCHenXtjsH1/Cq+TSoDIUNh+OKD89ee3pWTF+qRzBhTNDl6w/qeZ2xvyD4Po40ezjF2lyzk4mlsfGIQDOFOPePHd4RxB/xdzKR7tqN4ZZhTiVls5nfAR7MIF3kQySdVH+goqUkttXBvsN0niddGQ== 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=mPkIK285PXoFuEMOkKSu9zNoxSQasJdwHTYR+SQ/63BqRKQ1/CKzgOL00USmtSAUzmaw6uPjNxRWdClQQB1HRdhn3NvB9heZkHS0qLfRQdPy9NdDJW4yKuXDkNz51PA/nn8BRtH18/XbeuElae0LdXyDRClLmMbDP3MHPKxaVAqkA0cPwjR/6OBg0gPUKDxCu6n9R0qRY2Ifdv/f9DUuMP4eckaBkQBr0yRo7V9rIZwcLtaQgBrKh5gYYKHaa4Tvs2/S/lYxXDHl5MA8+v0QxR69uzTEeuQfUi+cd0LOdEAJKwMDyqU14K476l4YgR7QpZU5w2XmZJwoDs194nitmw== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:04 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:04 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:20 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [GveelalKBByk7xhmEbA/1iMTvrk41V+N] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-9-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ec1f589-4a58-4012-22e6-08dc475615eb X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF1YhBK+JJxZES5uW3wqiLmeqBhD6DNMQhBU0ysoggEXVqotW6tNWiExavZ4728XqljOLRx8szv3IuK/fJ6BC0R7EHY97S/lwY2AT0Yi0xu7GXUQ9CxAj8y4ov9lD2SBmn96r+R/qEGwZy6t3a7R6qzmglEKNLG5Rq3S3GwjsPeGSOJFzKKVrNYEC8TA+/PWtlkjXdpASaYsFZASfBf3tGfN/6YdU+2Bd+zvOooz5nF1rFQMcWi9odO4JY54F1Qbat67hTP+6mtowZ4qezfMy/pAeSKK1Cz0coIfv76hUTPuwYEJAfebuu1gSJMq3rq/pVIxgfkLWl8bKp56fPqGxjJazLmk3KORyNMjNF2l/h/p9NjsuhUcCjQ1V50PL69Oa9EiUdx+EM/sThsk5wr9ca1qaB06mmKruBicbYibtvBkYcM4AIXYb/oc2u2q0yj5sw3vwYtvNYugNmxZ++BT54BF+QC8splj5OFBljDQeCncGIE7iE7pFgDRPCPriX8ft2awmpnwRsDy7iO9/SQ3Owrhk13DDpQt0m5wWYPRDnZ2Cu0EAAQHyRo7/MyBKmIr9QPcc6kKl5TNqyCNEvc6NAbJNTJDexq2luXBfr3egdavIZZcBJRJoX67TCVY5xR9jU6NZhW4edPVjSqmO1angcXcGoamaPwknFS/++LNVDFBTePKRo3QNNUplQnnhwDlfeDQfqGF/7iITw= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3xovHxfPnYG+4vmu6/WPhJSi5S6Xwp2I6EheLrq2fHEcFV7ahzevdsAcptt1fJ70tcaH4Ic+gONK34u37EGKVoZVGZg3xbsZwzN5t6wSypUsm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qSfMxUOtWfC3RP3Mv758A31SEnWoEwjt4z0kpkoSMkNNmUzgzy4hBQbaQY+kEKz+tQsDHf9vkpmbBmYlToEF9BHCqnWQShWHXBzeVB74+P2FJ/ekTvMEqB6kolBsbETY8PX5WentK4i6fFyOVsd651P7X89eehZ7Q2PqIemAB3TduP9NYTqwZh6PaPmWV2pzP+02vtmkxIJJDtNDikm5Kp286KdWYxJxTqZdeB1SVQKzKOiaHB1QhyhxKW0GwDR+/ceXia1wg3q4yTzb1nmnZO1N/C/7G08SGApIyezC6uTnTRBGR1Tt4qkaZr+BXz9/XDd4p6N2XjsooiKIH5VHGj2kXKf1XndypmjmInwFh6DKAlIaRSYbwA3cbDkpdS2fRFvqWWT7Thm4fOh+ZJmtsnF7ee5ADBUZnJbPJMGJkeJA4+zInEoQNu/xW5IKE4yYAIHG7B48RprPeYwEM+WhU9vRXW9WZsEv/G+yF7gL7NeDtPuq3WS33sOWjjR5RNgyXFADnmdWH7Z5NbvfGrrfpBzV+HAYNeA4lwgGEimq5DDwTgk23OYjx/7Ia9L7X4QH3p8e6Zn7oloYCJS0uBqaJrDDEpiLVv8K2zblu5TCL/FoOPLTUHDfx+2hcJwKp1uaeCmbx2L4IApcfW21KxaICmRfhmLxcVkZHJbGwelXz0ARyqyXcNfnN5ubhC3ViRPWSW1fTs0UCbx1LIKWH0L5ulH31ughY0r37R6J7huURy610MVpJUS/YFRxwz4DDOMsbXNrhv9pdyxMZQnGR/VbuW5iTlvZRPvA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ec1f589-4a58-4012-22e6-08dc475615eb X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:04.2522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 08/14] 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: 7GkProDBOEUN --- 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 Mon Mar 18 14:16:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47174 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042735pzb; Mon, 18 Mar 2024 07:19:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXV1wNk5YKAnpgB2Drwx+ItJrWFcC65Eif1kgUbXvmJgYZR/MFCCnLQHnCOltrKthozWsK4YN/pSScOPGoZJ9vCIY37yHI1IrnlVw== X-Google-Smtp-Source: AGHT+IHx8xIQA7oamrM5LuGU9Pc8d4AmUA4WQ9XMfnt9WN4b+SSGIpfaJ+OAx0WV1M1N3nc61nnH X-Received: by 2002:a05:6402:548e:b0:568:1444:a828 with SMTP id fg14-20020a056402548e00b005681444a828mr8032641edb.37.1710771542809; Mon, 18 Mar 2024 07:19: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 fe6-20020a056402390600b00568ce82af98si1782245edb.536.2024.03.18.07.19.02; Mon, 18 Mar 2024 07:19: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=diEMfydp; 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 9C90668D2E1; Mon, 18 Mar 2024 16:17:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 894EE68D2B2 for ; Mon, 18 Mar 2024 16:17:20 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KuXCfvWVqRnnDSBiAAkAhGnmYfwSqwaLSEDTATmaKnbmR2JzQnztF6hIXV+JJ2E93gd9FI06IEqDsL3Tybf7gwhPG5dUfrI2piVnt+aNqfWByRA49DztNavfh79tLxs9mGsQuXXMc7v4/us5KvKWlgcBaEB9AzuMg2k+aO/5oFldgl0yDwUhYGYv0eS9TJ5yn6utkSJebm5/tVw2SHJNlEAGf4NpfrJ5bChD6XNoPpLqbEuV0pVkMqoaEVbJBK99XkOEH38432NS1nSsubqwxwmVXofRD+nSituhkD2oG2D22zkKMxen8rw/lMPqx8KgGekhfXT07EFsE+jsKQBMzA== 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=I45owPCWLGkTlbB/vW5gURFwQundf+SAG+1ei+iFSDQskwMiSsdtNpd/wcFyHnkHUnY77dX1XWMsA3LSPR4BaXoOET+vWde/cxz9b+Og7uFUVdRZrak4pb6bi4bq4Xar2qLf9wmDf83CDBMRjoexxQ9xxPf5/rnCP5gOkAVX7Px2/ODVF8Hzo+nSmPpg1Nkm14xznKCso1+qenyod6AqnTqPUIpyQYe6pAzJ4JqXzdSvrMNVmZH/wGkBL4xzXrh0ibTJJ9QyiirvC+Fq+EUC65JtfGMaFDDA2xUxGYm3PNIoKOL1d/tFo1d1uMZGlxQBpiwXVD89cfTbvkMATgTq1g== 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=diEMfydpJn8+l6R9ZEbXVTMwDEhS9vUiDHu1Vvi2gW0EnnTllmc9f/MPGtCLQcNXhexdS1jQIqWLK98GQLJnv2JVnr9vVludhnb5XLXsZIjxqhpbBF44LxpPUiD/qRX8wdsk0YQXO3Y6w2KAwIjKQxHnSOpioXElmAZpln+Dwd71LSSudbue1JoJ5linmERkptzfgwTuv7Act+92OWxTt6XEEv3s3kfviyTCnTaUlbByUrqzpD56XBwjDJtNr+OeT1gIXUDVz18k0VAgyK9rWNsjNjcxoZZRL5P3x4zUbC8n0bTSDVrQLnrjq/o42L83LXgUJEx7z2CtjubYI0pwJA== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:05 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:05 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:21 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [1CN+N4cwjEoodGAUG1/zV5PiwqKREBXs] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-10-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 51b598e9-5a4e-4184-42e7-08dc4756166d X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF11pm6dT1qy+EaIfML+kfX+cUURD2qzk94/vMcJ0Cchq2wnfaj0vQVKpt1tUk/vReQr8h3xmmCRn2eCWUlguDd5PnH6sm2MqKO4ljJ6b+xelRXYbCAYSMWYI9nBsARbXAnJxcPjr6vwn+kGw9nkpmG3vWOlV1fEpSpJyO2hljadgLCWge/gDeHdrbc48PhPZMcEmoaFR/Ds6SvI3snMJj1+DRFx/09m2R3EzD5UOEsig7nTdOWudjtex8xNrPLGIkm4hORxelcwIuexDXLRt1HM0lcRbP3CmUAndDYB8l+4fKVMcy5hGH7+1SsCo3Z/kxx6CPBgqn1gulzw3JzCmlYiekZ7M9A2LvZWPjt2BAczgKCppZVYdQLlOLEjSQen3t3BuO4soAmV1hIAQJ3I+CR7nG/EErkDnBDYg6P7GSXRErUf3/k4KaaFX/BHdtXvc3yw+nYRTrskytdOsMe5/LemR4LMF/NOJRpB0KPyEVhY8CtCljhsH4aVeAlmYaTYhU6gyNh+eP8CcPQ/mVk2nvpCL67gxRldj3gNRfYcfFugXcIIKoCFLhB7PR3vvmR4SOtAuzJ3Fa4EUb2qnrf9xmwgopKobgLb1AXlPji7HdRXhrSpeONbeg7kHhQEtfx95ICCvt3xf+WRs78ImjAcuzO/nFj8pCUhNF3X2rlJH3qR/ScrWvSXb/9UWz2usCtfIw1y9Tuhbr9aII= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q7/nSXR6L6z3/eEu/3XJswLEcQf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dTOhsjLEVRVGZnQyQeElUJ47IpKGLnadjSXmqpGd9fyZWJRd6v6oJgW5d83t4xLr6CTeuaA3g+UF4faQxwyCOnFpmacwI7xvN55k1fRsIXILbh6ZCH8NNgSD6M683KDdvO68kFzulysZ23Uy21VYhrEXfSl1n86KFANKAoNioUblAR5kGcaAK9VqvyQvztcO5z+mk/shLELKMkdFkka3qxlswO+wgkGqZEYN8XYPbhO8Nup0FNUUMU+fRMfMHD5Owh/Hk2CmCelBG9u3olGjsabtaeWxozxS95vZXAvlJlzME+iN5sBAEtTKRdlaffHxnMqxkmJx42bgTEa6eGnyexU7GLmRyzBf0GKzlSaL3Qw6eCzM72vvriUnlaxsWdA+VI3ZbB4L0C0iA/vhE0b3FSSw6blH6pr4U3TedpWmSQXRcBI5LRNpKXT7fnbRMNYYCIUbdbQeobiD3d4tMqtx3MvA7Sj6Ab0f0+iroInLyGZD/vFTA5bV4UI+n4Qwv5PuuoWAiFXZnSFrnyixsGmchxb2V2pK3sop6udN6DADHQSKKUcWUBwO91tK65weVVK5+MlrbkBQjzxi0kyYl/soQCS6U8tJpnanZD1VNjMoyy+ERhmLuilU3d+jKYDk4CjLo7E5taWRfULnpG5ByBLzjj80huAbspyCXqT2axWNjaNUs3OEkUsv06wKNDiSd/w6VgU6Lt3rQf6IlBU8ulzCvAdCQCCPrskdiShRngLS+cg7LB6zIfvT/x0ynRaZTgAOKWBDjonEKXt7KSbC8/Kbk/Fyj0lLi+Zh8mn+VnW6d7R7cR56NQlEQCplwNOnKc+1CtS9YPYDLdPAI3PeBNkU/6AG96avjRmtlfEnyWpS4vpsx2LaB9iQYuvYRtMwDf8h7A3Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51b598e9-5a4e-4184-42e7-08dc4756166d X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:05.1041 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 09/14] 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: 3L6XWowF7QCk 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 Mon Mar 18 14:16:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47175 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042856pzb; Mon, 18 Mar 2024 07:19:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWpi9L0iaeAe+xLvlfyTN8/tPJRIxf01dqXpifs8YtlICGfPswqwjwLlExCdPj/+EXfOihMa+0ylRyjhfYEPc/LxbNq0MT4N9P8bQ== X-Google-Smtp-Source: AGHT+IEb6wEY8eoVLH+XCk/EWNucUsPVtX+ochuQtXDMZE9XHJhgNiST2sNMWgvlCPg+PRkdCKAo X-Received: by 2002:a05:6402:1f4b:b0:568:b484:8a04 with SMTP id 11-20020a0564021f4b00b00568b4848a04mr7056048edz.35.1710771553122; Mon, 18 Mar 2024 07:19:13 -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 x2-20020a50d602000000b00566afb7bb1asi4382723edi.62.2024.03.18.07.19.12; Mon, 18 Mar 2024 07:19:13 -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=nH+DaODf; 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 E1B9768D287; Mon, 18 Mar 2024 16:17:26 +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-tyzapc01olkn2032.outbound.protection.outlook.com [40.92.107.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8C2FE68D2C3 for ; Mon, 18 Mar 2024 16:17:21 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BsA3+wMyfpVgWVgNyD3WZYrTCLVjl91RW78szvQxpTRj0JYGOydB8qKowVWTnfT09nrr11tMy/oP774nrKjlzjxX16NtNithObCPVD3kd+iqt34MfpGWnqWFyQI+ueifkwDZhdXwfhs0ZPrZ4T8caNiB6RzNuBD2ZQDIl80fKmKuO3kTY3NwV02iI/80xRTzqOx6kfdkI9VdSVTdYihv74fNlNxFvoFJ7Lp9wa8l+8ydBnvnTXW1wx3SdNn/Rr0NcVloKG42EUxDUxPVtuH65Tt7/U/noqfeZhKL/vE6NO0wBI/43xmetxvKUiau76DqNQioul4025NUTGVAp54CEQ== 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=l61jj5kcnLbnLFDQO0YQ4ZA6OPsX+xdpJ4RgAtZMzbbWmH4jC/8iJknaLPNhNMyhL/A8wYvXqrG6mJjaas0aukMT/hqjHhZNkx/2l2nTXplS/6qTy94opGKrJdVz+hFgm/ABZXuUL8tJuM8lmk8clboK9XsJhet3zEL9RKcP/uBs99Qu45bQr1k/yi+qSks7Vc8ued1XGWnA/plekV3peyTK810thJvMGCE1fi7Rm3nGheZKtXUKfJ5U7npR/8IUwh9ez5akEfI6SdtKiJaeo7FEfMG3ei2RVNNRffzu7/RlC8PAz+oKe0YVxl8RwCh75iKR257ezseHk05XzsPe+A== 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=nH+DaODff94PjLWcd+RIr4R2RD2I1l00Y1+bJIWt0+eWVQW8UGHH+0z0tCLMSsx9lQ303T4fthkIx2CEC4emr5I3Msdn6r3hsVnEUmVBhQuU6A0S26wLCYXCpHfXodfmRnp6itFYCRfiXS/eIVeBWWBpLqnXT+zbZFhugGm4PRplFPlGGPP12PC4SitM7dRZeVEtjZJETly9Z3As1pVv0oI/o6FcfFdpYv1km4kMl2cqOhje0cx6sU2xprTJ3h2phSBPzl/0cL6UgOk2rFPKFz6i2pBiuurUWYaHYvgicKS91MJSUrWFsZE/0PyDl2UMToKOa27RFDJ2mdmP5NSGhg== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:06 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:06 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:22 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [Q0ABpbByqO/r2nj2lPtW0nmeiRnGNGxe] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-11-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d48d000-6997-4a2d-e2a3-08dc475616ee X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF1wSpNR8eDKWqGmVv7Tfe6UqwyyCy2cJz1APfwKmb8VGpi5MVyAiHnqeJOSE0u7QLIeiqv/wrALQxbRlDNCSESE85m5yyzz9tfLpqwG883IN7b8+f+dXtNowHW6/hzQ10wut8zoH0taCGMMocZLgkHa/HAqeT4vGGEhg0gw3m0xNrCMjdAIeuSIEkA8YFtjzGfToABBhXGQKNF4NKGMZNtLAN6/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Ds2Am87jnbAqU6PPXbp3RUfrimlSs6G37bX+DxXWeSpwtpyyp3kS7/7UQWBoOUGLh99BXgLFuGBCW/UY+P/B9umozhTaQXOoIVJSQk9v8MkWyP5pCkwGi2xBo5BcB8Cw3Ei9ElnojCDElstdYeR3X9kg7/GFhnLsHelEB2M/jJALZu5YSfoed/P0pdHjUEFvIeq2ykqWazw6pPjVAnx6KunCEnsyb+VtIDnzvPjp+qmcqwpax7piPRaTw/UQPQZW3dEUL16DJ0v+AqAsPcPDx/VoWjC4d19eZ0C9BwSMeW5qpWelITQ7CHQe9qIdkpGbkIbL+/JNOdMG7mBMOyhXZaPpdYbYzL3lb4SIiqozyzUBos0KFA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d48d000-6997-4a2d-e2a3-08dc475616ee X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:05.9458 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 10/14] 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: j/6fkUjQVvZG --- 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 Mon Mar 18 14:16:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47177 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1043085pzb; Mon, 18 Mar 2024 07:19:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWzON7GHhlrUQJdZd0QTQYRVMYqctRoTKktArGQ/TurWMzo50n1sXmoRc4iknKmWzrLpsL4DztBSRhTMTdZ8856yA3l72PbzleGuw== X-Google-Smtp-Source: AGHT+IH0Qk6vKip2JMmmzCzpZP7613KSVNwcMhOeTQUgwsSMTYP5Jf8Gt6XZIwShb/R8Os0PPN4D X-Received: by 2002:a05:6402:2b8a:b0:568:7be0:50a4 with SMTP id fj10-20020a0564022b8a00b005687be050a4mr9334434edb.11.1710771572206; Mon, 18 Mar 2024 07:19:32 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ij11-20020a056402158b00b005685d8423a5si4700852edb.614.2024.03.18.07.19.31; Mon, 18 Mar 2024 07:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=OM0j8FLi; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 03CC468D2E7; Mon, 18 Mar 2024 16:17:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2037.outbound.protection.outlook.com [40.92.107.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6946F68D2D0 for ; Mon, 18 Mar 2024 16:17:23 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXdS8NinDhfHzN7VgzV6nCrNbrKjxtj7/PfVQdCMmUyFK8Og+3YUHCFxYCXHPgX/2GVyLUDHSfJ4NA1RYD7Q29vGvrCKH85o8mLvu8eg79amrmDS/A+wQbgG/pG7/HFvUWOgfV1gur4jXueXjY5aVtnqKDXv2vLOrOHF6XQnKxpzMwE6Tw3JgIGyemiaH8la5o/eNW9FVqQaz+Og94UT6+OOF7Xnuvw/XSemoqPri2q9XE7YyrkQ0qAlr48AdhBWQ3QAtZiFhO20wsN/IXSX3Y88dHVSKDS1BqTETl+REVpR/wHOPMPx+hfs+gY4Vt775IXllnQblk1LeEtjT2q5Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/YrsaOODjaGwZ0MqBEKUT7x/FraiYbZpemgFbJfY04M=; b=fMbhSnZI2efBumFunLmn+VtuLcoBgkUKeEy/2wJluVX9c6GArUmhLbgcxiZBSw8Nkaf6139NbLjOYmgHxqNb21BU1dbCKDMqq3LWw4tke5xuR68mHQQivW8r+7FvDeFkw7JN4pW7WtKS3zVHFXyzIPizoXLMo+YlUtqobzWz2mjfNJDJS5cbUQkASIiRdDKZnuWdZSNA+eu5UcU6f2Eoi/gBRVZZvdYGBc2oWZR2qs8+w5XbVqMJr+xodoyENE9BJvv+VDah4DFTzvF5gw4/gExE8FAkgxEdM95BEZCPxK62vEOEjxmFZQCAG4KtnI1QphccIzL2owvFPN96ZHjAWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/YrsaOODjaGwZ0MqBEKUT7x/FraiYbZpemgFbJfY04M=; b=OM0j8FLiScmNiVGAL0BZA/dED2OuDujmYVfAPqgx0y7RLmSsi3PY//UO/x7Tve7Op67t/HMfWZn+eQV9KBX8iGVRZj8qNezBdKkA9Htn0Dkl3fv2dsb50fbVjMpRklTCJnBDjmzRcMAcOS8vGOPFzroiHC7LCOGgQsMCKn/GFVnciicEQqZf/HoC1i5WCVTygIi5bsKeMZUhgdMd4mB/Da+PUddBZcoODBrmtvWR/045BdVFfKX6Sdaaq9QC/AkchDPOEDFgqOb6qdDPNpJove6Dx93siMrZV6W4kBhtDlKJK5DS9ZiDWACJQj2LcHx+rV2tKXyLViVdo3Mx6Tz22Q== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:06 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:06 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:23 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [sVQjo0wJKawRaTQ41UUiupf1kzSv8E4r] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-12-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: b24d4241-cf16-4713-a2a1-08dc4756176e X-MS-Exchange-SLBlob-MailProps: Vs63Iqe4sQndKyqL8642oOb5kiEsziF1NU6+cFbUMwrryYPyjLeOCYrhl+F4tIZTF2F8d6vWXO8Y2aaZN+k5nICPOdcdtxKfbrqj4IYUuTTNMzJTBGzup3bcO1Tn6jiYom7cNm1awCH4ZO9qZ1cTUv+KnEv+N0kgnWQQ1fWRb+g3XzGxBGJv1/MLIN45fk2JHibAOR7v5+zOeWMiGLWzb9Z2W8gKsCoGTwpCK6x4zJGl5Ga+qKZ22tYc9626phk4b9wOnp/6w2eMMbfcakPU1OldyAcwQFLtZ7N7U1KnyfsfijeexZAZ/pELD8VaF6umtM+H/vKzhuvMpBYneN4m8XnZLRKmreCyUtQK5cxfaOT8GQZwILUmdWP9X9ehKFwjF7dKaxMhddS5woSxCJ+iaNiMEx7D6LUbn1ZkA4uNuB9YoappzQ+NUveYHfThJvFlcWMUmrwKaGWjjyPh4YuSfaOPkShRy+VnW115acpsTrfUnAyFWdCR8ngVE17KkpXlVYaEZpa3BDE8x8XcHtQFlf4UcViU4UNO28QlDlsU9c+sKY13V1l3InJo/204b/EybNPXD23xO269NWK2ozvxMaB+fGFWDv7OpOi1u9nwQfWmNCLmgXFTi7QGEYKfshW1JI1IkVzMK6J9poO77HC5djNi/qHCY6V+KLJB8dul30ytg++bX3nYwa9iMXDBG8IUsrE1yPwguyJma0zwco95lI79NR5su4oF8VHup7HsjEE= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zfBvJwLWipO+ds88HuaCTqiYhzPZy/gqdv2hNlozdGL8pjU9yxw7LUkbTAhsdQZpj5pRo8ymeYFZ5f32uxZattlRWWbTbsXJ9/xbKljTKODBmHy2PO97KhpV/GOjRyHkHtdc49fW4iCgg4Itv29DkHBzXt8uRmGWD5jbaWZH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fYrVgpQx5VJjg2Tbyqkoizx0aVI/iwilsJjvZeDjI9EIPvdU1svg7ohB9NG9QoyePa8tAafErwjILd6JeW/mRBVmnzqAn4795YBPMJ3aMCgLdeozTu+4xI9x8PS2S3sDPH65dZRRhFlJHxAw5L+OcTqRreEkPMwdDv0GJ9ELObN17oxZfkvtX2p4N47R+gFiOZ5oi65UbqtxWKUjwtG8n+zwk1OxKt691QfpqMX04vhphUVH9QmB+eP599MEU09JHeNMN8fGJ1JymTGWpIjgr9v58FuBWeTMIJbnWuEz7bZTalhAeZf68LJMPIzjdOI2erVhBRnh8CbgSea+TLH2sWOSliHeXc0mAs28aO8P3jxkJL0RT6gNoTRT+2XDAz80Sln9iqdiqC0acM6YnREdJh/4Yir/hgtj7UNXhSQUtWUva0h+BgT6y+jpu7bNLPAew5uNuZbYYJlGMpjU6Fp1P4OwCkopxytTKfTLHIGBQmU9qczIvugd++D2/kzdqhdgiA0Yh00UPeOKTi1WXxhsn7ax//u1S/58rPIYHhbAwxzGI2qHcT5I4bweRYj79qfF1Kjp5XDbZVcIXMNIQ1UsB1sRUk7Xre5saIO8h96pX3lLUfwyrtZ6aQjwRCAPxMZeK3LTlm5ahUwZUnu16xJyVJ3Lo68x7i6jjFzNBnpNUqgVdRgUSpc87dERVZkWxH3wQLoFK1thiv6Eyb83HZ+l/n3l486a7XFPYnhzVhvQbB5Ftl2JgutDzwmnRZNnzA6gw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b24d4241-cf16-4713-a2a1-08dc4756176e X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:06.7882 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 11/14] avcodec/vvcdec: sao, support subpicture X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Nuo Mi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: saZlwgjiPdtL --- libavcodec/vvc/vvc_filter.c | 40 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/libavcodec/vvc/vvc_filter.c b/libavcodec/vvc/vvc_filter.c index 1a3cd02a9f..6b4c2050c7 100644 --- a/libavcodec/vvc/vvc_filter.c +++ b/libavcodec/vvc/vvc_filter.c @@ -166,39 +166,53 @@ void ff_vvc_sao_filter(VVCLocalContext *lc, int x, int y) uint8_t horiz_edge[] = { 0, 0 }; uint8_t diag_edge[] = { 0, 0, 0, 0 }; uint8_t tile_edge[] = { 0, 0, 0, 0 }; + uint8_t subpic_edge[] = { 0, 0, 0, 0 }; + const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; const uint8_t lfase = fc->ps.pps->r->pps_loop_filter_across_slices_enabled_flag; const uint8_t no_tile_filter = fc->ps.pps->r->num_tiles_in_pic > 1 && !fc->ps.pps->r->pps_loop_filter_across_tiles_enabled_flag; - const uint8_t restore = no_tile_filter || !lfase; + const uint8_t no_subpic_filter = fc->ps.sps->r->sps_num_subpics_minus1 && + !fc->ps.sps->r->sps_loop_filter_across_subpic_enabled_flag[subpic_idx]; + const uint8_t restore = no_subpic_filter || no_tile_filter || !lfase; if (restore) { if (!edges[LEFT]) { - tile_edge[LEFT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx; - vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT]; + tile_edge[LEFT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] == rx; + subpic_edge[LEFT] = no_subpic_filter && fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] == rx; + vert_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry)) || tile_edge[LEFT] || subpic_edge[LEFT]; } if (!edges[RIGHT]) { - tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1]; - vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT]; + tile_edge[RIGHT] = no_tile_filter && fc->ps.pps->ctb_to_col_bd[rx] != fc->ps.pps->ctb_to_col_bd[rx + 1]; + subpic_edge[RIGHT] = no_subpic_filter && + fc->ps.sps->r->sps_subpic_ctu_top_left_x[subpic_idx] + fc->ps.sps->r->sps_subpic_width_minus1[subpic_idx] == rx; + vert_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry)) || tile_edge[RIGHT] || subpic_edge[RIGHT]; } if (!edges[TOP]) { - tile_edge[TOP] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry; - horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP]; + tile_edge[TOP] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] == ry; + subpic_edge[TOP] = no_subpic_filter && fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] == ry; + horiz_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry - 1)) || tile_edge[TOP] || subpic_edge[TOP]; } if (!edges[BOTTOM]) { - tile_edge[BOTTOM] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1]; - horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM]; + tile_edge[BOTTOM] = no_tile_filter && fc->ps.pps->ctb_to_row_bd[ry] != fc->ps.pps->ctb_to_row_bd[ry + 1]; + subpic_edge[BOTTOM] = no_subpic_filter && + fc->ps.sps->r->sps_subpic_ctu_top_left_y[subpic_idx] + fc->ps.sps->r->sps_subpic_height_minus1[subpic_idx] == ry; + horiz_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx, ry + 1)) || tile_edge[BOTTOM] || subpic_edge[BOTTOM]; } if (!edges[LEFT] && !edges[TOP]) { - diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || tile_edge[LEFT] || tile_edge[TOP]; + diag_edge[0] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry - 1)) || + tile_edge[LEFT] || tile_edge[TOP] || subpic_edge[LEFT] || subpic_edge[TOP]; } if (!edges[TOP] && !edges[RIGHT]) { - diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || tile_edge[RIGHT] || tile_edge[TOP]; + diag_edge[1] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry - 1)) || + tile_edge[RIGHT] || tile_edge[TOP] || subpic_edge[TOP] || subpic_edge[RIGHT]; } if (!edges[RIGHT] && !edges[BOTTOM]) { - diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || tile_edge[RIGHT] || tile_edge[BOTTOM]; + diag_edge[2] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx + 1, ry + 1)) || + tile_edge[RIGHT] || tile_edge[BOTTOM] || subpic_edge[RIGHT] || subpic_edge[BOTTOM]; } if (!edges[LEFT] && !edges[BOTTOM]) { - diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || tile_edge[LEFT] || tile_edge[BOTTOM]; + diag_edge[3] = (!lfase && CTB(fc->tab.slice_idx, rx, ry) != CTB(fc->tab.slice_idx, rx - 1, ry + 1)) || + tile_edge[LEFT] || tile_edge[BOTTOM] || subpic_edge[LEFT] || subpic_edge[BOTTOM]; } } From patchwork Mon Mar 18 14:16:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47176 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042982pzb; Mon, 18 Mar 2024 07:19:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW2qb6yMie4hJLD0mX54CB5+Xxye3Pp7XkVroeuInflQ5ZGaq0K9HSaeCS/C/G1PYwgABYuXVLns3po1lrD80BuG4oe1fsqc/Ffeg== X-Google-Smtp-Source: AGHT+IFsQMJzFuPmP5m+BxFDbQK5Cr3LZnpTl5uwP9WNuo7ixHH2t1lAC0Svt8janSJunGcaZ7An X-Received: by 2002:a17:906:3090:b0:a46:1817:6b35 with SMTP id 16-20020a170906309000b00a4618176b35mr6510346ejv.55.1710771562866; Mon, 18 Mar 2024 07:19: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 sh20-20020a1709076e9400b00a46a154ff39si2594117ejc.756.2024.03.18.07.19.22; Mon, 18 Mar 2024 07:19: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=THWhKs8c; 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 D0B9068D2E9; Mon, 18 Mar 2024 16:17:27 +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-tyzapc01olkn2032.outbound.protection.outlook.com [40.92.107.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 69D1C68D2D1 for ; Mon, 18 Mar 2024 16:17:23 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M3MruNjR6akZWysOmxLxbNfRJwk3fqmPwyUX6TybI+5jHjC0fmtjw0ce7bd0cuVf7n6P50iqw2zRJO0XM2oh9JLkHRcBGjmSkUj7/hHo1L0irT/xpV2oBmfNy1agHLkvYvs13nnWbhovqrnH3Xv1VxKcXxpGYpGmkMGOEAqdHjKBYXHF/qO7dgwL/fkgU2Cm1M48XgZf//xYCLx5Hp+hSd59Q9THDQPDhUEOYnGlksZMOwwyTPbgaiqgUPGLmUCEYpaq+wCN5pSRC2CM73W5NaVjPRnuIyFOyr2DCBv/+LYf9DZ7kCHbzO8NdUrPHm7t5Y4Rf9CmLMpkn5j+K4dHlg== 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=OFyjsHDqSLrYAIAYJzBDz1GHxQ+bKK/jKd4JrlDz46uaWeMiPrH6fED+/PjUdmj+827fUTz3oOh4g52y6/7NyqaoRmTzBReCEWxfjUrRcmge0ZIIzG9viE0BToDuhApjhuV9n/hh/uJnoNSP5HssAAW++SPE/ECZP/qJUuK4JUiyNOCZgAlRfAWy0UYWtBdROqeDzCf3Pd1Fu1e6XAJDA/3+QODfd+WyhkOfCuCmnlrRxosnFCMul2iigb0/ZTfxkuAFyGmKQK2EuRaNOcJ/kxmKamysoQZkqUcuL5kTmE1/JcKcaEH6+e+W8aNjRW1UGRTzxKB+lMmYi1dwnfwrLw== 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=THWhKs8cwNe8dWjhWZYgPJ8LXiGHGjG1RnB5PJ5AsWv/aKa1pzUgBWZL12NETP/Ko8/D6V49pSxVKlSUiPs9QRfgTbtsT33hY3lrnhTC8I6oVurHE5aG4++8dekdpIB2o4ppSPqzaNsbwSHtKuODPIdzNCV6doO6RElCbJU2uvApl94vMlko0dJJ/4fz0CfCF5YqD1zRo52fvhw0ARZnq9s9zAXUKWR7RfkSjnWDTGCYp/PMuFHUwAg27mUzXRXbyT2qymLlny87zvIBGSil9rODZNvUVaWCT5pWskswiAwPN7Sl7KDVQ83rWPWgeIubsYDM+0kJ7RLUL/WMBND3xA== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:07 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:07 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:24 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [8X+ucXHv5U86CeD78+bK5ex5+OelrcEN] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-13-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: e7eaea68-e686-47d9-5b9a-08dc475617f0 X-MS-Exchange-SLBlob-MailProps: znQPCv1HvwVyACnTOSFL5RJO0O1WevBvb4uardwQ+CP2sJZpMoJn0hV3ss43rHFzOiXZ7zh91KGThlJkawa/IBrUkQlToxkAkv7kone8jdUuciVO4rLozrOhe6Bq+chaHrYL13J5wYUxBzWB71Wu0KOpwyRSR6pOPJ6duC0/fmaX9+1T1uoX+y/DHXI6/9LMvX2HlG17OwOLggqyI8XHSqDsFm5UBxCan9PuL9gprx9q4QRIBoZHzRDmFsHE3JvVuR//F+q4eEXsfr7i7qQz/OgRb/11ZTl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sjrhAl52/2++pGQzMYKQUTIKInDVp2iKywHIGeLG9fqBdVi3WeLiOA1RVuyvEESP+b0mVdqJXD8SHWm25aInt9XKKOwSJEwgEHAQjWMO17mCdnXMBfZ3sT5PsEnmsem+1awKn6YdpfsYp9DWPkyjyqQSOJB4W1NLFlh9nbe4eNwi/jSF0jNqPqYh7BcZU/2xa4/ydLlbsrfo2GpQB1NKTwM8/EFEOmeBCh15SO9uM4qZdvQaljf2PUaZUJxVZVKRhefvkpYaSlaWdLRZo42G09++JhnPxYkVkYeLIm38wgVjD2ZL1ILp7mWaF0tWIz2CxvcedB57gV80yP5Ks3SiAxqwknxQX9ZjIK2oLBI+cZHjsm0aiBk003gAX5v0b1Q9+xrOEg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7eaea68-e686-47d9-5b9a-08dc475617f0 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:07.6571 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 12/14] 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: pyXiiHD9FsE5 --- 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 Mon Mar 18 14:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47178 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1043175pzb; Mon, 18 Mar 2024 07:19:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWELccq4i5YDb3ZiSEG2NZbiEkejePOdOkqiOyiYfD3rJZMYWMlw8hRt62xcPR6vbESM5kDSCPJ+1rXwGBzO6z7b7zraV9AH8+GGw== X-Google-Smtp-Source: AGHT+IGV344l686NKPfBipXmkdmalDRfS8ooDKn2YWos3u3lK8hNE+QfZGor/CRIuZuYfbib+g4J X-Received: by 2002:a17:906:528d:b0:a45:b91f:2f95 with SMTP id c13-20020a170906528d00b00a45b91f2f95mr7955115ejm.72.1710771581514; Mon, 18 Mar 2024 07:19: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 kl8-20020a170907994800b00a46c744c6b0si671232ejc.85.2024.03.18.07.19.41; Mon, 18 Mar 2024 07:19: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=ExPIufkM; 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 E876768D2F1; Mon, 18 Mar 2024 16:17:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2032.outbound.protection.outlook.com [40.92.107.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3AE2068D2D6 for ; Mon, 18 Mar 2024 16:17:24 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BneZayw1387segFvwu9ZEMm2AQH9eBSJsSH/mD+mFpMfPoPqmHDPNVonC2nnZFbpwmjQJQ+qCCgZvHvoxz/Js0HINB4I5yK9Gmv68UtLqA1uMdC21bqMr5viPXFrhY8rlxwk9QoPfNgHbevzwCj/HWp74NRui366BqQct4EPOqU3IkD5b/MPCcZTfjokA3QeVBPiULbe11ytjTqnmKO5cDamP74m4n81FHj1ZpQIxza17G5QIF86DPrMRQLjhT2NZ51SnyM18UIlKHeVb3phxkr5VhSGWSYQwqy5N1HMZXPIpjm30z4tDal9MzNSviQeOe2qWk7S5kxwfMk8bZhLbA== 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=DbK73fURDQ0ZUfsfaEM26j65N0bn5tndsgIbU2KZnUVn+bEL9Gm/Q9jzdDduUrHP3EstCqv+3y0L4mYI41+IZVTLCogIdHx6cP2K0COfkbXyjJEWtaz9L9gW4HPeiDpCG+LDGwYhB9NQHB+eAezFjv8EOqb7C+45WI4+OE03WCuso2MIaGCyccfWr2o9D5wim3o93hLfOEJiXZMBw5KpChY4UZdZK9swnrHFIne8cbwJjzXe5Ke5nTe0tnnIVZjiUYTXCPSlqoqSUVbNXX6czvhVwZji8IS5AE5WQ0dggoSwHgbnNrKClf7s1udWAv4E/XThSvnMnZFzSuE3VJbTCQ== 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=ExPIufkMoSTTEImZMFU7AY12BghL2WQH0sw/xWAOHYdd1b+nqIqFUSoUHx4gNDA2N1g9fSWm/ep6ACRcK9WqXHHU1Knley/d1PKc8f5RatTBnW7zldccn9rF4YD6/2s9FQbWBSOFYitC52KqJg2T7cU6PG/VsrU82fWwKk0d/yNCEzFdlmil5NWIRg9usWmpCxcaaqDKs2cNl7mxcVe9ohsPMHvAD5Z4SFqFu9ypgSHBGG1ypk40873v0BoR7THgf4Y+qe93vCnF7vIdYuBmRMkMtIxuj3Ludy3NNiTyXZ3xHjhIfwgWGUYotdLnDr210rrk7devvcSNFDjjRJ2JBA== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB6604.apcprd06.prod.outlook.com (2603:1096:990:3f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 14:17:08 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:08 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:25 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [YTjnDSpjyhKjYIW6Vp9C+etNqoiAmN3e] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-14-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB6604:EE_ X-MS-Office365-Filtering-Correlation-Id: fdabcd08-f199-4fb7-81f2-08dc47561872 X-MS-Exchange-SLBlob-MailProps: znQPCv1HvwVyACnTOSFL5RJO0O1WevBvFLcdwvZkg4nrnjAU7cV0GId0YmiUqSeK+1UpekEI6GB4MFB3/s7edbA2+aDbsPnECF8gcS1vtcB1Yt+GnL6bePLz1ig/X1E2uUUq0Pt1xc/8iLE2to94kRkaNY67ZUzVH7vQFe5cLu5wssRK8fcxIRkUk6Wp+dq66Y37pe9lsGUZmq38UKRyw1GjXDMjvwYDd2Pu1rk9TIgR2mOfvshAYhtwUscHvUvBSzRECi2cLsqZfI4yQCHssGQfafVw6WYR2a13WScY8+lfbr3OiW31ZIPMfLAaSCISMH/C3xk2Ex62c4iumJvSJku+gOws2kNBhEiWrkBeqVKRauR2d9sUDQQ9LyCvfstgO5/nZX/bQfhtBb9WPmuNYd4aZCeZpNaAxhmFwVehDVVKFLkRNWqrBzdPPcjUOeGl2PAh57BX9dc+xJfE/fMnoCqXg7qqGKd0+YC3Kk9ROQ8Pcg27xr1qOznS4ST2laOZMIq4YTMFOymxGTGng/FwkDRzgeUxTX3iNLC27+YdcwwkOluzU+Jlykyv7ZfPSjoehql0ZXz1KjDQKGBhxwgRrY53pGl4S2k8LNBxYedj/H83xI2vqFbP+fh078vIjj6Xs0P639SoVQrnlOTuXmRCvtqa5I1yWZ/0nHTT57QUEVZ+FbyTp6npAvDtwW5ZFHuON94cIvsSHa/MdDdhgMVsYbDvbWw0+GNTVsOMgMiDdCZBJnGd2H7G6G9b99XawDw3MpnloFvpj7c= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NaSVTrHl6Dd++MujxcRwxh8UN9icDfyWsd5rreU9Lh2T4WKsLhNQx5/WftUsEpAtqGqQmyznSkGubG91xgKZN9mT6+t90dPYu7wburLzDW8DAsbnzmDnmlbXbgVPMQ2bapPkz83j/uJlmFE+9BSvbozxVsgpZo75QUEi0k4IKvefgx7vnvns3HMudGuM/8H3vpZqjSxWhhlr0oLNqU7YKHfirh3NY5LneZ8Tc0988abJli+LX2OE+q36foVhwrJRTDF4ublJLxxgzLfGoaAKncfWwUpQB4D1Y0oTKgB+mOfrpVqUR0muc2QytyWfA0l48eo/ncjaOk9EuTo+hKTNj7RKGmStdIBubDmbFVakxEe1pPew12H9rwba/b4/g+ZtMdvU+0cf6gxN15Nx6a+/e8DsWurcW+L8/zJOJx4fIuuSC9TfS2dQPBO20gU5/+3hl98A8POvxsrZjoENldMVtAK9mUjnwvoGMVWwmI//qFI3sQB80CuF7i99uEEyx9zdhDbHCG2qUqIOT2TLh+FYMMXrV9pCR2SzrhYMOUkY6aTXpcOVbkUOcG54dJX2M70W5Fscirhqp/s5DN5tFrVdp1R5IYbxcY+kAsq2ss3oqZM= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NDTIz3SJPH3+FtUbvF1oKjXisRwKtrV411Otg9s8PTYc/BUNejaOLhINGRjuJlV5YMlcTIVCeKrYQkE0Udnkn306seAfeyOCRr2Ovn+07S3ajeGY/v5V3tbnYFufzyoRI+NETL6j+8e0p9JXZ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HehDeOGzgpIzBcZz6RzHdaTH2YyJjaHbc+Xl/vBTPkY5DTNwhv3txcAK02gsZBZ2lGQrJNg9bLr+Uq+eLKaFhsYnOQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdabcd08-f199-4fb7-81f2-08dc47561872 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:08.5168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6604 Subject: [FFmpeg-devel] [PATCH 13/14] 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: ryqfhClAAJZK --- 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 Mon Mar 18 14:16:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 47170 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1042326pzb; Mon, 18 Mar 2024 07:18:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWhfPVIGtyhUaF56YIaYTUpK3gNz4BtPsPFF7IK3ZFP5ZBf8+ra+ql5eTNugSNjoAWFAGeNXGw8TpBtrI33KhPBoV9bpf2I6LLW+Q== X-Google-Smtp-Source: AGHT+IF6MV3LdXWjNaUqScGFAc8wm8hrzrc9saky4YdeiVq1nz/qEho5vz0Du2gDDXwehAU8o/Z5 X-Received: by 2002:a17:906:ecfc:b0:a46:6557:716f with SMTP id qt28-20020a170906ecfc00b00a466557716fmr7430394ejb.20.1710771503869; Mon, 18 Mar 2024 07:18:23 -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 j13-20020a170906410d00b00a46d2e93cd8si139172ejk.674.2024.03.18.07.18.23; Mon, 18 Mar 2024 07:18:23 -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=Gka9V7Ce; 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 28B0068D2B7; Mon, 18 Mar 2024 16:17:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01olkn2060.outbound.protection.outlook.com [40.92.52.60]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61FB668D2A2 for ; Mon, 18 Mar 2024 16:17:13 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZQgBj+2A/sG1Y2xDMExOKcFrOEzSz8iv2JY10i+8R2ULHBKjaWPZ4evyaWat8DuZ/eIQzx9VKbIZgahNL+BRVz05VAzAIq//A5OCNNSyeNhmUHO+HSCbz2CuyMafy59rsk/sSyYee42+iEQjPh4LuMeMK5Fr/hQ9KzPGFZLYBXF6khpWbD86vDt8mu7eJ9UKNIu9yTEINosih6ahzly7MvjhvKsTCoqOdwjF8AKjFuxbY1cuwcOtOF7Hs9VXHOb3gwt3XfFAaqOQQTGUjjs+gPIHycd8YC0Z9Rep1wR0zgLVVZIvRZ3LM1XNUEIVv0A1LCPYs7KXvcA1H2O+lLEAIQ== 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=FevQ7MTKHt2ooXzRP+427BUgnG1uUcWkTYi+18DCLas=; b=EZP0Hg9MW44anNXphklIdSOItbJfYneaq2EEPUYFBxu8j+3EJtiqN0/wM9aeI3oW0sPM+KE6KGc97djXzXoKJFynWCTkBVmTnnTOArIidGZXV94/tHeUDdlv5UZclw+zdVS5pp7SRuiWSLDd6/cpPgSbjqjw5uNpZSvQrIAhB4VmzUJiG6f0hDaXPRw1742dSioK7AMrRW6N1IJNYIaZv4WGhb2V4DTUiPutvCuJz+jgFp/U+YaXrfzWBTSIU0yCnI5yRFTQKyU8Wf3ioObW9L8VbCCwsbTHWbzHoLPmJjN4n2yVTkHhDURabLAIzQDn/KZdsgigxGaG9mSl9t+HHw== 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=FevQ7MTKHt2ooXzRP+427BUgnG1uUcWkTYi+18DCLas=; b=Gka9V7CeYJhfZ1xKDEAhyzFj0gSV6OGiOHAJNZeBv1S9kL0qwtK9r6rpbJpE3ciVkBFTYyk+36t4O7LSgDVgA1dLjOQku3yxO/xSPlBkqNcLUzrkuzkv1SX5BEjyiVosU5V0RUYC/m/0TVw3V1OEsFGuq++keiatclUjB84Y9ZWjM6+CbcIT/g7TQ1H40v614a62P4vjH8KcsOOGW2z3Qiq9nXzTpHDA1l20HNioMvyumpr5IQ9bT5UW+W7e4F9VA0XOoop+kkJveyAncH2FcVFThW96yKwWe0eL5zYpFf8JY57/uojMetH/MNR1Kxu6qOMLlwhAlZPdpuypOOHApQ== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by JH0PR06MB7327.apcprd06.prod.outlook.com (2603:1096:990:a5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.25; Mon, 18 Mar 2024 14:17:09 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::d001:da90:518b:ec1c%3]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 14:17:09 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 22:16:26 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240318141626.3375-1-nuomi2021@gmail.com> References: <20240318141626.3375-1-nuomi2021@gmail.com> X-TMN: [JHB5LR8VI0unPi4SR2EWmByc8Mz9/83D] X-ClientProxiedBy: TYAPR01CA0085.jpnprd01.prod.outlook.com (2603:1096:404:2c::25) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240318141626.3375-15-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|JH0PR06MB7327:EE_ X-MS-Office365-Filtering-Correlation-Id: ed8b30d5-57de-484e-8d8b-08dc475618f7 X-MS-Exchange-SLBlob-MailProps: qdrM8TqeFBtQM6LyuMuRQGpfKJqciaiF2muBooqnR7VI3gos38OmbjZ78mZLdpo6CohfXe/arF4/xCJrp9lRA3jxmdhZitw0Z2kpLdghr9nikvNeSGARExsvHfu4YKJaha7hcJBdMSz3ZEGzdQu2BNzxAOkMprhAtRxFeuWouO3eED/WgLYs8rrsLlR19V0eETl3q0V0bOg8RjE586SK1Y2/pzv6mKy2EZiww1UiauSLINa8KPiQEn/Ne1Cvg4p/K+w/3PJG1gecZ+crf4n5INLw6rBhWfCxqrVYOm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4HkKBrd5+GltjxQYEb8jQ9KGNSQtFf5EC/XmyBNenUQnI6qOeK7uTTGlH/U/2RKCwFtrBAXOy8psTt44UpFTEBTHfwynistOZ2iaD/v1dRUdXY4oK+YoylhYuc/CTxHX9HMM2bsES3cO+OwYsZePBzLL9n9aLfs4VBLs+jE/p2wP5GTwqMWDMuc6DSG7HDZ5cvc1vs3rVbomWGChgn8grjIFesKjlgxSZd5juMrr8fFLQlKs2IscRkVUCX5HvDQFhN9cxxeBUTyaifG1rA6PiGfQe3oDVMekUz/gEniimZrqssInu2+qd9e0b3FenjQx2guJ1/6whlkrD/0eb8s2PARQrp6ouX+0egOsaPznwZj9E92nX8zIWh1/jLbO/JU6p/JMm5gaydgBwEJ0noV6fcwY6OqRz/fRIl5gzv50cG/daZBRVPokKWPKmjxXlIda/M48dwoA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed8b30d5-57de-484e-8d8b-08dc475618f7 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 14:17:09.3688 (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: JH0PR06MB7327 Subject: [FFmpeg-devel] [PATCH 14/14] 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: /cpwgeklBmp7 passed files: 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,