From patchwork Tue Jul 23 18:48:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 50718 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2815348vqm; Tue, 23 Jul 2024 11:49:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVKj7GVvyMfNoW44ilXedFWgzb8UxzVBARtcMsEI/iB3VCZKWU2w4k97tHF0COt6UeWh+uoNlDP+tQZOnogh29FO96jiccdv6uEYA== X-Google-Smtp-Source: AGHT+IGEBrGx4nuuznJb17tIvZwUW0tQh01AzFhfHr5vXtin0IxTE0haL5aAQKFREm6emOwJWB9c X-Received: by 2002:a17:907:80c:b0:a77:c7d8:7b4c with SMTP id a640c23a62f3a-a7a9424e5a6mr330857466b.11.1721760562859; Tue, 23 Jul 2024 11:49: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 a640c23a62f3a-a7a3c993975si557385866b.1007.2024.07.23.11.49.22; Tue, 23 Jul 2024 11:49: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=YneX+fyB; 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 76A5B68D28D; Tue, 23 Jul 2024 21:49:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazolkn19011039.outbound.protection.outlook.com [52.103.43.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D02D68D28D for ; Tue, 23 Jul 2024 21:49:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O+TQeqNdEkVy6YuL399kPfFRbCE0hGQtxt4H+ES5lH8WcRyBv6zW1+9AyPf9TSFvgvqyhcEKw6e8/It3ibisamphPLK2rcbi6zz4p/qik5/Yv0SzO1DxO3UJi4VrZUYx8khSd0U8scL1nUKhZW6jmjfkLTDCYlA/tlISlkrtjfDk9ZAlBeyhsS1M2zfB2wrmWTtZ1s6oElR7z4KZ6X8w9kNZW++bsXz0AnF8/1x1c1unwgUtN39e//KNSjBJ8q6A92ffeBL3AKdeYtzpfw0YUqYu17tOzH86KN/yuQO6RQcg2QK1qYDzqHPkbSIwz4xWakF/aDvNk4jLxdjwnLwz5w== 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=fg12NvwEoHiVYf1I9fRWyD+0XbEy+BP5bL4noUsbshI=; b=wzQJYugWnYTzYYByJHXOl7RsQ04PpVGcYsQ/zT5yrkd4OD5npnkFvKke0qxyQnDXyvnMBblvHyB7pEupDvsfF0eo/oQonodbsNEoyRCvyk4O91aTMYlAuzwoakpT3oJEcqg9mL6q+LQ1qQxKFad7WEgJtKUrwNTGfvWfIuUY0mjztVeddN28aqqaCMwSNV8L2QklLrbCYCaJYU1XYe6iTKg4077fMMn5JaSMSjZp3/v3DZgcmNchDDO7M88x+zLQF8iItPg1201XRXVmFRUEf6bpj/I9Bq7c7gDdHDfLm304uBu4IfbGWvpagrl8OjezyQ0I9mILfrQs/IjgkGlmCg== 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=fg12NvwEoHiVYf1I9fRWyD+0XbEy+BP5bL4noUsbshI=; b=YneX+fyBwU5xVXNKFA3HBiHLIOT8LkAfhJsaevxgTFCvdp4E62Kyp2hu+pVCAc/tyYnNYe1re/F1uUkZRlrRInhiJHL7GbJJEtev2175/awfwmdSAqt04z7QXlUPk6OcgiKhK/Hs3DaiggN4X0SZABtKt4zLzfKwaRn1cDVh3mYyG1j7szMpivksmzeGdu1DjyfBOAT6V52Oy8VyySWqxicq7mW6T/ei1FCM8KQVWrjxz8jjKRG4sBnT8XeO3qy9lR3a3Cy/0y6R4682ATR0zjwVXsfY35OJgzFcq674mtCLaK0tTzP9fnZ/wHY8K4rkzN6rnmbYDXE0nFW3HbI46Q== Received: from OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:186::5) by OS3P286MB2213.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:198::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.17; Tue, 23 Jul 2024 18:49:01 +0000 Received: from OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM ([fe80::451b:2fa4:87f7:14a9]) by OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM ([fe80::451b:2fa4:87f7:14a9%6]) with mapi id 15.20.7784.017; Tue, 23 Jul 2024 18:49:01 +0000 From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jul 2024 02:48:08 +0800 Message-ID: X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20240723184808.1764-1-toqsxw@outlook.com> References: <20240723184808.1764-1-toqsxw@outlook.com> X-TMN: [SSlVcmCKQWD/CleigXq1XzEUhH8YJVTm] X-ClientProxiedBy: TY2PR01CA0011.jpnprd01.prod.outlook.com (2603:1096:404:a::23) To OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:186::5) X-Microsoft-Original-Message-ID: <20240723184808.1764-3-toqsxw@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2173:EE_|OS3P286MB2213:EE_ X-MS-Office365-Filtering-Correlation-Id: 134cfef7-1a58-44fd-c384-08dcab480c04 X-Microsoft-Antispam: BCL:0; ARA:14566002|8060799006|19110799003|461199028|1602099012|440099028|4302099013|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: +CMeBKAX2wQ11643vOGG0qKfSL+ebzn10ifeStzilScNIFSiCUkAG9HjpRVdFyEp9XqTJvoL6Ma2di4PedTt8osobw19sPM5SczGCLQNR+6vutCCNWNxVT87JthM9CPL0NKfzLit6x6n36Z/6Yx4lk/Qh2F2WtJjN+yYiJZ4m1a2Z2xPRQEVAEyjKo4DzvET8nx5apSsZi41EO36BAhHZe7E/PIiCWb5Q5Fplzn3YWApRTxnCMBKbxtYPYsSTtYMXqH+I/ypQZD/51lApO0V9mXCYOCpfL87Ux+aXr8Q6fj0YBp/qBvfTohJzIKbouG8Q4JTQGCIUFEonNR4jm9A72f7v92QS9awakjwWszrZpX4Nfp4gDzDT//QD+pZRnoj7tYG/6t1yZJ0k48FByPlXbEZ3Po6eY4WU6bxY5xTivMsHxNuWs2IleyO1Axou87TQeuaFaHWb22LoiSGW8svZ/X/RWUGTyzZdw3T8mIqK4G1S3Q/xJuq+iPDT4QkXBa8aztKnlieN00WrtlAZO2rTH3HmftKHy3cso+ln94Go4DM5qLxms2+F5daz3fDkv8q7FtZ+PPWQPeVxCsMccoNwtMlawygxMqa5ThgI+gdjr3Ng+v6HB3yZ044mYMSZEmLmq0c5TNZ3ZnBZ7C/uuXzbNLqhmFSZdy9D1WJat2ptjX/7B0SimUr2nR2Y58r78sJKcTgnFxP5FRFVu8LhtHyecvWDTiuaiA+DAqr9Dv/pmUYDm2qOOmgMAIoJvcxnAr3TRnYqYd8SGHOWz5U/lj3nHKTvcwBmbL4gyHPae26auc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mJS2GC8tXTM3+2aRaCuKVUAatiZvOaakqdreCa4wWTSHjegPNvObkT7vx+YbogPInycwa+iUOdd6C/S6ezPrplOH94kycyDPGFbMd/SlvLPgag/RHolAP8OuI8aGDoo/tPbZkS0+SrTFAEXapiaErYV1litowett4fynrXTrAeNg392vureoybthUB3x0IsDXpMeqRNObn1kwVyl2pDwT2BPHn1QBF61gK81zVgwuEb8FifWyje3flkdV8nKYRqnf2SioyJzX22qxfAUqkfEkUa3G34S49ZkyArHAhIhzusmgmMHCBF1yPZEFsj2O+wY+f7ruHBalftJaZbqPIC3At8ovYuWzx+fIzXbwD1PsDQ7BfptroKvdm/j3eBSQnv3xbSDCgHywNFXgHcAJl34pRqH3Cq8CPAYOz1wTXI0xNQEPoDXxrIBqW/GsPG9ldnkWMeXQ0uHcmMGQ84fbv8eV9+DnBeooiych4kN43ZP+1rgnj4qaoXaN/PBWn+QzBVx0unogIbWvTizZeAN8s8fsBo2ZTIRHxwA8YS/gnEM/omIeMuJXpiKsMTkoBOaiQDerZ0fdAYJXpRBBMMtdxXrzF5c35zRsJEGMANBdPOl7ujgw041pVHbq4pltkMdFB/eduKG2waKZnf4htQRJEqd966AFVU81ZK83+ZC7qbOuBim0mTV6203NIIhc+7bN8AWbCy5UZd9RFhSU+kVn658v+O+IBJYflezAtnvW7Ch3iX5ha51QDjG6atnS9E1TifpKRdeDE/Vm/WcAdvMwPbPk9+SbKIsKXqiymspnRq6VtJ/7XkzaSXyuKbrgYbwZ+3UlLwnbyRoILmxTvwKiXSKQ6aS70WzNlgMbdRxWAglQ12wf9y3DlExxVhgwlUXMOq2HPjKnI4lIoP+eM5VzK5eJXd9GAmzidq4PR+G7JVtM+W35HBcGwn2v/oNSyHSM5AQL1/Rolz2XZaxtrDPxwiC123bR7aYser+6WzxMXmzWFxPYcFgFP7cB76smEDcH0TZoO36Ttwq+WsFwfH24VDx5higoZ35q3wlDZI6X7yTGQxnGrMiGS73BOe0Wj1wavpE5AkB1YCqrAd+WvJY6z7AS7oTHt27YKd08wP2pUNOA+Ib/fIBo16I9iwjOZbgfgH8MR9K6P4due/iUh7aFgDLD1QCp1y7Av9C8o/edJVY26mwd1VsnHq4acYRYClWWumDELBX6LVYcnbe3tgtavdaRIjKYnCSHG3xyZNvHwNQ/OE= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 134cfef7-1a58-44fd-c384-08dcab480c04 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2173.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2024 18:48:30.9641 (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: OS3P286MB2213 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/vvc/dsp: prefix TxType and TxSize with VVC 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: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: izsMAgdvxmlR From: Wu Jianhua See https://github.com/ffvvc/FFmpeg/issues/180 Signed-off-by: Wu Jianhua --- libavcodec/vvc/dsp.h | 28 ++++++++++++++-------------- libavcodec/vvc/dsp_template.c | 2 +- libavcodec/vvc/intra.c | 26 +++++++++++++------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/libavcodec/vvc/dsp.h b/libavcodec/vvc/dsp.h index 1f14096c41..662092fafc 100644 --- a/libavcodec/vvc/dsp.h +++ b/libavcodec/vvc/dsp.h @@ -27,21 +27,21 @@ #include #include -enum TxType { - DCT2, - DST7, - DCT8, - N_TX_TYPE, +enum VVCTxType { + VVC_DCT2, + VVC_DST7, + VVC_DCT8, + VVC_N_TX_TYPE, }; -enum TxSize { - TX_SIZE_2, - TX_SIZE_4, - TX_SIZE_8, - TX_SIZE_16, - TX_SIZE_32, - TX_SIZE_64, - N_TX_SIZE, +enum VVCTxSize { + VVC_TX_SIZE_2, + VVC_TX_SIZE_4, + VVC_TX_SIZE_8, + VVC_TX_SIZE_16, + VVC_TX_SIZE_32, + VVC_TX_SIZE_64, + VVC_N_TX_SIZE, }; typedef struct VVCInterDSPContext { @@ -127,7 +127,7 @@ typedef struct VVCItxDSPContext { void (*add_residual_joint)(uint8_t *dst, const int *res, int width, int height, ptrdiff_t stride, int c_sign, int shift); void (*pred_residual_joint)(int *buf, int width, int height, int c_sign, int shift); - void (*itx[N_TX_TYPE][N_TX_SIZE])(int *coeffs, ptrdiff_t step, size_t nz); + void (*itx[VVC_N_TX_TYPE][VVC_N_TX_SIZE])(int *coeffs, ptrdiff_t step, size_t nz); void (*transform_bdpcm)(int *coeffs, int width, int height, int vertical, int log2_transform_range); } VVCItxDSPContext; diff --git a/libavcodec/vvc/dsp_template.c b/libavcodec/vvc/dsp_template.c index 8130abbccf..1aa1e027bd 100644 --- a/libavcodec/vvc/dsp_template.c +++ b/libavcodec/vvc/dsp_template.c @@ -97,7 +97,7 @@ static void FUNC(transform_bdpcm)(int *coeffs, const int width, const int height static void FUNC(ff_vvc_itx_dsp_init)(VVCItxDSPContext *const itx) { #define VVC_ITX(TYPE, type, s) \ - itx->itx[TYPE][TX_SIZE_##s] = ff_vvc_inv_##type##_##s; \ + itx->itx[VVC_##TYPE][VVC_##TX_SIZE_##s] = ff_vvc_inv_##type##_##s; \ #define VVC_ITX_COMMON(TYPE, type) \ VVC_ITX(TYPE, type, 4); \ diff --git a/libavcodec/vvc/intra.c b/libavcodec/vvc/intra.c index f77a012f09..73dca6dc85 100644 --- a/libavcodec/vvc/intra.c +++ b/libavcodec/vvc/intra.c @@ -128,15 +128,15 @@ static void ilfnst_transform(const VVCLocalContext *lc, TransformBlock *tb) } //part of 8.7.4 Transformation process for scaled transform coefficients -static void derive_transform_type(const VVCFrameContext *fc, const VVCLocalContext *lc, const TransformBlock *tb, enum TxType *trh, enum TxType *trv) +static void derive_transform_type(const VVCFrameContext *fc, const VVCLocalContext *lc, const TransformBlock *tb, enum VVCTxType *trh, enum VVCTxType *trv) { const CodingUnit *cu = lc->cu; - static const enum TxType mts_to_trh[] = {DCT2, DST7, DCT8, DST7, DCT8}; - static const enum TxType mts_to_trv[] = {DCT2, DST7, DST7, DCT8, DCT8}; + static const enum VVCTxType mts_to_trh[] = { VVC_DCT2, VVC_DST7, VVC_DCT8, VVC_DST7, VVC_DCT8 }; + static const enum VVCTxType mts_to_trv[] = { VVC_DCT2, VVC_DST7, VVC_DST7, VVC_DCT8, VVC_DCT8 }; const VVCSPS *sps = fc->ps.sps; int implicit_mts_enabled = 0; if (tb->c_idx || (cu->isp_split_type != ISP_NO_SPLIT && cu->lfnst_idx)) { - *trh = *trv = DCT2; + *trh = *trv = VVC_DCT2; return; } @@ -152,11 +152,11 @@ static void derive_transform_type(const VVCFrameContext *fc, const VVCLocalConte const int w = tb->tb_width; const int h = tb->tb_height; if (cu->sbt_flag) { - *trh = (cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? DST7 : DCT8; - *trv = (!cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? DST7 : DCT8; + *trh = (cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? VVC_DST7 : VVC_DCT8; + *trv = (!cu->sbt_horizontal_flag || cu->sbt_pos_flag) ? VVC_DST7 : VVC_DCT8; } else { - *trh = (w >= 4 && w <= 16) ? DST7 : DCT2; - *trv = (h >= 4 && h <= 16) ? DST7 : DCT2; + *trh = (w >= 4 && w <= 16) ? VVC_DST7 : VVC_DCT2; + *trv = (h >= 4 && h <= 16) ? VVC_DST7 : VVC_DCT2; } return; } @@ -447,7 +447,7 @@ static void dequant(const VVCLocalContext *lc, const TransformUnit *tu, Transfor //transmatrix[0][0] #define DCT_A 64 -static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxType trh, const enum TxType trv) +static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum VVCTxType trh, const enum VVCTxType trv) { const VVCSPS *sps = fc->ps.sps; const int w = tb->tb_width; @@ -456,7 +456,7 @@ static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxT const size_t nzh = tb->max_scan_y + 1; const int shift[] = { 7, 5 + sps->log2_transform_range - sps->bit_depth }; - if (w == h && nzw == 1 && nzh == 1 && trh == DCT2 && trv == DCT2) { + if (w == h && nzw == 1 && nzh == 1 && trh == VVC_DCT2 && trv == VVC_DCT2) { const int add[] = { 1 << (shift[0] - 1), 1 << (shift[1] - 1) }; const int t = (tb->coeffs[0] * DCT_A + add[0]) >> shift[0]; const int dc = (t * DCT_A + add[1]) >> shift[1]; @@ -476,7 +476,7 @@ static void itx_2d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxT scale(tb->coeffs, tb->coeffs, w, h, shift[1]); } -static void itx_1d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxType trh, const enum TxType trv) +static void itx_1d(const VVCFrameContext *fc, TransformBlock *tb, const enum VVCTxType trh, const enum VVCTxType trv) { const VVCSPS *sps = fc->ps.sps; const int w = tb->tb_width; @@ -484,7 +484,7 @@ static void itx_1d(const VVCFrameContext *fc, TransformBlock *tb, const enum TxT const size_t nzw = tb->max_scan_x + 1; const size_t nzh = tb->max_scan_y + 1; - if ((w > 1 && nzw == 1 && trh == DCT2) || (h > 1 && nzh == 1 && trv == DCT2)) { + if ((w > 1 && nzw == 1 && trh == VVC_DCT2) || (h > 1 && nzh == 1 && trv == VVC_DCT2)) { const int shift = 6 + sps->log2_transform_range - sps->bit_depth; const int add = 1 << (shift - 1); const int dc = (tb->coeffs[0] * DCT_A + add) >> shift; @@ -542,7 +542,7 @@ static void itransform(VVCLocalContext *lc, TransformUnit *tu, const int tu_idx, transform_bdpcm(tb, lc, cu); dequant(lc, tu, tb); if (!tb->ts) { - enum TxType trh, trv; + enum VVCTxType trh, trv; if (cu->apply_lfnst_flag[c_idx]) ilfnst_transform(lc, tb);