From patchwork Sun May 19 13:27:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 49021 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp3927634pzb; Sun, 19 May 2024 06:50:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV76kW+5Oyw/gXMBdyrv4RUMXoMXLgaLo2w1CGHS5N2MLZ2u9uU9/Grt/GrQbYtuSXekGRbxCxpe3rW7VdZqj8qsSvVT+LTXD4zbw== X-Google-Smtp-Source: AGHT+IH5awf4CyoAZQXaR/DgmrdU2tp8tQH7eScR9cAaTu5crpvsvv8rCBPn2dmD2R8UP3FtF62f X-Received: by 2002:a2e:2203:0:b0:2e4:14a0:4d15 with SMTP id 38308e7fff4ca-2e5204b1e41mr181766041fa.51.1716126607061; Sun, 19 May 2024 06:50:07 -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 38308e7fff4ca-2e4d194b9fesi67315951fa.637.2024.05.19.06.50.06; Sun, 19 May 2024 06:50:07 -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=m6qurKV6; 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 7212068D239; Sun, 19 May 2024 16:40:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazolkn19010000.outbound.protection.outlook.com [52.103.64.0]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4633968D0AD for ; Sun, 19 May 2024 16:39:58 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LQJ76+jEgiUppy6yDJEShF/ewZf7r8nduLXAhY5kj8U7zVdv2Ym819QdM3dvgxTzeUK3r8A7grO8DNg6ro01MK63MR94maHdUVXrh8Q5fsLb53s0zYrzj9XZ7zrdDmQPKT5xcXg119q3Scor/kQkg1q9ZAmrtf2rpTFiqLj2EJPeUqE7VFMEmjB2icqeeaNjlHzMPUmULu70FMlyeApqTHMWyCdGRvAJ5vbNQrycL5EEzC3CraXSWzLCJbtC0U2pCI5Vs6TG4bVPQrZUIIWl0xgS2Y4UbqSvAI+tOvMeerF1nsOLXR7zHcBThyZeRDhDdNIxww1FZqNU4eRKia0jIQ== 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=IUR0hHRkwcyX19qexd0RHuyyY3WTB0TOhM6w7EM4b9k=; b=RLFoVmBSXtdHAqiJOnzZVbXID8nu7l74/+hY5t2QAenOj0POqIeAUqTqziFuAKoAlZBZtRiMi2ULOYFFlf//iUDnC+WAhxPdpi+P2pmhaSwTBO5YRx9moSJU+aFS78Dowlv5034Hq3YL8lKKAUwFdue5RWJBtq/iWw1nNJ9dlPZ0YTc44QPd1w7nwkaoC1LRg6PApGGnGrE4HmhznXmfdnHppsavnGcwrZCD5ktaFeCY+WAYdqyPL++CMGJJok9c6A//jr8pcNUWiLJEyPFOlcMjxUT978Vc926zH+wmwNMURWGTT+YyhJ2Lwtt4//mZ5kFag4A+a/BRXr+88+hEGA== 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=IUR0hHRkwcyX19qexd0RHuyyY3WTB0TOhM6w7EM4b9k=; b=m6qurKV61eyp4Zax9HDUIB4KqgT+lSU3QBSfkUPaWbxUKnoROxXmadRzBxHvFTxTKs4V+zn40Xu60lurcS4mVdvD88FK7ITi+Jkca3irNxO8M03CA9IDD7UYRjktHKdXrE9793qu+DplVvoRSVM5kZQZv6ul1ziXkjY9V4QtuNL3m1bTTb+l8Mm+be9RNWlnd/hiNVflA1Q2lKk9bYDI2CISQm5W5a18ePSCn3pJAIqbNl3Lo+KNZwUKvUS5RczOWVomiYq7Gccn7QRYp2IWe8BUJmpmWHwjcWxCvNxAj58vEOILeSpqVKcRdpPJahBYR9xnqTvxwOD/4HJu8V2pQg== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by TYUPR06MB6098.apcprd06.prod.outlook.com (2603:1096:400:358::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.34; Sun, 19 May 2024 13:39:43 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::81f7:9125:583a:1cca]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::81f7:9125:583a:1cca%4]) with mapi id 15.20.7587.030; Sun, 19 May 2024 13:39:43 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Sun, 19 May 2024 21:27:45 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240519132749.790832-1-nuomi2021@gmail.com> References: <20240519132749.790832-1-nuomi2021@gmail.com> X-TMN: [iASfSRYbnSfTW7CPGF4XSym/gTbQy65z] X-ClientProxiedBy: TYCP301CA0017.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::8) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240519132749.790832-14-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|TYUPR06MB6098:EE_ X-MS-Office365-Filtering-Correlation-Id: a6b9ff3f-7edc-45b2-0ecd-08dc780923e1 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: /96emjFpX1ZvZQxR2xgwhiNOiSSqTcwoR7tUMYQZb1i9fL7JCfAfGy3cMmmgO2UIdtFKle4ZWmF/qrOVJzU7e9j85MbYzVr9DPhwAjy0PnKkfD9WNS1NvNL5jhXC+YZp+QRhz0nY2ZPJW6SB6b3Vu5gNd+eNq2pzhgWDzeUSG3I3icDhQAlfWUt04mUylOj2hbC02nhJtap7z79Ba6yyBGUw6IRT196RMtwKcctiPlep0jLSk5LjejEerRE+7SHfax7U467h8asfFaPSo+hz5A/y/hlgVuyW4JPDs5nGjq4HRX9mtBfOLSHL0NfCvh2YmRkq1TKOhNyXD/V96w4jQvaCAxp8EXYYRtzv0eLZGV1QYHGtdC6mktXpW5FEtxxBtOhJJWx3ibwKfcx/85zxBkuvrRP/fKPl8x7YCAMJJDj5z0FjGzkqzdVUl3WXLAIgrAbB42WYbXkt59ZaTGUdxtNgxi3RaAIlRJbankyDVmMNOzRInS8xNilBLvgf5SAAX4LhwROwTsRdWu7Qs/ERWsTmc5LH/apV7MlXTy0/6JwsQ3WaofSp/D8yNvQXSQdEGU1saDio5lNLwZDp/vF0IneF0WeKX85EbftbWaeKYJO4ghC23gVSSb5jHgvwlVgN X-MS-Exchange-Ant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pTv3/8eN09haubOH4BQtBEUXXAkTexGDDBNreni9CJuljqNtlaR2LB54T65Fm7OcJjaMnD5PjDSZrB3tKWFOLsszUj8U/9wNd7JGNTAiyA/sfIm00MBinAhCch/KtQwxc+dxnQIqsSZCUi5gyvFZeS3OVkuFZUQgIs8G+nOhIHNo6X0Yt1LWfScbYiIT3ZGkDWK4XDEikJizAqGt9kDGc5NCmgHlv+alGeo5RdRmFUAxG7nd0RccnLMQS9z8mcUF6vsPQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6b9ff3f-7edc-45b2-0ecd-08dc780923e1 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 13:39:43.3534 (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: TYUPR06MB6098 Subject: [FFmpeg-devel] [PATCH 14/18] avcodec/vvcdec: refact out luma_prof from luma_prof_bi 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: sqmSG8GRVQ2Z --- libavcodec/vvc/inter.c | 52 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c index f432a2dc3c..23b9a8af6b 100644 --- a/libavcodec/vvc/inter.c +++ b/libavcodec/vvc/inter.c @@ -347,40 +347,48 @@ static void luma_prof_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst } } +static void luma_prof(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, + const Mv *mv , const int x_off, const int y_off, const int block_w, const int block_h, const int lx) +{ + const VVCFrameContext *fc = lc->fc; + const PredictionUnit *pu = &lc->cu->pu; + const int mx = mv->x & 0xf; + const int my = mv->y & 0xf; + const int ox = x_off + (mv->x >> 4); + const int oy = y_off + (mv->y >> 4); + const int idx = av_log2(block_w) - 1; + const int is_chroma = 0; + uint16_t *prof_tmp = lc->tmp2 + PROF_TEMP_OFFSET; + ptrdiff_t src_stride = ref->frame->linesize[0]; + const uint8_t *src = ref->frame->data[0] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); + const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx]; + const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my]; + + MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, ox, oy); + if (!pu->cb_prof_flag[lx]) { + fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](dst, src, src_stride, block_h, hf, vf, block_w); + } else { + fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](prof_tmp, src, src_stride, AFFINE_MIN_BLOCK_SIZE, hf, vf, AFFINE_MIN_BLOCK_SIZE); + fc->vvcdsp.inter.fetch_samples(prof_tmp, src, src_stride, mx, my); + fc->vvcdsp.inter.apply_prof(dst, prof_tmp, pu->diff_mv_x[lx], pu->diff_mv_y[lx]); + } +} + static void luma_prof_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, const VVCFrame *ref0, const VVCFrame *ref1, const MvField *mvf, const int x_off, const int y_off, const int block_w, const int block_h) { const VVCFrameContext *fc = lc->fc; - const PredictionUnit *pu = &lc->cu->pu; const VVCFrame *refs[] = { ref0, ref1 }; int16_t *tmp[] = { lc->tmp, lc->tmp1 }; - uint16_t *prof_tmp = lc->tmp2 + PROF_TEMP_OFFSET; - const int idx = av_log2(block_w) - 1; int denom, w0, w1, o0, o1; const int weight_flag = derive_weight(&denom, &w0, &w1, &o0, &o1, lc, mvf, LUMA, 0); - const int is_chroma = 0; for (int i = L0; i <= L1; i++) { - const Mv *mv = mvf->mv + i; - const int mx = mv->x & 0xf; - const int my = mv->y & 0xf; - const int ox = x_off + (mv->x >> 4); - const int oy = y_off + (mv->y >> 4); const VVCFrame *ref = refs[i]; - ptrdiff_t src_stride = ref->frame->linesize[LUMA]; - const uint8_t *src = ref->frame->data[LUMA] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); - const int8_t *hf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][mx]; - const int8_t *vf = ff_vvc_inter_luma_filters[VVC_INTER_LUMA_FILTER_TYPE_AFFINE][my]; - - MC_EMULATED_EDGE(lc->edge_emu_buffer, &src, &src_stride, ox, oy); - if (!pu->cb_prof_flag[i]) { - fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](tmp[i], src, src_stride, block_h, hf, vf, block_w); - } else { - fc->vvcdsp.inter.put[LUMA][idx][!!my][!!mx](prof_tmp, src, src_stride, AFFINE_MIN_BLOCK_SIZE, hf, vf, AFFINE_MIN_BLOCK_SIZE); - fc->vvcdsp.inter.fetch_samples(prof_tmp, src, src_stride, mx, my); - fc->vvcdsp.inter.apply_prof(tmp[i], prof_tmp, pu->diff_mv_x[i], pu->diff_mv_y[i]); - } + const Mv *mv = mvf->mv + i; + + luma_prof(lc, tmp[i], ref, mv, x_off, y_off, block_w, block_h, i); } if (weight_flag)