From patchwork Sun Dec 17 15:19:15 2023 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: 45191 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp6856312pzf; Sun, 17 Dec 2023 07:19:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZjXFiPpk0/u5p/RHCw2LmbyzPC1aLDSchkYosmOLv67AySqJyAiY1Bok562A7eRmV95xI X-Received: by 2002:a05:6512:3f26:b0:50e:1a3f:fb28 with SMTP id y38-20020a0565123f2600b0050e1a3ffb28mr6164030lfa.6.1702826364820; Sun, 17 Dec 2023 07:19:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702826364; cv=none; d=google.com; s=arc-20160816; b=IZ9O1m4VTV9sGVd8KzkvZqnlyHT6Zyr8H1GwGFi99T4cwpE1Lv20SG1zsnGmURpPXa 5i+6VSSyTv8xbyqkBYPAcwtQqa7+49iuZtoRRglkLMXZx/prHwYrnQkubd8yGZVRYm2Z hiZbjIIjfihs7UVfBu78IPSEYICLYJKAnhRn4goTC5kpfjfo+jfhjxUZBh731Z1M+jTa PufM2RcAblPj4nKyEj+R5sXReRsOOWCf1qcHWV/nzxW5d06kJwmRv9Nqb4lSiNjL8O0M EyoJ4+ZWLhKc6sq7Xv3aVFOaRB54/UG/TxIMJsTmgq3ak5jHqFtM/AfLGn8I00d9Ds2F sj6Q== 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=Jrvb+9N17Lc34phAEx5xcnCNloM9lGMPdJW+GmzTjGU=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=weJrk2iO6r4kSKKDuQY0hPKHdH2zXJcEnENmc8NYKLkafIJ9OC1fk44r3Ux3i9ttmB Ti9iD8MsmAMUh7H3cx1X0456M1zBdBBggPH7NY1e3zDl3njR0Mws/oEjO79ArXEwQnWQ pJGV+Z6tfjDOjy9L2YERFA0zu1qfymZ13tOB7pSQhLRddmVpCDa1poIcDWuSibIK24cA ZnGiiMFs34cTik0ZaxVRz9jg8EUA7b384EFFR8pImLju0ZtebAq5N5AZDv+cRlqN7T3B h3LBzKwZZiHab8zhdmTBw1HxmBcOL3EfdkzzK1H1JocN6zihiTtRQigdnA8GFc1YGVcW fdEQ== 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 lf23-20020a170906ae5700b00a231408f6e2si2940417ejb.358.2023.12.17.07.19.24; Sun, 17 Dec 2023 07:19:24 -0800 (PST) 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 1954E68D17C; Sun, 17 Dec 2023 17:19:22 +0200 (EET) 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 F033E68C552 for ; Sun, 17 Dec 2023 17:19:15 +0200 (EET) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 963CBC01A0 for ; Sun, 17 Dec 2023 17:19:15 +0200 (EET) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Sun, 17 Dec 2023 17:19:15 +0200 Message-ID: <20231217151915.42895-1-remi@remlab.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/aacpsdsp: fix R-V V stereo interpolate 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: NAPmm57UmT/1 The penultimate loop iteration could pick any vl such that: vlenb/4 < vl <= vlenb/2 Thus if the total length is not a multiple of vlenb/2, the vfadd.vf on the penultimate iteration would yield corrupt values for the last iteration. To avoid this, force vl = vlen/2 until the last iteration. Unfortunately this latent bug is not reproducible with either hardware or QEMU as of now. --- libavcodec/riscv/aacpsdsp_rvv.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/aacpsdsp_rvv.S b/libavcodec/riscv/aacpsdsp_rvv.S index f46b35fe91..a79d7d7818 100644 --- a/libavcodec/riscv/aacpsdsp_rvv.S +++ b/libavcodec/riscv/aacpsdsp_rvv.S @@ -234,7 +234,8 @@ func ff_ps_stereo_interpolate_rvv, zve32f vfmacc.vf v22, ft3, v24 fmul.s ft3, ft3, ft4 1: - vsetvli t0, a4, e32, m2, ta, ma + min t0, t0, a4 + vsetvli zero, t0, e32, m2, ta, ma vlseg2e32.v v0, (a0) // v0:l_re, v2:l_im sub a4, a4, t0 vlseg2e32.v v4, (a1) // v4:r_re, v6:r_im