From patchwork Sun May 12 10:03:28 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: 48806 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp505756pzb; Sun, 12 May 2024 03:04:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWkoFafIB93BTl374mVubbP84MBmPE+Cy6ge/mDQ3+Ox0iqtXzXKRnr8S+UQz3qjjLMliNzF9SXcsdqbCGulwc9m4Ykm+kHXn/i4Q== X-Google-Smtp-Source: AGHT+IG69cGnb5+LUy89JTwS0G097TwX+BHLH27cdVZISnP0Dd+B/0Ask7z9YdHJ0wBrkknBqRDN X-Received: by 2002:a50:f697:0:b0:573:1e32:f6d6 with SMTP id 4fb4d7f45d1cf-5734d707240mr5937799a12.17.1715508282710; Sun, 12 May 2024 03:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715508282; cv=none; d=google.com; s=arc-20160816; b=P0BeRXoER/sMQO+Yly7fe6KQDqu8xxu7gOjjWKqgc0RQ3GMSBZw53Yw2e9rUixNIaG cbEtSYd7TBLhL74SWaoAIpeYUJqO/zunJbzqePpA/aAOry7ghs2ncAM03Tamsb/Qv+rR +k56Kmx+ZK/TbPSugUrcHeZfX/ETPoghqlYvuf9zSJeIIPh5q1Z3AnI46iuwizSDZgrw 5E9ykP8kw5G3l/zlxLkSYp7zfwHco9Lu67qxKHHCM9nsITM+Z/7q4eq8NlecOyUzXXjC usN3Fiy4gdWu8EdGqVGRjkMnvpEq3gvBzRLxuB4QJcMbyQVBJSM/mz94hc4o+qATZWB0 zhCw== 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=kjQl+Poiq5A1OuPStJxynv1sXipe/cEe5q21tNHBsQI=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=CIE5kKkx6/HQdEERsVq/XQbEuof4RQEHz+r/Sx5qTOvI2lYN+BRmVG5mD+VQqGPFyz Lab1irzuISqi7mmtkn5zgKgKZ5sCrQYDQTbWuHgJMrsc6AUpoMQko/Hk+O48qhC3OU0J lYWMo3Li2YLSWu3Ix4sHeAj70px6BIJA7+8ANjRnVnpgqA2WGDjWn/LCLw05rpgAosev x7ECWiJrMunQgmg/67bJA5XpbSk3bAlRJJD7hhAaMTr3boxmNFMe5KhGqutXOtdypb1l NEw1lJPoBwKxEoy9GqvHlgs5VStKVPs3me2m3JvfmLZIi37ZO5otgN6JC2N3J/lNy0ys KfRQ==; 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=djV9PjSy; 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 4fb4d7f45d1cf-5733beac78csi3859235a12.106.2024.05.12.03.04.42; Sun, 12 May 2024 03:04:42 -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=djV9PjSy; 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 B7ADE68D61C; Sun, 12 May 2024 13:03:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-84.mail.qq.com (unknown [203.205.251.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DBDCB68D5D9 for ; Sun, 12 May 2024 13:03:47 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1715508218; bh=DL55mdLzyvGwfMXnChpw81rzR7/qRrOSqCjIZKrAkr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=djV9PjSyBHuABZZ3tZyIvDtkY6bJH36WEOhwvyQljZEIzj/Jr8aT5Gfs+ItF3eVzr tjfBaoVl2iKeG9BiAvrWdxkxcCTgpYit4G5KNY22qulEzkhezs+gsUjKlfQAPRd0+d Fm2OkxdARrLY7vS4HTOMpXczzG9e847xkGVNbCsE= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id E135E56; Sun, 12 May 2024 18:03:33 +0800 X-QQ-mid: xmsmtpt1715508217tkc9kc8ke Message-ID: X-QQ-XMAILINFO: N5sfBKY/oC4kxGsf5WAq3/5Ijqv6gzWajEbJ0g+fG1VYHGAcdsayKpjz2C94Ge LxL4AxhAKNIB6JuL880sVuGAQmRbmkZO3hycDXDNwu46LBJ0D1zBiLRpQZ42TcgmcxtYgQQk7hxW /XhYz1YBn5/ykz2dEZSelI6hPBZrIdrFqul3QjhqYLOz2pIh+jyOrg80ke87EWjPHjDCBE/SSxcX hh1RxwvkCwcUo/gKgZo6amyIxT5mRfWIIhNasmwEn+XmxxKtOspUhpQtcmroVf9TIL0SEuCxtSJ0 STThxT+LbVHUgg9zVBxdmLb6+8IuVLrK8P2wvfRGtBo6RuZsIWyrNv9BTH83hicyp6C1vHXUc407 h0yviLEp7hKYITUWC0pd7ACJmCvl/CmJc6y0Ajf9iL+yDoqlNPDCZUIH+aGFrbo336VMVoitD/X1 3zh6XhnrYh0JB1lyH7rV4RZx72yXWIALZOzRInUVwaCI8IeTb03tUz1YkkiNAZNbEMsqISPGV8S9 UjKb9OJJJinVB348SRSl3x7BfhLVMQRuN7CSmYgwOuXllcgWGImyFBBh7TWjg3WsE8OHX+8yPxOo naU20zT+0lfuQ5mXnTNqqO5SsXVE+q76fHx0+hsOlr53dnEYFnlS3TdAqilehOe+JvmERPzxEMGG jrzH7LVxJtRIvYzuEVf95bjQsm953WhW9oS2Fn/sNekw6SE3igOaGCt2RXnIMLRgJ8hhSvyE7yvR 3J/MS1hQFb1N3+Y/UH3akZkViAYw1XS10thfJif3rNB3aDAD2RiO9oFoDPU3YoZxYKsuhGVmVrGq E86k0UgYLU8d7cGDufsEdCOio+pGPY42M4zyMdlrByIq7Ky4xZesgawVuzxklffB5A+W6sAfuN+F 450edyKSSzyO4wOu0ZftczS7puFOQ4s15q6HFzVaywI/3KBUD8aSVEi+HIpc1zn5PE4eh2VTZmks UvnBoIATk= X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 May 2024 18:03:28 +0800 X-OQ-MSGID: <20240512100331.995415-6-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240512100331.995415-1-uk7b@foxmail.com> References: <20240512100331.995415-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 6/9] lavc/vp9dsp: R-V V mc bilin h v 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: 058hcJX3XOln From: sunyuechi C908: vp9_avg_bilin_4h_8bpp_c: 5.2 vp9_avg_bilin_4h_8bpp_rvv_i64: 2.2 vp9_avg_bilin_4v_8bpp_c: 5.5 vp9_avg_bilin_4v_8bpp_rvv_i64: 2.2 vp9_avg_bilin_8h_8bpp_c: 20.0 vp9_avg_bilin_8h_8bpp_rvv_i64: 4.5 vp9_avg_bilin_8v_8bpp_c: 21.0 vp9_avg_bilin_8v_8bpp_rvv_i64: 4.2 vp9_avg_bilin_16h_8bpp_c: 78.2 vp9_avg_bilin_16h_8bpp_rvv_i64: 9.0 vp9_avg_bilin_16v_8bpp_c: 82.0 vp9_avg_bilin_16v_8bpp_rvv_i64: 9.0 vp9_avg_bilin_32h_8bpp_c: 325.5 vp9_avg_bilin_32h_8bpp_rvv_i64: 26.2 vp9_avg_bilin_32v_8bpp_c: 326.2 vp9_avg_bilin_32v_8bpp_rvv_i64: 26.2 vp9_avg_bilin_64h_8bpp_c: 1265.7 vp9_avg_bilin_64h_8bpp_rvv_i64: 91.5 vp9_avg_bilin_64v_8bpp_c: 1317.0 vp9_avg_bilin_64v_8bpp_rvv_i64: 91.2 vp9_put_bilin_4h_8bpp_c: 4.5 vp9_put_bilin_4h_8bpp_rvv_i64: 1.7 vp9_put_bilin_4v_8bpp_c: 4.7 vp9_put_bilin_4v_8bpp_rvv_i64: 1.7 vp9_put_bilin_8h_8bpp_c: 17.0 vp9_put_bilin_8h_8bpp_rvv_i64: 3.5 vp9_put_bilin_8v_8bpp_c: 18.0 vp9_put_bilin_8v_8bpp_rvv_i64: 3.5 vp9_put_bilin_16h_8bpp_c: 65.2 vp9_put_bilin_16h_8bpp_rvv_i64: 7.5 vp9_put_bilin_16v_8bpp_c: 85.7 vp9_put_bilin_16v_8bpp_rvv_i64: 7.5 vp9_put_bilin_32h_8bpp_c: 257.5 vp9_put_bilin_32h_8bpp_rvv_i64: 23.5 vp9_put_bilin_32v_8bpp_c: 274.5 vp9_put_bilin_32v_8bpp_rvv_i64: 23.5 vp9_put_bilin_64h_8bpp_c: 1040.5 vp9_put_bilin_64h_8bpp_rvv_i64: 82.5 vp9_put_bilin_64v_8bpp_c: 1108.7 vp9_put_bilin_64v_8bpp_rvv_i64: 82.2 --- libavcodec/riscv/vp9_mc_rvv.S | 43 ++++++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp_init.c | 21 +++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index 5d917e7b98..986cc3760d 100644 --- a/libavcodec/riscv/vp9_mc_rvv.S +++ b/libavcodec/riscv/vp9_mc_rvv.S @@ -53,6 +53,49 @@ func ff_avg\len\()_rvv, zve32x endfunc .endm +.macro bilin_load dst len op type mn +.ifc \type,v + add t5, a2, a3 +.elseif \type == h + addi t5, a2, 1 +.endif + vle8.v v8, (a2) + vle8.v v0, (t5) + vwmulu.vx v16, v0, \mn + vwmaccsu.vx v16, t1, v8 + vwadd.wx v16, v16, t4 + vnsra.wi v16, v16, 4 + vadd.vv \dst, v16, v8 +.ifc \op,avg + vle8.v v16, (a0) + vaaddu.vv \dst, \dst, v16 +.endif +.endm + +.macro bilin_h_v len op type mn +func ff_\op\()_bilin_\len\()\type\()_rvv, zve32x +.ifc \op,avg + csrwi vxrm, 0 +.endif + vsetvlstatic8 \len t0 64 + li t4, 8 + neg t1, \mn +1: + addi a4, a4, -1 + bilin_load v0, \len, \op, \type, \mn + vse8.v v0, (a0) + add a2, a2, a3 + add a0, a0, a1 + bnez a4, 1b + + ret +endfunc +.endm + .irp len 64, 32, 16, 8, 4 copy_avg \len + .irp op put avg + bilin_h_v \len \op h a5 + bilin_h_v \len \op v a6 + .endr .endr diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index 832b015166..31120a7893 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -63,6 +63,27 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) init_fpel(3, 8); init_fpel(4, 4); + dsp->mc[0][FILTER_BILINEAR ][0][0][1] = ff_put_bilin_64v_rvv; + dsp->mc[0][FILTER_BILINEAR ][0][1][0] = ff_put_bilin_64h_rvv; + dsp->mc[0][FILTER_BILINEAR ][1][0][1] = ff_avg_bilin_64v_rvv; + dsp->mc[0][FILTER_BILINEAR ][1][1][0] = ff_avg_bilin_64h_rvv; + dsp->mc[1][FILTER_BILINEAR ][0][0][1] = ff_put_bilin_32v_rvv; + dsp->mc[1][FILTER_BILINEAR ][0][1][0] = ff_put_bilin_32h_rvv; + dsp->mc[1][FILTER_BILINEAR ][1][0][1] = ff_avg_bilin_32v_rvv; + dsp->mc[1][FILTER_BILINEAR ][1][1][0] = ff_avg_bilin_32h_rvv; + dsp->mc[2][FILTER_BILINEAR ][0][0][1] = ff_put_bilin_16v_rvv; + dsp->mc[2][FILTER_BILINEAR ][0][1][0] = ff_put_bilin_16h_rvv; + dsp->mc[2][FILTER_BILINEAR ][1][0][1] = ff_avg_bilin_16v_rvv; + dsp->mc[2][FILTER_BILINEAR ][1][1][0] = ff_avg_bilin_16h_rvv; + dsp->mc[3][FILTER_BILINEAR ][0][0][1] = ff_put_bilin_8v_rvv; + dsp->mc[3][FILTER_BILINEAR ][0][1][0] = ff_put_bilin_8h_rvv; + dsp->mc[3][FILTER_BILINEAR ][1][0][1] = ff_avg_bilin_8v_rvv; + dsp->mc[3][FILTER_BILINEAR ][1][1][0] = ff_avg_bilin_8h_rvv; + dsp->mc[4][FILTER_BILINEAR ][0][0][1] = ff_put_bilin_4v_rvv; + dsp->mc[4][FILTER_BILINEAR ][0][1][0] = ff_put_bilin_4h_rvv; + dsp->mc[4][FILTER_BILINEAR ][1][0][1] = ff_avg_bilin_4v_rvv; + dsp->mc[4][FILTER_BILINEAR ][1][1][0] = ff_avg_bilin_4h_rvv; + #undef init_fpel } #endif