From patchwork Thu Sep 22 18:37:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 38181 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp516565pzh; Thu, 22 Sep 2022 11:41:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MQMuNgh8iqShhGlzuxn+ujWxf5ytJUAPA8yQ11966bBSQ4jSu1JFPxiWkrWPqf3oC9JiF X-Received: by 2002:a17:907:94d0:b0:77e:c2e5:a35e with SMTP id dn16-20020a17090794d000b0077ec2e5a35emr4085130ejc.648.1663872071583; Thu, 22 Sep 2022 11:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663872071; cv=none; d=google.com; s=arc-20160816; b=un/SMvSVciFnca7olX2A8/uFftDrNtQyegphtL7OXo0H91OjvLNFYtP5RzS4B3cyMW DOYOhBmfKg247wvQX2MlMsmzXMzoVBAjKgipWXADKMm5Fjy2BiVuddxuisZDJdXngs9B fCo0VDrFGh4+DJL683mt0ZHDJRE57oFJb0jBtmakzPIsaFe0LHy4m6VeQ1oxQIlk0tzq iR9ibuuwKsXKDqdBNEKLrcBszOgX9tPI2h3e3zjS6pFbsfEuAtlVhU8n+9ioC35k3zUI w3Mcy/WlzT6DqTAxA30XKX3dOlN0JdO9YiUs2+73ajbm+eX/b/XmYjSf1CQNiCnmEoUF KGww== 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:references:in-reply-to:message-id :date:to:from:delivered-to; bh=ADDywSDejfYw0dKAs6QAyLAiDCXPl3RqNuTNw2xmbrk=; b=erRCwdSRlTKb9hPoXY1psvWC8XnSs81CF/EguKpft5sctu5ZkFFanvE7DHHUpAXG++ FJihN4NQfL/U7iX3cutBkHMJ/QuuMjV3nrhiql50hJLx1KKgbUhKwJ9XrrAOTb1uGqji 3uZj3r4IMLPUPdPYITc8o8Nl5/w5JcaQph8qoCyNp2ej5xJjRJnfUp+7BJFaxRjIB4Zu YPLycmUEva5capQ9S2FpLJBKjeXTgd2AdgMGjJN7vjFb9rteLF0C/FpOXrAo1Nu8Q84Z h4Sov+lTBi0PqK6pGT9SHPOZnlRahpKBazNNkZDAc8KzIWLZDvTrDRvkvE6M5/L8ADMu CBSg== 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 y13-20020a056402440d00b0044e7ec802f4si6453024eda.381.2022.09.22.11.41.11; Thu, 22 Sep 2022 11:41: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 DF25B68BBF6; Thu, 22 Sep 2022 21:37: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 5C1C768BA05 for ; Thu, 22 Sep 2022 21:37:32 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id C6D53C00C0 for ; Thu, 22 Sep 2022 21:37:29 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Sep 2022 21:37:17 +0300 Message-Id: <20220922183726.38624-20-remi@remlab.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <12078904.O9o76ZdvQC@basile.remlab.net> References: <12078904.O9o76ZdvQC@basile.remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 20/29] lavc/audiodsp: RISC-V V vector_clipf 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: ysXatLV2Zc7S From: RĂ©mi Denis-Courmont --- libavcodec/riscv/audiodsp_init.c | 7 ++++++- libavcodec/riscv/audiodsp_rvv.S | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/audiodsp_init.c b/libavcodec/riscv/audiodsp_init.c index ce8b60ee52..ddd561484f 100644 --- a/libavcodec/riscv/audiodsp_init.c +++ b/libavcodec/riscv/audiodsp_init.c @@ -26,6 +26,7 @@ void ff_vector_clipf_rvf(float *dst, const float *src, int len, float min, float max); +void ff_vector_clipf_rvv(float *dst, const float *src, int len, float min, float max); void ff_vector_clip_int32_rvv(int32_t *dst, const int32_t *src, int32_t min, int32_t max, unsigned int len); @@ -36,7 +37,11 @@ av_cold void ff_audiodsp_init_riscv(AudioDSPContext *c) if (flags & AV_CPU_FLAG_RVF) c->vector_clipf = ff_vector_clipf_rvf; #if HAVE_RVV - if (flags & AV_CPU_FLAG_RV_ZVE32X) + if (flags & AV_CPU_FLAG_RV_ZVE32X) { c->vector_clip_int32 = ff_vector_clip_int32_rvv; + + if (flags & AV_CPU_FLAG_RV_ZVE32F) + c->vector_clipf = ff_vector_clipf_rvv; + } #endif } diff --git a/libavcodec/riscv/audiodsp_rvv.S b/libavcodec/riscv/audiodsp_rvv.S index 26b3cdffcf..e5a09f3b19 100644 --- a/libavcodec/riscv/audiodsp_rvv.S +++ b/libavcodec/riscv/audiodsp_rvv.S @@ -35,3 +35,21 @@ func ff_vector_clip_int32_rvv, zve32x ret endfunc + +func ff_vector_clipf_rvv, zve32f +NOHWF fmv.w.x fa0, a3 +NOHWF fmv.w.x fa1, a4 +1: + vsetvli t0, a2, e32, m1, ta, ma + vle32.v v8, (a1) + slli t1, t0, 2 + vfmax.vf v8, v8, fa0 + add a1, a1, t1 + vfmin.vf v8, v8, fa1 + sub a2, a2, t0 + vse32.v v8, (a0) + add a0, a0, t1 + bnez a2, 1b + + ret +endfunc