From patchwork Sun May 12 10:03:26 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: 48803 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp505541pzb; Sun, 12 May 2024 03:04:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9kcg3Kg/d1n/OhIhqclfSAk9WMnl2+9BMjBzMUGX33DXBik972YO8QzcwGdy1WauzEOWOSE0f1uAMeGVe9RiruVtQuCvGQ2fP7g== X-Google-Smtp-Source: AGHT+IFsBDZmDVEih9A8QHy6V7L57QGRMrIOtKH464zVMjmw195BI0Fm4olkivKjTf6Tu9VXXOHL X-Received: by 2002:a17:906:2842:b0:a59:bb63:5e93 with SMTP id a640c23a62f3a-a5a2d53b111mr670073466b.16.1715508252887; Sun, 12 May 2024 03:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715508252; cv=none; d=google.com; s=arc-20160816; b=peHRbhX+e7gz5vsBBb2PakTdfa3uoC5Vs0b7VKE79N+66fQIelY8bVvOfMXO1zbcvQ OAQSjagh2YpHapqtHtBKdNNDzeAkx5kybmJf/ejejA8lkRLUabsFEiXeFOHTHVXOe4Wg 83MN7S1xYQfkFn99tWrn4FfSZ9il/iZAf/4Euecg8Uq4wX8CO6eRiEB8rMkwVOuv76Zf e1Lx3jCsUcSeN4+r5UupkMMpUqD6odDttbtydP9N9RqaddvIZFHrCJig+TB7Ctywg70E RVgBeciip/JOa4YZ/zTLr/6n+QD5s0ju2WsCJxuK1vjOxbIAnMs4EnkbZ2WPo+Q6I9wc qvBg== 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=2YBI0yyplzSvJSo2TC7F0icIIlzSZTZBrJuHU6pmUmk=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=HM+Q/DOj2XC6zhDtwQI4dOGF1cJTcJS4tVDuSno1prLi6hi5BI88mcFhkAb2jxa/eW y7HR+shoQFrexoXqka08F7264G59fuDhjmlsu9aNIf25iEkNsOi5BT2XbL7HE+udunu2 pkOAdzhLJIRXCdaJ0tm/wmblWXfnxyBSEtiT3hBN83b0B1etvcvxZ0Ksr7XNRapp3J3k +83Ck3DrDt94CJbWN0AcrU7i0D6nUWk5DEWO4IIN9LWXRHh6MrZtpAO5zMBCWqN2aMVT luZsw1TFpHytPUSk0vilVt5MPSa8pLlLSiTC271ROSogixQ/Tmk3x/2x3wjd77kqfZyq AtDg==; 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=VGIM2J+y; 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 a640c23a62f3a-a5a17945f04si417114866b.191.2024.05.12.03.04.12; Sun, 12 May 2024 03:04:12 -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=VGIM2J+y; 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 131BB68D27C; Sun, 12 May 2024 13:03:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-221.mail.qq.com (out203-205-221-221.mail.qq.com [203.205.221.221]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DB92668D435 for ; Sun, 12 May 2024 13:03:46 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1715508217; bh=dZvcQCcH72subVIidgMZGwZa+787LtDLjyVTPfUh/As=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VGIM2J+y7JUK/gZEa46CFd0ZP4gfw+cowp5wdLuLMx3Z0TMnolWMTjNSaK/Hts4CI vMHS11Bofv+KCdOx+91vCMLGreWgqiCJ6XEwu9r+J1XoEMlJFzPuiu9Cw4gaBcZFlp NoZAg004CLHQA6r2IzoOgGXV7AkDKgLB2XD44p9M= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id E135E56; Sun, 12 May 2024 18:03:33 +0800 X-QQ-mid: xmsmtpt1715508216to2f38i1p Message-ID: X-QQ-XMAILINFO: OWP2IlFwb745qnYTKjRmmzFDDzQwhvfuQE/wS84t/S161VwCAKBc34UDkpInGs IVK5i+tTU6SGfzpYyu9r5bf4+qiqSLek3AhvzXtRvVDk0odaPXS10mLUqPU3uH9gCgRwx2Yfe3XK 2Y6USK6jbTuPzLuQQ/UzJl2Gc6tDSFWkBU1+s8iBgxCWDcl1cjRaMLU9FwKBfbb76UC/63n6Wlb2 pr2MHYaMpzw2ucx/c3Zcu9UgvJ04hj01ribHbhi7tKS1wo0LnYwHAziHyZmx9hyM835gGLA1LbwE WwxikhaQx8Px4c5TuMFdzeDTup4xVxIHDEZ+v8BvZSE6/UveI+ybAcC75BS+4vg4//pOVBPLq9yo 744RmoVF4CpFCcJi4Kv5Q78Ipl6WH9FFpMgkNaYaKRFsIker5Ll9k9cacpgINN1Pnz6MlHj2GOXI Yg2aDTLeoSkeNYXFNe42F5WZHHzMvOUevDd2zynvF0E5lc2P+ugxDQGCB/cndlmRszWiutGpUS8q zrRC67GRwzQ0z88reNTW5dEddcCd0m9A9uQNB5exP+rIzEonAM5Rk1eCCqJ+Wid8SNJDrC5NQHYj rpkOlgDFeAiomj9Nf8dPjL56tiAjm5YmqT945mN+39EC4l6Gn/PTvZQbA0erNdPM0qrsmwSyGCGB LM8rNzA0KIfkK/j1LdJ/02ab6pdlz6UQ1gRsdNjNNyRcvF0I0VfeBZJakAA8UEu1G5eSS3wFxnki 7XvvyO9/kRb5KFp1JbS4JyWvsLFXdbC7v42sgIp3EzN3Nmxi/egdxRYQkcasPPEu7fhDMny5kG3B 99gZLcXm42jhpWIMoGTsynm8H5FUaQj/4Kz9z+UrEkiRwam9rsw7GGvsNiy3Sh4cLZlT0Gx8hCca HTEmJ9kZqADZzEiKdbp6vfCOwkYNc7oOYcHpsJ/nWfDicYGQZr3lHvGUY8wTD43k1oFcPWXdGC X-QQ-XMRINFO: NS+P29fieYNw95Bth2bWPxk= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 May 2024 18:03:26 +0800 X-OQ-MSGID: <20240512100331.995415-4-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240512100331.995415-1-uk7b@foxmail.com> References: <20240512100331.995415-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 4/9] lavc/vp9dsp: R-V V ipred tm 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: a4KiAGbbEkLe From: sunyuechi C908: vp9_tm_4x4_8bpp_c: 116.5 vp9_tm_4x4_8bpp_rvv_i32: 43.5 vp9_tm_8x8_8bpp_c: 416.2 vp9_tm_8x8_8bpp_rvv_i32: 86.0 vp9_tm_16x16_8bpp_c: 1665.5 vp9_tm_16x16_8bpp_rvv_i32: 187.2 vp9_tm_32x32_8bpp_c: 6974.2 vp9_tm_32x32_8bpp_rvv_i32: 625.7 --- libavcodec/riscv/vp9_intra_rvv.S | 141 +++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp.h | 8 ++ libavcodec/riscv/vp9dsp_init.c | 4 + 3 files changed, 153 insertions(+) diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S index ca156d65cd..7e1046bc13 100644 --- a/libavcodec/riscv/vp9_intra_rvv.S +++ b/libavcodec/riscv/vp9_intra_rvv.S @@ -173,3 +173,144 @@ func ff_h_8x8_rvv, zve32x ret endfunc + +.macro tm_sum dst, top, offset + lbu t3, \offset(a2) + sub t3, t3, a4 + vadd.vx \dst, \top, t3 +.endm + +func ff_tm_32x32_rvv, zve32x + lbu a4, -1(a3) + li t5, 32 + + .macro tm_sum32 n1,n2,n3,n4,n5,n6,n7,n8 + vsetvli zero, t5, e16, m4, ta, ma + vle8.v v8, (a3) + vzext.vf2 v28, v8 + + tm_sum v0, v28, \n1 + tm_sum v4, v28, \n2 + tm_sum v8, v28, \n3 + tm_sum v12, v28, \n4 + tm_sum v16, v28, \n5 + tm_sum v20, v28, \n6 + tm_sum v24, v28, \n7 + tm_sum v28, v28, \n8 + + .irp n 0, 4, 8, 12, 16, 20, 24, 28 + vmax.vx v\n, v\n, zero + .endr + + vsetvli zero, zero, e8, m2, ta, ma + .irp n 0, 4, 8, 12, 16, 20, 24, 28 + vnclipu.wi v\n, v\n, 0 + vse8.v v\n, (a0) + add a0, a0, a1 + .endr + .endm + + tm_sum32 31, 30, 29, 28, 27, 26, 25, 24 + tm_sum32 23, 22, 21, 20, 19, 18, 17, 16 + tm_sum32 15, 14, 13, 12, 11, 10, 9, 8 + tm_sum32 7, 6, 5, 4, 3, 2, 1, 0 + + ret +endfunc + +func ff_tm_16x16_rvv, zve32x + vsetivli zero, 16, e16, m2, ta, ma + vle8.v v8, (a3) + vzext.vf2 v30, v8 + lbu a4, -1(a3) + + tm_sum v0, v30, 15 + tm_sum v2, v30, 14 + tm_sum v4, v30, 13 + tm_sum v6, v30, 12 + tm_sum v8, v30, 11 + tm_sum v10, v30, 10 + tm_sum v12, v30, 9 + tm_sum v14, v30, 8 + tm_sum v16, v30, 7 + tm_sum v18, v30, 6 + tm_sum v20, v30, 5 + tm_sum v22, v30, 4 + tm_sum v24, v30, 3 + tm_sum v26, v30, 2 + tm_sum v28, v30, 1 + tm_sum v30, v30, 0 + + .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 + vmax.vx v\n, v\n, zero + .endr + + vsetvli zero, zero, e8, m1, ta, ma + .irp n 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 + vnclipu.wi v\n, v\n, 0 + vse8.v v\n, (a0) + add a0, a0, a1 + .endr + vnclipu.wi v30, v30, 0 + vse8.v v30, (a0) + + ret +endfunc + +func ff_tm_8x8_rvv, zve32x + vsetivli zero, 8, e16, m1, ta, ma + vle8.v v8, (a3) + vzext.vf2 v28, v8 + lbu a4, -1(a3) + + tm_sum v16, v28, 7 + tm_sum v17, v28, 6 + tm_sum v18, v28, 5 + tm_sum v19, v28, 4 + tm_sum v20, v28, 3 + tm_sum v21, v28, 2 + tm_sum v22, v28, 1 + tm_sum v23, v28, 0 + + .irp n 16, 17, 18, 19, 20, 21, 22, 23 + vmax.vx v\n, v\n, zero + .endr + + vsetvli zero, zero, e8, mf2, ta, ma + .irp n 16, 17, 18, 19, 20, 21, 22 + vnclipu.wi v\n, v\n, 0 + vse8.v v\n, (a0) + add a0, a0, a1 + .endr + vnclipu.wi v24, v23, 0 + vse8.v v24, (a0) + + ret +endfunc + +func ff_tm_4x4_rvv, zve32x + vsetivli zero, 4, e16, mf2, ta, ma + vle8.v v8, (a3) + vzext.vf2 v28, v8 + lbu a4, -1(a3) + + tm_sum v16, v28, 3 + tm_sum v17, v28, 2 + tm_sum v18, v28, 1 + tm_sum v19, v28, 0 + + .irp n 16, 17, 18, 19 + vmax.vx v\n, v\n, zero + .endr + + vsetvli zero, zero, e8, mf4, ta, ma + .irp n 16, 17, 18 + vnclipu.wi v\n, v\n, 0 + vse8.v v\n, (a0) + add a0, a0, a1 + .endr + vnclipu.wi v24, v19, 0 + vse8.v v24, (a0) + + ret +endfunc diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h index 0ad961c7e0..79330b4968 100644 --- a/libavcodec/riscv/vp9dsp.h +++ b/libavcodec/riscv/vp9dsp.h @@ -72,6 +72,14 @@ void ff_h_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a); void ff_h_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a); +void ff_tm_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_tm_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_tm_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_tm_4x4_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); #define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx) \ void ff_put_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index 513e62721f..1f9a3bcd24 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -89,6 +89,10 @@ static av_cold void vp9dsp_intrapred_init_riscv(VP9DSPContext *dsp, int bpp) dsp->intra_pred[TX_32X32][HOR_PRED] = ff_h_32x32_rvv; dsp->intra_pred[TX_16X16][HOR_PRED] = ff_h_16x16_rvv; dsp->intra_pred[TX_8X8][HOR_PRED] = ff_h_8x8_rvv; + dsp->intra_pred[TX_32X32][TM_VP8_PRED] = ff_tm_32x32_rvv; + dsp->intra_pred[TX_16X16][TM_VP8_PRED] = ff_tm_16x16_rvv; + dsp->intra_pred[TX_8X8][TM_VP8_PRED] = ff_tm_8x8_rvv; + dsp->intra_pred[TX_4X4][TM_VP8_PRED] = ff_tm_4x4_rvv; } #endif #endif