From patchwork Thu Aug 1 12:08:48 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: 50857 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:12d6:0:b0:489:2eb3:e4c4 with SMTP id 205csp1098100vqs; Thu, 1 Aug 2024 05:10:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPQ1lFJj9yHCKKJDx7oIKbSfdb8JhNJxkwUC1mvlFxCVL1nEbuVisjDzkKLM5SrA4xSdmP9RMXWwBTml7h33s9LpQoO8UfksCrYQ== X-Google-Smtp-Source: AGHT+IG4kXU7deyFG7tV0/IJt47ME/xzW8jo1XGrw2WDSkFOkfbWKB8sP9RufT8N7Fb2Vw1fr01t X-Received: by 2002:a17:907:96a4:b0:a7a:b4bd:d0eb with SMTP id a640c23a62f3a-a7daf2d0990mr161417566b.24.1722514230932; Thu, 01 Aug 2024 05:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722514230; cv=none; d=google.com; s=arc-20160816; b=rTX7A2FJuLZzTb4wkyCDt14/CXNNc9x3InyjGjyB3zfjv2NcTQ+7WjPD3amkjFYGCD RmUlP6qa35m7rykP0hb4FONeyC58ao0R5PlbxdBFHUaMw2ijGVxzhPYWKR4GRg6WHlyM 0zlq3B0Jm8kzsks1lmTvKeURAreXS3za/30l6cy+4Oemq8Zls9Q3sC+pH9A85nqPiaCR fuIZ4YEQKLMB7uZGY6nyqQFIyAjQUglrUWnC1Q9NOafqUOSEts4fN1GiojAe9uf3A1zL uXvvWeBqTRNpq0MQeuVdfHF6nuJLJoIXAcYNKKvZPUWAlQHkHEqgCuP0rEwE4u/Aqr9f 98gQ== 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:date:to:from:message-id :dkim-signature:delivered-to; bh=DopU/XC6q51D7DPfTOqZg0g27QzdqLzGBhwIDRLYeGk=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=WEeL0ezC9dvvEcB4wFNVJPn9wexPgjFHqkBSwHopYj3tVS/Ng4phlpZjfh1yH1hO7D /vWE9rUZVmPT2OTzr3tKcRQVVm7LopGQCjNyB0Mw6BvSRhrtoVFkWT0y6FxEgREFsNon h4RBXlPQrWDDQUtyt8CMEf0DdAKH5LpRGnsZOWWsA1b5CBxURTLpGsyilI7TnAxMevia SamRRb9zGancVZ5XPQeESaYtjhCZ/EgCzXKXuqb0V3OxlgzH66gQwNUDl92Z+7tcfTkB PlmX/Jh1IL8fOwnrmlmfKwmyGGHAZNTIUfLHZlO7ZopZoF6wFoqmWLD67KWxH0Yz8en7 1vHQ==; 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=zyfum2Zd; 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 a640c23a62f3a-a7acac7f14esi1015162166b.732.2024.08.01.05.10.29; Thu, 01 Aug 2024 05:10:30 -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=zyfum2Zd; 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 504EC68D93D; Thu, 1 Aug 2024 15:10:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com [162.62.58.211]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E85568D789 for ; Thu, 1 Aug 2024 15:10:20 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1722514217; bh=UWyxdnuVyQfLI4S1ceTTt7+Z17AHd9XHA7POL4+rIiE=; h=From:To:Cc:Subject:Date; b=zyfum2ZdVGNqQa+DsmVXttI8R2Ma3v8eKyB+YnWauRUeaOVAA8KatSeKUVF+XhEmQ Mr/HvQRoi4bW/g0R3mj0ts1/GJ91HKC1HjFv/FjCNgrQXZuG/K52jnfEm5y/Ls69sP Yh/b239w2ao4wrm5Qq9YOnDux4nmDip4hlpXXoLM= Received: from localhost.localdomain ([42.86.132.47]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id 2419AC43; Thu, 01 Aug 2024 20:09:01 +0800 X-QQ-mid: xmsmtpt1722514141thsdul5bk Message-ID: X-QQ-XMAILINFO: OGEC8BYa7lsBX4Mhss5BBJuP+OXbZiTSjPOhoGfPvR7jsE+4NNOuQ39NhScVvz IaaTrQ1CZtEqhFjxaRJUVyg+6WMfPMPd1TyQ3jpAE8p80ARGHe0U1ZRFy/6+7FQuQEPumPeS+5Rx smsskU4AD5LUm9IqHjxf41nQoCAr005XGjlSQKkLrPnXyL9PV3IVeYj+npSFnAEwFSu3m8Nk9Jsq GxbZr/u5wPdPB01ecoLnRRgDjNwwAFNoq5gtiYzYfURW3KldTs8qBTvg0RRgRkqBRr4cu6uQ1+mi UIaiTPQGxV3EwG4+kMJxQ3749W/27A/1Xeab1LgvTVtym7Lpmrwvggg5CTVlHdRKzRkb1ZJ68V3n c35zY7Zsi/a3jhJ5J4z3YI9iknrTjOuxnXUXW/UwwxQcz+62Eg1Z4Xyv4+i++IurGcOt8AJv+BDy 1Dstd+CI6uLdgZPmb8pTEy8tuiM5otCHq1ioe1nE61JYXqRxb22Nf5c5namDC3nHEwWWN35PK3cu 8ZULlVDBe6JH949eo+GzCm3wko/cWe1zI9Ik1A84Wj0KsDck5Y5Ny3t1Bh+ppUUQ1CB2RGhaubiW 6aVssDnTygDsk3xxwS4dObT6FZAbV2g5HTTiAGCaniOqAN4ZcpKGWNjk03eD0TkFQklY1x9DXXFN VD0MDnf302/sgpnif1HMEqkbwuHUR5aXLyBpFHt/PhyXoKFhI1AtXVt3R+UxP2GMKEfkZW9ltVRg TF9FH9O4YpYGMUBdCLR+kZEMuWGphDwy3yPM/E61sL+zRa8Eq9Yw6NqNV7VMFslPcw+7wzfDhUwo 340y8P6vkXIH5X4L4ZOBDwAI+L7c0Mn12ZXVxALktmqUHGWsSyur1V9BhBpy+oBSlQhU+3vTsMPR E7f7G5XCFjVYqBCdB6To02nWN70dbd0NDK0b1q6tkK X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Aug 2024 20:08:48 +0800 X-OQ-MSGID: <20240801120851.3097443-1-uk7b@foxmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] 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: bb30NahUSG5p From: sunyuechi C908 X60 vp9_avg_bilin_4h_8bpp_c : 5.5 4.7 vp9_avg_bilin_4h_8bpp_rvv_i32 : 1.7 1.5 vp9_avg_bilin_4v_8bpp_c : 5.5 4.7 vp9_avg_bilin_4v_8bpp_rvv_i32 : 1.5 1.2 vp9_avg_bilin_8h_8bpp_c : 20.0 17.7 vp9_avg_bilin_8h_8bpp_rvv_i32 : 3.0 2.7 vp9_avg_bilin_8v_8bpp_c : 20.7 18.7 vp9_avg_bilin_8v_8bpp_rvv_i32 : 3.0 2.7 vp9_avg_bilin_16h_8bpp_c : 78.2 69.7 vp9_avg_bilin_16h_8bpp_rvv_i32 : 7.0 6.2 vp9_avg_bilin_16v_8bpp_c : 98.5 73.2 vp9_avg_bilin_16v_8bpp_rvv_i32 : 7.0 6.0 vp9_avg_bilin_32h_8bpp_c : 325.5 275.5 vp9_avg_bilin_32h_8bpp_rvv_i32 : 23.0 20.5 vp9_avg_bilin_32v_8bpp_c : 342.2 290.0 vp9_avg_bilin_32v_8bpp_rvv_i32 : 21.7 19.5 vp9_avg_bilin_64h_8bpp_c : 1263.7 1095.7 vp9_avg_bilin_64h_8bpp_rvv_i32 : 91.2 81.2 vp9_avg_bilin_64v_8bpp_c : 1331.7 1155.2 vp9_avg_bilin_64v_8bpp_rvv_i32 : 91.2 81.0 vp9_put_bilin_4h_8bpp_c : 4.5 4.0 vp9_put_bilin_4h_8bpp_rvv_i32 : 1.0 1.0 vp9_put_bilin_4v_8bpp_c : 4.7 4.2 vp9_put_bilin_4v_8bpp_rvv_i32 : 1.0 1.0 vp9_put_bilin_8h_8bpp_c : 16.7 15.0 vp9_put_bilin_8h_8bpp_rvv_i32 : 2.2 2.0 vp9_put_bilin_8v_8bpp_c : 17.5 15.7 vp9_put_bilin_8v_8bpp_rvv_i32 : 2.2 2.0 vp9_put_bilin_16h_8bpp_c : 65.2 58.0 vp9_put_bilin_16h_8bpp_rvv_i32 : 6.0 5.5 vp9_put_bilin_16v_8bpp_c : 69.2 61.7 vp9_put_bilin_16v_8bpp_rvv_i32 : 5.7 5.2 vp9_put_bilin_32h_8bpp_c : 273.2 229.0 vp9_put_bilin_32h_8bpp_rvv_i32 : 19.7 17.7 vp9_put_bilin_32v_8bpp_c : 290.5 243.7 vp9_put_bilin_32v_8bpp_rvv_i32 : 18.7 16.7 vp9_put_bilin_64h_8bpp_c : 1040.5 910.5 vp9_put_bilin_64h_8bpp_rvv_i32 : 82.5 73.0 vp9_put_bilin_64v_8bpp_c : 1108.5 971.0 vp9_put_bilin_64v_8bpp_rvv_i32 : 82.2 73.2 --- libavcodec/riscv/vp9_mc_rvv.S | 114 +++++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp.h | 12 ++-- libavcodec/riscv/vp9dsp_init.c | 21 ++++++ 3 files changed, 141 insertions(+), 6 deletions(-) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index 8d776661d9..2fe8e5b6d3 100644 --- a/libavcodec/riscv/vp9_mc_rvv.S +++ b/libavcodec/riscv/vp9_mc_rvv.S @@ -54,6 +54,120 @@ func ff_vp9_avg\len\()_rvv, zve32x endfunc .endm +.macro bilin_load_h dst, op, mn + addi t5, a2, 1 + 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 op, type, mn +func ff_\op\()_vp9_bilin_64\type\()_rvv, zve32x + vsetvlstatic8 64, t0, 64 +.ifc \op,avg + csrwi vxrm, 0 +.endif + li t4, 8 + neg t1, \mn +1: + addi a4, a4, -1 +.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 v0, v16, v8 +.ifc \op,avg + vle8.v v16, (a0) + vaaddu.vv v0, v0, v16 +.endif + vse8.v v0, (a0) + add a2, a2, a3 + add a0, a0, a1 + bnez a4, 1b + ret + +.Lbilin_\type\op: +.ifc \op,avg + csrwi vxrm, 0 +.endif + li t4, 8 + neg t1, \mn +1: + addi a4, a4, -2 + add t6, a0, a1 + add t0, a2, a3 + vle8.v v8, (a2) + vle8.v v4, (t0) +.ifc \type,v + add t2, t0, a3 + vwmulu.vx v16, v4, \mn +.else + addi t3, a2, 1 + addi t2, t0, 1 + vle8.v v0, (t3) + vwmulu.vx v16, v0, \mn +.endif + vle8.v v12, (t2) + vwmulu.vx v20, v12, \mn + vwmaccsu.vx v16, t1, v8 + vwmaccsu.vx v20, t1, v4 + vwadd.wx v16, v16, t4 + vwadd.wx v20, v20, t4 + vnsra.wi v16, v16, 4 + vnsra.wi v20, v20, 4 + vadd.vv v0, v16, v8 + vadd.vv v12, v20, v4 +.ifc \op,avg + vle8.v v16, (a0) + vle8.v v20, (t6) + vaaddu.vv v0, v0, v16 + vaaddu.vv v12, v12, v20 +.endif + vse8.v v0, (a0) + vse8.v v12, (t6) + add a2, t0, a3 + add a0, t6, a1 + bnez a4, 1b + + ret +endfunc +.endm + .irp len, 64, 32, 16, 8, 4 copy_avg \len .endr + +bilin_h_v put, h, a5 +bilin_h_v avg, h, a5 +bilin_h_v put, v, a6 +bilin_h_v avg, v, a6 + +.macro func_bilin_h_v len, op, type +func ff_\op\()_vp9_bilin_\len\()\type\()_rvv, zve32x + vsetvlstatic8 \len, t0, 64 + j .Lbilin_\type\()\op +endfunc +.endm + +.irp len, 32, 16, 8, 4 + .irp op, put, avg + .irp type, h, v + func_bilin_h_v \len, \op, \type + .endr + .endr +.endr diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h index ff8431591c..8fb326dae0 100644 --- a/libavcodec/riscv/vp9dsp.h +++ b/libavcodec/riscv/vp9dsp.h @@ -113,27 +113,27 @@ void ff_avg_8tap_##type##_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ int h, int mx, int my); #define VP9_BILINEAR_RISCV_RVV_FUNC(SIZE) \ -void ff_put_bilin_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_put_vp9_bilin_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_put_bilin_##SIZE##v_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_put_vp9_bilin_##SIZE##v_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_put_bilin_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_put_vp9_bilin_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_avg_bilin_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_avg_vp9_bilin_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_avg_bilin_##SIZE##v_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_avg_vp9_bilin_##SIZE##v_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_avg_bilin_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_avg_vp9_bilin_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index 2034e1c976..83dbe1b5d9 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_vp9_bilin_64v_rvv; + dsp->mc[0][FILTER_BILINEAR ][0][1][0] = ff_put_vp9_bilin_64h_rvv; + dsp->mc[0][FILTER_BILINEAR ][1][0][1] = ff_avg_vp9_bilin_64v_rvv; + dsp->mc[0][FILTER_BILINEAR ][1][1][0] = ff_avg_vp9_bilin_64h_rvv; + dsp->mc[1][FILTER_BILINEAR ][0][0][1] = ff_put_vp9_bilin_32v_rvv; + dsp->mc[1][FILTER_BILINEAR ][0][1][0] = ff_put_vp9_bilin_32h_rvv; + dsp->mc[1][FILTER_BILINEAR ][1][0][1] = ff_avg_vp9_bilin_32v_rvv; + dsp->mc[1][FILTER_BILINEAR ][1][1][0] = ff_avg_vp9_bilin_32h_rvv; + dsp->mc[2][FILTER_BILINEAR ][0][0][1] = ff_put_vp9_bilin_16v_rvv; + dsp->mc[2][FILTER_BILINEAR ][0][1][0] = ff_put_vp9_bilin_16h_rvv; + dsp->mc[2][FILTER_BILINEAR ][1][0][1] = ff_avg_vp9_bilin_16v_rvv; + dsp->mc[2][FILTER_BILINEAR ][1][1][0] = ff_avg_vp9_bilin_16h_rvv; + dsp->mc[3][FILTER_BILINEAR ][0][0][1] = ff_put_vp9_bilin_8v_rvv; + dsp->mc[3][FILTER_BILINEAR ][0][1][0] = ff_put_vp9_bilin_8h_rvv; + dsp->mc[3][FILTER_BILINEAR ][1][0][1] = ff_avg_vp9_bilin_8v_rvv; + dsp->mc[3][FILTER_BILINEAR ][1][1][0] = ff_avg_vp9_bilin_8h_rvv; + dsp->mc[4][FILTER_BILINEAR ][0][0][1] = ff_put_vp9_bilin_4v_rvv; + 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; + #undef init_fpel } #endif From patchwork Thu Aug 1 12:08:49 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: 50854 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:12d6:0:b0:489:2eb3:e4c4 with SMTP id 205csp1097350vqs; Thu, 1 Aug 2024 05:09:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWpj/nrlgJwzNCQ97aq63ghvwL+pPyRPXecBMx9ObPQA4+bLzPM/e6gniZW/0xrhx4WiVxVF3jdPsCTG30xS1Cl76vtBSRC2vXL2Q== X-Google-Smtp-Source: AGHT+IGQIADYcjUanPnzuTJPUFf52+xej8WCmz9qgWyQoVaoCQ+AsYBzVsTB0h60GnwXJVemXm1f X-Received: by 2002:a17:907:3f9f:b0:a7a:a763:8428 with SMTP id a640c23a62f3a-a7daf522a87mr159338966b.25.1722514165003; Thu, 01 Aug 2024 05:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722514164; cv=none; d=google.com; s=arc-20160816; b=vuLIbKCi6yPdz8mUsrh3H6hNePrf52c3p54jHIpNC8Sx21rKI/xmObQ6ymIbcuNTKe TmXNWzl9ymJQ+uAiqB+1Uf22gt82rfSR/438PYyt1nY7N75WfBHBlfUmqZc7lXDubMZ0 XowubW8zyxXd7b+zjnDZfBeT13+gijctWaO7W2Y6s1UL7HyH+mxvOLlJVsA58HCRUpAT EXCg8PwvgZFztwW2vtFSU+jy/mxvXLW8/Fno+6TVm+IpgYeYkky0gDOijoX5oW8pp5XT 7zFjeo/+sJEMH3oWuzMoFAXA8p7xIm4Q2Y5jrLNFSEgjBCh4aqkS6/nt+J/8r2XuWifv 0ipg== 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=dy5uXvUw4+qqad99CITdvMgWki7ICj7UeN2E1y0hEBc=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=BhmckRfE9dDYDdtfmqbPGhismrDdi8Ye7yJBkRrY5Waf8sA49yNB/IvmftsTAQRjBZ bOkCLByVq9F57JPDDgsiQj25+3rJ8Inqg22/iQrbgHG35KSepbuZywnyCDrPrxl5vbrx +T3iB7CqJwcraW1aYI1/PmCTBaL1jN21Ipted9gk9TIdPHbanXTLN2Op98Gk8l5hvLFQ wANnSp7YtWqgl2FhlLZEi+5kJYRpkGCXRcvXdjFSH7d5SGNc1bnM5HOAafY+aXbc+531 K1E22RvqHh5D5EbkU7tWbj3mDqGto87ySOVQhAwTTP485+4n8ivZVxTXxuystRcbzROr z/iA==; 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=B910zA4g; 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 a640c23a62f3a-a7acac91722si1024243566b.816.2024.08.01.05.09.24; Thu, 01 Aug 2024 05:09:24 -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=B910zA4g; 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 A6A5568D849; Thu, 1 Aug 2024 15:09:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 27A7068D077 for ; Thu, 1 Aug 2024 15:09:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1722514144; bh=sce6mtTRGAa5rCYyNGCxLM4rodZoLnrpVoh46q5Izsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=B910zA4gG9PWFg6nd7J+p2E2FVC7zIz640dFzxoHw/vzw2ecMAEbOweT55/9RMtnk c9NOw9VBpLk4dOFyCEokPmmNSkoUBbJ6DBzBRKTpM241KEiydaTnXtOaeydm4Ap7h0 EWjJk7deU3XWXVFqvMRBTK6ovkM9D/97ztEK5TFQ= Received: from localhost.localdomain ([42.86.132.47]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id 2419AC43; Thu, 01 Aug 2024 20:09:01 +0800 X-QQ-mid: xmsmtpt1722514143trsi3kse1 Message-ID: X-QQ-XMAILINFO: MJh9J/jkhbSZa3gzj/ZA1e5CF93qnWnVsRLD2N4f9DwttSlVSbaBykneGLxkhq /qv6tm+FPY+ia6ej0qKGMnhTj6LGBIufyXG4OmM1Zg55yQSNL2lcaepKQ2EthV1RcWOq2lay8qLL n4dTQcH9JgB6l8TLpaksOQKfHgvHnnT72KTMpxgzv/kJxfjN8nUMcaao0dWuhC5KXafGNibknpFy jeSSVWvwzA2SC8R1EjjbvJ7olc++zhggUJvrPGiaWtuVh8JsBMm/e2GhYD3OBmktPTWNX3KJm58W VXgpLlyx7PGD+gQ4XWU5XI6aQXwqgcJAdvaFUXTRxLjc/PI1I/Dau03gbu+KmTC18lFLCfBJR69M d6geTzkovP9hw76tLi+UbYDdpR/u1jSdDxE2DWLymqxrAgF1biltIXUGXHYxBBl7H4TJLC2Mh97o Gag43r7zlrz1Fgv8k9e3K2zQyh7dly7vTFkH+e9eSb+4b5B/VoX2RmDKxmN+OHfSANo1dhiTx2ut J0ZNLV94ej0d5sNncMMe1D+9FxpA0+eEE+x3xY45vFYnCu68ixzRvdnooKgc7c4NI7W5CBNrGVXp NWaVSDotrzfs1w3Xq+zOnEO6iahjRmO/jhlH+WIC6ZvqNfzIUm4iLSwSFig7jUJd6Ogu2vD/EEdM dydKY10GncrUMEK2KmDKTKXKz2zXaTVrPiKK9Wl5AGp9qFcIgoZLqVFwYL74RM3nCEXMgjqlL6aL RJLNL9jgMuwMSygDa1zlFqjnpG4eeTCSjrAPsp4kfhzZbqTpoHysnFH3bfLFQJQg/hP0EL9cpPWx w2cWQMxNxK5MUKOPbOnGM8ZJzKFYteOYXXIqfJ2DqqV0+GUFpS5L3/wj0mFPHHIv7SQ+ZUiK9RR3 tbyGZ7UjrhYv9sgfsi2vjf5EByiKATS6BzzGDyAg8HTwRFDi9fF1QeQyloUUoykw== X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Aug 2024 20:08:49 +0800 X-OQ-MSGID: <20240801120851.3097443-2-uk7b@foxmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240801120851.3097443-1-uk7b@foxmail.com> References: <20240801120851.3097443-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: wAiECT2Aa0q+ 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 | 38 +++++++++++++++++++++++++++++++++- libavcodec/riscv/vp9dsp_init.c | 10 +++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index 2fe8e5b6d3..4faf932100 100644 --- a/libavcodec/riscv/vp9_mc_rvv.S +++ b/libavcodec/riscv/vp9_mc_rvv.S @@ -148,6 +148,40 @@ func ff_\op\()_vp9_bilin_64\type\()_rvv, zve32x endfunc .endm +.macro bilin_hv op +func ff_\op\()_vp9_bilin_64hv_rvv, zve32x + vsetvlstatic8 64, t0, 64 +.Lbilin_hv\op: +.ifc \op,avg + csrwi vxrm, 0 +.endif + neg t1, a5 + neg t2, a6 + li t4, 8 + bilin_load_h v24, put, a5 + add a2, a2, a3 +1: + addi a4, a4, -1 + bilin_load_h v4, put, a5 + vwmulu.vx v16, v4, a6 + vwmaccsu.vx v16, t2, v24 + vwadd.wx v16, v16, t4 + vnsra.wi v16, v16, 4 + vadd.vv v0, v16, v24 +.ifc \op,avg + vle8.v v16, (a0) + vaaddu.vv v0, v0, v16 +.endif + vse8.v v0, (a0) + vmv.v.v v24, v4 + add a2, a2, a3 + add a0, a0, a1 + bnez a4, 1b + + ret +endfunc +.endm + .irp len, 64, 32, 16, 8, 4 copy_avg \len .endr @@ -156,6 +190,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 @@ -166,7 +202,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 } From patchwork Thu Aug 1 12:08:50 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: 50856 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:12d6:0:b0:489:2eb3:e4c4 with SMTP id 205csp1097719vqs; Thu, 1 Aug 2024 05:10:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWdd4Fg8nOvHfBec6P/luxr6s63qx9M1V3RVQDnAyZgb5GZgUG7LVXHncc5ncYf580pRkYStmvpS2y9oIBAy7trkyT5P2yDtVAJUg== X-Google-Smtp-Source: AGHT+IHhvtGZcL5CZZ2sW8wk63j6+w6z11SdHZ82YtBkmyR6BdJW9w+lVEyKJL9TKejPfaIGRHvv X-Received: by 2002:a05:6512:31cc:b0:52c:d9b3:2b06 with SMTP id 2adb3069b0e04-530b61f378amr1777321e87.58.1722514199858; Thu, 01 Aug 2024 05:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722514199; cv=none; d=google.com; s=arc-20160816; b=cuaThE5L4guiKZe7Kc5MIzezLok4I8IeyVwWQqhsFt2JeZ3uFr8lCWY5sUj6m76+Ut fA61gUPN7JUY3ZLAlo29pS45Vs5kwEY8+Ww9gPd3RKunjHavA6iYv3ARYeQrNbYZWnia b7mDd/Dn4vblavGnJAWHlNfUaG6LY611SU5D5IuIuuRqQ9QFPdBpqt+5SHAoMGoB9iMD P/6ByZBBq0PCxLCqkAUv+aDOHCHruOVVfTeox9x040RxJynWDFQOBnAB1AWT1sj+YwDl 8CZkEOH39b27eDoDs72ND55EqnJKTX6cVei99KUM3P9dPaRr4bn4mrEJG60Eb1zQ4k8I tz9A== 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=iqUcnzA8wo6FBb30W2qN33fbwuOQfntENLQioruGxOw=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=M7YZvOQfu7T4Qco4O783XlU5JMk7j+Sexk9zQxA0CvmXmXOCB8dkWK/YrWHo0KUtOH v00hjDikGHVlKjvy/kBoNoLjsESpCpsW21Giw/awK4nAq/6Ya3ClYyFQr3O1dLfggWN0 qXV0fhyMsL7oTfpS3n5mcx8iHVLSP1Xu77TiLRkn14kllwMRH60vzbNQo4gbpDgT7puX pahwQb44o0q+7GoWxZGd2lr7Eg2j/5CUywgcDolXfTSIaeiJ22iOXbtmd/GuvvteQPmy 9lwcad9wzyxm+U8zkz697Zp4+3Nmq1qKhk61u/QoJyfimhoqFKj5rg8O1G0cYo9fAoAN nl3Q==; 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=k8eRi+3M; 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 2adb3069b0e04-52fd685b247si4717458e87.306.2024.08.01.05.09.59; Thu, 01 Aug 2024 05:09:59 -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=k8eRi+3M; 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 F23EE68D94A; Thu, 1 Aug 2024 15:09:55 +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 AD85168D473 for ; Thu, 1 Aug 2024 15:09:12 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1722514144; bh=UGHhsezCjnoPsXxomgoITHTjor6ePuI6QtkOOXzW0mM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=k8eRi+3MoTGRwB1LJoN1Ygpxycxxdtn7ig4gqpZ4yEMWrmCkmet5E5OwGbnSWi6T+ qpNolkQakuyflN/Jt1tJ1BVQJHp8OG4vcFWcfpK8nOOPTUhhsfYMFqqSf2YhuXGyHu hmNt8HDEG8jJmc/8FHhnBdvpTXth/FZRyCFZE3S0= Received: from localhost.localdomain ([42.86.132.47]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id 2419AC43; Thu, 01 Aug 2024 20:09:01 +0800 X-QQ-mid: xmsmtpt1722514143t59cuv04j Message-ID: X-QQ-XMAILINFO: M9cLQ6J2M+AjRzHZkIqQq9fq2FV0WQzoIkjN6JsaVmpUmlBkFfJY4bTY2fQUmZ M5wBHBL/ow/YSvC6iq8MnnADZgy2DPy4iFX+NjMTjnThE7Aow3nCoF/cu/9xQ9jef+Ot7AyiTA+x SzeCUYCCksaz/MAjTdmrTQp952epG1WeaFiUlXbw4OP8SJByBZUXS74V9Na75d6S369ruzcaNmsu XF/C/D/reNXIHFXSSrPML+17JCAA6oBNd5UBUGfzspV4+2CSloNLzq+a3xc+LWOl0NzKtc3kugml EcQ9UTpsUsylocUSA61S4gIcef6F0+z8hA4oIM2FhZKFbZs4H56O9JUJI18MpnI6x9KQl+sM/qwm 7dxB6INaDPlJAzLQz8AwR4QFaaGeW9cqCWV/73r1rQ5gDsisrUGlNduxl5pA1dRgy/9NjDCyPTGF Bp2KKg9RukHJLYZNpAwuoq5Kmiz6qmoRBX8oItTPpnS4UBFFTLGnIOX/HZ6M6CATpplvtUGNfSCq ah48ak+9BXmzb26aJ1KeSOTgYxaSK9DTlyj2Z4klektvBeCwi+73eaFYzc3DroALzqB29rQh9wZC 0NhawvlsMEC2P8IurgQ7Qc+n6BQ4sSL/iQeYpwchVdN/USVtg7lAX4mdAlh5KpmozYi7v9I45Ywh g0S+wXvmuINAsF9I8wu7cSX3P2GKcDiq91xtdMW/nrjLwEbtQC2uhMsGFP+a9/e/aLXSyRHsXpHN Rk/krR0hnFsE4sYnNOWbBO6+ekYvYidAAQqo/IfJvJiWck+QmWgWznRhBh26a8IBFp9BvfbWBOP3 Fa8a95+eCWIMVRNA/Xkh1uI6szXbetA4X6UscoGP0apGsJxdjZUgnspO1nsT9jGclLYv35EJAqOu zSe453HYxTdUnDefvusXgY3FRsaYe/goS0VDUra6JVFsFAaenh8RFMa/xFz2XNTQ== X-QQ-XMRINFO: MSVp+SPm3vtS1Vd6Y4Mggwc= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Aug 2024 20:08:50 +0800 X-OQ-MSGID: <20240801120851.3097443-3-uk7b@foxmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240801120851.3097443-1-uk7b@foxmail.com> References: <20240801120851.3097443-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] lavc/vp9dsp: R-V V mc tap 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: L16FQ0OH5BdW From: sunyuechi C908 X60 vp9_avg_8tap_smooth_4h_8bpp_c : 12.7 11.2 vp9_avg_8tap_smooth_4h_8bpp_rvv_i32 : 4.7 4.2 vp9_avg_8tap_smooth_4v_8bpp_c : 29.7 12.5 vp9_avg_8tap_smooth_4v_8bpp_rvv_i32 : 4.7 4.2 vp9_avg_8tap_smooth_8h_8bpp_c : 48.7 42.2 vp9_avg_8tap_smooth_8h_8bpp_rvv_i32 : 9.5 8.5 vp9_avg_8tap_smooth_8v_8bpp_c : 49.7 45.5 vp9_avg_8tap_smooth_8v_8bpp_rvv_i32 : 9.5 8.5 vp9_avg_8tap_smooth_16h_8bpp_c : 192.0 166.5 vp9_avg_8tap_smooth_16h_8bpp_rvv_i32 : 21.7 19.5 vp9_avg_8tap_smooth_16v_8bpp_c : 191.2 175.2 vp9_avg_8tap_smooth_16v_8bpp_rvv_i32 : 21.2 19.0 vp9_avg_8tap_smooth_32h_8bpp_c : 780.2 663.2 vp9_avg_8tap_smooth_32h_8bpp_rvv_i32 : 68.2 60.5 vp9_avg_8tap_smooth_32v_8bpp_c : 770.0 685.7 vp9_avg_8tap_smooth_32v_8bpp_rvv_i32 : 67.0 59.5 vp9_avg_8tap_smooth_64h_8bpp_c : 3116.2 2648.2 vp9_avg_8tap_smooth_64h_8bpp_rvv_i32 : 270.7 120.7 vp9_avg_8tap_smooth_64v_8bpp_c : 3058.5 2731.7 vp9_avg_8tap_smooth_64v_8bpp_rvv_i32 : 266.5 119.0 vp9_put_8tap_smooth_4h_8bpp_c : 11.0 9.7 vp9_put_8tap_smooth_4h_8bpp_rvv_i32 : 4.2 3.7 vp9_put_8tap_smooth_4v_8bpp_c : 11.7 10.5 vp9_put_8tap_smooth_4v_8bpp_rvv_i32 : 4.0 3.7 vp9_put_8tap_smooth_8h_8bpp_c : 42.0 37.5 vp9_put_8tap_smooth_8h_8bpp_rvv_i32 : 8.5 7.7 vp9_put_8tap_smooth_8v_8bpp_c : 43.5 38.5 vp9_put_8tap_smooth_8v_8bpp_rvv_i32 : 8.7 7.7 vp9_put_8tap_smooth_16h_8bpp_c : 181.7 147.2 vp9_put_8tap_smooth_16h_8bpp_rvv_i32 : 20.0 18.0 vp9_put_8tap_smooth_16v_8bpp_c : 168.5 149.7 vp9_put_8tap_smooth_16v_8bpp_rvv_i32 : 19.7 17.5 vp9_put_8tap_smooth_32h_8bpp_c : 675.0 586.5 vp9_put_8tap_smooth_32h_8bpp_rvv_i32 : 65.2 58.0 vp9_put_8tap_smooth_32v_8bpp_c : 664.7 591.2 vp9_put_8tap_smooth_32v_8bpp_rvv_i32 : 64.0 57.0 vp9_put_8tap_smooth_64h_8bpp_c : 2696.2 2339.0 vp9_put_8tap_smooth_64h_8bpp_rvv_i32 : 259.7 115.7 vp9_put_8tap_smooth_64v_8bpp_c : 2691.0 2348.5 vp9_put_8tap_smooth_64v_8bpp_rvv_i32 : 255.5 114.0 --- libavcodec/riscv/vp9_mc_rvv.S | 182 +++++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp.h | 72 ++++++++----- libavcodec/riscv/vp9dsp_init.c | 38 ++++++- 3 files changed, 267 insertions(+), 25 deletions(-) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index 4faf932100..ce8fe6f66f 100644 --- a/libavcodec/riscv/vp9_mc_rvv.S +++ b/libavcodec/riscv/vp9_mc_rvv.S @@ -36,6 +36,18 @@ .endif .endm +.macro vsetvlstatic16 len +.ifc \len,4 + vsetvli zero, zero, e16, mf2, ta, ma +.elseif \len == 8 + vsetvli zero, zero, e16, m1, ta, ma +.elseif \len == 16 + vsetvli zero, zero, e16, m2, ta, ma +.else + vsetvli zero, zero, e16, m4, ta, ma +.endif +.endm + .macro copy_avg len func ff_vp9_avg\len\()_rvv, zve32x lpad 0 @@ -182,8 +194,178 @@ func ff_\op\()_vp9_bilin_64hv_rvv, zve32x endfunc .endm +.equ ff_vp9_subpel_filters_smooth, ff_vp9_subpel_filters +.equ ff_vp9_subpel_filters_regular, ff_vp9_subpel_filters + 16*8*2 +.equ ff_vp9_subpel_filters_sharp, ff_vp9_subpel_filters + 16*8*2*2 + +.macro epel_filter name, type, regtype, arg + lla \regtype\()2, ff_vp9_subpel_filters_\name +.ifc \type,v + slli \regtype\()0, a6, 4 +.else + slli \regtype\()0, a5, 4 +.endif + add \regtype\()0, \regtype\()0, \regtype\()2 + lh \regtype\()1, 2(\regtype\()0) + lh \regtype\()2, 4(\regtype\()0) + lh \regtype\()3, 6(\regtype\()0) + lh \regtype\()4, 8(\regtype\()0) + lh \regtype\()5, 10(\regtype\()0) + lh \regtype\()6, 12(\regtype\()0) + lh \arg, 14(\regtype\()0) + lh \regtype\()0, 0(\regtype\()0) +.endm + +.macro epel_load dst, len, op, name, type, from_mem, regtype +.ifc \from_mem, 1 + vle8.v v22, (a2) +.ifc \type,v + add a5, a3, a2 + sub a2, a2, a3 + vle8.v v24, (a5) + vle8.v v20, (a2) + sh1add a2, a3, a5 + add a5, a5, a3 + vle8.v v26, (a5) + vle8.v v28, (a2) + add a2, a2, a3 + vle8.v v30, (a2) +.else + addi a5, a2, 1 + addi a2, a2, -1 + vle8.v v24, (a5) + vle8.v v20, (a2) + addi a5, a5, 2 + addi a2, a2, 3 + vle8.v v28, (a5) + vle8.v v26, (a2) + addi a2, a5, 1 + vle8.v v30, (a2) +.endif + +.ifc \name,smooth + vwmulu.vx v16, v24, \regtype\()4 + vwmaccu.vx v16, \regtype\()2, v20 + vwmaccu.vx v16, \regtype\()5, v26 + vwmaccsu.vx v16, \regtype\()6, v28 +.else + vwmulu.vx v16, v28, \regtype\()6 + vwmaccsu.vx v16, \regtype\()2, v20 + vwmaccsu.vx v16, \regtype\()5, v26 +.endif + +.ifc \regtype,t + vwmaccsu.vx v16, a7, v30 +.else + vwmaccsu.vx v16, s7, v30 +.endif + +.ifc \type,v + sh1add a5, a3, a3 + sub a2, a2, a5 + sub a2, a2, a5 + sub a5, a2, a3 + vle8.v v28, (a2) + vle8.v v26, (a5) + sh1add a2, a3, a2 +.else + addi a5, a2, -7 + addi a2, a2, -6 + vle8.v v26, (a5) + vle8.v v28, (a2) + addi a2, a2, 2 +.endif + +.ifc \name,smooth + vwmaccsu.vx v16, \regtype\()1, v28 +.else + vwmaccu.vx v16, \regtype\()1, v28 + vwmulu.vx v28, v24, \regtype\()4 +.endif + vwmaccsu.vx v16, \regtype\()0, v26 + vwmulu.vx v20, v22, \regtype\()3 +.else +.ifc \name,smooth + vwmulu.vx v16, v8, \regtype\()4 + vwmaccu.vx v16, \regtype\()2, v4 + vwmaccu.vx v16, \regtype\()5, v10 + vwmaccsu.vx v16, \regtype\()6, v12 + vwmaccsu.vx v16, \regtype\()1, v2 +.else + vwmulu.vx v16, v2, \regtype\()1 + vwmaccu.vx v16, \regtype\()6, v12 + vwmaccsu.vx v16, \regtype\()5, v10 + vwmaccsu.vx v16, \regtype\()2, v4 + vwmulu.vx v28, v8, \regtype\()4 +.endif + vwmaccsu.vx v16, \regtype\()0, v0 + vwmulu.vx v20, v6, \regtype\()3 + +.ifc \regtype,t + vwmaccsu.vx v16, a7, v14 +.else + vwmaccsu.vx v16, s7, v14 +.endif + +.endif + vsetvlstatic16 \len +.ifc \name,smooth + vwadd.vv v24, v16, v20 +.else + vwadd.vv v24, v16, v28 + vwadd.wv v24, v24, v20 +.endif + vnclipu.wi v24, v24, 7 + vmax.vx v24, v24, zero + vsetvlstatic8 \len, zero, 32, m2 + vnclipu.wi \dst, v24, 0 +.ifc \op,avg + vle8.v v24, (a0) + vaaddu.vv \dst, \dst, v24 +.endif + +.endm + +.macro epel_load_inc dst, len, op, name, type, from_mem, regtype + epel_load \dst, \len, \op, \name, \type, \from_mem, \regtype + add a2, a2, a3 +.endm + +.macro epel len, op, name, type, vlen +func ff_\op\()_vp9_8tap_\name\()_\len\()\type\()_rvv\vlen\(), zve32x + epel_filter \name, \type, t, a7 + vsetvlstatic8 \len, a5, 64, m2 + csrwi vxrm, 0 +1: + addi a4, a4, -1 + epel_load v30, \len, \op, \name, \type, 1, t + vse8.v v30, (a0) +.if \len == 64 && \vlen < 256 + addi a0, a0, 32 + addi a2, a2, 32 + epel_load v30, \len, \op, \name, \type, 1, t + vse8.v v30, (a0) + addi a0, a0, -32 + addi a2, a2, -32 +.endif + 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 + .irp name, regular, sharp, smooth + .irp type, h, v + epel \len, \op, \name, \type, 128 + epel \len, \op, \name, \type, 256 + .endr + .endr + .endr .endr bilin_h_v put, h, a5 diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h index 8fb326dae0..5fd64a1b8c 100644 --- a/libavcodec/riscv/vp9dsp.h +++ b/libavcodec/riscv/vp9dsp.h @@ -81,33 +81,39 @@ void ff_tm_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, void ff_tm_4x4_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a); -#define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx) \ -void ff_put_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ +#define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx, min_vlen) \ +void ff_put_vp9_8tap_##type##_##SIZE##h_rvv##min_vlen(uint8_t *dst, \ + ptrdiff_t dststride, \ const uint8_t *src, \ ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_put_8tap_##type##_##SIZE##v_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_put_vp9_8tap_##type##_##SIZE##v_rvv##min_vlen(uint8_t *dst, \ + ptrdiff_t dststride, \ const uint8_t *src, \ ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_put_8tap_##type##_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_put_vp9_8tap_##type##_##SIZE##hv_rvv##min_vlen(uint8_t *dst, \ + ptrdiff_t dststride, \ const uint8_t *src, \ ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_avg_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_avg_vp9_8tap_##type##_##SIZE##h_rvv##min_vlen(uint8_t *dst, \ + ptrdiff_t dststride, \ const uint8_t *src, \ ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_avg_8tap_##type##_##SIZE##v_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_avg_vp9_8tap_##type##_##SIZE##v_rvv##min_vlen(uint8_t *dst, \ + ptrdiff_t dststride, \ const uint8_t *src, \ ptrdiff_t srcstride, \ int h, int mx, int my); \ \ -void ff_avg_8tap_##type##_##SIZE##hv_rvv(uint8_t *dst, ptrdiff_t dststride, \ +void ff_avg_vp9_8tap_##type##_##SIZE##hv_rvv##min_vlen(uint8_t *dst, \ + ptrdiff_t dststride, \ const uint8_t *src, \ ptrdiff_t srcstride, \ int h, int mx, int my); @@ -146,23 +152,41 @@ void ff_vp9_avg##SIZE##_rvv(uint8_t *dst, ptrdiff_t dststride, \ const uint8_t *src, ptrdiff_t srcstride, \ int h, int mx, int my); -VP9_8TAP_RISCV_RVV_FUNC(64, regular, FILTER_8TAP_REGULAR); -VP9_8TAP_RISCV_RVV_FUNC(32, regular, FILTER_8TAP_REGULAR); -VP9_8TAP_RISCV_RVV_FUNC(16, regular, FILTER_8TAP_REGULAR); -VP9_8TAP_RISCV_RVV_FUNC(8, regular, FILTER_8TAP_REGULAR); -VP9_8TAP_RISCV_RVV_FUNC(4, regular, FILTER_8TAP_REGULAR); - -VP9_8TAP_RISCV_RVV_FUNC(64, sharp, FILTER_8TAP_SHARP); -VP9_8TAP_RISCV_RVV_FUNC(32, sharp, FILTER_8TAP_SHARP); -VP9_8TAP_RISCV_RVV_FUNC(16, sharp, FILTER_8TAP_SHARP); -VP9_8TAP_RISCV_RVV_FUNC(8, sharp, FILTER_8TAP_SHARP); -VP9_8TAP_RISCV_RVV_FUNC(4, sharp, FILTER_8TAP_SHARP); - -VP9_8TAP_RISCV_RVV_FUNC(64, smooth, FILTER_8TAP_SMOOTH); -VP9_8TAP_RISCV_RVV_FUNC(32, smooth, FILTER_8TAP_SMOOTH); -VP9_8TAP_RISCV_RVV_FUNC(16, smooth, FILTER_8TAP_SMOOTH); -VP9_8TAP_RISCV_RVV_FUNC(8, smooth, FILTER_8TAP_SMOOTH); -VP9_8TAP_RISCV_RVV_FUNC(4, smooth, FILTER_8TAP_SMOOTH); +VP9_8TAP_RISCV_RVV_FUNC(64, regular, FILTER_8TAP_REGULAR, 128); +VP9_8TAP_RISCV_RVV_FUNC(32, regular, FILTER_8TAP_REGULAR, 128); +VP9_8TAP_RISCV_RVV_FUNC(16, regular, FILTER_8TAP_REGULAR, 128); +VP9_8TAP_RISCV_RVV_FUNC(8, regular, FILTER_8TAP_REGULAR, 128); +VP9_8TAP_RISCV_RVV_FUNC(4, regular, FILTER_8TAP_REGULAR, 128); + +VP9_8TAP_RISCV_RVV_FUNC(64, sharp, FILTER_8TAP_SHARP, 128); +VP9_8TAP_RISCV_RVV_FUNC(32, sharp, FILTER_8TAP_SHARP, 128); +VP9_8TAP_RISCV_RVV_FUNC(16, sharp, FILTER_8TAP_SHARP, 128); +VP9_8TAP_RISCV_RVV_FUNC(8, sharp, FILTER_8TAP_SHARP, 128); +VP9_8TAP_RISCV_RVV_FUNC(4, sharp, FILTER_8TAP_SHARP, 128); + +VP9_8TAP_RISCV_RVV_FUNC(64, smooth, FILTER_8TAP_SMOOTH, 128); +VP9_8TAP_RISCV_RVV_FUNC(32, smooth, FILTER_8TAP_SMOOTH, 128); +VP9_8TAP_RISCV_RVV_FUNC(16, smooth, FILTER_8TAP_SMOOTH, 128); +VP9_8TAP_RISCV_RVV_FUNC(8, smooth, FILTER_8TAP_SMOOTH, 128); +VP9_8TAP_RISCV_RVV_FUNC(4, smooth, FILTER_8TAP_SMOOTH, 128); + +VP9_8TAP_RISCV_RVV_FUNC(64, regular, FILTER_8TAP_REGULAR, 256); +VP9_8TAP_RISCV_RVV_FUNC(32, regular, FILTER_8TAP_REGULAR, 256); +VP9_8TAP_RISCV_RVV_FUNC(16, regular, FILTER_8TAP_REGULAR, 256); +VP9_8TAP_RISCV_RVV_FUNC(8, regular, FILTER_8TAP_REGULAR, 256); +VP9_8TAP_RISCV_RVV_FUNC(4, regular, FILTER_8TAP_REGULAR, 256); + +VP9_8TAP_RISCV_RVV_FUNC(64, sharp, FILTER_8TAP_SHARP, 256); +VP9_8TAP_RISCV_RVV_FUNC(32, sharp, FILTER_8TAP_SHARP, 256); +VP9_8TAP_RISCV_RVV_FUNC(16, sharp, FILTER_8TAP_SHARP, 256); +VP9_8TAP_RISCV_RVV_FUNC(8, sharp, FILTER_8TAP_SHARP, 256); +VP9_8TAP_RISCV_RVV_FUNC(4, sharp, FILTER_8TAP_SHARP, 256); + +VP9_8TAP_RISCV_RVV_FUNC(64, smooth, FILTER_8TAP_SMOOTH, 256); +VP9_8TAP_RISCV_RVV_FUNC(32, smooth, FILTER_8TAP_SMOOTH, 256); +VP9_8TAP_RISCV_RVV_FUNC(16, smooth, FILTER_8TAP_SMOOTH, 256); +VP9_8TAP_RISCV_RVV_FUNC(8, smooth, FILTER_8TAP_SMOOTH, 256); +VP9_8TAP_RISCV_RVV_FUNC(4, smooth, FILTER_8TAP_SMOOTH, 256); VP9_BILINEAR_RISCV_RVV_FUNC(64); VP9_BILINEAR_RISCV_RVV_FUNC(32); diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index d53852f673..d7a1f51d6e 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -49,7 +49,9 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) # endif #if HAVE_RVV - if (bpp == 8 && (flags & AV_CPU_FLAG_RVV_I32) && ff_rv_vlen_least(128)) { + if (bpp == 8 && (flags & AV_CPU_FLAG_RVV_I32)) { + int vlenb = ff_get_rv_vlenb(); + if (vlenb >= 16) { #define init_fpel(idx1, sz) \ dsp->mc[idx1][FILTER_8TAP_SMOOTH ][1][0][0] = ff_vp9_avg##sz##_rvv; \ @@ -95,6 +97,40 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) dsp->mc[4][FILTER_BILINEAR ][1][1][1] = ff_avg_vp9_bilin_4hv_rvv; #undef init_fpel + +#define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, vlen) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = \ + ff_##type##_vp9_8tap_smooth_##sz##dir##_rvv##vlen; \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = \ + ff_##type##_vp9_8tap_regular_##sz##dir##_rvv##vlen; \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = \ + ff_##type##_vp9_8tap_sharp_##sz##dir##_rvv##vlen; + +#define init_subpel2(idx, idxh, idxv, dir, type, vlen) \ + init_subpel1(0, idx, idxh, idxv, 64, dir, type, vlen); \ + init_subpel1(1, idx, idxh, idxv, 32, dir, type, vlen); \ + init_subpel1(2, idx, idxh, idxv, 16, dir, type, vlen); \ + init_subpel1(3, idx, idxh, idxv, 8, dir, type, vlen); \ + init_subpel1(4, idx, idxh, idxv, 4, dir, type, vlen) + + init_subpel2(0, 1, 0, h, put, 128); + init_subpel2(1, 1, 0, h, avg, 128); + + if (flags & AV_CPU_FLAG_RVB_ADDR) { + init_subpel2(0, 0, 1, v, put, 128); + init_subpel2(1, 0, 1, v, avg, 128); + } + + } + if (vlenb >= 32) { + init_subpel2(0, 1, 0, h, put, 256); + init_subpel2(1, 1, 0, h, avg, 256); + + if (flags & AV_CPU_FLAG_RVB_ADDR) { + init_subpel2(0, 0, 1, v, put, 256); + init_subpel2(1, 0, 1, v, avg, 256); + } + } } #endif #endif From patchwork Thu Aug 1 12:08:51 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: 50855 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:12d6:0:b0:489:2eb3:e4c4 with SMTP id 205csp1097499vqs; Thu, 1 Aug 2024 05:09:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVt5MiIMFyqrVaCxI3lOufyEAlKxmOmrfoMZfXoxPzZtMEPkwOw9Rq13D4D69n+ifQ2wAps65aKhwEaT9hX0a3o@gmail.com X-Google-Smtp-Source: AGHT+IH3roaipAUJHk3ceXUYTUv5dKC0d7zgeLzaTqhciQe+cA2KIHqn4m+DkjNHIQyuvhp8qMFh X-Received: by 2002:a05:6512:24b:b0:530:ad7d:8957 with SMTP id 2adb3069b0e04-530b61f2c71mr1426370e87.49.1722514177366; Thu, 01 Aug 2024 05:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722514177; cv=none; d=google.com; s=arc-20160816; b=teX0NfLjFliIMNw26G9NcnxGGEeLBcCm0E+bgePTxqrNzfoquq44aYDzNE002TmKkM LGXdmqMQstCOcWgtQmFWeGFBcJvEqtSO0EZ6TZgEr6r/mLH9umz5j2aeR2kl0VuCoFmM NexdYUdAzna8s0vO2jfFbtzzVGwJjAaUxMgXxmWv0b3oe7haYPsU9rO0xJaJaO0HYdTk MycuRouEZuR2GC5uL15w0f/OA/64tmrlD3FJSqSpYqz6SANiS4B+uGpI37q3P9/sJi/e MoxtvDv2+vcFtVm4w1YyAmJTDoe9X1yQOccoK0Px1FwDmy3yrjDSoIjgYXZqKpn9nS7p kN9w== 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=1Bwl3J7pkOV5cgGiiBHFSBJt0UD6B47uDOD91j+NBjo=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=gXdR+vVkHs4crWZh5Yf6luZi1GSj0mCkmTpPh3gjpwnW/+Js2jxyv7XwxvCcLKEhT/ EqFBiSX/QV3DqiOFzY6dec/sCgRBtL3qsw0mlciPsPbio+Iu0prmlbvxlfDpUl/jpcoS 7xUjsjjrzjf1CxFL/qA0xOxI7JmF/1CUGO6AcS/lsi3jWDQJ/WfHaB5kcE/g+aKR+mdh BDG4gvT3R17R28E2MmhI7mU6uuZn/BVb1cFxdYeB6d8IfUzyz6NRhaunDmAJuDL6Wd8y hzwSoUWXNQTw0venjIXVarFC7VkhfTKcMHoAR2LfroB080VCSle3tx7BMBAyc3zyWDX1 2HNQ==; 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=ltJo6V0d; 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 2adb3069b0e04-52fd5b94cf0si4975508e87.76.2024.08.01.05.09.36; Thu, 01 Aug 2024 05:09:37 -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=ltJo6V0d; 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 BC2EB68D8E3; Thu, 1 Aug 2024 15:09:21 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-149.mail.qq.com (out203-205-221-149.mail.qq.com [203.205.221.149]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B9D5468D179 for ; Thu, 1 Aug 2024 15:09:14 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1722514145; bh=yVff1EFNegpDuBxNN36u0qJMFgGk8o3AE26m0+9g6NI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ltJo6V0dUx4wzb/ZBumxa2qSr3qsbK4OAx2ScdY7KXri6AVI7OmDufYadRFxPe5CE XspzttnaJ/9GsTvr9YIBVu1tq+KT1u3jfEgF//R++9731Ls8OTJ4T9DuCs8/T4iR7N C408eNsOBgaUux6ERJNvMlUFWTGHJKWPhLsrwKFQ= Received: from localhost.localdomain ([42.86.132.47]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id 2419AC43; Thu, 01 Aug 2024 20:09:01 +0800 X-QQ-mid: xmsmtpt1722514144t96ksxhs6 Message-ID: X-QQ-XMAILINFO: NIergYn61mJ1uBOXyiH9PHqL1T48R/Kt+BT4C6yLRp9WMt3WJyA0heYUVieU/6 +KnVsEdE88C3KcHlsO7TRbSA1OWakIuz4APjVy94tCOVNh+N2M+lpsz5SrlcoCDbvoI2QdAG8ikI Mwfuy84uFLtnzcZr9IS3WHd7s0f3MLXeYPDo/saJbkncxbZxzO7Dd3YkNciG7Of0dvEkrCWjmabE C1GLIHWhs0Giak7DTNm49z70DS/r3AY6QPeWVbXMk1Kck4G6r0TQfw2NAbjgKsd64vgiaJV+p/l2 1M3I3QaidrHE/WIu/LdYW1NJo3rTqJr+rft6K98IS4K5ZTLSrZpGLSGGgHnELQUCHPII4EoV3cvn taIJ9O9QgclFagxahVVbxjHnvkfdYCMwznPRBrcEHAHsZIQZzBt52Z95hbTemTdX5FKrzlG98xfL a6BokLQPEa2z/xY0ri57X2vR9fd80ZxQU8+lEVKdCQ2u3iavwzu5820SHkdegVPTaA0dNuLfhNMM pScWZsmEg27VN9Vknykl6yMo33AkcjQOkVJRMH/BzKVtRvQuTkYmVR2egA+q6WfPVE9vHdje0yhZ /yTtt37WpASCcyH3rf/AEDBRRPiPvmsgFsXsiOUb44tRO4ve0DVvRVkKZvnLXfLcYLlBmZ3cDOTh VeXc6xjRdVFmaA4f5sMtne8c3VGcRjJyZkggW4xqpSVyH6u1ljKnnc7B+l4Zf3ssM4x4ZcaSibQ9 uhAk+iuHTQHXX/uxijng48mCJq5F1DOvpC3+VKyJG1Wmr4wdNPyNMstZFJqCimSBg578a2Qy8I88 FOCj1GeF/V6057EpKNxQii6pE7JOWVU0hTswL8v8BCiADDIuQ6D10nPc9stlW7NhN23kDimw+6nl eYYi+thI4HYCkTLmpNts72CRJw4v3TlFLV0/EBN+5TRBHJ5U3l4VQfLWaLuroX2A== X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Aug 2024 20:08:51 +0800 X-OQ-MSGID: <20240801120851.3097443-4-uk7b@foxmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240801120851.3097443-1-uk7b@foxmail.com> References: <20240801120851.3097443-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] lavc/vp9dsp: R-V V mc tap 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: x64APEMHrcEx From: sunyuechi C908 X60 vp9_avg_8tap_smooth_4hv_8bpp_c : 32.0 28.0 vp9_avg_8tap_smooth_4hv_8bpp_rvv_i32 : 15.0 13.2 vp9_avg_8tap_smooth_8hv_8bpp_c : 98.0 86.2 vp9_avg_8tap_smooth_8hv_8bpp_rvv_i32 : 23.7 21.2 vp9_avg_8tap_smooth_16hv_8bpp_c : 355.7 297.0 vp9_avg_8tap_smooth_16hv_8bpp_rvv_i32 : 47.0 41.5 vp9_avg_8tap_smooth_32hv_8bpp_c : 1272.7 1099.7 vp9_avg_8tap_smooth_32hv_8bpp_rvv_i32 : 134.7 119.7 vp9_avg_8tap_smooth_64hv_8bpp_c : 4937.0 4224.2 vp9_avg_8tap_smooth_64hv_8bpp_rvv_i32 : 528.5 228.5 vp9_put_8tap_smooth_4hv_8bpp_c : 30.2 26.7 vp9_put_8tap_smooth_4hv_8bpp_rvv_i32 : 30.5 12.5 vp9_put_8tap_smooth_8hv_8bpp_c : 91.5 81.2 vp9_put_8tap_smooth_8hv_8bpp_rvv_i32 : 22.7 20.2 vp9_put_8tap_smooth_16hv_8bpp_c : 313.2 277.5 vp9_put_8tap_smooth_16hv_8bpp_rvv_i32 : 45.2 40.2 vp9_put_8tap_smooth_32hv_8bpp_c : 1166.7 1022.2 vp9_put_8tap_smooth_32hv_8bpp_rvv_i32 : 131.7 117.2 vp9_put_8tap_smooth_64hv_8bpp_c : 4560.5 3961.7 vp9_put_8tap_smooth_64hv_8bpp_rvv_i32 : 517.0 223.2 --- libavcodec/riscv/vp9_mc_rvv.S | 69 ++++++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp_init.c | 8 ++++ 2 files changed, 77 insertions(+) diff --git a/libavcodec/riscv/vp9_mc_rvv.S b/libavcodec/riscv/vp9_mc_rvv.S index ce8fe6f66f..5b49445a4a 100644 --- a/libavcodec/riscv/vp9_mc_rvv.S +++ b/libavcodec/riscv/vp9_mc_rvv.S @@ -356,6 +356,71 @@ func ff_\op\()_vp9_8tap_\name\()_\len\()\type\()_rvv\vlen\(), zve32x endfunc .endm +#if __riscv_xlen == 64 +.macro epel_hv_once len, name, op + sub a2, a2, a3 + sub a2, a2, a3 + sub a2, a2, a3 + .irp n,0,2,4,6,8,10,12,14 + epel_load_inc v\n, \len, put, \name, h, 1, t + .endr + addi a4, a4, -1 +1: + addi a4, a4, -1 + epel_load v30, \len, \op, \name, v, 0, s + vse8.v v30, (a0) + vmv.v.v v0, v2 + vmv.v.v v2, v4 + vmv.v.v v4, v6 + vmv.v.v v6, v8 + vmv.v.v v8, v10 + vmv.v.v v10, v12 + vmv.v.v v12, v14 + epel_load v14, \len, put, \name, h, 1, t + add a2, a2, a3 + add a0, a0, a1 + bnez a4, 1b + epel_load v30, \len, \op, \name, v, 0, s + vse8.v v30, (a0) +.endm + +.macro epel_hv op, name, len, vlen +func ff_\op\()_vp9_8tap_\name\()_\len\()hv_rvv\vlen\(), zve32x + addi sp, sp, -64 + .irp n,0,1,2,3,4,5,6,7 + sd s\n, \n\()<<3(sp) + .endr +.if \len == 64 && \vlen < 256 + addi sp, sp, -48 + .irp n,0,1,2,3,4,5 + sd a\n, \n\()<<3(sp) + .endr +.endif + csrwi vxrm, 0 + epel_filter \name, h, t, a7 + epel_filter \name, v, s, s7 + vsetvlstatic8 \len, a6, 64, m2 + epel_hv_once \len, \name, \op +.if \len == 64 && \vlen < 256 + .irp n,0,1,2,3,4,5 + ld a\n, \n\()<<3(sp) + .endr + addi sp, sp, 48 + addi a0, a0, 32 + addi a2, a2, 32 + epel_filter \name, h, t, a7 + epel_hv_once \len, \name, \op +.endif + .irp n,0,1,2,3,4,5,6,7 + ld s\n, \n\()<<3(sp) + .endr + addi sp, sp, 64 + + ret +endfunc +.endm +#endif + .irp len, 64, 32, 16, 8, 4 copy_avg \len .irp op, put, avg @@ -364,6 +429,10 @@ endfunc epel \len, \op, \name, \type, 128 epel \len, \op, \name, \type, 256 .endr + #if __riscv_xlen == 64 + epel_hv \op, \name, \len, 128 + epel_hv \op, \name, \len, 256 + #endif .endr .endr .endr diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index d7a1f51d6e..6999e93374 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -119,6 +119,10 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) if (flags & AV_CPU_FLAG_RVB_ADDR) { init_subpel2(0, 0, 1, v, put, 128); init_subpel2(1, 0, 1, v, avg, 128); +# if __riscv_xlen == 64 + init_subpel2(0, 1, 1, hv, put, 128); + init_subpel2(1, 1, 1, hv, avg, 128); +# endif } } @@ -129,6 +133,10 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) if (flags & AV_CPU_FLAG_RVB_ADDR) { init_subpel2(0, 0, 1, v, put, 256); init_subpel2(1, 0, 1, v, avg, 256); +# if __riscv_xlen == 64 + init_subpel2(0, 1, 1, hv, put, 256); + init_subpel2(1, 1, 1, hv, avg, 256); +# endif } } }