From patchwork Mon Jul 29 18:45:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50812 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:16f:b0:489:2eb3:e4c4 with SMTP id h47csp1330649vqi; Mon, 29 Jul 2024 11:45:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUIgo/OraXGsxDe7r1gwJSv3Zeye3xJ5Il04u5iF2UkmIX6sc0ZS0ynT8xxEGRXsLXTWjTwOzMjvJsG1ss/PZpr/J8HYb0yQZQ8kQ== X-Google-Smtp-Source: AGHT+IEbU0XJkDpG9ZUIE/g4V6fjukX+cBUhDysJfdCK6iqYQguTtIgwFLWTYZDnyAA3LqN5ZggE X-Received: by 2002:a05:6512:2527:b0:52e:bf53:1c13 with SMTP id 2adb3069b0e04-5309b269a95mr7033840e87.7.1722278748966; Mon, 29 Jul 2024 11:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722278748; cv=none; d=google.com; s=arc-20160816; b=biT5Qbc5W9Y/xeOpa64xMriavQaDcjptAot5T9z+FTuRFSvmf0gwlt7Wjqm+HhmMth mNuya0+exA3L4DjIDECHfrUZ1wczkpjCavOqgEY2lYMxdl89lqplWYSXncCMGltPu0Y8 9gaCPAdJKxoCopdwf/OB1lpxsTuH2Cj2tAZwPj+xjTfSUQ7LXfIhA4puFO53rNof2PRG kdiWTEpMiL9Na9411M0SJfeE9cgfU+QHHqHRWxVZLs9VTXq4xc8NtKBfiKV7XRIP2cQ8 yeVyT9UNmH6s8DA+ypJpt6xKgs2Y81WWh7mrA8+pznn6OG1+y4crFdI3hQ/Ay+vdatLt iMPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=Cn8DTWPgufi9IsJyX8p8CuIzWCmFyQf/hoabJQF5l9Q=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=CwdiAAZYoGNgf1KYG45oz5w4gvR4HTcWWyZghZFdK0he22EbeWDAXoJ42v/KmU8n1P gZHty2dTKqN/s7f7R4zBmtQ16uJ56lqfIlL6FjEwWYYdG/P+TKl1W147CshE+QmO2EDB +8rvoNeR2N2v4F1c4jzVazVIPAYgj/lvmxxRxOCN7fLUUT8DqNMt6j2C48pkB9RVkti7 mgvATac184It08relld9IDNjzNVDPUoyF7u17n/N/c8kNSjTY88rmry41mGBtJub/ip1 +VnCgDhHUXWmhNFSJsk283VdRvirjtrf1BmXw5nzVbEsMnt+XOXMAXdNyo07gEXJKjJt b/Iw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52fd5bfccc3si3038510e87.441.2024.07.29.11.45.48; Mon, 29 Jul 2024 11:45:48 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 229DE68C736; Mon, 29 Jul 2024 21:45:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A52B568C736 for ; Mon, 29 Jul 2024 21:45:38 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id E6E29C0140 for ; Mon, 29 Jul 2024 21:45:37 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jul 2024 21:45:37 +0300 Message-ID: <20240729184537.108950-1-remi@remlab.net> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/h264dsp: stick R-V V biweight to 16-bit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yZmkVF6ACV0f T-Head C908 (ns): h264_biweight2_8_c: 2414.5 h264_biweight2_8_rvv_i32: 701.8 (before) h264_biweight2_8_rvv_i32: 562.8 (after) h264_biweight4_8_c: 4655.3 h264_biweight4_8_rvv_i32: 1377.5 (before) h264_biweight4_8_rvv_i32: 1109.0 (after) h264_biweight8_8_c: 9701.5 h264_biweight8_8_rvv_i32: 2896.0 (before) h264_biweight8_8_rvv_i32: 2340.5 (after) h264_biweight16_8_c: 18025.0 h264_biweight16_8_rvv_i32: 3460.8 (before) h264_biweight16_8_rvv_i32: 3146.0 (after) SpacemiT X60 (ns): h264_biweight2_8_c: 2415.5 h264_biweight2_8_rvv_i32: 478.2 (before) h264_biweight2_8_rvv_i32: 405.0 (after) h264_biweight4_8_c: 4655.3 h264_biweight4_8_rvv_i32: 946.7 (before) h264_biweight4_8_rvv_i32: 811.5 (after) h264_biweight8_8_c: 9061.8 h264_biweight8_8_rvv_i32: 2071.7 (before) h264_biweight8_8_rvv_i32: 1811.3 (after) h264_biweight16_8_c: 18020.5 h264_biweight16_8_rvv_i32: 3457.2 (before) h264_biweight16_8_rvv_i32: 2499.0 (after) --- libavcodec/riscv/h264dsp_rvv.S | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S index a38bf7ef1d..46392c92a5 100644 --- a/libavcodec/riscv/h264dsp_rvv.S +++ b/libavcodec/riscv/h264dsp_rvv.S @@ -56,22 +56,21 @@ func ff_h264_biweight_pixels_simple_8_rvv, zve32x addi a7, a7, 1 ori a7, a7, 1 sll a7, a7, a4 + addi a4, a4, 1 1: - vsetvli zero, t6, e32, m4, ta, ma + vsetvli zero, t6, e16, m2, ta, ma vle8.v v8, (a0) addi a3, a3, -1 vle8.v v12, (a1) add a1, a1, a2 vmv.v.x v16, a7 - vsetvli zero, zero, e16, m2, ta, ma vzext.vf2 v24, v8 vzext.vf2 v28, v12 - vwmaccsu.vx v16, a5, v24 - vwmaccsu.vx v16, a6, v28 - vnclip.wx v16, v16, a4 + vmacc.vx v16, a5, v24 + vmacc.vx v16, a6, v28 vmax.vx v16, v16, zero vsetvli zero, zero, e8, m1, ta, ma - vnclipu.wi v8, v16, 1 + vnclipu.wx v8, v16, a4 vse8.v v8, (a0) add a0, a0, a2 bnez a3, 1b @@ -121,12 +120,13 @@ func ff_h264_biweight_pixels_8_rvv, zve32x addi a7, a7, 1 ori a7, a7, 1 sll a7, a7, a4 + addi a4, a4, 1 1: mv t0, a0 mv t1, a1 mv t5, t6 2: - vsetvli t2, a3, e32, m8, ta, ma + vsetvli t2, a3, e16, m4, ta, ma vlsseg2e8.v v0, (t0), a2 vlsseg2e8.v v4, (t1), a2 addi t5, t5, -2 @@ -135,19 +135,17 @@ func ff_h264_biweight_pixels_8_rvv, zve32x vsetvli zero, zero, e16, m4, ta, ma vzext.vf2 v8, v0 vzext.vf2 v12, v2 - vwmaccsu.vx v16, a5, v8 - vwmaccsu.vx v24, a5, v12 + vmacc.vx v16, a5, v8 + vmacc.vx v24, a5, v12 vzext.vf2 v8, v4 vzext.vf2 v12, v6 - vwmaccsu.vx v16, a6, v8 - vwmaccsu.vx v24, a6, v12 - vnclip.wx v8, v16, a4 - vnclip.wx v12, v24, a4 - vmax.vx v8, v8, zero - vmax.vx v12, v12, zero + vmacc.vx v16, a6, v8 + vmacc.vx v24, a6, v12 + vmax.vx v8, v16, zero + vmax.vx v12, v24, zero vsetvli zero, zero, e8, m2, ta, ma - vnclipu.wi v0, v8, 1 - vnclipu.wi v2, v12, 1 + vnclipu.wx v0, v8, a4 + vnclipu.wx v2, v12, a4 vssseg2e8.v v0, (t0), a2 addi t0, t0, 2 addi t1, t1, 2