From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BEE7247A73 for ; Sun, 28 Jul 2024 03:20:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD33A68D7AA; Sun, 28 Jul 2024 06:19:24 +0300 (EEST) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2107.outbound.protection.outlook.com [40.92.53.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 87AF868D79B for ; Sun, 28 Jul 2024 06:19:16 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v6k303Xz4fnMn0aFvbEBR3Mt1uNAvpxL6/kTZi9Ohs1NjWdReE4rf3nEiWAkubUprAK8Z1kRaVc012cJ+kNMrEdcYyVcs8096B/b/AJ/fieWemXyD2pW0t6NgQjAG7PCWGHRkS62IMYL4CvrkP+1eQaTYDsYy1hAQEyKbTPAXdem+yoTEp3RqVge771NFRrIY5I7bkIeEwHer0o6v0+nJsY/1q2XTORVeWljjDE/Bi5h0YoJxPqJbh5wFv72FZDvd4NXI2ZnOATuUeVoweB+BUon5W5TIWQ6XHd4xqMYXzsJJcJvYj2MRckl2tUFNmV5zkXcGyhw6EydCaYETNwycg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1X1teiHQCWJnHdhGHnn0B+aKqi644uD3OK1ZQ8GRUR8=; b=aP+rK4+pX61dB8F3IM/Rhwqul8sbjhVRRqAasxgUS8V+WKHdjmJ0t8uCKCSCRpi0jfY7QVtj2ts6cHvDW80OlV1CxZybiCNpjUWfztl0Wm6vw+FLUnOWWNuiM1Xa/sWUdxggAKTCSDAJpH9Lro4+0hAj9ONNaf1wXPmuKOiv7Nu468+SfedQQliKGDdFxi+kPqj344KeDj3GQZhRg7lu/z4asnz23bwgbrOp75Cpztxc7XueHlhFoEj0FW3KT+8hO8DAe6LTW/xIYX6T0UXJd8ze3+rbDPdNCAybl9akPvj7LZ+uh3oT5bILJLmk05TTezb+oEKWjBPEwx8658W/VQ== 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=1X1teiHQCWJnHdhGHnn0B+aKqi644uD3OK1ZQ8GRUR8=; b=H9H47y5hEN+VqeCmikTTfLnn6gKVqAl//lQya0hxDGZpDktFomW2GrO/KdKhHa095pLLoZEVcbNSCsipxPCpksWj9GazP7K5gpY5LKEFUj/B3vfmOpfRS02cuL64ZkI2zpunLSoybSisrmpOiytmvPc9L48WK1z6HhG/5FIe59cqpL6/xyZlFuJjJkc3HYZLnqMYwK0Pc3sJqTLDotbwmthqeLZohE1Y88JplpqU84l6gyfE7CUEHnGrS2yS5SEwoS852GhcxdMlNqZZF2wWaGMG6dMDKQrgsUcxtwVwd0RO3weDH1OuuZtEDnfnChbLenUClRgPY0fhOMZvQ3oEZA== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by PUZPR06MB5747.apcprd06.prod.outlook.com (2603:1096:301:f4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.28; Sun, 28 Jul 2024 03:19:04 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::81f7:9125:583a:1cca]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::81f7:9125:583a:1cca%3]) with mapi id 15.20.7784.020; Sun, 28 Jul 2024 03:19:04 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Jul 2024 11:18:00 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240728031807.462810-1-nuomi2021@gmail.com> References: <20240728031807.462810-1-nuomi2021@gmail.com> X-TMN: [j9Ao25ehHCC+iVEnvMaTZD5ashYu0QFu] X-ClientProxiedBy: SI1PR02CA0016.apcprd02.prod.outlook.com (2603:1096:4:1f4::17) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240728031807.462810-4-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|PUZPR06MB5747:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cafc4b7-eecb-4ca8-a537-08dcaeb408e7 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199028|8060799006|19110799003|5072599006|3412199025|440099028|1710799026; X-Microsoft-Antispam-Message-Info: Obm3icpsJcugwsK4AcTPj+1xt4IiedQciQz+IVWXYyqhc2Lv4E8vbioC6aqNUH60NgEBrb+Y17UUKQEOq9ZqqcS1LdhbQKF/A6ZrFW/fLWvYKWw9QtyL2+i9hQNenNcgKFsG5wfYZXoA4L1n3JVrBGDnIuy3AtCuxyoA6LwVpoXNQADBKiJoFUrHAe2x6M23OJBXLKis/8uh2k/uGJD6PJi9xOm06sVNpTPqLHMYAfcpAkBKHDnJjM0YP8XN7wq/TBojfNKFlzelUC62PwRPPkWterIf4MS6wNTgqOumqYy/ERVwJ+PHS0IbK97qIFbSi6tqyMYIBHvr/NdVYduo2F9KcVISpEUd9GzVa25dAE/yPeUjV+767+Nc0ITjzbhqUe5i0eCxZOZRdYumHN+df/0HsQbND+8pHaJGg7BdX/x3Iv2NDoysS3rpQLm2Mmq8JegYOK0uzt92cU7UJTElOXcId6B1+24kzVFRvvXUP88wYE1je5DVwCqOxOSvwUW6duy6wYT7Umxl9Pge1wt8nFqJnPwt7uqSMjE+55YcdQ77MZYe7KLB6LvAzARfHkvmH+neRP/n0WFWnu7vvC4pYmuf3MiteZeA1xjm2ZTKQUf12yneBtaWhe6CHzgGwE049wg3g+9KvX0VDWl1rqXBI5XR2uVsUBLs8qbdZEY+slWqgTjc1U2iAyDb2cWz75A6iqcDvqaoqg1FvsjlxYXE4w== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3wjfU1J3/F2BN6Zkh0LL2WxL1WR4ziVwgYqMnmUpgY0pxOi/SFafCQkG2Lin?= =?us-ascii?Q?MabCSIJb4jS2zYoEgdDZXDfZ7JF3FgRrn1LC6lJ8mHiKec7VFIpiXcT4sbgc?= =?us-ascii?Q?xVtlgzVGEIp+H0JxHt+zVX99f1zEJIexazKPGzFRLnP6FhbUlZLAI32cD0pj?= =?us-ascii?Q?p2ZI3Jms7LEXXKOi2ZD7pQyuFP4RQ+11TdvW3RBIjD22n2q5vpSisdGtsGj9?= =?us-ascii?Q?iVjZXxeKUoMmdGQkVG5GW1McNtqcbTKkrnmLVxTn0sMOvrl9ADLqWYF0sp0H?= =?us-ascii?Q?IUojMbj001UhozVacKY9uPHMJ6JBCEODIsifSBkBHt0HuDN+UqPn/cLMbNMs?= =?us-ascii?Q?w7W0UQbhkiqglpWVMvmNYuCr3Li9SSTmS6tssOG+wnajiDKurfFb6klR+uFT?= =?us-ascii?Q?znl5xRqRgvZfwkybE2nxYogeLzZu1/K7H6QvbbV9wEij5oMrg4Pl1j9xabhE?= =?us-ascii?Q?qTMfKFSSm1whttaOatYA8RfnRHes4x84hHJBCv5xfeZHs/mHktpOipwR4SYt?= =?us-ascii?Q?ElbcfzP7F11I9bjDvphw5JI0ceXh1rOsRJa1sCrMWLzFVes/rSGQ+vTTaEek?= =?us-ascii?Q?LIAZCKLeLWZlRnZFyk45h4SXTqjCMEVi2NPo1w9x0Wb6f0cpzaRATfdhB0d0?= =?us-ascii?Q?RkKs/F/JyMevZZirkw7lmhng2fcnCQ0BzpVHQyXwxd8j+C4/2fez6WJ7Zdmq?= =?us-ascii?Q?8PFMlolEFWwWQjyZnBWTAxy0hQ/Yv+tyPRytfTBuiiXxD3p+n5LSMwxS00VX?= =?us-ascii?Q?1cYEp2nGEDCxM807XrOhVvlEfl7tFAMMYRuCtP2BdMnSgUtNGxyGO64Yxkwn?= =?us-ascii?Q?pThnCpJuoceURx+/+zdiv30ngg63dO6z32U126qYE55mXx5wXGNHwf5sUNUP?= =?us-ascii?Q?UHjHjMYYaaXIghC8LLevrvLNSbYpFWF8WCuIF+9kjOpH3Q9I/lE09v4IjaB1?= =?us-ascii?Q?xf6SlNkVKYfmGMkcRwo29UUyHBX0oDJtAjx75JZKrm0NlQ1sCZ73yWFgDJz3?= =?us-ascii?Q?4n8lOBqZDbcGYyystzJDdM+BakAJyacOCUryVBBdAB4DxAdAXpTiJDRcBikt?= =?us-ascii?Q?FqeSw7X4S8vz7Gwu6zBbyhdeXArWBvx5E5xK7y5DEupNi3JDKyp8xnMxFJh+?= =?us-ascii?Q?jHox8qOqTFKyJyHcN6bntjocby5H52gTvtV/xCbZ8qZ5mMXW9ltOdXxwVtR5?= =?us-ascii?Q?OVLfSm9RVQMIolB1LFxezsU23CyIwc+pf3MTRBrie4NifrsmTFo0xqblPZhY?= =?us-ascii?Q?N96/KTr88LHfrSGU5G42MvscNTbHuEgPx46l0omKhA=3D=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cafc4b7-eecb-4ca8-a537-08dcaeb408e7 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2024 03:19:04.8443 (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: PUZPR06MB5747 Subject: [FFmpeg-devel] [PATCH 04/11] avcodec/vvcdec: split ctu table to zero init and no zero init parts 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: cus need to init to zero, other parts are not --- libavcodec/vvc/ctu.c | 11 ++++++----- libavcodec/vvc/ctu.h | 3 +-- libavcodec/vvc/dec.c | 21 +++++++-------------- libavcodec/vvc/dec.h | 5 +++-- libavcodec/vvc/inter.c | 3 +-- libavcodec/vvc/intra.c | 5 ++--- 6 files changed, 20 insertions(+), 28 deletions(-) diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c index 3f9a75190b..d39dd579ae 100644 --- a/libavcodec/vvc/ctu.c +++ b/libavcodec/vvc/ctu.c @@ -1174,7 +1174,7 @@ static CodingUnit* alloc_cu(VVCLocalContext *lc, const int x0, const int y0) const VVCPPS *pps = fc->ps.pps; const int rx = x0 >> sps->ctb_log2_size_y; const int ry = y0 >> sps->ctb_log2_size_y; - CTU *ctu = fc->tab.ctus + ry * pps->ctb_width + rx; + CodingUnit **cus = fc->tab.cus + ry * pps->ctb_width + rx; CodingUnit *cu = ff_refstruct_pool_get(fc->cu_pool); if (!cu) @@ -1184,7 +1184,7 @@ static CodingUnit* alloc_cu(VVCLocalContext *lc, const int x0, const int y0) if (lc->cu) lc->cu->next = cu; else - ctu->cus = cu; + *cus = cu; lc->cu = cu; return cu; @@ -2429,7 +2429,9 @@ static void ctu_get_pred(VVCLocalContext *lc, const int rs) const VVCFrameContext *fc = lc->fc; const H266RawSliceHeader *rsh = lc->sc->sh.r; CTU *ctu = fc->tab.ctus + rs; - const CodingUnit *cu = ctu->cus; + const CodingUnit *cu = fc->tab.cus[rs]; + + ctu->has_dmvr = 0; if (IS_I(rsh)) return; @@ -2526,9 +2528,8 @@ void ff_vvc_set_neighbour_available(VVCLocalContext *lc, lc->na.cand_up_right = lc->na.cand_up_right_sap && (x0 + w) < lc->end_of_tiles_x; } -void ff_vvc_ctu_free_cus(CTU *ctu) +void ff_vvc_ctu_free_cus(CodingUnit **cus) { - CodingUnit **cus = &ctu->cus; while (*cus) { CodingUnit *cu = *cus; TransformUnit **head = &cu->tus.head; diff --git a/libavcodec/vvc/ctu.h b/libavcodec/vvc/ctu.h index d5c3e8d96f..eab4612561 100644 --- a/libavcodec/vvc/ctu.h +++ b/libavcodec/vvc/ctu.h @@ -329,7 +329,6 @@ typedef struct CodingUnit { } CodingUnit; typedef struct CTU { - CodingUnit *cus; int max_y[2][VVC_MAX_REF_ENTRIES]; int max_y_idx[2]; int has_dmvr; @@ -484,7 +483,7 @@ int ff_vvc_coding_tree_unit(VVCLocalContext *lc, int ctu_idx, int rs, int rx, in //utils void ff_vvc_set_neighbour_available(VVCLocalContext *lc, int x0, int y0, int w, int h); void ff_vvc_decode_neighbour(VVCLocalContext *lc, int x_ctb, int y_ctb, int rx, int ry, int rs); -void ff_vvc_ctu_free_cus(CTU *ctu); +void ff_vvc_ctu_free_cus(CodingUnit **cus); int ff_vvc_get_qPy(const VVCFrameContext *fc, int xc, int yc); void ff_vvc_ep_init_stat_coeff(EntryPoint *ep, int bit_depth, int persistent_rice_adaptation_enabled_flag); diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c index d609fc5184..568229d2c3 100644 --- a/libavcodec/vvc/dec.c +++ b/libavcodec/vvc/dec.c @@ -91,17 +91,6 @@ static int tl_create(TabList *l) return 0; } -static void ctu_tl_init(TabList *l, VVCFrameContext *fc) -{ - const VVCPPS *pps = fc->ps.pps; - const int ctu_count = pps ? pps->ctb_count : 0; - const int changed = fc->tab.sz.ctu_count != ctu_count; - - tl_init(l, 1, changed); - - TL_ADD(ctus, ctu_count); -} - static void ctu_nz_tl_init(TabList *l, VVCFrameContext *fc) { const VVCSPS *sps = fc->ps.sps; @@ -112,6 +101,8 @@ static void ctu_nz_tl_init(TabList *l, VVCFrameContext *fc) tl_init(l, 0, changed); + TL_ADD(cus, ctu_count); + TL_ADD(ctus, ctu_count); TL_ADD(deblock, ctu_count); TL_ADD(sao, ctu_count); TL_ADD(alf, ctu_count); @@ -307,7 +298,6 @@ typedef void (*tl_init_fn)(TabList *l, VVCFrameContext *fc); static int frame_context_for_each_tl(VVCFrameContext *fc, int (*unary_fn)(TabList *l)) { const tl_init_fn init[] = { - ctu_tl_init, ctu_nz_tl_init, min_cb_tl_init, min_cb_nz_tl_init, @@ -334,9 +324,9 @@ static int frame_context_for_each_tl(VVCFrameContext *fc, int (*unary_fn)(TabLis static void free_cus(VVCFrameContext *fc) { - if (fc->tab.ctus) { + if (fc->tab.cus) { for (int i = 0; i < fc->tab.sz.ctu_count; i++) - ff_vvc_ctu_free_cus(fc->tab.ctus + i); + ff_vvc_ctu_free_cus(fc->tab.cus + i); } } @@ -364,6 +354,9 @@ static int pic_arrays_init(VVCContext *s, VVCFrameContext *fc) if (ret < 0) return ret; + // for error handling case, we may call free_cus before VVC_TASK_STAGE_INIT, so we need to set cus to 0 here + memset(fc->tab.cus, 0, sizeof(*fc->tab.cus) * ctu_count); + memset(fc->tab.slice_idx, -1, sizeof(*fc->tab.slice_idx) * ctu_count); if (fc->tab.sz.ctu_count != ctu_count) { diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h index eb8d0bad6b..d27cf52ca2 100644 --- a/libavcodec/vvc/dec.h +++ b/libavcodec/vvc/dec.h @@ -187,8 +187,9 @@ typedef struct VVCFrameContext { uint8_t *alf_pixel_buffer_h[VVC_MAX_SAMPLE_ARRAYS][2]; uint8_t *alf_pixel_buffer_v[VVC_MAX_SAMPLE_ARRAYS][2]; - int *coeffs; - struct CTU *ctus; + int *coeffs; + struct CTU *ctus; + struct CodingUnit **cus; uint8_t *ibc_vir_buf[VVC_MAX_SAMPLE_ARRAYS]; ///< IbcVirBuf[] diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c index 9578fd8de4..64a9dd1e46 100644 --- a/libavcodec/vvc/inter.c +++ b/libavcodec/vvc/inter.c @@ -1003,8 +1003,7 @@ static int has_inter_luma(const CodingUnit *cu) int ff_vvc_predict_inter(VVCLocalContext *lc, const int rs) { const VVCFrameContext *fc = lc->fc; - const CTU *ctu = fc->tab.ctus + rs; - CodingUnit *cu = ctu->cus; + CodingUnit *cu = fc->tab.cus[rs]; while (cu) { lc->cu = cu; diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c index f77a012f09..e79a83bc30 100644 --- a/libavcodec/vvc/intra.c +++ b/libavcodec/vvc/intra.c @@ -664,8 +664,7 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in const VVCSPS *sps = fc->ps.sps; const int x_ctb = rx << sps->ctb_log2_size_y; const int y_ctb = ry << sps->ctb_log2_size_y; - CTU *ctu = fc->tab.ctus + rs; - CodingUnit *cu = ctu->cus; + CodingUnit *cu = fc->tab.cus[rs]; int ret = 0; lc->num_ras[0] = lc->num_ras[1] = 0; @@ -691,7 +690,7 @@ int ff_vvc_reconstruct(VVCLocalContext *lc, const int rs, const int rx, const in ibc_fill_vir_buf(lc, cu); cu = cu->next; } - ff_vvc_ctu_free_cus(ctu); + ff_vvc_ctu_free_cus(fc->tab.cus + rs); return ret; } -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".