From patchwork Tue May 7 07:36:10 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: 48612 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:6816:b0:1af:836d:81b3 with SMTP id wr22csp208853pzb; Tue, 7 May 2024 00:37:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXtHF8iBfawtSlLp250RPtWwNPqIP120JVb3i2BKk0ai71kT7R3IP14eHcw+Xk2l6c1wdXrPwH1+YBzXSTTj/Xmosgyoz9YHJX8VQ== X-Google-Smtp-Source: AGHT+IEE+xjqXH3k5srZmSwHOclpOVpdpUu9+B52xE/oBlmzc1abgRMQwA9XYijvyzlYt3qSFGeX X-Received: by 2002:a50:9ea9:0:b0:572:65d3:8084 with SMTP id a38-20020a509ea9000000b0057265d38084mr8095614edf.1.1715067448774; Tue, 07 May 2024 00:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715067448; cv=none; d=google.com; s=arc-20160816; b=Te71zNq3F8Gx07r2Bh0Ol5S5zJ9zDgEe02EI5Dj03elzJBKEqrBJBht/AJujEzUGxw bkvglF4Z3Iyh4B4JCxU5+tyjgkFLK6OOuuhdm2ypEdxYf3u/FCNHFJwQGN/zDJAZ3PIi weUwo8zCYCFsLiDDMqZCzuvbc5/EjOqFLVIzwykp0i+99+fQoWUK73zr/sU9KGRfOoTO xQSblyCzOnXT+C1CWb8WOjjcPErgI6/Ej+f4CPkmj64gThhu+fXzny0DwbiShnJn1Ckt UWqAroj/AaS195ie9pPP4X/2qzFh7Xh1QfZMxPhSyPAlOIfSyEhl1bljYv7p6VXvSE3f QdtQ== 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=DNua6GbPS73veJfT1r6jdJvejRma6xwGsEPAaqmmBh8=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=Q6HruKxWK3Wyv+QfbEMfnIWAluHuLs2rIPTIgMeI8F6HOyh6k0JY3Ugi/7Oqt+OghE W5w/f6MTXegFtbYqwngFFr4MvJ4YpOaHVEHfEuyyBdvK3pYcwzs9fsYP/9ZVXyy25JFJ KLdBvEIorJMPiYOjy3kWUrVUTHDYf7glwMvn1giSMsijc19uI+SLBHU2+C5/os5fM9Nl nbFvnATMlm3iFB/QBmP9FxRGzXdv3Qsrpq2Z4RfdVW2Qh/QxbzsA8+z8duFPHuWjDZ40 AQxPt117KxOeJjAPiGEWUu6c1tFyc0+Jsbwobm1cgUCFHreBBE7YMyDMjCnOa/9m7B60 K3IQ==; 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=QYPwTaZK; 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 bf26-20020a0564021a5a00b005726f528effsi5861175edb.88.2024.05.07.00.37.28; Tue, 07 May 2024 00:37:28 -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=QYPwTaZK; 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 5932A68D742; Tue, 7 May 2024 10:36:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-231.mail.qq.com (out203-205-221-231.mail.qq.com [203.205.221.231]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DE7D268D724 for ; Tue, 7 May 2024 10:36:38 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1715067390; bh=dVrJ2inZO1EzfhRqPpWvWiDV5y/LslkQBBkzJ3EM2Qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QYPwTaZKpYMrZcbJoCiNMq0uRh79T6ShJit2Obes57wKjBcXVJn/V/W9ZGLwv8MCM OhPKvB2gWX2uONJaKy0/vDWHu40aMQXRo29cAJR7PoyRKOD8PTG0uJH5WiCNLd0lSg iGabC+4Ciuw4+ntQ+ATCus++GkjgcqWJE87Pl9JE= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrsza29-0.qq.com (NewEsmtp) with SMTP id 9188D283; Tue, 07 May 2024 15:36:24 +0800 X-QQ-mid: xmsmtpt1715067389tnos5g35q Message-ID: X-QQ-XMAILINFO: OabLgwGJB7xGL/sUIQZSuhGbVm3Lwg5GUdT84nDfALSTZa+35TQCYv/gVep9YZ scYaylyzR7gWgmGW2vRATk+XZizqFfu6DBilRdxP1UiqU4xC7nq0yN2QAPRXRX141GCoit7Gf/JJ 25yxJbJTqb5JZW2xMx2VNbHWCnPhRoeiCy6g9jpsfxjYmUetsnX0ZUM73O23isLc/JjH7wwliaq9 PyqZ/fiDQK+MFVx0LUMXN867JEqJocxDb24+O9jPdFqMXxXvaPDQJe908rwkbli4VG5vVPg1DMZ0 NQ2fxGEbu7UwFhM/itx3mjrpgrB3spbtSwMT6GRVEYMY7twK0sTA/+o7is2yXpFQLeLICjT09idu LIg5TeLkf9f8bzENFTdsZo+1GUJuZrvmNJcHe1UtXLRSfwWpkrb9b+0r8hYPyorua5KNxEKfyk5/ 9zz/a3Ya5Lo6x9z9EDrls0NcWYxY7Z3AGLTXIs1p5ucaEpI1FmOr/5lRfju4mdntisTMzg6ZyqUF aWjc58E7NjPEPSX8FFHYYp9IXxJepHvcUS/rsF5maRZx+9x4LdGW4jVJZ5XXPTXE0IZwcNcM4xmQ D3XEsGOU4xCWMrhxj3dmyNB0Vmp3+3Ase1IGALz9aaUXp9kUZ2KTDTa2fTliCRexJLMPSqQklXp+ FFUNiq0DUevmDWgkCE9tLhF7LTMYI8tfrhj857uwNEyGO2SZwJ8eo+zlc3jC0Zv1huX/2cpKrsY0 1tHPTfJ1nTk9hmkMkqrRhrhdrX9pcUByqbaiZ52P59twIqTpETJO8NIksxmGev8pUPQzEtkuQNNm E7bc5OiA4PjNEMobXRx3Xd2Jfpi7Sl/EVB5oieIUNqKbgLFdqniFPRxrMMun/gFjbULkEg4liXFJ 5hEtqETZwXmDbeRaj1aR2jXCGpZQgKfarObDAjicxEDQCPP895vNZViZ8EUiXQ7A== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 May 2024 15:36:10 +0800 X-OQ-MSGID: <20240507073613.2871668-6-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507073613.2871668-1-uk7b@foxmail.com> References: <20240507073613.2871668-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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: EUMbQUBclgox 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 | 22 +++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index 81ecb49435..598a67fc94 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 + 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 2caaf732db..cfeaa06c0a 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -109,6 +109,28 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) init_fpel(4, 4); #undef init_fpel + +#define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type) \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][idxh][idxv] = \ + ff_##type##_bilin_##sz##dir##_rvv; \ + +#define init_subpel2(idx, idxh, idxv, dir, type) \ + init_subpel1(0, idx, idxh, idxv, 64, dir, type); \ + init_subpel1(1, idx, idxh, idxv, 32, dir, type); \ + init_subpel1(2, idx, idxh, idxv, 16, dir, type); \ + init_subpel1(3, idx, idxh, idxv, 8, dir, type); \ + init_subpel1(4, idx, idxh, idxv, 4, dir, type) + +#define init_subpel3(idx, type) \ + init_subpel2(idx, 1, 0, h, type); \ + init_subpel2(idx, 0, 1, v, type); \ + + init_subpel3(0, put); + init_subpel3(1, avg); + +#undef init_subpel1 +#undef init_subpel2 +#undef init_subpel3 } #endif #endif