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/DAyaf2MlHdl4A1fuX4hQtGl1nj7RVLI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ant-Network-Message-Id: b3645bce-37f9-4ca3-70ab-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 &&