From patchwork Thu Jul 25 14:58:36 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: 50731 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc0a:0:b0:482:c625:d099 with SMTP id h10csp604367vqv; Thu, 25 Jul 2024 07:58:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUgBgg+v1FUXcYNKhfhMxXbtTzRQT+c7TKWN3xUw7gjCLuYQxziBXiex9N6+wN6n33OFnJAEd43L03WhLWiL2x3gvOYvE8xN0P93w== X-Google-Smtp-Source: AGHT+IH327Tw/oijrZugf+9U3opGJ3IaDOijx2laWaKPHD+ZbdbovCUWL5f+z8RVijgaHNFb+ZkQ X-Received: by 2002:a2e:994f:0:b0:2ef:1efb:1b6b with SMTP id 38308e7fff4ca-2f03aabfc88mr9027681fa.15.1721919528929; Thu, 25 Jul 2024 07:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721919528; cv=none; d=google.com; s=arc-20160816; b=Pxz//gly+UKwBNZZWKto5j7DIciTLhhbqtgYrUTGhhJssh7zRZsR3s024DtMF5sXbF odnREfWe5ZuHyhNK75N6PYFmGzYl0Ex2zx0RnwjHCYjGFsFXEMNNr0IW4zHOctSmNIp3 f298gVO6An0DnK3UGpEuBvFTgKuLzSGUAkst+TkxOPCXyfDwbHzY7xa0JEc/tO2qFGJM xSEEqaQW+JHEFKwYwbKKIx0aZdRtPWun82Dbi7l0mqN23uWUzQYRuLHMmrTsDfAho57f wfSY3mslvMugBtWS6COkOjAEJnlgdbpY34WIW3t0ZmLxb6QrTZAb0UNuAt0Cw+EifMBq QyWA== 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=wu9pGNHvU9Uq3vCsxQtWU5yrVL6NE5/p08X0PSEKObI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=iy5D9xplK6/OzeIjBqDiYnETyGH6km4Gza1XFP3kshMm9dQHPJra76S3JHxCFa3REh Q0A+8qGulUPe9Y30dcvupXq06/KpyGA7Y0uoYFHNCgDOqFKT6adTtZaBGE3CvafErZ0o obZTsGWvmqKBhe8wgwQ2OIgyVXgrT3Ts3H2C6BYxi0BXqAs5EJet4xG8g3FK+iP+hozU V+7sppepx7iVxInNW5U0gx41D0vOkwALTQygLMlpFlc5PbYntTe7tvW+x7ckYyOFBEiV fC+YDW70ge3wYIWHBkWoCtr6qmwM7C89MEbx0ZYAXC52GHjo8ZId2Edev4cK3nJsozIL wPCg==; 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 38308e7fff4ca-2f03d08d6d1si4876931fa.132.2024.07.25.07.58.48; Thu, 25 Jul 2024 07:58: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 7EF1768B659; Thu, 25 Jul 2024 17:58: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 2415C68B659 for ; Thu, 25 Jul 2024 17:58:37 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 795C1C013B for ; Thu, 25 Jul 2024 17:58:36 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Jul 2024 17:58:36 +0300 Message-ID: <20240725145836.15313-1-remi@remlab.net> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/vp8dsp: use saturating add/sub for R-V V DC add 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: xXDpV9EWcRZy T-Head C908 (cycles): vp7_idct_dc_add_c: 108.5 vp7_idct_dc_add_rvv_i32: 56.2 (before) vp7_idct_dc_add_rvv_i32: 47.2 (after) vp8_idct_dc_add_c: 96.2 vp8_idct_dc_add_rvv_i32: 43.0 (before) vp8_idct_dc_add_rvv_i32: 34.0 (after) --- libavcodec/riscv/vp8dsp_rvv.S | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index e50e27ce82..67b54c0035 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -169,12 +169,18 @@ func ff_vp78_idct_dc_add_rvv, zve32x vsetivli zero, 4, e8, mf4, ta, ma sh zero, (a1) vlse32.v v8, (a0), a2 - vsetivli zero, 16, e16, m2, ta, ma - vzext.vf2 v16, v8 - vadd.vx v16, v16, a3 - vmax.vx v16, v16, zero - vsetvli zero, zero, e8, m1, ta, ma - vnclipu.wi v8, v16, 0 + vsetivli zero, 16, e8, m1, ta, ma + bgez a3, 1f + + # block[0] < 0 + neg a3, a3 + vssubu.vx v8, v8, a3 + vsetivli zero, 4, e8, mf4, ta, ma + vsse32.v v8, (a0), a2 + ret + +1: # block[0] >= 0 + vsaddu.vx v8, v8, a3 vsetivli zero, 4, e8, mf4, ta, ma vsse32.v v8, (a0), a2 ret