From patchwork Sun May 12 17:07:50 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: 48824 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp671428pzb; Sun, 12 May 2024 10:08:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWuKPgDiQkNjJXG4N3CmxeKoXK9rhA1breg9OcabaUe++b/VtyzbTyMAFBIs3Ju4YupbCNLE4/NJ+ktTOiz8bmz4kINnvIy4LGZDw== X-Google-Smtp-Source: AGHT+IGDj7Flq7Kxq6VQZhqiFC46pIgHO9rIuRn/jJsKnAbiI9BESAB4lmoER1NxQtT52FWpQVBn X-Received: by 2002:a05:6512:3d1e:b0:51e:b5b6:29fb with SMTP id 2adb3069b0e04-5220fb6b0f8mr7311149e87.21.1715533682376; Sun, 12 May 2024 10:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715533682; cv=none; d=google.com; s=arc-20160816; b=zrP8fbqlSbhI26N+Ym0R2Kvz4YMOgnXdLy9KOziTvIQ5pMXYFPBGfCU+zZLorgZjfe yYasub8Oso1D5aSn6xr3hq6JfFFssQ/YdsnUglynkoJqSaFEC8/82Fn6TYpgUSNcvMep W5gXXQWOHxRdKkfjhQCrjMS9Bive7riJuDei642ZR2s5ZHi1sRC+5p46JtzO33wVPfE2 qSTYmuTSFLJNaPETto6VhAuF0Hww9onjZ1mC1h9SThQbM2Mz/bXV1rRVRmSrIjA3boVK WBibJKVa/tubVHiwP5tGPyZ20dSP6iZoFlPm01JQ39rwuNXhkvrl/t66cOWfy25ezX3q HMJg== 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=nRflQx8Q9XpbzMq1gbejm35NZdfN0S7pVIeYsybDWzI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=F4fGGdxAkPx728oQOxyn/CrJ1i3Iy2N2t1V739OfyEyir6TLTPh9WJXN52tOR7vnNO 6S0XbQfAg/M+jqKZvJcZhOuMeKqGU4qPLHFvHpzPOE8bMIud0SJE78Pau3/25U0yfbkW or0dY44t9vGYEw7dXdn3sQrQ9OVlTx/EyxB6oWMiUKYjmVZo9ppBmo2CVIm5iEGJi+42 l8cyu9vdf5PBxU7FSocVwMDLAvevKeXHJqSCclvOBDQAdHIwj3UeegvYtdsKxuxXZEW0 JCP6FU4pmsFNmkKhLbOHmLnmgyma72P9s8U1oPCChMWFR37Uj48IPbhSHj90vdMdOf6l lnRg==; 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 a640c23a62f3a-a5a17ba3a20si435502666b.612.2024.05.12.10.08.01; Sun, 12 May 2024 10:08:02 -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 B38DE68D6AD; Sun, 12 May 2024 20:07:58 +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 D192668C371 for ; Sun, 12 May 2024 20:07:51 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 5403EC006F for ; Sun, 12 May 2024 20:07:51 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 May 2024 20:07:50 +0300 Message-ID: <20240512170751.65853-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavc/flacdsp: R-V V flac_wasted32 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: cNdGnoPA1/dZ T-Head C908: flac_wasted_32_c: 949.0 flac_wasted_32_rvv_i32: 278.7 --- libavcodec/riscv/flacdsp_init.c | 7 ++++++- libavcodec/riscv/flacdsp_rvv.S | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/flacdsp_init.c b/libavcodec/riscv/flacdsp_init.c index 6cfb50ead8..4043715a3b 100644 --- a/libavcodec/riscv/flacdsp_init.c +++ b/libavcodec/riscv/flacdsp_init.c @@ -31,6 +31,7 @@ void ff_flac_lpc32_rvv(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len); void ff_flac_lpc32_rvv_simple(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len); +void ff_flac_wasted32_rvv(int32_t *, int shift, int len); void ff_flac_decorrelate_indep2_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift); void ff_flac_decorrelate_indep4_16_rvv(uint8_t **out, int32_t **in, @@ -76,8 +77,12 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, c->lpc32 = ff_flac_lpc32_rvv_simple; else c->lpc32 = ff_flac_lpc32_rvv; +# endif } + c->wasted32 = ff_flac_wasted32_rvv; + +# if (__riscv_xlen >= 64) switch (fmt) { case AV_SAMPLE_FMT_S16: switch (channels) { @@ -117,8 +122,8 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, c->decorrelate[2] = ff_flac_decorrelate_rs_32_rvv; c->decorrelate[3] = ff_flac_decorrelate_ms_32_rvv; break; -# endif } +# endif } #endif } diff --git a/libavcodec/riscv/flacdsp_rvv.S b/libavcodec/riscv/flacdsp_rvv.S index 2a0b50f7a9..d576a0cc21 100644 --- a/libavcodec/riscv/flacdsp_rvv.S +++ b/libavcodec/riscv/flacdsp_rvv.S @@ -100,7 +100,22 @@ func ff_flac_lpc32_rvv_simple, zve32x ret endfunc +#endif + +func ff_flac_wasted32_rvv, zve32x +1: + vsetvli t0, a2, e32, m8, ta, ma + vle32.v v8, (a0) + sub a2, a2, t0 + vsll.vx v8, v8, a1 + vse32.v v8, (a0) + sh2add a0, t0, a0 + bnez a2, 1b + ret +endfunc + +#if (__riscv_xlen == 64) func ff_flac_decorrelate_indep2_16_rvv, zve32x ld a0, (a0) ld a2, 8(a1) From patchwork Sun May 12 17:07:51 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: 48825 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp671466pzb; Sun, 12 May 2024 10:08:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUwEYZHGv81rnNdA7OCJmFP1+Nl4noYxTXIiwDeqwvB9oii6vBE2sKjzLDXVwDoI4LEy1g7BATA3UrfKLt+NI7SpX3hYctyhw+8XA== X-Google-Smtp-Source: AGHT+IFJb13C2aJ83mdzDibDDh5FxiRBczBmKvLXWjXceee37nT4kgibB64LlzUW4TOu/s1n5ZLW X-Received: by 2002:a50:a6d7:0:b0:572:d4de:ed08 with SMTP id 4fb4d7f45d1cf-5734d6f3317mr6504022a12.16.1715533691663; Sun, 12 May 2024 10:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715533691; cv=none; d=google.com; s=arc-20160816; b=yu/In0j5+UKXEA/O1j0yTjni2Gu9u/yG+0s6VDTicnQN/R4qMV2WGEG5ONHU1Ss9h8 V9NHwCTpBUMfdwjRoWTdpmGjwI7huXn3KjNz83e5c54sJ6M3k4ZLOWqCnBXneHVmzNth Sn3ZOfFEMdj98lCYCitUKEkp3TGj/yx5LowDMfNLybi/oeiYncu/IiFVNOkQxsZODuag lKKcR0NIKZbfvh4eZpNuwP0gFKfzJIlcNP24awMuXD0/JOfzLJo3xs23tAtqVB16MJZV v8G8zkcGBumMpQRj90HnJh+sL8PUa7DdUrPBcZW9XNO6ck0wn+L+XmHIoHYqpXLM6rrF ciog== 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=79mOLo4DnzX2mXdM0+4951ZgD9mogFtyCrxcNCEvfuE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=w2JqajN6iK8bvB9F9AlX3+52XOmYg6XQd5kQ135savY05GkkkpdBH0bPrfQYem7Ox6 gVsRoi0UZnGo1+DUKUxXkw7mgmKkcO6nXdnbx0BjUB3ttIm14hR1cBlH6wpo5f/ZNvQ1 aQHyvqJh9sp7/KUxiXiP/M811ugGO3nYhp4FkSOTJq5JtdIFjudIBHCMtsuR7CTN9gsa hQz7/Izob5f6+CunlZz57KkY/ec3jSpLpPmfXc9Z7ghw+FUodxDn6OQ6KHE770dnPxC2 lXuXQGJBkUataQdQpJKkh0p5opOe7MGkYdPsnW+Ise+Gz0bbjUnnp9HwWWcKIjaP/1FK cNFg==; 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 4fb4d7f45d1cf-5733beac560si4242707a12.80.2024.05.12.10.08.11; Sun, 12 May 2024 10:08:11 -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 BD63568D6BE; Sun, 12 May 2024 20:07:59 +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 27EA968C371 for ; Sun, 12 May 2024 20:07:52 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 86652C009A for ; Sun, 12 May 2024 20:07:51 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 May 2024 20:07:51 +0300 Message-ID: <20240512170751.65853-2-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/flacdsp: R-V V flac_wasted33 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: hFPIoDTdF4Pq T-Head C908: flac_wasted_33_c: 1040.0 flac_wasted_33_rvv_i64: 711.2 --- libavcodec/riscv/flacdsp_init.c | 4 ++++ libavcodec/riscv/flacdsp_rvv.S | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libavcodec/riscv/flacdsp_init.c b/libavcodec/riscv/flacdsp_init.c index 4043715a3b..7d043db163 100644 --- a/libavcodec/riscv/flacdsp_init.c +++ b/libavcodec/riscv/flacdsp_init.c @@ -32,6 +32,7 @@ void ff_flac_lpc32_rvv(int32_t *decoded, const int coeffs[32], void ff_flac_lpc32_rvv_simple(int32_t *decoded, const int coeffs[32], int pred_order, int qlevel, int len); void ff_flac_wasted32_rvv(int32_t *, int shift, int len); +void ff_flac_wasted33_rvv(int64_t *, const int32_t *, int shift, int len); void ff_flac_decorrelate_indep2_16_rvv(uint8_t **out, int32_t **in, int channels, int len, int shift); void ff_flac_decorrelate_indep4_16_rvv(uint8_t **out, int32_t **in, @@ -82,6 +83,9 @@ av_cold void ff_flacdsp_init_riscv(FLACDSPContext *c, enum AVSampleFormat fmt, c->wasted32 = ff_flac_wasted32_rvv; + if (flags & AV_CPU_FLAG_RVV_I64) + c->wasted33 = ff_flac_wasted33_rvv; + # if (__riscv_xlen >= 64) switch (fmt) { case AV_SAMPLE_FMT_S16: diff --git a/libavcodec/riscv/flacdsp_rvv.S b/libavcodec/riscv/flacdsp_rvv.S index d576a0cc21..e0a937817a 100644 --- a/libavcodec/riscv/flacdsp_rvv.S +++ b/libavcodec/riscv/flacdsp_rvv.S @@ -115,6 +115,22 @@ func ff_flac_wasted32_rvv, zve32x ret endfunc +func ff_flac_wasted33_rvv, zve64x +1: + vsetvli t0, a3, e32, m4, ta, ma + vle32.v v8, (a1) + sub a3, a3, t0 + vwcvt.x.x.v v16, v8 + sh2add a1, t0, a1 + vsetvli zero, zero, e64, m8, ta, ma + vsll.vx v16, v16, a2 + vse64.v v16, (a0) + sh3add a0, t0, a0 + bnez a3, 1b + + ret +endfunc + #if (__riscv_xlen == 64) func ff_flac_decorrelate_indep2_16_rvv, zve32x ld a0, (a0)