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 119E24B2FA for ; Mon, 3 Jun 2024 13:08:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E6A868D689; Mon, 3 Jun 2024 16:08:03 +0300 (EEST) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2108.outbound.protection.outlook.com [40.92.107.108]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7588D68D4D0 for ; Mon, 3 Jun 2024 16:07:55 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ULvaQ7ylP+2QUTy8R5L+QOrJhP/RYKt5GHjxA4N9gCBTKnZGaSOybnuJkGvdLhqf/KrhdjBOiu3VkEG+ZOGyz0rDseJsCmDA3+wTUH1ZYPQD4EQ4f1qn6EuibKKOgdjYQwuakgiYPUyNump6zqFrZQ3HMcR7Y3oeVXLYuIr53NmLIa7UBZq+LcOJIuUS6eP7TmwOlXPr0oX8HVVbjbxViJ5v92H7tI/rSGLRGO37KPpovBbHRJFcUaaTxyY4eVmq8Pfl1lmT/L6kc+xGAcpNumX2y2YAox+tX3XeIDxFmgD6+BTIGWJC1tnRcWijPH0PdBnvy7zH4AIQYrAFcqTveQ== 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=po2wkLhe6FvF6Jh0fFg6xtHF4zSn1EgDF2PyfvJ5WRk=; b=SuWPM3UeaX5QMwgjJOW5E0YyyzRim2CFKWb6pLf6tnJsO/bfemTBiCPR1LjAMVVt9kJKh/03xQED718gyKdmqul3ZzKN8IEPWbXJQP+VrUPfMgfvQbS2jBZ5JHGftCs6MbCBWMEIJTpw9Ui0MqV0GSeit9A4adXILyIrvWHBjLj4jVdiVTZSFCovDfHYD9htbcY2I5zQj4bojFuh6xqe2s0TYrQx/kc6f6XZbyraiJxlkjQhVSHg+lkXtv2gv6dgwirTPJtiAFjc/FH6Pc/ihv9q4PKnULfGDs7cBQn55OPB8Mk1+wtbHPHQDqzPwnwll8lghK/EfmLARD8avolXHQ== 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=po2wkLhe6FvF6Jh0fFg6xtHF4zSn1EgDF2PyfvJ5WRk=; b=rWupcCPU75DsC/0Mjqtvu72w+/QLXwcAnzWcJ0/WrH2GHJ3fkG8DE+++aoNMrWbXHuaw9vT13f6PuaaOPJGS3LFQ15kj6M657ykMQPrqAIENqqcMklWZxylc0tTdXCI32QTbpkozHou2uO52Nc3mZSA5fbhoGHP6d0QW1FOT+uDFL6EN/V6pe/FPE5fuJSl0HDbdorw+7lYj6wBNpO5AoyRnmCFcP82xfIuHNaOpBYsRM/ewfG5aZVigJ657j4emM6JLwOVBDIx1w8za44K1i/RKqewYcoNF4JoM7NaOsCNc+7/3bw9NG6enEg26mRUOeUh7chQMceaYQ6fApHwuJQ== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by TYUPR06MB5978.apcprd06.prod.outlook.com (2603:1096:400:358::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.23; Mon, 3 Jun 2024 12:52:07 +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.7633.021; Mon, 3 Jun 2024 12:52:07 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 3 Jun 2024 20:51:12 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [NVTVT5RAH5QCkKqTCVfVkHilbKIig7SL] X-ClientProxiedBy: SG2PR04CA0170.apcprd04.prod.outlook.com (2603:1096:4::32) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20240603125117.10791-1-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|TYUPR06MB5978:EE_ X-MS-Office365-Filtering-Correlation-Id: 063d181b-a69c-4562-d0a3-08dc83cbf97d X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: nO8QskYcqlpXuvWSt+vYblxz/o4We+KhJGx0+IFjUuU1WZXB6yoP9zjzOzswTdrP+azJsD6e/iyyEyKRd2vdNvNOUWMQ6e4DBrGBUFyS19fyWRMKr31XSN+dSrBtCQ6gPDwW5Wa3owTfF6/gqprD1uM1krZVVndwAik0ouckhlHJX5h7a9ii637BukmJmvp2fZIM9QC9ituWssJj/fHDzb8k6lLyk6Yax90U8nnNhem1BKJLdoqQ8qoHOs4wdyVSCmWEWHmk6b9LBPw0eXZqiB4in4k3juRN8N+uO4Ywfk32LsE2bSf9+q1oG5Z8P26Y+QDG9aZs3SXrswxpo5nqTy8ku0ihVjLDhH/aM0v7Qv1Ll1bYhXqlamJ9Ok2UVw/KGrSXjh3ZinEViImuj4TR4i9vpRKuuWWILhq3wbNOKc8yF/mGx7vdlv+TkrjKTzT0T0y4gr+4CR7rKTWEVpXeXVlOsD5BEQXiMS2TUNsCflt2caIZLOh4p6y8Z7EiIv9uMOwQImraivJjbXWSkwxVsAFZdptS32hARCFSKZg/F+ss6Cvu4mjRXCO1D14YAV8KbykS+zEAAWmMABkLS+MeoEfB6xeFnZErZ52fE5QEhXWETyiueSGJ14apwDqz4ecn X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?hdpmdvlOifjK0+U/OOKz5ljmeVfmEjiBK4wdXhUZOOagMMWtxlByF7aIYWPS?= =?us-ascii?Q?0P/FQUAxMa1U9cuvnF9Hsmc3fM8cA5O+1zhoFXsg5CjUKJyyJcgc1fGbUl6S?= =?us-ascii?Q?6MQvMZ0I1JUTyXhtzo1mZzKJ9Pq7sAkCCSp867DuoeKKmWDrjVq/gxEISBkg?= =?us-ascii?Q?aSlFEDqOf/GpPE7/6E5KhJAibigtPUhngDnNNDre7eWYjNlkN5HeiuBWnbrO?= =?us-ascii?Q?oQ9NH1bwYRO8rpuruGGHBo/QDC4Xb7r49v94NrEriEhFSx5kUi4qfgys5IAn?= =?us-ascii?Q?4vFia+LT1td+KmYhOla/ZQ2mUdStca2aeu8RrrN9w1AtcqLFGRw5oOcv3JUo?= =?us-ascii?Q?TvcrzBygPeBZM19C92Z3NzOu4O1l0lKO/YVMlqLM9ERBhYIifNYsw4Irwjrf?= =?us-ascii?Q?+65n12a37NtlkPDp97k22KxhfKMC/2QPtg6H8lxZXmCOHV2R4/dvbbsr39dc?= =?us-ascii?Q?9y0XjlAmTpTacNuywkTEjXaHq2L0aozSPhH8ltPJeFAfLKXTXjxuIuuN3/Jw?= =?us-ascii?Q?yGvIMVilelh/XPNbyT/9FfUWYgPl9JEd5OOcmg7yO6xbjuTndrxLjwhfWUlR?= =?us-ascii?Q?9AHlvIIzCg7owEFzI/GTC9b1Twa8Q07DS3ov041O3/mBz0rqvCQDZQK6rHae?= =?us-ascii?Q?XncyuR58zBDSoxOm43xFa8V0dHJJS5NXyZV3mmQQVBffV2EAnzqjbFG6Pu/v?= =?us-ascii?Q?qzXEiUiRqmY/WWyoP7Y45ukvwQynrl+h7WphS5xFxPwkeA/QIYeqc+K+l5Zj?= =?us-ascii?Q?30sFeWQlouB4XDneUolRErcyWukyThSLE5Kz3Q8zS9eX1p5eC2E1MqelBlYe?= =?us-ascii?Q?x9bJ0dcu4yOWIPZpqJu5Dax28SaCG0kAlzP0TJ2nV5L8kAhJYkEKU7e5UjqK?= =?us-ascii?Q?t0Hbu5XLR03irgjjmstS853ZdWVVIXbgPLoBcOXxZj89Kcb3WJAzxqvZlm/1?= =?us-ascii?Q?vlkGvEtOTqS0NhWJsTPL6g+f42++MkKnQD0hbv/IDB1bj70RK/4x7YsVeDwQ?= =?us-ascii?Q?DCWAjJkze74YeErewA/4GF2XfqG7gq3bAvFA76Xa4pdDP1qhlDSX9HTm+DTh?= =?us-ascii?Q?T0gCiALGGyS033uIHuoorpMCuiau6ZYvmX3EoKg8E2YyUVQDz4yoVqY83eXD?= =?us-ascii?Q?qVLGRRTGKzKCP1OOMMqsHTkDJrhvKOXQ9lEFl3yWxfFNS6cUAHLDiBxSdHqx?= =?us-ascii?Q?3xXNPy5/nITFz06ymqINE4h1Kehw32Mrgk6A2qYHqf6RaK82dEC5d41Mev4P?= =?us-ascii?Q?00wNIxbxHT2MEhKT2idc4jsNxVxkiKL6IThAq9D1tA=3D=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 063d181b-a69c-4562-d0a3-08dc83cbf97d X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 12:52:07.0866 (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: TYUPR06MB5978 Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/vvcdec: refact, remove emulated_edge_dmvr and emulated_edge_bilinear to simplify code 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: benjamin.bross@hhi.fraunhofer.de, 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: --- libavcodec/vvc/inter.c | 146 +++++++++++++---------------------------- 1 file changed, 46 insertions(+), 100 deletions(-) diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c index e1011b4fa1..0843c99eb6 100644 --- a/libavcodec/vvc/inter.c +++ b/libavcodec/vvc/inter.c @@ -44,112 +44,59 @@ static void subpic_width_height(int *pic_width, int *pic_height, *pic_height = pps->subpic_height[subpic_idx] >> sps->vshift[is_chroma]; } -static int emulated_edge(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, const VVCFrame *src_frame, - int x_off, int y_off, const int block_w, const int block_h, const int is_chroma) +static void emulated_edge(const VVCLocalContext *lc, uint8_t *dst, + const uint8_t **src, ptrdiff_t *src_stride, const VVCFrame *src_frame, + int x_sb, int y_sb, int x_off, int y_off, const int block_w, const int block_h, + const int is_chroma, const int extra_before, const int extra_after) { const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = src_frame->sps; const VVCPPS *pps = src_frame->pps; const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; - const int extra_before = is_chroma ? CHROMA_EXTRA_BEFORE : LUMA_EXTRA_BEFORE; - const int extra_after = is_chroma ? CHROMA_EXTRA_AFTER : LUMA_EXTRA_AFTER; - const int extra = is_chroma ? CHROMA_EXTRA : LUMA_EXTRA; - int pic_width, pic_height; - - subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_chroma); - subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_chroma); - - if (x_off < extra_before || y_off < extra_before || - x_off >= pic_width - block_w - extra_after || - y_off >= pic_height - block_h - extra_after) { - const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << fc->ps.sps->pixel_shift; - int offset = extra_before * *src_stride + (extra_before << fc->ps.sps->pixel_shift); - int buf_offset = extra_before * edge_emu_stride + (extra_before << fc->ps.sps->pixel_shift); - - fc->vdsp.emulated_edge_mc(dst, *src - offset, edge_emu_stride, *src_stride, - block_w + extra, block_h + extra, x_off - extra_before, y_off - extra_before, - pic_width, pic_height); - - *src = dst + buf_offset; - *src_stride = edge_emu_stride; - return 1; - } - return 0; -} - -static void emulated_edge_dmvr(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, - int x_sb, int y_sb, int x_off, int y_off, const int block_w, const int block_h, const int is_chroma) -{ - const VVCFrameContext *fc = lc->fc; - const VVCSPS *sps = fc->ps.sps; - const VVCPPS *pps = fc->ps.pps; - const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; - const int extra_before = is_chroma ? CHROMA_EXTRA_BEFORE : LUMA_EXTRA_BEFORE; - const int extra_after = is_chroma ? CHROMA_EXTRA_AFTER : LUMA_EXTRA_AFTER; - const int extra = is_chroma ? CHROMA_EXTRA : LUMA_EXTRA; + const int extra = extra_before + extra_after; + const int dmvr_clip = x_sb != x_off || y_sb != y_off; int pic_width, pic_height; subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, is_chroma); subpic_offset(&x_sb, &y_sb, sps, pps, subpic_idx, is_chroma); subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, is_chroma); + if (dmvr_clip) { + const int start_x = FFMIN(FFMAX(x_sb - extra_before, 0), pic_width - 1); + const int start_y = FFMIN(FFMAX(y_sb - extra_before, 0), pic_height - 1); + pic_width = FFMAX(FFMIN(pic_width, x_sb + block_w + extra_after) - start_x, 1); + pic_height = FFMAX(FFMIN(pic_height, y_sb + block_h + extra_after) - start_y, 1); + x_off -= start_x; + y_off -= start_y; + } - if (x_off < extra_before || y_off < extra_before || + if (dmvr_clip || x_off < extra_before || y_off < extra_before || x_off >= pic_width - block_w - extra_after || - y_off >= pic_height - block_h - extra_after|| - (x_off != x_sb || y_off != y_sb)) { + y_off >= pic_height - block_h - extra_after) { const int ps = fc->ps.sps->pixel_shift; const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << ps; - const int offset = extra_before * *src_stride + (extra_before << ps); + const int offset = extra_before * *src_stride + (extra_before << ps); const int buf_offset = extra_before * edge_emu_stride + (extra_before << ps); - const int start_x = FFMIN(FFMAX(x_sb - extra_before, 0), pic_width - 1); - const int start_y = FFMIN(FFMAX(y_sb - extra_before, 0), pic_height - 1); - const int width = FFMAX(FFMIN(pic_width, x_sb + block_w + extra_after) - start_x, 1); - const int height = FFMAX(FFMIN(pic_height, y_sb + block_h + extra_after) - start_y, 1); - - fc->vdsp.emulated_edge_mc(dst, *src - offset, edge_emu_stride, *src_stride, block_w + extra, block_h + extra, - x_off - start_x - extra_before, y_off - start_y - extra_before, width, height); - - *src = dst + buf_offset; - *src_stride = edge_emu_stride; - } -} - -static void emulated_edge_bilinear(const VVCLocalContext *lc, uint8_t *dst, const uint8_t **src, ptrdiff_t *src_stride, - int x_off, int y_off, const int block_w, const int block_h) -{ - const VVCFrameContext *fc = lc->fc; - const VVCSPS *sps = fc->ps.sps; - const VVCPPS *pps = fc->ps.pps; - const int subpic_idx = lc->sc->sh.r->curr_subpic_idx; - int pic_width, pic_height; - - subpic_offset(&x_off, &y_off, sps, pps, subpic_idx, 0); - subpic_width_height(&pic_width, &pic_height, sps, pps, subpic_idx, 0); - - if (x_off < BILINEAR_EXTRA_BEFORE || y_off < BILINEAR_EXTRA_BEFORE || - x_off >= pic_width - block_w - BILINEAR_EXTRA_AFTER || - y_off >= pic_height - block_h - BILINEAR_EXTRA_AFTER) { - const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << fc->ps.sps->pixel_shift; - const int offset = BILINEAR_EXTRA_BEFORE * *src_stride + (BILINEAR_EXTRA_BEFORE << fc->ps.sps->pixel_shift); - const int buf_offset = BILINEAR_EXTRA_BEFORE * edge_emu_stride + (BILINEAR_EXTRA_BEFORE << fc->ps.sps->pixel_shift); - - fc->vdsp.emulated_edge_mc(dst, *src - offset, edge_emu_stride, *src_stride, block_w + BILINEAR_EXTRA, block_h + BILINEAR_EXTRA, - x_off - BILINEAR_EXTRA_BEFORE, y_off - BILINEAR_EXTRA_BEFORE, pic_width, pic_height); + fc->vdsp.emulated_edge_mc(dst, *src - offset, edge_emu_stride, *src_stride, + block_w + extra, block_h + extra, x_off - extra_before, y_off - extra_before, + pic_width, pic_height); *src = dst + buf_offset; *src_stride = edge_emu_stride; } } -#define MC_EMULATED_EDGE(dst, src, src_stride, x_off, y_off) \ - emulated_edge(lc, dst, src, src_stride, ref, x_off, y_off, block_w, block_h, is_chroma) +#define MC_EMULATED_EDGE(dst, src, src_stride, x_off, y_off) \ + emulated_edge(lc, dst, src, src_stride, ref, x_off, y_off, x_off, y_off, block_w, block_h, is_chroma, \ + is_chroma ? CHROMA_EXTRA_BEFORE : LUMA_EXTRA_BEFORE, is_chroma ? CHROMA_EXTRA_AFTER : LUMA_EXTRA_AFTER) -#define MC_EMULATED_EDGE_DMVR(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \ - emulated_edge_dmvr(lc, dst, src, src_stride, x_sb, y_sb, x_off, y_off, block_w, block_h, is_chroma) +#define MC_EMULATED_EDGE_DMVR(dst, src, src_stride, x_sb, y_sb, x_off, y_off) \ + emulated_edge(lc, dst, src, src_stride, ref, x_sb, y_sb, x_off, y_off, block_w, block_h, is_chroma, \ + is_chroma ? CHROMA_EXTRA_BEFORE : LUMA_EXTRA_BEFORE, is_chroma ? CHROMA_EXTRA_AFTER : LUMA_EXTRA_AFTER) -#define MC_EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off) \ - emulated_edge_bilinear(lc, dst, src, src_stride, x_off, y_off, pred_w, pred_h) +#define MC_EMULATED_EDGE_BILINEAR(dst, src, src_stride, x_off, y_off) \ + emulated_edge(lc, dst, src, src_stride, ref, x_off, y_off, x_off, y_off, pred_w, pred_h, 0, \ + BILINEAR_EXTRA_BEFORE, BILINEAR_EXTRA_AFTER) // part of 8.5.6.6 Weighted sample prediction process static int derive_weight_uni(int *denom, int *wx, int *ox, @@ -357,23 +304,21 @@ static void scaled_ref_pos_and_step(const VVCLocalContext *lc, const VVCRefPic * } static void emulated_edge_scaled(VVCLocalContext *lc, const uint8_t **src, ptrdiff_t *src_stride, int *src_height, - const VVCFrame *ref, const int x, const int y, const int dx, const int dy, - const int block_w, const int block_h, const int is_chroma) + const VVCFrame *ref, const int x, const int y, const int dx, const int dy, const int w, const int h, const int is_chroma) { const VVCFrameContext *fc = lc->fc; - const int x0 = SCALED_INT(x); - const int y0 = SCALED_INT(y); - const int x_end = SCALED_INT(x + block_w * dx); - const int y_end = SCALED_INT(y + block_h * dy); - const int x_last = SCALED_INT(x + (block_w - 1) * dx); - const int y_last = SCALED_INT(y + (block_h - 1) * dy); - const int src_width = x_end - x0 + (x_end == x_last); + const int x_off = SCALED_INT(x); + const int y_off = SCALED_INT(y); + const int x_end = SCALED_INT(x + w * dx); + const int y_end = SCALED_INT(y + h * dy); + const int x_last = SCALED_INT(x + (w - 1) * dx); + const int y_last = SCALED_INT(y + (h - 1) * dy); + const int block_w = x_end - x_off + (x_end == x_last); + const int block_h = *src_height = y_end - y_off + (y_end == y_last); - *src_height = y_end - y0 + (y_end == y_last); + *src += y_off * *src_stride + (x_off * (1 << fc->ps.sps->pixel_shift)); - *src += y0 * *src_stride + (x0 * (1 << fc->ps.sps->pixel_shift)); - - emulated_edge(lc, lc->edge_emu_buffer, src, src_stride, ref, x0, y0, src_width, *src_height, is_chroma); + MC_EMULATED_EDGE(lc->edge_emu_buffer, src, src_stride, x_off, y_off); } static void mc_scaled(VVCLocalContext *lc, int16_t *dst, const VVCRefPic *refp, const Mv *mv, @@ -737,11 +682,11 @@ static int parametric_mv_refine(const int *sad, const int stride) #define SAD_ARRAY_SIZE 5 //8.5.3 Decoder-side motion vector refinement process static void dmvr_mv_refine(VVCLocalContext *lc, MvField *mvf, MvField *orig_mv, int *sb_bdof_flag, - const AVFrame *ref0, const AVFrame *ref1, const int x_off, const int y_off, const int block_w, const int block_h) + const VVCFrame *ref0, const VVCFrame *ref1, const int x_off, const int y_off, const int block_w, const int block_h) { const VVCFrameContext *fc = lc->fc; const int sr_range = 2; - const AVFrame *ref[] = { ref0, ref1 }; + const VVCFrame *refs[] = { ref0, ref1 }; int16_t *tmp[] = { lc->tmp, lc->tmp1 }; int sad[SAD_ARRAY_SIZE][SAD_ARRAY_SIZE]; int min_dx, min_dy, min_sad, dx, dy; @@ -757,8 +702,9 @@ static void dmvr_mv_refine(VVCLocalContext *lc, MvField *mvf, MvField *orig_mv, const int my = mv->y & 0xf; const int ox = x_off + (mv->x >> 4) - sr_range; const int oy = y_off + (mv->y >> 4) - sr_range; - ptrdiff_t src_stride = ref[i]->linesize[LUMA]; - const uint8_t *src = ref[i]->data[LUMA] + oy * src_stride + (ox * (1 << fc->ps.sps->pixel_shift)); + 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)); MC_EMULATED_EDGE_BILINEAR(lc->edge_emu_buffer, &src, &src_stride, ox, oy); fc->vvcdsp.inter.dmvr[!!my][!!mx](tmp[i], src, src_stride, pred_h, mx, my, pred_w); } @@ -828,7 +774,7 @@ static void derive_sb_mv(VVCLocalContext *lc, MvField *mv, MvField *orig_mv, int VVCRefPic *refp[2]; if (pred_get_refs(lc, refp, mv) < 0) return; - dmvr_mv_refine(lc, mv, orig_mv, sb_bdof_flag, refp[L0]->ref->frame, refp[L1]->ref->frame, x0, y0, sbw, sbh); + dmvr_mv_refine(lc, mv, orig_mv, sb_bdof_flag, refp[L0]->ref, refp[L1]->ref, x0, y0, sbw, sbh); set_dmvr_info(fc, x0, y0, sbw, sbh, mv); } } -- 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".