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: vSs2TSW4j7xAy4xxoqlZY27gBVQaXzkAdlVA6EcCX8gNuYztNHG4fMB6JzMgaiGkl0GqoFxDHYSLJPfU/V0Jq+v01XxKKbGmW5fPqozXcPCwOhnJJIl5236nrUkEOl0KOvxObwekPRQtolCoNmYdCOf6an8JJ0HPenI15SJXgRjcLGmfui2IfZsyHiGHLCWEvKDG0K3yPA+nTQ/fXvU6mUdx0Bp/mmv36OMknsQvhV0eZF45X0hIG6Zs/TtgmH1RVw/zEcWgly/kTu7aCIEjC8zViaSn9sUqglvYngoGhUKN1ITj3n0CRS6qdmDmljmk4akKtBjyWlvjqGVFaiJHGZhtwwauk8Ou3DGlxWheDtnSM0/psbzssy85OXv1XFlxEg7fgIAheAmguzgvsPtZ7Vid6eFlFK7TOFijE+R9+LycBglQB4VK2RzC5rmpdpSr97brNsBULqdDDku3NQ6IyWdd4WG8ygQeKC+RR2vfDSSkRrgKTt3oM5RD9ZGJftlUDUKSdVRdgmxZsSKMlFTxodWn3rMr5iOCbQC1/RCYQXSCX35YT9O/jZ72/Faza0nPX9Fa4/Q/Q8nguIvOczF2I9bm+3Ir/t05rSeeuoNWAYe3SigylFR2pCbNrM7+7JUz X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4zw2VfvtLb639JMsTFygWiw6fTe6Mogg9pl9cfW39ziFg9tW1oNHlz/qum3Y8MYGj5gDxnfizrq74fiqnI4gP08bmh6PrS1WVUtOkbBlCLRDBFr1G5c2ranf9Ci5yi8CgUBPU7MR9QGvVYq/UIu/KJ0gCoGndM97GtL6SsNdeniMBTTNZFpNobMNzLozQHapiHUkWMxNgtIf/Uv0v2l7WORjialiqdyoV/Wt3xCwWbuabdD7St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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