From patchwork Fri Aug 9 14:24:04 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: 50956 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b106:0:b0:489:2eb3:e4c4 with SMTP id o6csp469936vqn; Fri, 9 Aug 2024 07:24:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVy4iqHIYEikTVRbnVd+r707xA28aOnE+eqGsaH2K0XOk95GCc8N1+AxXURZ+i/AnzsAhWBiUbC9gT1KNYon5LSjtmT8HMR6qWgnw== X-Google-Smtp-Source: AGHT+IEiidfiEPrOXrvJvC/pfYmnWjL1VE6E6/B6ip4LvmJnt+8vPMcYS2BprIytUEH5VYAskqtm X-Received: by 2002:a05:6402:3596:b0:57c:a422:677b with SMTP id 4fb4d7f45d1cf-5bd0a54f3b4mr1469228a12.8.1723213471529; Fri, 09 Aug 2024 07:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723213471; cv=none; d=google.com; s=arc-20160816; b=IfwrbD7S1GL2DxSMuPXvaRvLl4cCXBYm680PhO6SVoVFXN3EAH9EZSVrW79RStrjxe IIb9FULfURJ6R36ZjZRaE5eldHF2vEjsfKxdeFwFv7j8LejTKuNpHJutYwmOfB1Rx3BP i2V7Tt5nYTGbTairMe9HzqC9lPtTdDgIllQhd81jOffSvwphFPX+3h5m+qe4sYq4ToC3 h+gvykPBxfZNhgqwmhd8JtERNqb9LBYPJM5j9cg2SEJpo5cIsQw4bjb+KEcl3bx9qjIL 3qD8Z5QmSKr9a7uXrxOUhujyZ8m35x9sf/HaenXaufgRDp1lRuPOTACjO/n36eZc8qEV CuhQ== 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=IsvYQlTCnX7Pmz/TytDLoJE/hA8MDaPCcGG7toja3BU=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=R1Wwyb79OaiORbcno9IoyC5e0eV8U1bpsS7jfpoVGOIwhiVZ0sheftK6eVHvbZddup NmRvoLSa1VmgqyhuQ+e2NI7qQMzUvlrLRYJNRPQKVb7o3fb19234EvWACFhZ0uizhT9K bsDCWDPsa2TK5n2BYodLSLDp4bd+kygCO4Zl0DD/54SDsWNdMjcxeGxV81BHytaCVnmg oLUf+LhzcMSaan7duFyFQj/6d4v4d1tI+ncJE9SPQldnBkmx1saocBabyxIzSFNYzy+H RDDdClYb4CYfct4VnmtCAfClsk8qcWJL4pBYbiVioxjNaHErwbF7HTbrvRTciPdWpfBt VAig==; 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=yT4D+QpC; 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-5bbb2d23e75si1954539a12.423.2024.08.09.07.24.30; Fri, 09 Aug 2024 07:24:31 -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=yT4D+QpC; 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 9110968DA0A; Fri, 9 Aug 2024 17:24:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from xmbghk7.mail.qq.com (xmbghk7.mail.qq.com [43.163.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C92668D864 for ; Fri, 9 Aug 2024 17:24:18 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1723213450; bh=WpTKuLjOnlNx3oTQFzDE1AbmEzfPovqfT0ksTDudjC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yT4D+QpC2rnNIuyzumb6A1kb8fSkp6V7P736oAyPH04cd45ot8XsPe+sawdZfzX7l VaIYxUVY8chSK3zUxwgYSdH0wzAmmlYVIAEd2Ta2bByb/1Ad9DG/xwTQJu7biCdWyH ZMXNMZCnokAQtOP+jGdhGJpFgyxjqm5Zsi/qIMss= Received: from localhost.localdomain ([42.57.186.183]) by newxmesmtplogicsvrszc13-0.qq.com (NewEsmtp) with SMTP id 6083D02B; Fri, 09 Aug 2024 22:24:08 +0800 X-QQ-mid: xmsmtpt1723213449t6pul9a3n Message-ID: X-QQ-XMAILINFO: M0PjjqbLT90w3nyP7Da4/7HXdQSZ05N61KxB0JtanpC/3VKD6qPKjC6ocApweH ug018kyTG+2irccpjUimEiihsSkC1kJm7Y8fbrNJ1cgQMvwzf6Pbq3OHRecHpTkv1YVNzO6Uy+/z tOSMI0ShngS6sduOBzKnUdk+EjZg8XkMSmEnh+Tn53P/y35xRPNHj909S+tLPIKmIFAXN3CSwXpw Ni8aR8ig88KaBlhoMBzChaJubgpGWoTtJVWhPPPtfGKF9ANz6ITNlkI09MdbVo1YcAbwuCi6BL34 8LyYkBr2rXvXEhQMxn7GXoi94glGvJF3pJg8b6ujSEiFPUua2n4NNjJjCFj1gf2m9lZ1aZz5X4TC AMPLtsRjQGmD9Vv6fJKoQCwVMeD0S+5+vaMkx6kJJDZMld8mxVK61cipcA9d55PID/UBQn/dlKPN SwXbTFQ16KZpweHhE5oMoE2T5af/mpBIXlMluG6BWESi2guN03Mz2DxyMS8kEFXbCcU3p9YNCALW NQc6M6P/1pS9aN1NXNJbTwr0aZqajrakXp6+6TZmnQFkJw9Vt0Zi/UZBgt1qqPB1QvG3lGPkeKss r4CfPqHA0dyY2rS2fsyuu6Gn5rgol/5TkYG1GjTTnL5Rr7v7fOzFgZhUumuoHPmeihsUJsZy6qN0 xgSPEaJ3/kgvdydBBfi9pdw+2a/jMM69uuKb1+tafohyJBNdGFHv0ogBOHmMGoRAuyquj68+IeN6 xeXqOiioisfU4lQUOumXCG+uQi94MDE+RySQVvR0KSVBswC3k0AGOpcJCIxdY3Myl8EByq/KbDyK QE808prafAoXxl7erjC6Qt7IlXPyOqJ7XU7C/IHqA5kqbg7NZZ/LCa3b7NpD1GPTUi51ZhlZxnBh boh5jSstUQdUZlCMju9O7c4QOfF3cNFLrRIos0EzqG X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Aug 2024 22:24:04 +0800 X-OQ-MSGID: <20240809142406.3845162-2-uk7b@foxmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240809142406.3845162-1-uk7b@foxmail.com> References: <20240809142406.3845162-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] lavc/vp9dsp: R-V V mc bilin 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: FMOVQUxiDbtB From: sunyuechi C908 X60 vp9_avg_bilin_4hv_8bpp_c : 10.7 9.5 vp9_avg_bilin_4hv_8bpp_rvv_i32 : 4.0 3.5 vp9_avg_bilin_8hv_8bpp_c : 38.5 34.2 vp9_avg_bilin_8hv_8bpp_rvv_i32 : 7.2 6.5 vp9_avg_bilin_16hv_8bpp_c : 147.2 130.5 vp9_avg_bilin_16hv_8bpp_rvv_i32 : 14.5 12.7 vp9_avg_bilin_32hv_8bpp_c : 574.2 509.7 vp9_avg_bilin_32hv_8bpp_rvv_i32 : 42.5 38.0 vp9_avg_bilin_64hv_8bpp_c : 2321.2 2017.7 vp9_avg_bilin_64hv_8bpp_rvv_i32 : 163.5 131.0 vp9_put_bilin_4hv_8bpp_c : 10.0 8.7 vp9_put_bilin_4hv_8bpp_rvv_i32 : 3.5 3.0 vp9_put_bilin_8hv_8bpp_c : 35.2 31.2 vp9_put_bilin_8hv_8bpp_rvv_i32 : 6.5 5.7 vp9_put_bilin_16hv_8bpp_c : 134.0 119.0 vp9_put_bilin_16hv_8bpp_rvv_i32 : 12.7 11.5 vp9_put_bilin_32hv_8bpp_c : 538.5 464.2 vp9_put_bilin_32hv_8bpp_rvv_i32 : 39.7 35.2 vp9_put_bilin_64hv_8bpp_c : 2111.7 1833.2 vp9_put_bilin_64hv_8bpp_rvv_i32 : 138.5 122.5 --- libavcodec/riscv/vp9_mc_rvv.S | 46 +++++++++++++++++++++++++++++++++- libavcodec/riscv/vp9dsp_init.c | 10 ++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index 9e8061616f..d1ddbe007b 100644 --- a/libavcodec/riscv/vp9_mc_rvv.S +++ b/libavcodec/riscv/vp9_mc_rvv.S @@ -138,6 +138,48 @@ func ff_\op\()_vp9_bilin_64\type\()_rvv, zve32x endfunc .endm +.macro bilin_hv op +func ff_\op\()_vp9_bilin_64hv_rvv, zve32x + lpad 0 + vsetvlstatic8 64, t0, 64 +.Lbilin_hv\op: +.ifc \op,avg + csrwi vxrm, 0 +.endif + neg t1, a5 + neg t2, a6 + li t3, 8 + bilin_load v24, a5, h +1: + addi a4, a4, -2 + bilin_load v8, a5, h + vwmulu.vx v16, v8, a6 + vwmaccsu.vx v16, t2, v24 + vwadd.wx v16, v16, t3 + vnsra.wi v16, v16, 4 + vadd.vv v12, v16, v24 + add t5, a0, a1 + bilin_load v24, a5, h + vwmulu.vx v16, v24, a6 + vwmaccsu.vx v16, t2, v8 + vwadd.wx v16, v16, t3 + vnsra.wi v16, v16, 4 + vadd.vv v0, v16, v8 +.ifc \op,avg + vle8.v v8, (a0) + vle8.v v16, (t5) + vaaddu.vv v12, v12, v8 + vaaddu.vv v0, v0, v16 +.endif + vse8.v v12, (a0) + vse8.v v0, (t5) + add a0, t5, a1 + bnez a4, 1b + + ret +endfunc +.endm + .irp len, 64, 32, 16, 8, 4 copy_avg \len .endr @@ -146,6 +188,8 @@ bilin_h_v put, h, a5 bilin_h_v avg, h, a5 bilin_h_v put, v, a6 bilin_h_v avg, v, a6 +bilin_hv put +bilin_hv avg .macro func_bilin_h_v len, op, type func ff_\op\()_vp9_bilin_\len\()\type\()_rvv, zve32x @@ -157,7 +201,7 @@ endfunc .irp len, 32, 16, 8, 4 .irp op, put, avg - .irp type, h, v + .irp type, h, v, hv func_bilin_h_v \len, \op, \type .endr .endr diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index 83dbe1b5d9..d53852f673 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -83,6 +83,16 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) dsp->mc[4][FILTER_BILINEAR ][0][1][0] = ff_put_vp9_bilin_4h_rvv; dsp->mc[4][FILTER_BILINEAR ][1][0][1] = ff_avg_vp9_bilin_4v_rvv; dsp->mc[4][FILTER_BILINEAR ][1][1][0] = ff_avg_vp9_bilin_4h_rvv; + dsp->mc[0][FILTER_BILINEAR ][0][1][1] = ff_put_vp9_bilin_64hv_rvv; + dsp->mc[0][FILTER_BILINEAR ][1][1][1] = ff_avg_vp9_bilin_64hv_rvv; + dsp->mc[1][FILTER_BILINEAR ][0][1][1] = ff_put_vp9_bilin_32hv_rvv; + dsp->mc[1][FILTER_BILINEAR ][1][1][1] = ff_avg_vp9_bilin_32hv_rvv; + dsp->mc[2][FILTER_BILINEAR ][0][1][1] = ff_put_vp9_bilin_16hv_rvv; + dsp->mc[2][FILTER_BILINEAR ][1][1][1] = ff_avg_vp9_bilin_16hv_rvv; + dsp->mc[3][FILTER_BILINEAR ][0][1][1] = ff_put_vp9_bilin_8hv_rvv; + dsp->mc[3][FILTER_BILINEAR ][1][1][1] = ff_avg_vp9_bilin_8hv_rvv; + dsp->mc[4][FILTER_BILINEAR ][0][1][1] = ff_put_vp9_bilin_4hv_rvv; + dsp->mc[4][FILTER_BILINEAR ][1][1][1] = ff_avg_vp9_bilin_4hv_rvv; #undef init_fpel }