From patchwork Sun May 5 16:45:28 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: 48545 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:e68f:b0:1af:836d:81b3 with SMTP id mz15csp962766pzb; Sun, 5 May 2024 09:46:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0MfahRkIYGZn5bmBKUhOzLOwEbBXTa1YkO5pj13vuiOhN76svgtZ0SyjvuuzuQJ0XNNucqfNGQQiuKDQup9YrTpGxPLgysUOtAA== X-Google-Smtp-Source: AGHT+IEbL7GsnVtEJ04RntyKR7stt+1EcoTmm3qoL6kZiGi7jy9nyFh+wVO6wJKuor2GyIDczbKZ X-Received: by 2002:ac2:593b:0:b0:51d:b2a:5f7d with SMTP id v27-20020ac2593b000000b0051d0b2a5f7dmr4580730lfi.48.1714927589109; Sun, 05 May 2024 09:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714927589; cv=none; d=google.com; s=arc-20160816; b=u2DCMeZPdkbWt/fxpdRGyr6zkM7eqPEvYfAalJypsXqB050CVcH8uZhzuCReOBCQun iqfKT0cJf2ihA8iGed7bFoVo4r1Fz11UZarr2YB8H+jcpJW3/piFz2RREMpKoWcltkGy UIGvrQt0EyBHk5d8pCXVgye2gxCdKyyznuqeeYJWor6EZ3t/WU7gqpKxfAEFHy59iaa9 UkpC7zEx7AgMTbzb1+nj+vI63QDve4SxfXE/MJbSsYHEnna5UbESdQrYHMDYq5Vr3rTL OPBzlhns/WmqbFtpbZ2RBnDVLcILCCf1Fkoz4K8n+8sYeb89QXXV9k8NtzlPdiemm2gG BwIw== 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=fFkMReyzpL/KrVNuF7HgCSO+V+LlxX6MsQzUD85DH3c=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=Cg++BJU6COmHqBzJG4CwqlTXcHRoNLZivl+I5kyVYmXI1Y3d5LlWrWJ/be4x5YNwBq 0XA+PG0IVci1C0luD0WtTrighOzZJy9e6MfArpmOLX+qJ8CHt++WwBjTTm3hUfIB176y Y2K5g3cCPRkG6BPkW/QSjwAC69kMPxOyjNM6AlGkTu4BlJdGyGkSfJWDjKNKIvFRuD+K wU0NkZCuVb+OCu/2gurQNgLlcc1aLdZT2zmBdGdj+FUlM6f3dJC2BAhp4Eq4FusKHRZb g513lQv9BOdEdjCeOI8UfkCXpfL9Sk7dJr6Nr2ke78zxqIUOT2ggDH7g9FtJdeKy8XFN K49A==; 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=osdPpRIe; 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 g19-20020a056402181300b00572cfad956csi3231105edy.617.2024.05.05.09.46.28; Sun, 05 May 2024 09:46:29 -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=osdPpRIe; 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 4AB2368D5B6; Sun, 5 May 2024 19:46:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-242.mail.qq.com (out203-205-221-242.mail.qq.com [203.205.221.242]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F013868D5A6 for ; Sun, 5 May 2024 19:45:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1714927539; bh=lloFRjmxC3JfyN+g4iLuCeX7X/8bzmqGnsFdKl4g9mM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=osdPpRIePgRhIto5MGz3Ygjs7iSdYDXWClGjR/pm9JpdoSYzFJrbbwUNv1borIAN7 f2cJOT0HazcgKUhl/a9YWXGvtkxkojjTqxLBtd3hkcIyIlejBDSjAx4wIs85Y8pbSC S52Edy9rwafJE01oO648on11ikVY3U6Jh/nrn8Gg= 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: xmsmtpt1714927538tcmjdeiek Message-ID: X-QQ-XMAILINFO: OI1RgUwxh0kZ4AwXOCNKjHFz2wRn86+9DFb4gbCmgFGDHywY8oM4Pa5DnJusc0 FwpSBtigQBjGdagstM51TouhbfOg/4AXr0E1H3K3M8d0rH/ekTrnuOlr0z3/vjyeAMiVwL1kGG58 Hzcw3hZLeJvNg0OEGXpeqL++1kiOSGcOtSAlxUmeMx9ooDAxVPsB48dGs6Vy+wjSOer8KGfCj2D6 p+7KUb459j6r5yYst9F9R65uws5WEySZJwNK4xCCjQ8DURGcOylFBqE/MVSwAVtpynQWaEUQENPE CKfA5vyEbzTo+i82O0BVi2t861FsrPyJyUbZcVUDMAXbZop6Gs26fnE5nfckQwFVPkmwrW67mUpT 9R1gLCzTR3Mb3NJkF54uLeWKtnbwppuN4M0eINd528BrpuL5CMsAmcivSspEQitqNk0zTIgQyTJR phNkye3WdPRBPXpu8aalugNaIQVnv8uJw5YAPREsf37Go1JuzrZibC7y2f09MPeELEJyOei1sj7+ eQCJFaYAHhQ7v+lPoaaX15FNHIBNGTyZ1Woi5pLy7YVEliKPx/pYFBIzGDXA9oM3U/np+jhyza+P CFKMAoshtCju1nbXPVi9UoaQ0EyogrKpjYsRXXhnI+KGMToYExVQZhoGSdzYRx13thZ6F8vV4UCS scoj5jKGijsND/1hXzQPqXKpD6atYJ3Zopl16NKvgGlA1KUtCvK3rWOG5U2k+Qt39Gyu52hUO4RH xeFMrg5iSknkvicC23nNkQthwS5i6Me1A3+NHTX4ut2MGGwv7pkpt/1grzp75BXALZ11aySIBwmu MCU7JJoekMXy/2CugrpXtbm2HgFr70WW+sVwDgF01OybTgdaxDHYyLunnTfU0Co3VRIW9JBXGKyx eq7dR0+OZBokpzgclFUtngbxIiSZ1vNk5CPYlBZyGjq/LwOxjp07FTphS7pkvZKjVJ+g20W0zW X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 May 2024 00:45:28 +0800 X-OQ-MSGID: <20240505164536.872683-2-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 02/10] lavc/vp8dsp: R-V V put_bilin_h 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: oQNGMWWkGCm7 From: sunyuechi C908: vp8_put_bilin4_h_c: 373.5 vp8_put_bilin4_h_rvv_i32: 158.7 vp8_put_bilin8_h_c: 1437.7 vp8_put_bilin8_h_rvv_i32: 318.7 vp8_put_bilin16_h_c: 2845.7 vp8_put_bilin16_h_rvv_i32: 374.7 --- libavcodec/riscv/vp8dsp_init.c | 14 +++++++++++ libavcodec/riscv/vp8dsp_rvv.S | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index fa3feeacf7..778d5ceb29 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -34,6 +34,10 @@ VP8_EPEL(16, rvi); VP8_EPEL(8, rvi); VP8_EPEL(4, rvi); +VP8_BILIN(16, rvv); +VP8_BILIN(8, rvv); +VP8_BILIN(4, rvv); + av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) { #if HAVE_RV @@ -48,6 +52,16 @@ av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) c->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_rvi; c->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_rvi; } +#if HAVE_RVV + if (flags & AV_CPU_FLAG_RVV_I32 && ff_get_rv_vlenb() >= 16) { + c->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_rvv; + c->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_rvv; + c->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_rvv; + c->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_rvv; + c->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_rvv; + c->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_rvv; + } +#endif #endif } diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 8a0773f964..760d9d3871 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -20,6 +20,18 @@ #include "libavutil/riscv/asm.S" +.macro vsetvlstatic8 len +.if \len <= 4 + vsetivli zero, \len, e8, mf4, ta, ma +.elseif \len <= 8 + vsetivli zero, \len, e8, mf2, ta, ma +.elseif \len <= 16 + vsetivli zero, \len, e8, m1, ta, ma +.elseif \len <= 31 + vsetivli zero, \len, e8, m2, ta, ma +.endif +.endm + .macro vp8_idct_dc_add vlse32.v v0, (a0), a2 lh a5, 0(a1) @@ -71,3 +83,36 @@ func ff_vp8_idct_dc_add4uv_rvv, zve32x ret endfunc + +.macro bilin_h_load dst len + vsetvlstatic8 \len + 1 + vle8.v \dst, (a2) + vslide1down.vx v2, \dst, t5 + vsetvlstatic8 \len + vwmulu.vx v28, \dst, t1 + vwmaccu.vx v28, a5, v2 + vwaddu.wx v24, v28, t4 + vnsra.wi \dst, v24, 3 +.endm + +.macro put_vp8_bilin_h len +func ff_put_vp8_bilin\len\()_h_rvv, zve32x + li t1, 8 + li t4, 4 + li t5, 1 + sub t1, t1, a5 +1: + addi a4, a4, -1 + bilin_h_load v0, \len + vse8.v v0, (a0) + add a2, a2, a3 + add a0, a0, a1 + bnez a4, 1b + + ret +endfunc +.endm + +.irp len 16,8,4 +put_vp8_bilin_h \len +.endr