From patchwork Sun May 5 16:45:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: uk7b@foxmail.com X-Patchwork-Id: 48550 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:e68f:b0:1af:836d:81b3 with SMTP id mz15csp963026pzb; Sun, 5 May 2024 09:47:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYVX/XmN+7+/lxjXjwer4/jQXvX2SFF/tUyYBkjX7ZL5QFD5gzdpbjLbpqOL0EXwbXrbIgw3PI+gIu7rbSnAnFzTuM3cd9xcgqOQ== X-Google-Smtp-Source: AGHT+IG/163CS6tebz2gdIKRKfnUjnqWzh/qKuB53197RBN29HzDleJrU1qyAg7pZddPQ4bo4pTf X-Received: by 2002:a17:907:868e:b0:a59:bfab:b24f with SMTP id qa14-20020a170907868e00b00a59bfabb24fmr1525382ejc.3.1714927633617; Sun, 05 May 2024 09:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714927633; cv=none; d=google.com; s=arc-20160816; b=nMi3RKeQXPOsBwJglQwFgZFVFoDSaO6Y7SjieivWjUHHy2vxuoykAhINy3NnotRCbb NnEVaWvlBLkKOwQdiT0KsnFEapo9h/wwZDl9zZFI7o1KNeCHRjXjaUc5MYphrzO86xFc shuO7WHw6+racDJDF/S4mEGoQIeQJWjutlVHDxDf3kSxB1GUX0r1Yu3HCuK8qPj0AvFZ SYncYnGol3M8oWAC/+T9xXcAd85sRyskMQ1QlZdQ89mJaTekJTg6ryWQEyPzkU6YkIwc ReFEfA2sSooMxiHJRAXIwIIXwLhWskJGiURHZx0FAiKqhmIwHunGE4aVIhPXg+46mLxT HanQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=FlS8ZlHm+iEvM2V0/cYmeJRoMnzESlUbdCYPW979/AI=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=szx8Uj/G+4nLWUTe9E7Zvw/irXp4WUoy8IRdZU4JrKg1yd6qJb7h403CwHoW+zyRe0 E8Pqo0SgY50mT5fGOwkq3h5+p8ShCARpcq84sJIhJpEhWlRyme5PixbKqNH6KfdJeEVu sbikhVyFNiPSvL3bDNCnW9MZ1K0WyRoiyWRxshfnm/ceVAf9VVW8k4BlX5WBlWmmRGyq vbctV+bBYuZuNPuX+QJAp1Dyn7ot8DZGMc2dQ5GDM/LAOQTVhapRaMrdXoBDanBgHvvT 6vqlJxtYQ5iTHaxleL6P/zY5YNQjKa8mY26JZkjwaXjrD68DPkKqQ55zsgH99cTpFSyP tOiA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="xCWL/7D+"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x20-20020a170906711400b00a59a221dca9si2065037ejj.522.2024.05.05.09.47.13; Sun, 05 May 2024 09:47:13 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="xCWL/7D+"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A82FE68D412; Sun, 5 May 2024 19:46:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-59.mail.qq.com (out203-205-251-59.mail.qq.com [203.205.251.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 16B7E68D5B6 for ; Sun, 5 May 2024 19:45:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1714927544; bh=F6jF1id8DDLcrsk11DC4Mn+xizI1R0fa1XAWtbSfGrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xCWL/7D+viWFFJjZTJKx8daPkkE0t2PyOFLv1MnuSaETcTnBCkDoqnNjPM1uW4n7X pPHowPxBsWmNw3qCYvgxpo38eJMgQBHJBcTAddQei5mTDvbwFPLJ3RvpaWs1GWzLw9 DovSM3twyc9hfbG2jBGuBeLGs++yR1KDqx6mvz8o= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id B65A42EA; Mon, 06 May 2024 00:45:37 +0800 X-QQ-mid: xmsmtpt1714927543tol549bmk Message-ID: X-QQ-XMAILINFO: NVviswOLIcto/wzg5HEBo/Iahpry03MZn7igUyoI8bEqzRUlCT6x8qRXRbtEHi Gg6I0bEYTTD7FojI4JYdtn+ybvWmSetxN9Ir8rlbaH9AfJ65CisJt2PclNoAEaOLVZCDFjIgYGFG dSJ7tqjGNnNs30AfOlBCXG5ZQx9JJP5dXGPhUwNbLrHv8uk7clbGx4RB4gIViT2LO43Hvq7zNJ8a IOSb3eSNPI8G0K2ydmCgroQOrIsveWHKjSEiGsaQPfUi4YmJhPbh6qNL35Od+EdsNLjC16oBClC4 TSZKA5X2mJTBmN+dd9TscVSApkPwvyDJYGgjefGVmvFcAMwuPkXN0LbqeodD0IFkV/7q3fTqxYkK rlv8BTI7bqZ73+Cczm+V22/We7of1k62aE+il+TcUfrs4kfiSAMtoe1W3iJx27Sc4z0OySOHDH5R lCYAwRhw09XGD7rC57TD6aWXxuZiVvWfaaoF3Iylwc6VklznQsHq/goLk30azCi8F6973iLJWPSh 9DrURBkGmxkmSJF12SHaVbM1Bh34eg/ws+UcUe0KF/sAJ1wwVP4RnOxKeH09IeWb6tmoDW+GnTKn iS46UO7oFwYN3j1eNp5c9yJz9+/oPXIduxENhL1H+Xx/ILLSzGeV02C8UumI52tNV5ws6qSkzU85 H8g46Kt7UfNgi4aHejB/mOVg8A4kyygPvW2UFzKCEtiyb8hJxWiGNjvAJWZNYeD4Mxo7I1F4bn6i 6/ObBkV6my8F3wKyaBMLMim0fXVKuKmZAS+vbjFp2y10r1YXl0QH7DTqnnmxiKFz4G4oIc2tk5aq HAkTf0A/QjKiSIUQW9AWVd89dq1ESGz2i0LsnzwRHpTEodJTHcLZEFAtFuWvmhygzaznSRalj3Km vzWlxHaFziXHbnY5dkE+YCvBeoalUC5DUV1L8dSUHLmGnmMYwvEVfas8UBIoyy9w== X-QQ-XMRINFO: Mp0Kj//9VHAxr69bL5MkOOs= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 May 2024 00:45:34 +0800 X-OQ-MSGID: <20240505164536.872683-8-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240505164536.872683-1-uk7b@foxmail.com> References: <20240505164536.872683-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/10] lavc/vp8dsp: R-V V loop_filter_simple 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 Cc: sunyuechi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: jzI4hbTrMTiz From: sunyuechi C908: vp8_loop_filter_simple_h_c: 416.0 vp8_loop_filter_simple_h_rvv_i32: 187.5 vp8_loop_filter_simple_v_c: 429.7 vp8_loop_filter_simple_v_rvv_i32: 104.0 --- libavcodec/riscv/vp8dsp_init.c | 5 ++ libavcodec/riscv/vp8dsp_rvv.S | 85 ++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index 6ebb2e11e0..6037c86e19 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -42,6 +42,8 @@ VP8_BILIN(16, rvv); VP8_BILIN(8, rvv); VP8_BILIN(4, rvv); +VP8_LF(rvv); + av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) { #if HAVE_RV @@ -127,6 +129,9 @@ av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) if (flags & AV_CPU_FLAG_RVB_ADDR) { c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_rvv; } + + c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_rvv; + c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_rvv; } #endif } diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 2d5e2260b7..bef5f0ebdc 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -95,6 +95,91 @@ func ff_vp8_idct_dc_add4uv_rvv, zve32x ret endfunc +.macro filter_fmin len a f1 p0f2 q0f1 + vsetvlstatic16 \len + vsext.vf2 \q0f1, \a + vmin.vx \p0f2, \q0f1, a7 + vmin.vx \q0f1, \q0f1, t3 + vadd.vi \p0f2, \p0f2, 3 + vadd.vi \q0f1, \q0f1, 4 + vsra.vi \p0f2, \p0f2, 3 + vsra.vi \f1, \q0f1, 3 + vadd.vv \p0f2, \p0f2, v8 + vsub.vv \q0f1, v16, \f1 + vmax.vx \p0f2, \p0f2, zero + vmax.vx \q0f1, \q0f1, zero +.endm + +.macro filter len type normal inner dst stride fE fI thresh +.ifc \type,v + slli a6, \stride, 1 + sub t2, \dst, a6 + add t4, \dst, \stride + sub t1, \dst, \stride + vle8.v v1, (t2) + vle8.v v11, (t4) + vle8.v v17, (t1) + vle8.v v22, (\dst) +.else + addi t1, \dst, -1 + addi a6, \dst, -2 + addi t4, \dst, 1 + vlse8.v v1, (a6), \stride + vlse8.v v11, (t4), \stride + vlse8.v v17, (t1), \stride + vlse8.v v22, (\dst), \stride +.endif + vwsubu.vv v12, v1, v11 // p1-q1 + vwsubu.vv v24, v22, v17 // q0-p0 + vnclip.wi v23, v12, 0 + vsetvlstatic16 \len + // vp8_simple_limit(dst + i, stride, flim) + li a7, 2 + vneg.v v18, v12 + vmax.vv v18, v18, v12 + vneg.v v8, v24 + vmax.vv v8, v8, v24 + vsrl.vi v18, v18, 1 + vmacc.vx v18, a7, v8 + vmsleu.vx v0, v18, \fE + + li t5, 3 + li a7, 124 + li t3, 123 + vsext.vf2 v4, v23 + vzext.vf2 v8, v17 // p0 + vzext.vf2 v16, v22 // q0 + vmul.vx v30, v24, t5 + vadd.vv v12, v30, v4 + vsetvlstatic8 \len + vnclip.wi v11, v12, 0 + filter_fmin \len v11 v24 v4 v6 + vsetvlstatic8 \len + vnclipu.wi v4, v4, 0 + vnclipu.wi v6, v6, 0 + +.ifc \type,v + vse8.v v4, (t1), v0.t + vse8.v v6, (\dst), v0.t +.else + vsse8.v v4, (t1), \stride, v0.t + vsse8.v v6, (\dst), \stride, v0.t +.endif + +.endm + +func ff_vp8_v_loop_filter16_simple_rvv, zve32x + vsetvlstatic8 16 + filter 16 v 0 0 a0 a1 a2 a3 a4 + ret +endfunc + +func ff_vp8_h_loop_filter16_simple_rvv, zve32x + vsetvlstatic8 16 + filter 16 h 0 0 a0 a1 a2 a3 a4 + ret +endfunc + .macro bilin_h_load dst len vsetvlstatic8 \len + 1 vle8.v \dst, (a2)