From patchwork Mon May 6 03:38:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: uk7b@foxmail.com X-Patchwork-Id: 48566 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:e68f:b0:1af:836d:81b3 with SMTP id mz15csp1152647pzb; Sun, 5 May 2024 20:39:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWba9D0VnGd71TPZo/GpKPzDwY97JAsb6CAbiPObhX+4r1m8BRR6lnxbAp/bB+7qIKaoa95/lO6N1Ru7PaDoC9UZbDs6aaV5H8p6Q== X-Google-Smtp-Source: AGHT+IHjWyWKrZOaZr2P43vx5rqboDBrid4BI3BDf5tPTb1zx2jonEosI+UYoVKcNvUiVtHS1mud X-Received: by 2002:a50:9ea5:0:b0:572:a158:8a7b with SMTP id a34-20020a509ea5000000b00572a1588a7bmr7673203edf.8.1714966753780; Sun, 05 May 2024 20:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714966753; cv=none; d=google.com; s=arc-20160816; b=v7XhUBmo71Q1A3cHQK/EPUS2fhmTxKvkbvl/A6e7RmzAouE9FjfleWyr2ddhFXEU/g ORcWSberNRnB1Y65GpfYuN5+Vmt9S+ja4FqDCDyu/C7HXcyXs3FFZJXfKk4+BFlSaWe1 IvCgKb3LPlZD+IUVM+CUnlUSCILoZXsqu56IeyKSUF1bRntChmJqw1kL0z7mZnH8DM+a xsTdelYfvB+8RJIl+1Aaic6cz5oZsuqLyzFVwF3W7IIbSesSoCYilYgEs2mSSGHHArbG qjRi6Zpj5gw4SN6pCMVvdFMLhQauvX/Dj0SmZGJBiNl6dONAmWfLnraQwMshoxitPmPI 9ZGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=JL9Zc9sOVZ7wH7vo8Fq1DWNuDh48F3seAyRn6xd3QpQ=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=iuMDggStvVIZD8KX7WwH2wqwyIGDEkbyovf3M9AYVcFqC+akCEP7ziMPSPinieV9d/ wiyYa85l3TYaoQHxOU1wrxyIv/DzJ8unaWbgymadVc0au7pyzvbct39SLU+IcBAfFsuB XcdBkSKRab8QMC3/HgYUNzFY7iCgFKbVvW+MaifK8UnQ6pCdEwUmUXWsCCHUzA41v2Ft siREFyT3ViVq9IzSC1Mp6a1+mqdBMRMsLRvXviO/zdXorXcmdI4VAQxJZQDEeVRFqGxB JhhEuqBPg/mkwRZ+DD43Zcgqzn/sfV9LrWqM5TnjgX6jN7uMsFCK7Ln47n21Glm/nyjy 3DOQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=QMpAmTWs; 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=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l1-20020aa7c3c1000000b00571d70d1b05si3214496edr.370.2024.05.05.20.39.13; Sun, 05 May 2024 20:39:13 -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=@foxmail.com header.s=s201512 header.b=QMpAmTWs; 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=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6846368D5F9; Mon, 6 May 2024 06:38:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA9EC68D57A for ; Mon, 6 May 2024 06:38:26 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1714966698; bh=VnKNwIxmbZHWFa9k8KYb9CnKeOBHkFJSIhrBqBfrZV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QMpAmTWsH8tRCaBAPrKhMQzjbbIKgOUKnI8GKKn6Ovzroz/KIxYd5xxjFERNU6nv6 M/5XJMUTGysQr+Gbz7IDgzfuljUabiQTCDg2/LkEkFJA7haaNqMc5ko6+WkmrmIalk N+f6o6Dpqr7Rs2wdujxdzVY+OZIpdUXkKb81PWXg= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id 98B83073; Mon, 06 May 2024 11:38:11 +0800 X-QQ-mid: xmsmtpt1714966697tjhevwm5k Message-ID: X-QQ-XMAILINFO: M0PjjqbLT90wL0yBJmkH6q57fdnUMTDXI6BBPm4y4BSyVxjPexvXoVzTPLAW8d M5yQ6YLQ5pINhr3BAE1Qma4T7W7PQXgzALCEfPmZbPvw3Up/ADG9hTxT0hqfilMD8HTBb51YTYbm RGWOGiAysi9ZrExBW1a0/1OEPFK2kWPj+Natjmfmp3mKV5UWBHZ8HRJLBJlWXtZCoGImbzrWMqhc jklkwfY8gorHqWkJaC09rxsR0AdF/dk2huWWKAp9PTI5/aVYOEMJXRnAOSxR4SKY/tYMKLrT8PZr KTNaRHCxA5+yg0Yt7KgoHzRZxs1ZjeK8lXVUCJo2LXua+tyM8tH6xuHpOupeMFkKlHCK5XUMo+vh UDPs+yYa5vEffzA7EGtOqvHOOoQUzTvaYNiN8DwxYTY86bH541exsqH9AF5VkknT/4HNLAFPYWbv ASttxrB2o7hGd7LyoE61au6a0hQrE8Y07chicHnMHetB6yfTNeT1wcNMdzp3yS9J5oJB3AvLB+LN ODZ/t0zB7U/wDFTdoPTLc8Ishcvu1+/s3Bx2Mq7OEdVWu2cpa9XOu8U2fAkC7piRNszCDZwLBmKi Cn0yy4pX4XG+F5iMb7dexy5pK92HZxhuM3KnK1AgPL4XxhY/wBfCL8VEb6Kv+gKiLz7d3lIVYZa1 zaTkAYEI4RXcrW/rMX10Bvqun3GUHA3Kq0ChiSvL/Q39JwX81NImV0xUJwOV7TYwOaftPF6PcGH8 3iC/nMDQXuCZZuLkN3aZn/QqaK+LMCdZ+AWKCVOb/x/i7U3z5zxZJzXwaMoomL7b9AyeImF+nHCU Fh486fetpqw1zLgVUcOP5R51XetGjLEhRSCjtJEeMc/UNuzlVFbyktbSZueeqIiujgn7x2FnsXFd PS0F1gCVy4uOJHVTBwTx8PIWglbskXdyaNpuTRntvS4R1JN6Ef2Fs5XsvhiOyXKTq06UB2kt6PHO NZGO+idgbsTDdG25vQDQ== X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 May 2024 11:38:06 +0800 X-OQ-MSGID: <20240506033809.3790245-6-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240506033809.3790245-1-uk7b@foxmail.com> References: <20240506033809.3790245-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 6/9] lavc/vp8dsp: R-V V put_epel hv 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: sunyuechi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wgq7pbUgeM/+ From: sunyuechi C908: vp8_put_epel4_h4v4_c: 20.0 vp8_put_epel4_h4v4_rvv_i32: 11.0 vp8_put_epel4_h4v6_c: 25.2 vp8_put_epel4_h4v6_rvv_i32: 13.5 vp8_put_epel4_h6v4_c: 22.2 vp8_put_epel4_h6v4_rvv_i32: 14.5 vp8_put_epel4_h6v6_c: 29.0 vp8_put_epel4_h6v6_rvv_i32: 15.7 vp8_put_epel8_h4v4_c: 73.0 vp8_put_epel8_h4v4_rvv_i32: 22.2 vp8_put_epel8_h4v6_c: 90.5 vp8_put_epel8_h4v6_rvv_i32: 26.7 vp8_put_epel8_h6v4_c: 85.0 vp8_put_epel8_h6v4_rvv_i32: 27.2 vp8_put_epel8_h6v6_c: 104.7 vp8_put_epel8_h6v6_rvv_i32: 29.5 vp8_put_epel16_h4v4_c: 145.5 vp8_put_epel16_h4v4_rvv_i32: 26.5 vp8_put_epel16_h4v6_c: 190.7 vp8_put_epel16_h4v6_rvv_i32: 47.5 vp8_put_epel16_h6v4_c: 173.7 vp8_put_epel16_h6v4_rvv_i32: 33.2 vp8_put_epel16_h6v6_c: 222.2 vp8_put_epel16_h6v6_rvv_i32: 35.5 --- libavcodec/riscv/vp8dsp_init.c | 13 ++++ libavcodec/riscv/vp8dsp_rvv.S | 117 +++++++++++++++++++++++++++------ 2 files changed, 109 insertions(+), 21 deletions(-) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index dc3e087f01..463c8fa0a2 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -97,6 +97,19 @@ av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) c->put_vp8_epel_pixels_tab[0][1][0] = ff_put_vp8_epel16_v4_rvv; c->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_rvv; c->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_rvv; + + c->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_rvv; + c->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_rvv; + c->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_rvv; + c->put_vp8_epel_pixels_tab[0][2][1] = ff_put_vp8_epel16_h4v6_rvv; + c->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_rvv; + c->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_rvv; + c->put_vp8_epel_pixels_tab[0][1][1] = ff_put_vp8_epel16_h4v4_rvv; + c->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_rvv; + c->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_rvv; + c->put_vp8_epel_pixels_tab[0][1][2] = ff_put_vp8_epel16_h6v4_rvv; + c->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_rvv; + c->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_rvv; } #endif #endif diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index bf268e4d8d..baa8152830 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -161,26 +161,26 @@ const subpel_filters .byte 0, -1, 12, 123, -6, 0 endconst -.macro epel_filter size type - lla t2, subpel_filters +.macro epel_filter size type regtype + lla \regtype\()2, subpel_filters .ifc \type,v - addi t0, a6, -1 + addi \regtype\()0, a6, -1 .elseif \type == h - addi t0, a5, -1 + addi \regtype\()0, a5, -1 .endif - li t1, 6 - mul t0, t0, t1 - add t0, t0, t2 + li \regtype\()1, 6 + mul \regtype\()0, \regtype\()0, \regtype\()1 + add \regtype\()0, \regtype\()0, \regtype\()2 .irp n 1,2,3,4 - lb t\n, \n(t0) + lb \regtype\n, \n(\regtype\()0) .endr .ifc \size,6 - lb t5, 5(t0) - lb t0, (t0) + lb \regtype\()5, 5(\regtype\()0) + lb \regtype\()0, (\regtype\()0) .endif .endm -.macro epel_load dst len size type +.macro epel_load dst len size type from_mem regtype .ifc \type,v mv a5, a3 .else @@ -189,24 +189,35 @@ endconst sub t6, a2, a5 add a7, a2, a5 +.if \from_mem vle8.v v24, (a2) vle8.v v22, (t6) vle8.v v26, (a7) add a7, a7, a5 vle8.v v28, (a7) - vwmulu.vx v16, v24, t2 - vwmulu.vx v20, v26, t3 + vwmulu.vx v16, v24, \regtype\()2 + vwmulu.vx v20, v26, \regtype\()3 .ifc \size,6 sub t6, t6, a5 add a7, a7, a5 vle8.v v24, (t6) vle8.v v26, (a7) - vwmaccu.vx v16, t0, v24 - vwmaccu.vx v16, t5, v26 + vwmaccu.vx v16, \regtype\()0, v24 + vwmaccu.vx v16, \regtype\()5, v26 +.endif + vwmaccsu.vx v16, \regtype\()1, v22 + vwmaccsu.vx v16, \regtype\()4, v28 +.else + vwmulu.vx v16, v4, \regtype\()2 + vwmulu.vx v20, v6, \regtype\()3 + .ifc \size,6 + vwmaccu.vx v16, \regtype\()0, v0 + vwmaccu.vx v16, \regtype\()5, v10 + .endif + vwmaccsu.vx v16, \regtype\()1, v2 + vwmaccsu.vx v16, \regtype\()4, v8 .endif li t6, 64 - vwmaccsu.vx v16, t1, v22 - vwmaccsu.vx v16, t4, v28 vwadd.wx v16, v16, t6 vsetvlstatic16 \len vwadd.vv v24, v16, v20 @@ -216,18 +227,18 @@ endconst vnclipu.wi \dst, v24, 0 .endm -.macro epel_load_inc dst len size type - epel_load \dst \len \size \type +.macro epel_load_inc dst len size type from_mem regtype + epel_load \dst \len \size \type \from_mem \regtype add a2, a2, a3 .endm .macro epel len size type func ff_put_vp8_epel\len\()_\type\()\size\()_rvv, zve32x - epel_filter \size \type + epel_filter \size \type t vsetvlstatic8 \len 1: addi a4, a4, -1 - epel_load_inc v30 \len \size \type + epel_load_inc v30 \len \size \type 1 t vse8.v v30, (a0) add a0, a0, a1 bnez a4, 1b @@ -236,6 +247,66 @@ func ff_put_vp8_epel\len\()_\type\()\size\()_rvv, zve32x endfunc .endm +.macro epel_hv len hsize vsize +func ff_put_vp8_epel\len\()_h\hsize\()v\vsize\()_rvv, zve32x + addi sp, sp, -48 + .irp n 0,1,2,3,4,5 +#if __riscv_xlen >= 64 + sd s\n, \n\()<<3(sp) +#else + sw s\n, \n\()<<3(sp) +#endif + .endr + sub a2, a2, a3 + epel_filter \hsize h t + epel_filter \vsize v s + vsetvlstatic8 \len +.if \hsize == 6 || \vsize == 6 + sub a2, a2, a3 + epel_load_inc v0 \len \hsize h 1 t +.endif + epel_load_inc v2 \len \hsize h 1 t + epel_load_inc v4 \len \hsize h 1 t + epel_load_inc v6 \len \hsize h 1 t + epel_load_inc v8 \len \hsize h 1 t +.if \hsize == 6 || \vsize == 6 + epel_load_inc v10 \len \hsize h 1 t +.endif + addi a4, a4, -1 +1: + addi a4, a4, -1 + epel_load v30 \len \vsize v 0 s + vse8.v v30, (a0) +.if \hsize == 6 || \vsize == 6 + vmv.v.v v0, v2 +.endif + vmv.v.v v2, v4 + vmv.v.v v4, v6 + vmv.v.v v6, v8 +.if \hsize == 6 || \vsize == 6 + vmv.v.v v8, v10 + epel_load_inc v10 \len \hsize h 1 t +.else + epel_load_inc v8 \len 4 h 1 t +.endif + add a0, a0, a1 + bnez a4, 1b + epel_load v30 \len \vsize v 0 s + vse8.v v30, (a0) + + .irp n 0,1,2,3,4,5 +#if __riscv_xlen >= 64 + ld s\n, \n\()<<3(sp) +#else + lw s\n, \n\()<<3(sp) +#endif + .endr + addi sp, sp, 48 + + ret +endfunc +.endm + .irp len 16,8,4 put_vp8_bilin_h_v \len h a5 put_vp8_bilin_h_v \len v a6 @@ -244,4 +315,8 @@ epel \len 6 h epel \len 4 h epel \len 6 v epel \len 4 v +epel_hv \len 6 6 +epel_hv \len 4 4 +epel_hv \len 6 4 +epel_hv \len 4 6 .endr