From patchwork Sat May 18 18:15:30 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: 48992 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp3571986pzb; Sat, 18 May 2024 11:16:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU47voqH4jHtVQmyvj7joVdN12Jspv8GuKDSGWbQQ2Iu++M9G+L/SSB0iUw8mSmrcGbf3Wf5PA9g/lDMBUMh65eJ98seV71OyjctA== X-Google-Smtp-Source: AGHT+IExi1hqiLmVS5Xv0QZJACgVz1Fx+HYNpFuBeI6AXqiI/4L/lGko7EUruNG5UdvVR0V8S+43 X-Received: by 2002:a2e:a1ca:0:b0:2e5:67a7:dda7 with SMTP id 38308e7fff4ca-2e567a7df67mr159591041fa.3.1716056184010; Sat, 18 May 2024 11:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716056183; cv=none; d=google.com; s=arc-20160816; b=wbU2wXjGed0FjLSgiPiLvzjhzyw1izYyDcAh7QUVhbKGslJ6Gbb1e+6LAK2wyLCVzo iqj9YPN7zqfeFF9ywdobmF+52+JqFY7dT+9R7beTHC+lwjBgiQ9hVuK/zcPCCdKKyK2Y F6yo8H7tCMwvDPNaLLwsGF/GJhrIFCa4JA6PVV1IAvqTJQUfSFW8Hc/2Te6RerD2S/i0 F3hF3YdNpig8BrOCJ8IjGlvcUIj+YGfxugAmPq+f3lg2mxqMRAnYPxvMeGMItIgHqzP1 un5+LBquUKYinSE9SWEzE6Rz4e5wQRDp11hzeDk34vgk/JFipMq9VRjOyzp89880j6WP ndlg== 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=42lSXGDppeU09ABPOvAgFly7LbmmP5bZamK29NeEhok=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=mDzpu8le6dAnyoNByyH3NEn/ilFLQhiseQ3reoeIWsa3CbgWJw02WJOpWowWxJpGUM lFZKt2QFZaEGl6ULUdAMndGG52FfP/m6dgjoehkifeepU4rlzOkiEVMtBpenXlOLcTOW +DEZ2jg8eOCYX+W6AwLIxOqp23daoYnipkMZSfNyldSsvIKk1FcrY0yNCdz8QT3g6gyr l8aqomXym7b6ik/3GVirII7CC0z8qngsKYgiBaN3hlpJFE6iFNiom/Ro/u8rsjkjDdtq Mxou4L/h5Vn6HCU4QEENuMA30UraI835zrkLE7/AN47y7RaHacJ+g4G1xzLrmzPs/ilv 5Q7w==; 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=BVeVT0M5; 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-574e1d5f0f2si6611348a12.79.2024.05.18.11.16.23; Sat, 18 May 2024 11:16:23 -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=BVeVT0M5; 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 7339F68C825; Sat, 18 May 2024 21:16:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-191.mail.qq.com (out203-205-221-191.mail.qq.com [203.205.221.191]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8066468C825 for ; Sat, 18 May 2024 21:15:57 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1716056137; bh=nBkUAx35ozTGl3HCFwX8RH63j3Q/xjsl/Ah0wKSjs/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BVeVT0M5audb6CR1t8W6hbj8DGteT5F6CDo6zQb+5BBQkZRmpnHsiA6BCS4hYguu7 srV3J0vV11NIVosBUc6Xys1nzSYRPP9BY2VDrDQWPiYuZ1fgrEy6wBt9WpbtE72U2F 3RQ14ZrijR423YA7x+WgSQlgdGNj2/kBRfJwfI0w= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrszb16-1.qq.com (NewEsmtp) with SMTP id 3E33EA47; Sun, 19 May 2024 02:15:35 +0800 X-QQ-mid: xmsmtpt1716056136t6zvhj1bo Message-ID: X-QQ-XMAILINFO: NafziRg7Bx69bGzgJtECDdvSYulAfUQlPQl2HkfTRVsiHzy3FdP9tX5Cx934mJ 2XK+bavhq4XfSHyn7XHg11PBqXJ4X1lG+KxJogyia/eV9zav8uCkTtJTwAUSHp/s5ySWNNuo+BMU R5G4hGpNDC611k5ndl66Atape023zc/zEyFjiTqZWaeyeiNPAvnIhZ+hUYn87EYdBzfaqucOiaw2 GW2mYicnk92xtoQyWBoAaZs0qTq6IDOggmnYOV/qSnSoung8bC0mOWcWPYTcBJTNmEBCy/K/SZr7 sXn9JQl4dDuNWvoBZcQ/Sj7iz+7vANEUeFAOFt8Jnibk9VIrbGlMR0gh4Laj+03ooeeGRehQMJPA G8XD/lRkkrLFIKm1LN8v/idyaKka5Nmjimo2UEW+saoPhvXLdZzcDIdNkcX8kzoQoN+ibAOCU/Im 5krxku0yWE69jTpjbaCZ1AV2C+urjCg+l1KTPYNOSfWh4tjKf3y0OnWCmDYF6Xf/mDFh8drGTa6g bEZLbnXoKnysZbRZMO6h5xhvCblYLZmPxvIB4drtvR7owMvcugRr7XrSVv6iSuiEsLV/A8A/VhtR x4so/5sGRfCjBwyl+PlgTGdZQSICRfkRZ5rNvHbHZth61Z2+OoLoM+oNz5+Bo1Lv9hpA4XTS2jPu WIusgxlw4o2InhhfiuypV9vOsLteWFQpB7m+blRMiB4BShBAUyevzBdDIi3xQ0KcqBc0LwhgcWMr 7KWoex5C457tyL90jHBeHh9mNRS/Vp7DK2cw1Ji14sZCOwSGViWZ/MuFBtuvWqskXOP9kYUCrqGM ZXkiE/bEZvlRyDL6wMWLb2yi/jH1ud85AhzU0XqGkmpo8cTo8NLn2pFF4uigre73D5AJzKJ9vZxz kJbNjSxf11QF8SyvOX43QI0yReLEosjfwV9/GVPn+FGcHQTKoAIwIbe+2gwPWs0d88HJVctDSYEh JxPEGRXGk= X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 19 May 2024 02:15:30 +0800 X-OQ-MSGID: <20240518181533.3124314-2-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240518181533.3124314-1-uk7b@foxmail.com> References: <20240518181533.3124314-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 2/5] 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: U6NbBdigzMe4 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 7811cd9928..b0052c0ece 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 +.else + 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 6bfe23563a..565b68959f 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