From patchwork Thu Aug 8 19:13:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 50947 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:d7b2:0:b0:489:2eb3:e4c4 with SMTP id dc18csp1244525vqb; Thu, 8 Aug 2024 12:21:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUoT0SEvtThQfNzD+Zoap+uahx+OmvCMagw3/b8qb3U18YoqGqq/q7dXIFVqro5dCqnXeJTrE4kjHeVtFyuUFiXMSafJiO2DYxASg== X-Google-Smtp-Source: AGHT+IH2gUeSRJaUpXn7RAaKbaAZxiWlmxm19POObl0JToC6mdQ/5er9PI0RpQrmdqF49r0Qk05R X-Received: by 2002:a2e:a450:0:b0:2ee:87c1:3c94 with SMTP id 38308e7fff4ca-2f19de85765mr17033701fa.40.1723144867795; Thu, 08 Aug 2024 12:21: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-2f15e13c8dbsi42476721fa.158.2024.08.08.12.21.07; Thu, 08 Aug 2024 12:21: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=aHxpzdxp; 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 5A2F068D9FD; Thu, 8 Aug 2024 22:14:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazolkn19011031.outbound.protection.outlook.com [52.103.43.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2177C68D98A for ; Thu, 8 Aug 2024 22:14:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mLzPeUNDSagBFurKvaqfdmDMIhoJfZqiiwdjkDpjvqzfVHJWFYnCzJ39QeMWBFlZlQVl5NrNbDDfIV8n/crYxDUA+SWraI0Ri1PB778nLUwFWuBQUJv7k4MnWDNaUG5pRiHGYCKFA4gxRiPzT7m95iUf4q/qLVWSj4LfOjZGtzUfxp9RKp5tn/yShyYcEvT8g4h8J5SZ8AUHeMY6qaKOAodk80x6wy/0//6a+HegWxSG53DBJDARuaUI9reTJBdFHaSgUHka4PdO/unOmOlky2S8vVoe0C33WA6TidZxk9XSsaYWk6u4yJth5ez2NjdVDPpoHKoIdbLI+hudwB8QSg== 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=MOUgpZrQq/jiIzW+dvJzUmfuDqCHToRNzXjnmd2IsD8=; b=B4kb8UVESxPrP7HyNHff4jUocXaUjCjKv+jztAaiY+/HoDKYeM7nWRs9Exd6r55bUySO+fDoFK09Kfg8NVyR4t3uty1AXxF/EsoDP9tMKn0cbecknzhVo8eEOsmyZJc79NqWMKoIYCkkMjvG4pqrVQ1bRITrYrWesvwcx9K4uR6Ykf/W+zJf6HNRrYdk1fil5nwNiAL2XWscN1qjK6vwsOJ/vK2D0uLrUqhRJNfPg5Zsx++M/rkNclSG4g/5rwlufWT0bNcX0wIWG2aKDiQ9p/ztfGEEpOw9vkBlC3UvH6Tno/jdvCLcxcE7HIngAgUYirz49Y46AE1NVmJPOlWjFw== 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=MOUgpZrQq/jiIzW+dvJzUmfuDqCHToRNzXjnmd2IsD8=; b=aHxpzdxpTrE47ReiAnE5ytm1WOJ9whTJSyQ5xdvtUpH2yLLQvzux+KTd6GpTkq+lebFwt8fLNwsuI9g3jICE3w/hBabvHfEpPm8BLQJN+z5Vb8k32WizqeLNtuUvJ4e2wv5Caj+ZATCH2A4+28n8xBEpjgSRkRuGPfQCujy6Wc7+ajwAdfCWn2XjVl82R2YwmE13hCwLHKf/o8zVlsmKxmh8I97Gqw8gC7A9qnceXx5KJuXH+vf554mIl5l9Yi+6qmGyxfQzamhq8vHpHjpaIfXUq0PaQC7eKnLYKBJC0EMyD2yXkxb1m2yzpEDYbgi3YmhxbjNR2v/FGPgO4uQC+A== Received: from OS3PR01MB9944.jpnprd01.prod.outlook.com (2603:1096:604:1e0::10) by TYYPR01MB12466.jpnprd01.prod.outlook.com (2603:1096:405:f8::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.26; Thu, 8 Aug 2024 19:14:05 +0000 Received: from OS3PR01MB9944.jpnprd01.prod.outlook.com ([fe80::7b06:78cc:adb3:903c]) by OS3PR01MB9944.jpnprd01.prod.outlook.com ([fe80::7b06:78cc:adb3:903c%6]) with mapi id 15.20.7828.023; Thu, 8 Aug 2024 19:14:05 +0000 From: toqsxw@outlook.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Aug 2024 03:13:43 +0800 Message-ID: X-Mailer: git-send-email 2.44.0.windows.1 In-Reply-To: <20240808191344.1017-1-toqsxw@outlook.com> References: <20240808191344.1017-1-toqsxw@outlook.com> X-TMN: [UOUx1AbiECPVNjHJbJh4YDSGV3OBODqo] X-ClientProxiedBy: TY2PR0101CA0018.apcprd01.prod.exchangelabs.com (2603:1096:404:92::30) To OS3PR01MB9944.jpnprd01.prod.outlook.com (2603:1096:604:1e0::10) X-Microsoft-Original-Message-ID: <20240808191344.1017-3-toqsxw@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB9944:EE_|TYYPR01MB12466:EE_ X-MS-Office365-Filtering-Correlation-Id: 49522e57-6b6f-4d54-8a03-08dcb7de43b1 X-Microsoft-Antispam: BCL:0; ARA:14566002|15080799003|461199028|8060799006|5072599009|19110799003|3412199025|4302099013|440099028|1602099012|1710799026; X-Microsoft-Antispam-Message-Info: EwTuO4VuNx0MCMAFudVwuZBscjyqGItl6jvsisE1hdSYzixdBdBxS5LufUvda6y0W8NgzCOqYhHVmAJilTZZHJ//vkZeh4Xf0P2ffNI8+BfFob17eq0JwRiaFNxar1RC/wM0LqYUyk6K9QPG8dYSEex1vSQnlZOPhqCG3wHHdufs9S9ZMnHCuK8x7CUASWLBwGHn6dhnYbK3Zb9aQP+YYF6Es0Ebe6goy+3bkY1v9YdBNYcmrh1LorGU9cyimdY+sMA8mJE6o3ZHRTOAMrqVXiytBBAYrG48INl84o3jAiVH8KJmOpabdJEo7d/Z2xljkVNEpWUbsd1GAuMRSc5RTvBWa85f6qafkkxDLwvghhrqVpmpm2DBjxhXXVYco6wpfGJxCwEbRUoNAO1binkbxJByj+rkAtvVUvqzkisbtCM0MxThwYAUSsclJfE7gsV7vT6QxhOkXcBkaZ/HUdQ+tWPwiGgDG5vB73aCBHai6mBiENei7OSqPrjy1UAknU/cBPxZ5TPUDle3EW1KQsx+E4E0YGOL36fGi/Zt2mBf6WWER8GEpd30VAqCQjnqeqB6LqaZQfuYv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zpZ7br/NgMHxq2SSJWrUOySYU/jkYjzRZquhBF6Ahtf4yIE0kMIPi51XetP2cr81QTKS7FseQpRYV+7U7dS+yIeUI+NOq0OKRgxQg/NHfH8cTlh5cR/+cuMgDvDbZ3Nyw9Y2Y2/wW8dobzFOPQQKz8DGHrsZRdVpoqi0M+PbajdpNn35bOz+JUV40J3VhO6fkafV+Irm7FA7s/ahFD/PsIBVNn+pIgaFNF4yvQDuPsgjLwL+OBw7fX1X8BbPFqiqYnufHcnWpUsX3FFHScN/IVfsLJMdXYmxh39o6nmzTcTLO/+gDi8rXGrZv304ytm7hAw28+sytg4LFHQcjrvF3dwGOketAkuM6tBl0jHe90WI7xtkmUNZlB+FncYwMUMVRTbiYoBQfEYmyiV20gCKqAv9ol4P46oNaDvnsRUxUgZPLCw2iZB4jvv36Vtb0Tm7wEclRUIOLB5QsuS1G+cw0aVOMaGEy6A56kwKRpYBAZs2BcItnBKL2bcy4S6FLIwVwOMJtgq9FUhibzoGOqnKZKCGE= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49522e57-6b6f-4d54-8a03-08dcb7de43b1 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB9944.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2024 19:14:02.8375 (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: TYYPR01MB12466 Subject: [FFmpeg-devel] [PATCH v2 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: YPrxmyzuR6Dk 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 0b49b97021..38ff492a23 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);